January 19, 2007

Prototype News!

Prototype, in case you don't know, is a fantastic javascript library that lays the foundation for all the hottest new UI trends on the web. I've been using it for over a year now and I have to say it may just be the greatest thing ever to happen to javascript.

Anyway...they've finally come out with a 1.5 release version. Oh, and they also have a shiny new website with official documentation...that last part just makes me feel all warm inside.

January 3, 2007

Be Judged...And Like It!

I recently ran across a fantastic way to waste some time in a completely productive manner. The Sphere Online Judge works like this:

  1. You choose from a wide array of problems (think back to your computer science classes)

  2. You develop and upload a solution in the language of your choice

  3. Your code is run and judged against the time and memory constraints of the problem

  4. If you pass, you get a warm fuzzy feeling inside. If you fail, you get angry and vow upon the graves of your forefathers to spend every waking moment figuring out how to find all the prime numbers between two given numbers up to 1 billion in under 6 seconds...not that anything like that happened to me.


I think this is a great way to keep your programming skills sharp and have some fun too.

.NET Nuggets

With all the flashy new features of ASP.NET 2.0 it's easy to overlook the little things that actually help out in your daily coding. Here's a couple that I use quite often:

  1. String.IsNullOrEmpty(string value)

    This method does exactly what it says, returns true if a given string is either null or empty. A quick look in reflector reveals that it does this by properly checking the length of the string as opposed to comparing it to String.Empty:



    public static bool IsNullOrEmpty(string value)
    {
    if (value != null)
    {
    return (value.Length == 0);
    }
    return true;
    }


  2. int.TryParse(string s, out int result)

    This method takes a string and attempts to convert it to an integer, returning the result through an output parameter. If the conversion is successful, the result will be the appropriate integer, otherwise the result will be zero. The conversion will fail if the input parameter is null, not a properly formatted integer, or falls outside the range of an Int32 type.


    I looked at this with Reflector, and it's a bit too complicated to post here, but the cool thing is that it does it's thing without ever using a try/catch. This method definitely comes in handy when you need to get integer values from an untrusted source like the querystring.