Posted by Ben on April 30, 2006
I just received this hilarious message: Thanks, you *****, for not responding to my Prim’s e-mail, and may you be cursed with the worst of success in Computer Science. Sincerely, Michael Every once in a while I get requests from people asking me for completed code. The purpose of my articles (and this blog) is [...]
Posted by Ben on April 26, 2006
What is wrong with the following code? struct Foo {    public int id;    public string value;    public static readonly Foo Empty = new Foo(“”);    public Foo(string val)    {         this.value = val;         this.id = -1;     } }; and elsewhere… Foo m = new Foo(“Something”); if (object.ReferenceEquals(m, Foo.Empty)) {    [...]
Posted by Ben on April 24, 2006
A useful attribute in .Net is Obselete. When you mark a method with this the compiler will flag any line that accesses the method (or property, or whatever) with a warning (error is optional). I recently used it for a framework that sits between a database and applications–I wanted to faithfully reflect the database design [...]
Posted by Ben on April 21, 2006
The “as” keyword is very useful in managed code because it solves a very common problem. Suppose you have this: object o; … … string s = (string)o; but what if o is null? Then you will get a NullReferenceException. Sometimes this is ok, but often if o is null, you want s to be [...]
Posted by Ben on April 19, 2006
How to detect whether a database is up and available before processing data.
Posted by Ben on April 16, 2006
Is it just a coincidence that humans require roughly the same amount of sleep as there are hours during the night? In other words, is the amount of sleep that is “healthy” for us the result of long centuries of nurturing and tradition or is it biological? In other words, if the day were 30 [...]
Posted by Ben on April 12, 2006
Joel of Joel on Software recently posted a good article on managing programmers in software companies. I liked this paragraph: A programmer is most productive with a quiet private office, a great computer, unlimited beverages, an ambient temperature between 68 and 72 degrees (F), no glare on the screen, a chair that’s so comfortable you [...]
Posted by Ben on April 7, 2006
I was reading an interview of Gary Flake who works with MSN search. The following quote stood out to me: Â However, there is an even richer class of algorithms that can only be efficiently built on a 64 bit system because you essentially have to have a significant part of the web stored close to [...]