Open Side Menu Go to the Top

01-07-2013 , 01:28 PM
Quote:
Originally Posted by Fubster
seems absolutely ridiculous to define N as a preprocessor directive
it's a bog-standard idiom in C.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
01-07-2013 , 03:32 PM
Quote:
Originally Posted by jjshabado
Gah, this tilts me like crazy. We had an intern a couple of months ago and my most common feedback in code reviews was to rewrite method signatures to be more sensible. Writing good method signatures is a major part of writing good interfaces which is in turn a major part of writing good code.

It's especially frustrating because this is something that can be taught and explained really easily.
a better design than both cases is probably a grades object with grades.mean() and grades.variance()
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 04:31 PM
Quote:
Originally Posted by gaming_mouse
a better design than both cases is probably a grades object with grades.mean() and grades.variance()
Probably, but I don't necessarily have a problem with stand alone functions (depending on the language).

Edit: As opposed to the signature of "variance(grades, mean)" which is just always wrong.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 04:41 PM
agreed
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 04:43 PM
Yup. If you're worried about wanting to cache the mean value, wrap it all in an object and cache it there.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 06:29 PM
I actually have a class lying around from a simulations course that does the caching mean/variance thing. One of the things I learned in making it was that once you have an initial mean/sd calculated, you can update the stats for a new data point in O(1) time without even needing to store the data you already processed as long as you keep track of how many data points you've accepted.

Of course, I know this is probably way more complicated than what they were going for, so my real reaction was "So what if we calculate mean twice? It's O(n) either way! How many grades can there be?!?"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 10:31 PM
xhad,

well, there could be N grades...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 10:39 PM
Quote:
Originally Posted by tyler_cracker
xhad,

well, there could be N grades...
For any number of students there can always be one more added, therefore there can be an INFINITE NUMBER OF GRADES, therefore your algorithm is causing your program to run MULTIPLY INFINITE LENGTHS OF TIME.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 11:18 PM
Quote:
Originally Posted by Neil S
MULTIPLY INFINITE LENGTHS OF TIME.
pretty soon your algorithm is O(2N) or even O(3N)!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-07-2013 , 11:37 PM
I like you all so I'm going to share this: http://this-plt-life.tumblr.com/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 12:02 AM
Quote:
Originally Posted by tyler_cracker
pretty soon your algorithm is O(2N) or even O(3N)!


I don't know why I don't give you more excuses to troll me

I just went and reread ATTN: Micros again
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 01:09 AM
I usually don't have a strong opinion about these things, especially because I'm almost certainly not qualified to have one, but having 3 variables named angle1, angle2, and angle3 seems completely ridiculous to me in this context. Saying that the tuple thing is wrong is just nuts.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 01:23 AM
I kinda wanna go check and see if they're still doing this: http://forumserver.twoplustwo.com/sh...postcount=2365
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 01:47 AM
Quote:
Originally Posted by Xhad
I just went and reread ATTN: Micros again
lol me too.

Quote:
Originally Posted by Xhad
I kinda wanna go check and see if they're still doing this: http://forumserver.twoplustwo.com/sh...postcount=2365
they optimized the *typing* -- see how much less there is in the new form? totally refactored.

Quote:
I don't know why I don't give you more excuses to troll me

Last edited by tyler_cracker; 01-08-2013 at 01:49 AM. Reason: i agree declaring the variable outside the for loop clarifies the intended scope (the only kind in js!)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 02:03 AM
Maybe xhad can create a thread on all the bonkers code found on that site and then after every program has been dumped all over, he can send them an email with a link asking them wtf went wrong.

That micros thread was funny for about a page. The poker advice on 2+2 has historically been awful, though I'm not sure how much of it was intentionally bad or just plain mis-guided. Quick brag to display my own poker prowess: I'm crushing the $5 DoN's on Carbon these days.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 02:17 AM
Quote:
Originally Posted by Xhad
I kinda wanna go check and see if they're still doing this: http://forumserver.twoplustwo.com/sh...postcount=2365
i prefer:

Code:
raceTimes.reduce(function(a, b) { return a + b;});
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 02:42 AM
Quote:
Originally Posted by gaming_mouse
i prefer:

Code:
raceTimes.reduce(function(a, b) { return a + b;});

Last edited by tyler_cracker; 01-08-2013 at 02:42 AM. Reason: see xhad i'm an equal opportunity troller
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 02:51 AM
sort of funny you chose that pic cause sometimes on seeing your screen name i hear a sort of chris rock-like voice going "tyyyyyyyyyyyyyler CRACK-uh!!"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 03:03 AM
lol

Last edited by tyler_cracker; 01-08-2013 at 03:06 AM. Reason: cracka-ass cracka!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 11:16 AM
Quote:
Originally Posted by daveT
Maybe xhad can create a thread on all the bonkers code found on that site and then after every program has been dumped all over, he can send them an email with a link asking them wtf went wrong.
I am kind of tempted to make a "lol Codecademy" thread for people checking it out or recommending it to people.

I just found something funny in one exercise where they make you write a JavaScript blackjack game. In the part where you write the function that determines the winner of the game, one of the things you find out from the "Show Hint" button is that the authors got the rules of blackjack wrong.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 01:05 PM
For one of my first programming side projects I wrote a blackjack simulator in C++ because I wanted to confirm you should hit a 16 when the dealer has a 7 showing. Turns out you should, but it's almost a wash when the dealer has a face card showing – which I thought was pretty counterintuitive.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 03:58 PM
so, another "Is this WTF or not" survey: There's this class method of the form:

Code:
method (A,B,C)
The catch here is that A and B are instance variables that are never changed. For bonus points, the method recursively calls itself, literally always passing A and B unmodified. Oh, and the exercise is "refactor this standalone function into a class method."
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 09:11 PM
Anybody been working on any new or interesting projects lately?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 10:28 PM
xhad,

sounds like refactoring A and B to be instance variables is exactly what the assignment is after?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-08-2013 , 11:05 PM
Quote:
Originally Posted by sdturner02
Anybody been working on any new or interesting projects lately?
xhad's project looks really intersting...

I'm not really doing anything interesting. Just going through Learn C the Hard Way and converting my sites over to Leiningen 2. I ordered CLRS this past Sunday and I'm waiting for it in the mails. Should be here in a few days. All of this means I'm not writing any new articles or writing any interesting code.

What did you decide about the payment structures on your website?

Last edited by daveT; 01-08-2013 at 11:13 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m