Click here to Skip to main content

Comments by jfriedman (Top 30 by date)

jfriedman at 16-Oct-13 1:51am View
   
Reason for my vote of 1 \n You don't cache the field lokup so if you call this function 100 times you have 99 iterations where you are using the same field info however you will waste time locating that same field info on the type 99 times.
jfriedman at 13-Mar-13 22:17pm View
   
Reason for my vote of 5 \n Excellent advice, great article for showing an example of useless code with bad habits :P
jfriedman at 5-Dec-12 21:02pm View
   
Reason for my vote of 2 \n Forgot about Reading the BMP Palettes and made your own..
 
The whole thing could be done like this private void button1_Click(object sender, EventArgs e)
{
using (FileStream file = new FileStream("face.bmp", FileMode.Open, FileAccess.Read))
{
this.pictureBox1.Image = Image.FromStream(file);
}
}
jfriedman at 13-May-12 9:57am View
   
Reason for my vote of 4
Sweet, Simple and to the Point. I would have given you the extra point if you completed it by having the methods being Extensions to Directory. Good job otherwise.
jfriedman at 6-May-12 11:49am View
   
Reason for my vote of 3
See improvement
jfriedman at 5-May-12 14:59pm View
   
Reason for my vote of 1
For the love of money, family, pride or sanity in general please see the Distinct method @ http://msdn.microsoft.com/en-us/library/bb348436.aspx
 
v//
jfriedman at 30-Apr-12 19:27pm View
   
Reason for my vote of 3
Great code but how is this better or worse or even different than Lazy ? A small comparison might be in order IMHO.
jfriedman at 27-Apr-12 10:28am View
   
Reason for my vote of 4
For situations in which multiple queries will be run on the XML document over a period of time this is a very good example. In addition you may even be able to hash searches and use an additional hashTable or array to make lookups even faster.
jfriedman at 13-Jan-12 17:53pm View
   
Deleted
terinary operations such as (true ? 0 : 1) are basically nested if statements and some can ever short circuit as pointed out below in the alternates. What's insane is not using a TimeSpan when it is a Framework construct.
jfriedman at 12-Jan-12 20:39pm View
   
Deleted
Reason for my vote of 3
I would have used Enum.HasFlag and I would have used a single switch statement with goto for each case not a if else with nested if statements. Additionally you could just use the result of the time - anotherTime and use TotalSeconds or similar... e.g. someTime - anotherTime >= TimeSpan.FromSeconds(1.5)
jfriedman at 27-Apr-11 17:06pm View
   
In hind sight you dont actually need a timer if you have the philsopher instances.
 
You can store a lastWorkTime variable and determine from that weather or not you need to work further.
jfriedman at 25-Feb-11 14:41pm View
   
Deleted
may want to fix your formatting though :)
jfriedman at 25-Feb-11 8:32am View
   
Deleted
Reason for my vote of 3
Cleaner than last time...
jfriedman at 22-Feb-11 18:10pm View
   
greg,
 
It seems you are not familiar with GoF Principles. Google 'Chain of Responsibility' and 'Gang of Four'... It will greatly help you in the future to understand these principles so that you do not back yourself into these types of corners.
jfriedman at 22-Feb-11 18:09pm View
   
Deleted
It seems you are not familiar with GoF Principles. Google 'Chain of Responsibility' and 'Gang of Four'... It will greatly help you in the future to understand these principles so that you do not back yourself into these types of corners.
jfriedman at 22-Feb-11 18:03pm View
   
Very nice answer SA, beautiful response & beautiful analyzation of the question. You have forced me to rethink the way I answer questions in general.
 
Reguards,
Julius
jfriedman at 17-Feb-11 17:38pm View
   
Deleted
Reason for my vote of 1
Because you are trying to appear as if you know what you are doing. This maybe would have been valid about 20 years ago in c and still might hold true for a unoptomized C compiler however for .Net you clearly display you lack of understanding of the CLR.
jfriedman at 17-Feb-11 17:30pm View
   
Deleted
Dr. Abell,
 
Please stop.
 
http://www.codeproject.com/KB/recipes/CRP.aspx
 
You are just causing stack overflows and wasting cycles with your code
 
http://www.codeproject.com/KB/recipes/Iterative_vs_Recursive.aspx
 
We appreciate your post, your comments have been summarily noted and dually overruled.
 
Thank you for yout time.
jfriedman at 15-Feb-11 10:03am View
   
Deleted
Dr.Abell, int is a value type which can never be null. The bit work you perform with AND and OR and the multiple branches of the code result is a less optimzed function call which utilizes more stack space. These are the hard facts of the matter.
 
Thank you for your article.
 
-Reguards.
jfriedman at 15-Feb-11 5:25am View
   
Deleted
1.) You are claiming that if both numbers are equal the Euclid part does not need to be run however I am arguing that rather than performing a binary AND followed by a jump if equal or just the jump if equal call you just perform the modulo which will result in a single operation and get the required result which will be much easier for the JITTER to optimize due to less possible branches of code paths to evaluate.
2.) I did not write alternate 1 so I do not care to make points about it.
3.) I have also made this discovery when working on a brain teaser at my work.
4.) Due to recursive calling there is more stack space utilized in your function call.
Sincerely,
Julius
jfriedman at 14-Feb-11 16:37pm View
   
Deleted
I am not sure how correct your assertation is... I dont' use var once. I accept the point about the two numbers being the same but I would like to see how that realtes to the problem mathematically. E.g. so what if I pass 1,1? is this not the point of the algorithm...
jfriedman at 8-Feb-11 18:48pm View
   
Deleted
How this classifies as a "Article" is beyond me.... Totally beyond me.
 
Fortunately I watched Bambi as a child and I took away a valuable lesson, "If you don't have anything nice to say don't say anything at all".
 
I guess for people who are new to programming this is very helpful... Good Job!
jfriedman at 20-Jan-11 18:19pm View
   
Deleted
Should we not be using ++i (prefix) to prevent the overhead of the temporary copy of the variable which occurs when you use the postfix increment operator?
jfriedman at 2-Jan-11 18:17pm View
   
Deleted
Even without unsafe there is no denying that the methods I have shown here and have been shown by others are more efficient then the posted methods... Unsafe code will only marginally increase the performance anyhow. Thank you for the readability edits.
jfriedman at 16-Dec-10 15:22pm View
   
Deleted
Dooper Super
jfriedman at 2-Dec-10 13:36pm View
   
Manipulates i, thus losing the origional value. What is i's value is needed later?
jfriedman at 2-Dec-10 13:35pm View
   
The only joke about this is that since there are only 2 viable states for a bool You can manipulate circuit based on conditionals and you only need the iif... Whats funny about that :p
jfriedman at 16-Sep-10 15:11pm View
   
Deleted
Your code wont compile... You return false without assigning to the result variable. You probably meant:
 
else return result = false;
jfriedman at 13-Aug-10 16:30pm View
   
Deleted
Thank you for clarifying however...
 
Whitespace variants can be matched with a RegEx and are outside the scope of the name of the functions which implies Whitespace not WhiteSpace Variants...
 
http://www.csharp411.com/remove-whitespace-from-c-strings/
 
The name of the function is not IsNullOrWhitespaceOrNewLineorTabOrSomeOtherCharacterWhichTakes0Space()
jfriedman at 12-Aug-10 12:19pm View
   
Deleted
Reason for my vote of 5
Because its just a fast and does the same thing! (Obviously Sarcastic)

Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid