This space intentionally not left blank

 

A little esprit de corps

19 Jun 2009  in mid-morning  Matt Winckler

I am gratified to learn that developers are born brave.

Of course, were we to unceremoniously carry this picture’s metaphor to its logical (yet bitter) end, we would realize that the developer’s only brave because he put the rat there in the first place. So perhaps the correct conclusion is that developers are born scary.

I’ll take either one.

Seen someplace

12 Jun 2009  around evening time  Matt Winckler

Command-line Russian roulette:

[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo '*click*'

I like it.

Some design pleasantness

11 Jun 2009  in mid-morning  Matt Winckler

I’ve landed at Marc Grabanski’s site a few times on the business end of Google searches about jQuery, and every time I end up there I find myself wishing I could come up with a blog title image like his. Take a look. I love it.

The other, similar illustration style I like a lot is exemplified by Joyent. I freely admit to having clicked all over their site just to find all the pictures of their cast of characters, even though I have pretty much nothing to do with what the company offers (again–landed there after a Google search of a technical problem). I particularly commend the developer and the support staff.

Egotistical roller coaster

05 Jun 2009  just before lunchtime  Matt Winckler

If you’re a programmer, there is no excuse for not knowing about Stack Overflow. I’ve never seen such a high signal-to-noise ratio combined with such fast responses to programming-related questions. It seems to take me longer to compose a question than it does for the answer to show up in response to it. (Of course, this may merely indicate that I’m a simpleton asking stupid questions. Don’t tell anyone.) I like to give back to the community that helps me out, so although I don’t have time to slavishly answer questions all day long (the way the SO community seems to), I do my best to browse the unanswered questions for a softball that a hack like me can handle. The drawback to this is that browsing the questions that go unanswered for any significant period of time is a major blow to the ego. There are some seriously smart people out there!

So in order to get my programming ego back in line, I usually have to browse over to The Daily WTF for a few minutes. Following that, I feel much better about myself, and everything balances out.

DynamicDictionary, C# style

20 May 2009  in the early afternoon  Matt Winckler

A couple of years ago I posted my DynamicDictionary class, intended to act as a multidimensional hashtable that won’t throw exceptions the way a Dictionary<T> will when attempting to access a null bucket.

Since then I’ve experienced the supremely pleasant circumstance of changing my primary language from VB.NET to C#. Although I haven’t used the DynamicDictionary much lately, there have been a couple of times when I’ve wanted it but wasn’t at the computer on which I translated it from VB.NET to C#, resulting in annoyance at having to re-translate (or just skip it entirely). Thus, I’m posting the C# version now, primarily for my own benefit and archival. Read the original post for an explanation of functionality/usage.

(Also: I know I need a better way to present code here. A theme rewrite and major cleanup/recategorization for this blog is on my todo list for later this year. I may also split out the technical/non-technical content into separate RSS feeds so the theologians and other non-developer friends don’t have to wade through all these cryptic and baffling series of semicolons and brackets, which, pathetic though it seems, does in fact constitute my daily working life. Until then, grit your teeth!)

public class DynamicDictionary<K, V> : Dictionary<K, V> where V : new() {
    public DynamicDictionary() { }

    /// <summary>
    /// Retrieves the value associated with the specified key.
    /// </summary>
    /// <param name="key">The key.</param>
    /// <returns>If found in the dictionary, returns the value associated with <c>key</c>.
    /// If no such value exists, creates and returns a new <c>V</c>.</returns>
    public new V this[K key] {
        get {
            V val;

            if (!this.TryGetValue(key, out val)) {
                val = new V();
                base.Add(key, val);
            }
            return val;
        }
        set {
            base[key] = value;
        }
    }

    /// <summary>
    /// Retrieves the value associated with the specified key. If <c>autoCreateItem</c>
    /// is true and no value exists, creates a new <c>V</c>, stores it in bucket <c>key</c>,
    /// and returns it. Otherwise, returns the default value for <c>V</c> (without storing
    /// it in the dictionary).
    /// </summary>
    /// <param name="key">The key.</param>
    /// <param name="autoCreateItem">Specifies whether or not a new item should be created and
    /// added to the dictionary if a value does not already exist. True == if value does not exist,
    /// a new <c>V</c> will be created, added to the dictionary, and returned. False == if value
    /// does not exist, nothing will be added to the dictionary and <c>default(V)</c> will be returned.</param>
    /// <returns>The value found in bucket <c>key</c>, or if no value exists, either a new <c>V</c>
    /// or <c>default(V)</c> (based on value specified in <c>autoCreateItem</c>).</returns>
    public V this[K key, bool autoCreateItem] {
        get {
            V val = default(V);
            if (!base.TryGetValue(key, out val)) {
                if (autoCreateItem) {
                    val = new V();
                    base.Add(key, val);
                }
            }

            return val;
        }
        set {
            base[key] = value;
        }
    }

}
 
  • cheapest cialis
  • buy cialis us
  • cheap cialis from canada
  • cheapest clomid prices
  • viagra canada
  • cheapest cialis online
  • cheapest generic cialis online
  • order synthroid
  • accutane online cheap
  • buy zithromax
  • cheap cialis overnight delivery
  • online viagra
  • lowest price levitra
  • buy cheapest cialis
  • acomplia without a prescription
  • cheapest viagra prices
  • buy generic clomid
  • where to order cialis
  • purchase viagra overnight delivery
  • buy cialis from india
  • cialis in australia
  • viagra
  • lasix prescription
  • buy propecia cheap
  • acomplia online cheap
  • cheap viagra without prescription
  • purchase zithromax
  • buy accutane without prescription
  • cheap generic cialis
  • acomplia pills
  • cialis information
  • cheap generic viagra
  • find viagra on internet
  • acomplia no prescription
  • order cialis no prescription
  • buy cheap viagra internet
  • lasix discount
  • buy synthroid cheap
  • free cialis
  • cialis no prescription
  • cialis from canada
  • synthroid sale
  • propecia online stores
  • discount viagra
  • overnight cialis
  • price of synthroid
  • order clomid online
  • purchase cialis overnight delivery
  • lasix generic
  • zithromax
  • viagra for order
  • buy cialis low price
  • buying viagra online
  • accutane discount
  • generic cialis
  • free viagra
  • buy viagra cheap
  • cheap price cialis
  • order no rx cialis
  • clomid online
  • where to buy acomplia
  • best price for viagra
  • lowest price synthroid
  • discount viagra without prescription
  • buy cheap soma online
  • clomid online cheap
  • cheap viagra in usa
  • cialis bangkok
  • cheap price viagra
  • compare viagra prices
  • propecia prices
  • sale viagra
  • order viagra overnight delivery
  • buy cheap acomplia