« first day (299 days earlier)      last day (3720 days later) » 

11:12 PM
0
Q: Improve\simplify my bash script that updates intel e1000e driver

powerthrashI am writing now small bash script, that updates Intel NIC driver to the latest version from the official website. Is there any way to improve\simplify the script? I want to avoid a lot of "if...else" stuff. Helpful tips will be appreciated! #! /bin/bash DRV_PKG_NAME="e1000e-3.0.4.tar.gz" DRV_P...

 
@Jamal I'll hit that C answer of yours when we reload.
 
Alright. :-) I assume that means it's correct. I remember once hearing about doing that with error values.
 
@Jamal You are correct. You might of read that in either one of my answers, or one of 200's answers.
 
Sadly, they hardly teach you that in school (I think). I've always thought that only 0 and 1 should be used, and negative values are just wrong.
 
11:28 PM
Is there any World of Warcraft players here ?
 
0
Q: Where to put common method used in controllers that calls service layer?

BeeTee2I have an asp.net mvc5 web application using the repository pattern, and I have several controllers that need to call my _loggingService (queries audit logs) to get the last updated information for certain pages, not all pages. I want to abstract this method into a common place, so that I don't ...

 
@Jamal You'll see good use of the different return values in my UTTT game, once I post it.
I just need to kill a few more bugs.
 
I wonder... are comments are enough, or is it good to give those error values macros? For instance, something like #define INVALID_POINTER -1;.
 
@Jamal I don't really see a use for that, unless you have some sort of pattern with the return values. If they are only returning one or two values, there isn't much use to it.
If they are returning more than 2 values though, I would recommend an enum.
Not multiple #defines
 
Oh yeah, an enum. Even better.
I'll mention this. Thanks.
 
Not sure why this answer was deleted on that: codereview.stackexchange.com/a/28550/27623
I voted to re-open.
I know mKorbel too. I didn't know he was on CR.
 
Vote to undelete, you mean?
 
Yeah... same difference :P
 
hey all
 
Hey @Yuushi
@palacsint I'll get that zombie when we reload in a bit.
 
11:43 PM
@palacsint FYI, I updated my answer with some performance numbers: codereview.stackexchange.com/a/42985/31503
 
@syb0rg Thanks :)
 
Got it before reload.... ;-)
 
0
Q: Is this also a correct way of writing level order printing of a binary tree?

Siva//level order printing public static void levelOrderPrint(Node root){ Queue<Node> que = new LinkedList<Node>(); Node mark = new Node(0); if(root != null){ que.add(root); que.add(mark); } while(!que.isEmpty()){ Node te...

 
@rolfl After reading the Java Performance book I don't believe in benchmarks any more :) (amazon.com/Java-Performance-Charlie-Hunt/dp/0137142528)
 
@syb0rg: Let me know if this is still good.
1
A: Hexadecimal to integer conversion function

JamalI think you should be returning different error values for different errors. You're returning -1 for an invalid pointer, too many hex digits, no hex digits, and a non-hex character detected. Instead, choose separate error values for each of these (and any additional error types) and return the ...

 
11:48 PM
@Jamal typedef the enum, like here: stackoverflow.com/q/1102542/1937270
 
@syb0rg: Ah, thanks.
 
@Jamal Put the name after the declaration:
typedef enum { INVALID_PTR = -1, EXCESSIVE_HEX = -2, /* ... */ } Error;
Sorry, I should have specified that.
 
No problem. I got it within the five minutes. I've also upvoted that SO post.
 
@palacsint everything said there is true, but I also believe in what I have personally experienced. If I can look at some code, and offer a suggested improvement, and the improvement produces better results, well, then either I am plain lucky, or there is a way to know.
to 'feel', as such.
If I can do it 9 times out of 10, then it is worth doing
Then the opinion that 'early optimization' is useless, for performance-critical code, is not valid.
Building it fast the right time, by avoiding performance pitfalls, is much easier than finding them afterwards.
Creating unnecessaryt Java objects is a performance pitfall... again, and again, and again
 
11:56 PM
@syb0rg: I can go ahead and undelete that answer, if it appears to be a good answer.
 
@Jamal why?
If a user self-deletes an answer, why undelete it?
 
It has received undelete votes, so some users seem to want it. But another trusted user can always make that decision.
 
@syb0rg - you have an opinion on this?
 

« first day (299 days earlier)      last day (3720 days later) »