February 2005 - Posts

While going through my blogroll I came across this awesome little bitmap font maker web app – it’s so darn cute! :)
Rob Fuller commented my post about Sage and recommended that I’d give Onfolio a try — I have, and damn, it is smokin’! I’ve only used it for a couple of hours, but I can already heartily recommend it.

Darren came to me today requesting some help with an SQL  problem had run into; he was trying to return some conditional data using a ‘SELECT CASE’ in his query, but he kept being served NULL values for all the rows that did not match his ‘WHEN’ statements. He tried to check if the returned value from the CASE was a NULL in a WHERE clause:

select
    case
        when shipcountry = 'norway' and @year1 = datepart(yy, orderdate) then employeeid
        when shipcountry = 'brazil' and @year2 = datepart(yy, shippeddate) then employeeid
    end
from orders
where 1 is not null

That didn’t work because what he was checking was whether the column value was NULL or not and not the value of the actual value returned from the CASE. That’s when I suggested the following example to Darren:

select employeeid
from orders
where orderid in (
                  select
                      case
                          when shipcountry = 'norway' and @year1 = datepart(yy, orderdate) then orderid
                          when shipcountry = 'brazil' and @year2 = datepart(yy, shippeddate) then orderid
                      end
                 )

This works perfectly and does exactly what he wanted — you have got to love the power of nested queries ;)

NOTE: the actual sample queries have been modified for the Northwind database for your testing pleasure.

Been talking to Darren about his recent post (and his follow-up) regarding Robert’s blog reading habits; I must say I am very intimidated by how many blogs he’s reading every day – I’m struggling to follow just a few, but it does start you thinking about how much time he puts into this and how it must done with a few sacrifices… family? friends?  I’m just speaking from personal experience and have no clue whatsoever about how Robert solves this.

Been trying out a cool FireFox extension I found while looking through the extensions gallery – it’s called Sage, and it’s an RSS feed reader that completely integrates with FireFox. One of the things I thought was cool was the newspaper style of reading the feeds (not a new feature, but still nice) and the fact that this “newspaper” is completely styled by CSS; I’ll be creating my own styles tonight… I might post it here if it turns out good ;)

Just thought I'd share the simplest little algorithm ever with you guys. I created this little cutey for the blogging part of my personal site (coming soon ;) - I use it for generating unique, semi-sequential identifiers for my blog posts...

public static string GenerateId()

{

    string ticks = DateTime.Now.Ticks.ToString();

    string temp = "";

 

    for ( int i = 0; i < ticks.Length; i++ )

    {

        if ( ( i % 3 ) == 0 )

        {

            temp += ticks[i];

        }

    }

 

    return temp;

}

 

Jason mentioned this little beauty on his blog yesterday; AppRocket. It's a wicked little application for quick launching apps, finding your music and what not... Well, just check it out, you won't regret it :)

Oh, I forgot to mention the coolest part: it's written in .NET :D

More Posts