Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
View
Sort
Coming soon
3

I haven't played in a while, and I am wondering if any changes have been made to the end of chapter buffs.

  1. Are there still resistance buffs?

  2. Are you still able to play through earlier chapters to get more buffs?

3
1 comment

When after 2 days she tells you she loves you... And also proceeds to mention that she loves your green eyes so much that if we ever broken up she would steal them while you sleep and keep them in a jar in her room...

see more

ಠ_ಠ

Someone is salty.

Yeah, definitely much better than r/circleoftrust.

Also, happy cake day!

see more

Why do I always miss these things :(

2

Button, RadioButton, CheckBox, NumericUpDown, ListView, ListBox, TreeView, WebBrowser, DateTimePicker, LinkLabel, MonthlyCalendar, and CheckedListBox controls prevented the events from firing.

Label, ProgressBar, TextBox, RichTextBox, MaskedTextBox, and PictureBox controls did not.

My methodolgy was to pick controls from the common controls section of the toolbox, run the application, and press a key, and check if my debug line ran. Close the form, change the visibility to false, and retest. I was able to duplicate this in a generic windows form app where the only code was autogenerated, with the exception of my debugging code.

2
3 comments
[deleted]
2 points · 5 months ago

Can you provide a small complete program that replicates the problem?

I created a form and dropped a checkbox, radiobutton, textbox and listbox on it. Then added event handlers to the form and one to listbox.

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    Console.WriteLine("KeyDown");
}

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    Console.WriteLine("KeyPress");
}

private void Form1_KeyUp(object sender, KeyEventArgs e)
{
    Console.WriteLine("KeyUp");
}

private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
    Console.WriteLine("PreviewKeyDown");
}

private void listBox1_KeyDown(object sender, KeyEventArgs e)
{
    Console.WriteLine("KeyDown LB");
}

PreviewKeyDown on the form doesn't fire if a control has focus, but the others do. The ListBox has its own KeyDown and that fires as well as the form one when it has focus.

So more info might help.

see more
Original Poster2 points · 5 months ago

God, I'm an idiot. Didn't think that form controls key events would interfere with the form key events if I didn't define them. Fixed it by having the control key event point to the form key event.

Thank you!

108 points · 5 months ago

I love those at haunted houses! The first time I experienced it I thought it was actually rotating and I remember thinking, how was this in their budget? and then if I go upside down, I'm suing.

My friend had to drag me out.

see more

Found the american :P

1

So I have a database of words that I am trying to query to see if a string is a subword. For example, if my string is "cat", I want a list of strings that will include "cats", "catch", "catastrophe", etc.

I have a stored procedure to perform the query:

CREATE PROCEDURE [dbo].[findSubWord]
    @word nchar(16)

AS
    SELECT word
    FROM words
    WHERE word LIKE @word
RETURN 0

And this is my code in C# to run the query:

SqlCommand command = new SqlCommand("findSubWord", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@word", "cat%");
connection.Open();
SqlDataReader dr = command.ExecuteReader();
List<string> results = new List<string>();
while (dr.Read())
{ 
    results = (from IDataRecord r in dr select (string)r["word"]).ToList();
} 

However, this only returns two words, "CATS" and "CATE".

When a change my stored procedure to this:

CREATE PROCEDURE [dbo].[findSubWord]
    @word nchar(16)

AS
    SELECT word
    FROM words
    WHERE word LIKE 'cat%'
RETURN 0

I get the desired list of words. This leads me to believe my C# syntax is off, and my Google Fu has failed me in determining the problem.

Next, I tried this for adding parameters (while using the stored procedure that uses @word)

command.Parameters.AddWithValue("@word", string.Format("%{0}%", "cat"));

Now I got a list of 11 words as follows: "CATCH"

"CATE"

"CATER"

"CATES"

"CATS"

"CATTY"

"DUCAT"

"SCAT"

"SCATH"

"SCATS"

"SCATT"

But

command.Parameters.AddWithValue("@word", string.Format("{0}%", "cat"));

returned "CATE" and "CATS" again. Which is kind of odd because if "cat%" doesn't return "CAT" I don't get how "%cat%" could return "DUCAT" (and I double checked, "CAT" is in the database).

1
10 comments
2 points · 5 months ago · edited 5 months ago

Also wanted to mention: this code is really weird:

while (dr.Read())
{ 
    results = (from IDataRecord r in dr select (string)r["word"]).ToList();
} 

You should either use the while loop and iteratively add results to a list, or use the LINQ expression, but not both.

Basically, the LINQ is casting the SqlDataReader to an IEnumerable<IDataRecord> and getting all its records at once. But SqlDataReader.Read() reads a row at a time. So what you're actually doing is for every row, you convert the entire dataset into a collection, then overwrite for the next row, then the next, until there are none left, turning the entire thing into an O( n2 ) operation.

If you're going to use ADO.NET, I'd avoid the LINQ expression, as its confusing, difficult to debug, and completely unnecessary; you could re-write that part like this:

while(dr.Read())
{
    results.Add((string)dr["word"]);
}

Which is very much more readable.

see more
Original Poster1 point · 5 months ago

I've made your suggested changes, and I've done some experimentation.

As stated before, when I use 'cat%' as static value in the stored procedure, I get the desired outcome.

When I use @word + '%', it has absolutely no effect on the outcome as far as I can tell, regardless of what value I assign @word on the c# side, even if I use a % symbol in the string argument.

Playing with the string argument I pass in the AddWithValue statement has led to some interesting results. Basically my conclusion is that the query will then treat it like a single character wildcard. For example "c%%" returns a list of three letter words that start with "c". "c%%e" returns a list of 4 letter words that starts with "c" and ends with "e".

I tried replacing % symbols with _ symbols just for a lark and got the same results. However, using @word + '_' returns no results, which is odd because @word + '%' had no discernible effect on the results.

Original Poster1 point · 5 months ago · edited 5 months ago

Also interesting to note that while "%cat%" returned, among other words, "DUCAT", "%cat" only returned "SCAT" and "CAT".

Load more comments

1

Prompt: Find the sum of 1/(1*2*3)+1/(2*3*4)+1/(3*4*5)+⋯+1/(45*46*47)

So I'm sure the professor wants me to use a simple loop, which would be easy:

        decimal sum = 0;

        for(int i = 1; i <47; i++)

        {

            sum = sum + 1m / Convert.ToDecimal(i * (i + 1) * (i + 

                      2));

        }

        Debug.WriteLine("Sum: " + sum);

However, I would like to be able to find the formula that will give the sum given any number n. I believe this is the equivalent of "finding the limit" in calculus?

The formula for any given value of n is:

1/(n3+3n2 + 2n)

However, I don't know how to proceed from here.

1
1 comment
43 points · 7 months ago

It's unsolvable right now because we don't know the angle at which the catapult launches them, unless it can be assumed that all catapults launch at 45 degrees or some shit.

see more

Furthermore, are the monkeys being launched passively or are they jumping off at the end?

Ya they’re probably the weakest of the bunch imo. Iron man is def my fav

see more

Thor 1 is my favorite.

Ancestors have needs

Google knows all your secrets

Refrigerator.

see more

What happened to the haiku bot?!?

It was crap

see more

I liked it because it was interesting how often a comment was unintentionally a haiku.

To sound like you aren’t flirting, say it as casually as possible. Just kinda say it, you don’t even have to look at them.

see more

Like Dwight and Angela?

What the hell Bible are you reading?

see more

Another interpretation is ass = donkey. I still don’t understand the reference, though.

I wonder when the point comes people forget the story but keep parroting the meme anyway.

see more

“And things that should not be forgotten, were lost...”

81 points · 7 months ago

ProTip: you have to do it just after saying "I don't like your tone".

see more

“Watch your tone” works equally well.

Do not regret growing older. It is a privilege denied to many.

see more
Original Poster6 points · 7 months ago · edited 7 months ago

Oh, I agree. It’s so annoying when people who bemoan growing old will turn around and lament the loss of someone who “was only” their same age or thereabouts.

So that's why all my birthday cards always say "Most improved."

see more
Original Poster9 points · 7 months ago

Lucky you. Mine always say “Best Attitude”

328 points · 7 months ago

Am youngest sibling. Can't confirm I'm not an accident.

see more

You sure about that?

110 points · 7 months ago

I was kind of a "nice guy" in high school and even early college. I never really pursued anyone but i definitely thought I was the nice one and girls never seemed to like me, and the rest of the guys they liked were pieces of shit. I thought being nice meant not asking for sex and being there for girls and helping them. And then being resentful when they wouldnt want me. Fortunately I grew out of it and realized I was just another asshole who was lying to themselves and probably making women uncomfortable. Sex/dating isnt something you get in return, and trying to be "nice" to earn it just makes you the creep who clearly has ulterior motives and lacks the confidence to be upfront.

see more

This is me now. I think. Is the key part not being resentful? I try to be nice, and respectful when people show their disinterest. I would be lying if I said it didn’t upset me, though I try to make sure those feelings are suppressed.

I just feel so lonely, though.

234 points · 7 months ago

I am disinclined to acquiesce to your request

see more

Furthermore, I cannot sanction your buffoonery.

u/Felix_Dragonhammer
Karma
2,453
Cake day
September 10, 2016
Trophy Case (2)
One-Year Club

Verified Email

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.