Sunday, December 30, 2007



The short version:
I'm releasing xPathFinder, a tool I wrote for doing XPATH expressions against xml files on the file system. You can get information about it as a tool by going to the website. Here are some screenshots:


The long version:
Not too long ago I ran into a problem that I thought would be common but didn't seem to have a canned solution. We use a webservice to store some data in a database but we also store the xml files transmitted on the file system as a defensive maneuver in case the database is unavailable or the xml is invalid. After a while I was dealing with a lot of xml files - far too many to search one at a time and needing more structured lookup than a desktop search tool offered. This is the raison d'etre of this tool. Of course it could have been a quick script in -insert language of choice- but this was something I needed to do repeatedly and have more facility with than console output. I'm also planning to make it simple enough for our client to use. It was a goal of mine to get it up before the end of the year so I'm happily posting this a day early.

One more footnote to this tool - stylistically I've done quite a bit of blending between Windows Forms and Web by leveraging the WebBrowser control heavily for things I thought would be easier to quickly generate html for as well as the feedback mechanism which allows users to report bugs or request features. It's so tightly coupled that while it will work without an internet connection, it's a much more limited experience. I really like this model and will probably start doing more blending like this for new work.

You can get more detail from the website or just ask directly by submitting feedback.

Future plans?

1. XPATH functionality works for most xml documents, but namespace heavy documents with prefixes seem to throw a curve ball.
2. What I'm posting was actually a fast prototype I intended to use to make this tool in WPF from - I'm not sure that the WPF step is still necessary but I may release an updated version since this is a fairly straight forward utility.
3. I'd like to make it open source. Not sure of what steps to follow, but CodePlex is probably the best starting point. I always promise myself I'll clean up my code before doing something like that but maybe I should just bite the bullet since I think the idea is sound enough.


Tuesday, December 11, 2007

Installing ASP.NET 3.5 MVC Preview


Code Climber has this great list of what you need to download and the order in which you must install it. I just completed my installation and have begun to poke around.


Thursday, December 06, 2007

Someday Language: F#


There's a lot to learn these days (whenever isn't there a lot?) and one thing I will do for 2008 is make a list of technologies I'd like to dive into with some sense of priorities. 

Among the ASP.NET MVC, Powershell 2.0, and Iron Python (for starters) I've been interested in F#. First as a topic on Hanselminutes but I lurk on Harry Pierson's blog and he's been posting about it quite a bit.  Here are some links:

1. F# Overview on hubFS
2. From DevHawk:

Someday it is.


Mads Samples


Mads Kristensen has a listing of his code samples. One thing I like about Mads' samples is that they are all very straightforward without unnecessary layers of abstraction.


Wednesday, December 05, 2007

The FogBugz Salesman


Once or twice people have confused what I'm doing with sales. Some time back I met with a prospective client and kept having to explain that I actually do write code and would probably be a lead developer on any work they gave us. The reaction I had for even the mere perception that I was "sales" was a little surprising to myself although with some reflection I realized it was because I conflated most of what I disliked about salesmen into an image I couldn't deal with for myself:

  • Style over substance
  • Shallow understanding
  • Pandering for a quick buck

But once in my life I was a happy salesman. Some time back I pushed the company I worked for into adopting FogBugz and really building a large part of our lifecycle around it. I did so enthusiastically after reading Joel's early essays on bug tracking and seeing how well it applied to our situation.

I've seen other bug tracking software since but still think the FogBugz experience was best.  It seems simple, but because of how much thought has gone into the product, I gather a lot of work has gone into keeping it stripped from unnecessary features.

To be clear, I don't work as a bona fide "in house" developer. But as a consulting company, I spend a lot of time playing that role or working with people in it.  It's therefore conflicting when I read his understanding of what it means to work in house. Phil Haack had it right in the middle of 2005 when he wrote of the irony of this disdain towards the people that would be excited to use his software in the first place.

I wonder what kind of conditioning it is - maybe that I've liked musical artists who are fairly open about loathing their fanbase - but I still miss the simplicity and elegance of FogBugz. 

What's sad these days is that as much as I'd like to slip on the poorly fitting suit and do my sales routine, we get Sharepoint for free (okay, not free but let's just say Microsoft does an excellent job making it seem so) and it's the environment in which we track what I'd gotten my previous company to use FogBugz for so effectively.  I'm not a big Sharepoint fan (that's an understatement) so I'd even be tempted to go The Powers That Be and ask for FogBugz if I couldn't predict the answer right away.

Tomorrow I'll be unflustered but I've got a few comments on what it's like to be in house:

1. In a small enough company, it's great to have decision making power.  I've used technologies like Ajax and Perl where a larger environment would have involved committee meetings with some manager shooting me down for doing things differently. You don't have to be a renegade to do this, just document what you do well and communicate with anyone you're working with that may have to look at it on your behalf.

2. In consulting it helps a lot to condition your client.  First build confidence with a track record of success, after which the client is usually willing to listen to you when you'd like to do things "right" or improve a piece of software even if it's getting by functionally.  After a while, depending on the client, they will usually just trust your judgement and stay away from technical arguments unless there's some disproportionate cost.

3. Software is never finished.  This is true even for what is developed in house.  As a result the process of continual improvement still exists.  It takes a tremendous amount of discipline to try to develop things right when there's a small budget or a tight deadline but I always think of those moments I've spent late at night hacking the ugliest workarounds because of a bad initial effort. Most of the time finishing when it's "good enough" is about the taste and craftsmanship of the person who writes the software; whether they tried to think of the future or not.

4. From working in both a "software company" and a "consulting company" I understand that software development is always a process of coming to terms with friction - all the unexpected realities and circumstances of real life and real users. Different places will have different kinds of friction; where an in house developer may have to deal with the kind of discipline it takes to write unit tests on a deadline a programmer at a software company may have the dilemma of trying to be all things to all people.


Tuesday, December 04, 2007

Comment Spam Begone


I maintain a few personal websites, one of the closest to my heart is phoDak, a photoblog.  I wrote the site using ASP.NET about two years ago and intended it to be a low key, personal area to post pictures.  I had absolutely no validation on comments and my "what will be" attitude worked for a long time until about a week ago when I saw a comment spam link to porn right off the most recent picture.  No longer avoidable, I looked into a few ways to block unwanted comments and came up with a hybrid approach:

1. Use a photo/word as validation for a human user, just like Jeff Atwood's blog.
2. I heard about Akismet from Phil Haack who mentioned it in passing on a Dot Net Rocks episode. I found a free library and wrote about 10 lines of code:

AkismetManager akismetManager = 
new AkismetManager("my key", "my site");
string ip =
AkismetItem item =
new AkismetItem(ip, Request.UserAgent.ToString());
item.AuthorName =
item.AuthorUrl =
item.Content =

Q.E.D., really. Somewhat Mort-ish for me to lean solely on the library but it works beautifully: my spam comments since implementation remain at absolute zero.


CodeMash: I'll be there!


On a whim I've signed up to be at CodeMash 2008.  After learning about the conference when Hanselman posted he'd keynote, I mapped out that Sandusky, OH (Whiskey, Tango, Foxtrot!) is none too far (an audio book's worth of distance).

I'm really looking forward to the opportunity to walk among Elvis and Einstein, hopefully gleaning some direction along the way. The session list is impressive, I'm thinking it will be hard to choose a particular direction.

I've been studying Python of late, so I'm really looking forward to Bruce Eckel's Why I Love Python. Another interestingly titled Python presentation Crash, Smash, Kaboom Course in Python will be run by MIT alum Catherine Devlin.  Finally on the Python front, I'll try to squeeze into the Getting Started with Django session.

On the "indy" .NET programming, I'm interested in the Introducing Castle session from Jay R. Wren. Because Hanselman is going to be there I can't imagine no mention of ASP.NET MVC stuff, so hopefully it will somehow be mentioned at least comparatively.

Jesse Liberty is going to present on Silverlight, so that's something I won't miss either. There are other Microsoft technology presentations I should see but it would be hard to sit in on a Sharepoint session when I could be learning Python design patterns.

The other area of interest I'll have is the Dojo stuff, two sessions in particular: Overview of the Dojo JavaScript Toolkit and Working Offline with Dojo+Google Gears, both by Kevin Dangoor.

Well, it should be interesting from start to finish, I'll be working on my note taking skills so that I can share what I do learn.


CodeMash – I'll be there!


Monday, December 03, 2007

Tis the Season


Don't get me wrong, I love Christmas too, but I really like the Advent Calendars that wind up the year. 

24 ways
Drew McLellan and his crew have been putting together web development tricks to round out the year for the last few years.

Perl Advent Calendar
None too late and looking like it was designed by a Perl programmer.

Two advent calendars I'd love to see:
1. Microsoft .NET
2. [Iron] Python


Thursday, November 08, 2007

Firefox 3 Coming


LifeHacker has a first look at the forthcoming Firefox 3. It's interesting to see lots of improvements to the storage and management of places visited online - I'm sure this will provide inspiration for the Internet Explorer team at Microsoft to implement cool new features too.

A feature I asked for (and got a skeptical response) was the ability to do what Firefox seems to aim for but in a Google-ish way. That is to say that it would be nice to have a browser history management/search capability that precluded real effort in organization. In simpler terms, the whole "search, don't sort" experience one has with Gmail, except with browsing history and favorites.


Tuesday, November 06, 2007

Web Shell: Prototype & IronPython


I've been experimenting with IronPython of late trying to get the gestalt of Python as a language.  It occurred to me that something I had been thinking about for a while as a web project would make sense as an Iron Python project so I dabbled a bit.

The idea I had was a command line type application that approximated commands going to a windows shell and sent the results back to the user.  It's a part of a larger suspicion that I've had: that command lines are crisp, efficient user interfaces that are easy to lose sight of because it's not a natural way of thinking on the web.

The screen shots tell you the basic story: you open your browser to nothing but an underlined textbox after which you type your command and press the enter key. 

The client code is pretty straight forward - I've become disillusioned with YUI and moved back to using Prototype:

function runCommand(cmd){
    var request = new Ajax.Request(
            parameters:'cmd=' + cmd,
            onComplete: handleResult

function handleResult(response){
    $('loaderImage').style.visibility = 'hidden';
    var cmdResult = response.responseText;
    $('stdoutDiv').innerHTML = '<pre>' + cmdResult + '</pre>';

So that's all pretty simple, on the server processing the request is equally simple in IronPython.

from System.Diagnostics import *
from System.IO import *

def Page_Load(sender, e):
    cmd = Request.cmd
    p = Process()
    p.StartInfo.FileName = "cmd.exe"
    p.StartInfo.UseShellExecute = 0
    p.StartInfo.CreateNoWindow = 1
    p.StartInfo.RedirectStandardInput = 1
    p.StartInfo.RedirectStandardOutput = 1
    myOut = p.StandardInput
    myIn = p.StandardOutput   
    output = myIn.ReadToEnd()

The web project is fairly small - go ahead and download it here. If you have any improvement, let me know - I'm not sure how to start this as an "open source" affair but it would be a great solution as a light weight tool for remotely operating on a server.

Oh yeah, security: I was thinking of simple NTFS permissions on the files along with Windows Security on the website.  Should do the trick...


Monday, November 05, 2007

Innovative Thinking



There are some great videos at the Business Innovation Factory -

Jason Freid (37 Signals) -
I've been watching these guys for a long time. Although I'm a little resistant to some of the accolades associated with them, the 37 Signals crew thinks clearly and has a clear identity with which they seem overwhelmingly successful.
My favorite comment is Jason saying that they (37 Signals) want to be "enemies of mediocrity."

Richard Saul Wurman -
I first learned about Wurman from TechTV's "Big Thinker" series - although he is trained as an architect his career spans the sort of multidisciplinary mix that makes him special. He originated the TED conferences which have become quite popular of late. He's got an interesting new project called 19:20:21, be sure to check out the information graphics.

Clay Christensen -
One of the most interesting thinkers in the theory of business at present.  I wonder if Clay is more an economist than what one would consider a conventional "business" person. His gifts as a teacher shine through in this particular presentation.



Sunday, October 21, 2007

Leveraging CSS opacity for help


A few projects ago a control was created (who exactly did it I'm not sure) for displaying dialog "popups" without new browser windows.  The technique was fairly straightforward: an IFRAME with an opacity filter and a div with the popup values. 

I wasn't a huge fan of the infamous "popup" which managed to come up in project after project, but the idea of using opacity on an IFRAME for an overlay of helpful information struck me about a week ago. 

The nRegex interface, which is quite straightforward to me, still seems to pose some confusion to new users and so I thought I'd use it might be suitable for a virgin implementation of the idea.  It's a little crude* but the idea should come across: use the 'How to use Nregex' button to display the overlay and it seeks to explain the various pieces of the interface.

The implementation is quite simple. There's an IFRAME with the following attributes:


Within the frame, a button hides the IFRAME calling a javascript function from the parent window. 

The easiest way to implement this is to use the skeleton of the interface in the *original* design.  I'm interested in comments on this approach - would it be feasible as a way to document an interface's functionality?


Wednesday, October 17, 2007

Podcasts I: Think Big


I remember my first conference well: I was 24, it was February of the year 2000 and I was in San Francisco.  I'd bartered my way there: I turned down a raise from my employer and instead asked for a "personal budget" for professional development. In a bookstore I'd seen an ad in the Visual Basic Programmer's Journal and thought it was an opportunity to develop skills and visit my favorite city at the time.

One keynote that week was delivered by the futurist Paul Saffo. He spoke about observing trends and thinking past the day to day problem solving we experienced in our lives as programmers.  I remember his anecdotal story: an engineer working in telecom had purchased land on hilltops knowing there would be a demand for communication towers on top.

It's been nearly a decade but with Saffo in mind I still try to get out of the "technical" and think on a higher order.  With that in mind here are a few podcasts from last week I enjoyed:

1. Scott Berkun - The Myths of Innovation

Scott was a developer and manager at Microsoft but broke away to write and mentor. Key takeaway on innovation: breakthroughs are less about epiphany and more about consistent effort and dedication. Scott's blog is here.

2. Guy Kawasaki - The Art of Innovation

I've been wary of Guy to this point; marketing guy, and Apple obsessed. I like Apple too but not enough to start to ignore the outside world. But not only did I laugh and get entertained, I learned a few things. Guy recommends companies (and I'll extend that to people too) need a mantra, not a mission statement.  He also has great ideas about releasing early and often.  Good stuff.
Guy blogs here.

3. Ned Gulley - MATLAB Programming Contest

John Udell interviews Ned on an interesting collaborative contest Mathworks puts on.  I always like hearing a John Udell interview since he probes with more than the passive interest than most people in conversation.  Someday when I'm not bleeding a lack of time I'll check in on the problems although I think my math skills are suspect (and rusty) enough to render it more fascination than practical utility.
Ned's "starchamber" is here. (I learned the meaning of that word from the Merriam-Webster Word of the Day podcast by the way)


Monday, October 15, 2007

NYT presents OPEN


A new boast puts perspective on the original New York Times tagline: "All the News That's Fit to Print." 

Now we have "All the Code That's Fit to printf()".

On a serious note, OPEN is a new blog written by and for developers. I'll subscribe for the moment even if all the code I'm interested in is usually in a language that doesn't support printf natively.

Courtesy of Aaron.


Saturday, October 06, 2007

C# 3.0 Screencast


I hope I can call him a friend - I was fortunate enough to sit a class with him and then ran into him at TechEd - but Tim Rayburn has an excellent screencast overview of C# 3.0 new language features.  For 46 minutes of your time, you'll not only be up to speed, but hopefully a little excited at the future.

 The first few items have more to do with improving the syntactial approach to things we're already familiar with:

1. Automatic Properties

public string Foo{get;set;}

2. Implicitly Typed Variables

var o = new SpecificType();

3. Object Initializers

class Test{

public string Foo{get;set;}

public string Bar{get;set}


var p = new Test(){Foo = "shaz", Bar = "bot"};

4. Collection Initializers

List<string> myList = new List<string>(){"foo", 'bar"};

List<Test> myList2 = new List<Test>(){

new Test(){Foo="foo", Bar="bar"},

new Test(){Foo = "blam", Bar="biff"}


The remaining items are better explained rather than just shown - I suggest you pay closer attention to the screencast:

5.  LINQ & Anonymous Types

6. Lambda Expressions

7. Extension Methods

(This was, as Tim assumed, my favorite piece)

Although Partial Methods were noted on the list, time seemed to run out on Tim. Stay tuned; it appears he is planning to continue doing screencasts.


Monday, September 24, 2007

The Shining Armor is Rusty (on Rails)


Derek Sivers writes about switching back to PHP from Ruby on Rails after attempting to rewrite cdbaby. Raganwald references an intersting series from Chad Fowler on "Rewrites" and why they are so difficult.


Saturday, September 22, 2007

Beautiful Code


Although it seems to be a little disagreement over the existence of beautiful code, a refactor I did today was pleasant to my eye.

Starting with:

string result;
if (parameterLessCommands.Contains(commandName))
    result = RunArglessCommand(user, commandName);
else {
    string commandArg = RetrievePairCommandArg(commandData);
    result = RunArgCommand(user, commandName, commandArg);
return result;

Ending with:

(parameterLessCommands.Contains(commandName)) ?
            RunArglessCommand(user, commandName) :
            RunArgCommand(user, commandName,

I'll take it. ()?: is your friend!


Tuesday, September 18, 2007

Meeting Time


I've always wanted to work for Microsoft. My first chance was right out of college when a professor of mine passed my resume to his friend up there.  I had some embarrasing crap about how I'd always wanted to work for "the company." It was all true but I can imagine the HR person directing anything that sappy to the trash. Instantly.

But it's just as well - Steve McConnell has an interesting comment about how much time at Microsoft may be spent in meetings - for developers:

When I was at Microsoft in 1990-91 I probably spent less than 5 hours a week in meetings. In contrast, I had a former Microsoft employee tell me earlier this year that on the team he was on he was booked in meetings from 10:00-4:00 5 days a week. Lots of managers at other companies have told me that they're in meetings all day every day and get most of their "real work" done during evenings and weekends, so obviously there's a big difference between Microsoft 1990 and Microsoft 2007, and among different companies.


Tuesday, September 11, 2007

Pivot, UDF, FizzBuzz!


As I hit "publish" from my previous post on pivot tables, a thought struck me on another most excellent use for them. No, really - for the next job interview:

        WHEN I % 5 = 0 AND I % 3 = 0 THEN 'FizzBuzz'
        WHEN I % 3 = 0 THEN 'Fizz'
        WHEN I % 5 = 0 THEN 'Buzz'
FROM dbo.fnPivot(100)


Pivot Tables with UDFs


I taught a T-SQL Programming class this week and in the process looked over some old books on the subject. One in particular I've enjoyed was the Transact-SQL Cookbook from O'Reilly - I have yet to find as novel an approach to SQL, coming from the ideas of set theory rather than tutorials on querying. I'm biased too, my best friend in highschool was Slovenian and one of the authors, Aleš Špetič, hails from that fine country.

A cool idea from the very first chapter is the pivot table, a numeric range that can come in handy for many different types of operations. The book, which is probably circa Microsoft SQL Server 7, demonstrates the building of a pivot table using some hardcoded insert statements followed with a cartesian join that generates the range.

It occured to me in SQL 2000 and higher one can use a User Defined Function and get all the benefits with a little bit more flexibility. Here is a simple approach to the same concept:

SET @I = 1
SET @I = @I + 1

The approach is different but the benefits are similar. A simple one from the first chapter is building a calendar of a given range of days. I've adapted it to use the function above:


date day
---------- ------------------------------
2007-09-13 Thursday
2007-09-14 Friday
2007-09-15 Saturday
2007-09-16 Sunday
2007-09-17 Monday
2007-09-18 Tuesday
2007-09-19 Wednesday


Wednesday, September 05, 2007

Nregex Kaizen vol. I


Kaizen is all about small improvements that never stop coming.  With respect to Nregex, I plan to keep it moving as a project by spending small amounts of time on new features that will hopefully make it more useful.

Tonight's new feature, though it was really something I did on Saturday morning, is a bookmarklet that should make it a little easier to get into the site from elsewhere (like your favorite IDE).

A few weeks ago my boss noticed some latency issues, especially with larger documents. I've added a "manual" mode that will let you press a button or just hit your enter key to evaluate a regex, rather than it being processed as you type.  Animated gifs give a little feedback on wait time.

If you have a request for a feature, please submit it here.  If you have a handy regex you solved some problems with, please submit it too. I'm currently at work on a "library" that I hope to cover some basic regular expressions (phone, zip, ssn, and so on) with.


Monday, August 27, 2007

Graham, On Point


I was just missing the old Paul Graham, the one who would write wisdom for the type of programmer that I imagined myself to be. The most recent essay, Holding A Program In One's Head, is that treat I've been waiting for.


.NET 301 Redirect


Scott Hanselman was noting that many people who'd updated the locations of their tools on his 2007 Ultimate Developers Tools List had emailed or contacted him asking him to update his reference.

He lamented the fact that they didn't simply use HTTP 301 redirects (Moved Permanently) which tools can easily use to update referenced links.

I must confess, I was one of those people.  I just lazily made a default.asp that had one line:


But 301 redirect are pretty simple whether you use .NET or lazily throw an ASP script somewhere.

'classic ASP
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://foo/bar.asp"


Response.Status = "301 Moved Permanently";

Source: seoconsultants.


Friday, August 24, 2007



I embarrassed myself today (yelling at the work desk, telling everyone I'd take them to McDonalds) but with good cause: a tool I wrote some time back made it to Scott Hanselman's 2007 Ultimate Developer/Power User Tools List. The goal of the tool was simple: to do browser based evaluation of regular expressions using the .NET engine.  Prior to writing it I would frequent but because the engines supported there were different, I'd usually have to do some conversion to get things to the .NET world.

There are quite a few .NET Regular Expression tools: Expresso, which is my first and favorite since I've used it longest, but also tools like Roy Osherove's The Regulator. The problem with these tools, however, was that as fat clients I wasn't always easily able to use them: I work on different machines (home, work, client sites) and also assist people quite a bit away from my desk.

There are also quite a few Regular Expression tools for the web, Rexv, which I mentioned before but also RegexPal. But these tools support either javascript or alternate implementations so patterns like (?<foo>\w+) usually return some kind of error. 

The way Nregex works is pretty straight forward: I'm using YUI for the Ajax library and working with the .NET implementation of the regular expression on the server.  A simultaneous goal of mine is to get into more of YUI because I'm always building little knick-knacks in javascript and I think it's the library to beat right now.

Of course it's a fledgling: I worked on it a few nights when I could and fixed bugs here are there when I had a moment.  Please use it and give me feedback since that will be my biggest help in making it better.

One more thing: I'm trying to collect useful regular expressions. I'd like to build a good library of expressions to help users of the tool. Use the feedback form and let me know if you've got one you've found handy. Don't worry if it's not .NET specific, I'll do the translation.


Sunday, August 12, 2007

What Comes First?


Although it's an older essay (November, 2004), The IDE Divide made for some good Sunday reading. Not only is the author, Oliver Steele, engaging but his visualizations are exceptional. I'd like to think of myself as a "language maven" - that is a person who puts the emphasis on language capabilities before tools - but I know that growing up in the Microsoft world as I did, I understand how big of a difference good tools can be.

One item I don't recall seeing in the essay was how tool mavens are responsible for their own obsolesence. It makes perfect sense to focus on language first and be flexible with tools - and to have a good text editor you can rely upon. I started using Textpad first with Java and nowadays I usually don't pass a day when I don't open something with it - either for quick inspection of a file or to write something in perl or python.

I know there are other good text editors out there but it seems like having good regex support and the ability to attach shell commands to keyboard shortcuts is most important. Syntax highlighting is a nicety too although as time passes it's not really as important to me.


Tuesday, August 07, 2007



Some time ago Jason Kottke posted an entry for which quite a few people bashed him about unnecessary database normalization. I've thought a lot about it since it represents some of my own internal sentiments and instincts. The two things I observe on a regular basis that I find annoying are bad naming conventions within databases and unnecessary complexity because of overzealous normalization.

It's hard to have an argument discussion on the topic with people lacking experience because the penalties for bad normalization are usually paid in the long term whereas the "effeciency" of storage with normalized data seems to be an ideal to strive for when one's perspective is short.

I was therefore heartened to see some caution from Patt Heland (courtesy of Dare Obasanjo who elaborates) on the topic. It may be a good idea to have a meeting at work and discuss some of the details given... maybe not to come to some "conclusion" or "database standard" that can apply to every situation, but more to generate good discussion and ideas.


Wednesday, August 01, 2007

Upsert Properly


For the longest time, my approach to update/insert logic has been the following:


So courtesy of .NET Kicks this gem was very informative which is the same logic but with a cleaner approach. Instead of selecting records first, you attempt to do an update and check afterwards if the @@rowcount is greater than zero - if not the record doesn't exist so you can move logically to an insert.


IF @@rowcount = 0 BEGIN

Nifty, very nifty.


Tuesday, July 31, 2007

Fast Learning, Norvigian Thinking


I was looking over Justice Gray's post on becoming a better developer in 6 months and noticed that he had listed Freidl's Mastering Regular Expressions as a one week reading project. I'll preface my comments by admitting I am not the quickest read - unless I'm reading something I don't particularly care about I tend to go it slow no matter what the subject matter.


Not really thinking of connecting the dots I checked in on Jeff Freidl's blog and digging around saw it took him 2.5 years to complete the first edition of the book.

It strikes me as funny that there would be such a disparity in creation and consumption. Of course I may be slow - a big part of my wanting to learn Perl was the desire to have the capacity to "think" in regular expressions - but over the last few years as I've gotten better and better I find it hard to think I could compensate the little projects and tools I've written without the pain and grit of using what I read slowly.

But then again we can all rest assured that there's no rush.


Sunday, July 29, 2007

Remove Duplicate Lines In Python


I had posted about the set operator in Python with some questions. All that changed today when I wrote a little script to remove duplicate lines from a file. The set operator takes a list and automatically gets rid of duplicate items. Very useful for situations like this:

#!/usr/bin/env python

f = open("c:\\temp\\Original.txt")
f2 = open("c:\\temp\\Unique.txt", "w")
uniquelines = set("\n"))
f2.write("".join([line + "\n" for line in uniquelines]))


Saturday, July 21, 2007

Shuffled Arrays


One of my weaknesses is that I love puzzles. And once I'm puzzle solving, I usually dwell on the problem beyond its worth. I recently saw a job ad - I'll leave this post disconnected - that had a quiz associated with it. The quiz amounts, basically, to shuffling items in an array (javascript).

My first stab was intuitive, but I wonder if it's the most optimal because it relies on a lot of discarded data. In my loop generating a random order, I essentially go through an undetermined amount of times discarding results that already exist in the randomized array. Additionally the array with random numbers is just for positioning and is probably unnecessary.
Here is the code:

function BuildArray(){
// just builds a random array to work with
var testArray = new Array();
testArray.push('Test 0');
testArray.push('Test 1');
testArray.push('Test 2');
testArray.push('Test 3');
return testArray;

function GetShiftOrder(testObject){
// this is what sorts things out
var upperBound = testObject.length;
var newOrder = new Array();
var shuffledArray = new Array();
while(newOrder.length < upperBound){
n = parseInt(Math.random() * upperBound);
if(newOrder[i] == n){
continue builder;
alert(newOrder + '\n' + shuffledArray);

I was thinking about this today and it may be more effecient to make a random number of passes at the array swapping pairs of items. A shuffling cards approach may be slightly more effecient although to have meaningful swaps there would need to be a minimum number of passes - and additional complexity with making sure pairs were swapped in random pattern.

Anyway, it was interesting and I'm always curious about more elegant solutions.


Thursday, July 19, 2007



I'm taking a serious look at CodePress. Very, very, very cool.


Sunday, July 15, 2007

Sieve of Eratosthenes, Python, Set Operations


I pretty much broke down after TechEd. I thought I'd be patient enough to wait for Ruby but because Python is most mature I have started to learn it, whitespaces or no.

The first thing I did was check out Guido van Rossum's tutorial for programmers, which was an excellent first step. I've followed that up with some random programming - a lot of fun so far.

I was wondering about the set operations in python and how that made a difference in programming since there aren't syntactical equivalents in .NET. Incidentally at the time I was reading The Man Who Loved Only Numbers and ran across a short description of the Sieve of Eratosthenes as a way of finding primes. I thought it would be a good way to check out the set operations of Python.

I wrote the following:

from System import *

def multiples(num, thresh):
multi = []
for i in range(2,thresh):
m = num * i
if(m < thresh):
return multi

primeThresh = 5000
print DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")
nums = range(2,primeThresh)

for n in nums:
nums = set(nums) - set(multiples(n, primeThresh))

print nums

print DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")

Interesting, but slow. The way I may do something like that in C# (which also works just fine in Python) would be this, which I wrote later:

from System import *

primeThresh = 5000
print DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")
nums = range(2,primeThresh)

for n in nums:
for m in range(2,primeThresh):
mult = n * m
if(mult > primeThresh):

print nums

print DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")

It's a lot faster than the previous approach which makes sense - doing set algebra on large sets should take a long time... but that begs the question: are those set operations dangerous (ie. so slow as to be costly).

I'm wondering what's "pythonic" and how a jedi would write this most effeciently.


Saturday, July 14, 2007

Being Better


I probably won't be officially "tagged" but a meme is going around about what one would do in the next 6 months to become better. Hanselman, in his podcast, spoke of a few things and the responses seem to be going up around the blogs.

How will I be better? Most of the things people mentioned are things I already try to do: reading technical books, working on my software, looking at open source, training others... but one thing I want to do is to start posting code.

I write a lot of code and much of it doesn't make it here because I'm sheepish about looking foolish. But getting better is about having courage to show my work because without that, how could it get any better?

I'm going to start with my JAPH, a program that prints "Just Another Perl Hacker." It's meant to be novel and I actually like mine since it leverages some language features that don't exist in my mainstay, C#. The map operation can visit each item on an array performing some opertion - in this case I'm using a regular expression on each item and grabbing alternating characters! I haven't been writing perl for a long time so hopefully over time I can claim a better one but at least this is my own thinking at play, destined for improvement. I did post it on usenet (a first version which had some foolish mistakes) but this is after a little bit of massage:

#!/usr/bin/perl -w
# David's JAPH, volume 0.1
map(print(/(\w)\w/g," "),
qw(Jaubsctd Aenfogthhiejrk Plemrmln Hoapcqkresrt));

The original JAPHs, from Randall Schwartz, were not really about obfuscation but more about language features. The use of map, regular expressions, and $_ in the above are what make it interesting to me.


JLam on DNR


I never mind a long drive with a podcast. A few days ago I listened to John Lam on Dot Net Rocks. I'll admit that sometimes the DNR people can be annoying to me (think Richard Campbell saying over and over like it's a joke "Managed JavaScript??") but it was all worth it to hear some of the internal goings on with the Iron Ruby project.

Gleaning: Iron Ruby is a ways off. I got somewhat impatient and have been using IronPython in the meantime, but more on that later. That's not a small decision for me because I am of the Norvig perspective on learning a new language - it takes the length of time needed to think in terms of the idioms of that language, as opposed to just writing your code with different syntax and keywords (ala writing C# in Ruby).

Gleaning: Ruby is a powerful language for creating domain specific languages. That meme has been floating in my head for a while - listened to a good Software Engineering Radio podcast on the topic sometime back.

Gleaning: JLam talks a bit about how the learning curve for new languages these days revolves around the frameworks for languages - I think the idea of Ruby combined with .NET is that the .NET libraries will fill a gap that Ruby has always missed in library support. Dangerous or brilliant? In other words, I'm sure the open source crowd (is/will be) up in arms because this will, in their minds, dilute the community effort behind a language. Brilliant because the Mort you know (who is probably your boss) will have a better level of confidence about using it.

Gleaning: Iron Ruby is implemented in C# but Managed Javascript for Silverlight is a VB.NET implementation!


Monday, July 02, 2007

True Story: The Cat Ate My Source


A security issue prompted my ISP to change passwords for all users. Normally, this wouldn't be a problem - I'd go to my repository of code, divided at present by year in a "Code05," "Code06," "Code07" format and update a constant in my Constants class and *presto* the connectivity would be back.

Problem is, what if I have to go back more than 3 years?

I'm usually not that irresponsible. In fact, I'm fiendish about backing things up. Yes, I use source control, even on my own little-bitty projects that matter to no one but me. But my mistake was using an external drive - a flakey one - which died after I'd had to reformat/reinstall. I'd backed everything up to it, and my data was gone.

Edge case since I'd after the reinstall I'd moved what was important back to the machine. Edge case because it was in a "code archive" that was something like 6 years old - code that was so long forgotten it was like a head bludgeon when I got a phone call from the client saying that their site was down.

After panicking and looking for some accidental backup (why do we look for things when we know they're gone for good?) I had an epiphany.

I downloaded the *.aspx pages and the site dll - I then used Reflector to disassemble and - I kid you not - 15 minutes later the client was up and running.

And yes, I kept the source...


Monday, June 25, 2007

Mac History


It's strange that I've had a long relationship to Apple's products - or perhaps not if you're a believer and consider their reach unremarkable...

Growing up in Nairobi, a missionary's kid next door had an Apple IIc he'd occasion to let me use (more often I'd simply watch him using it). A few years later, I spent time in my high school computer classes using Apple IIe computers - for the most part it was typing but I had moments of the extracurricular.

My freshman year of college (1993), after many months hovering around the computer store, drooling and daydreaming, a family gifted my sister and I with a Powerbook 160. The little Powerbook that could took us through the college years although by the end it was on its last legs -

... after which I took a long departure from the Apple universe. I began working with PCs and forgot how much fun it was to pick icons, leverage a trackball, and use the Finder.

After talking my boss into it, however, a year ago I got the priviledge of using Macs again with a company owned, David leveraged iBook G4. It's still a foreign environment but it's nice to return to - especially last week after my HP laptop needed to be reinstalled after catching a virus.

All this to post that there is this interesting graphic of Macs in time, with most of my old friends along the way.


Yegge, NBL


John Lam reports that Steve Yegge revealed a Javascript implementation of the Rails framework at this weekend's "Foocamp." Having just finished Yegge's most recent post Rich Programmer Food this weekend, and following his NBL (Next Big Language) post from a while back, the dots seem to be connected. It seems early even among technical blogs but I suspect information will start to seep out in the short future.


Thursday, June 21, 2007

NDepend vs Me


I didn't manage a blog post during TechEd but I'll take a stab at a few things that have swilled in my mind since then. The first thing I've been working on is understanding NDepend, the tool for static analysis. I went to a "Birds of a Feather" spearheaded by some folks from Corillian and had to keep my mouth shut tight so as not to look a fool. Luckily many of the folks there were like me: they knew about static analysis as a concept but were trying to figure out how they could make good use of it.

It will be quite some time before we have static analysis as a part of our build process but I'm most interested in using a tool like NDepend to take the emotion out of code reviews. That is to say that while I do love a vigorous discussion on style and preference, there are concrete measures one can look at objectively to evaluate the well being of software design.

While I'm shaky on the exact meaning of all the metrics (it was suggested to run repeatedly looking for trends) I ran it against a project that has pretty much taken my thirty first year on this earth. For a while that's been on my "to do" list but I think there's always a bit of hesitancy on my part when I'm about to be brutally honest with myself; I designed this software and wrote quite a bit of the code.

The results weren't great, but they weren't horrible. When I used it on the libraries by themselves, the visualizations of the dependencies seemed clean and tidy, and many of the metrics weren't too badly outside of some of the pointers in the cheat sheet we got.


There are some obvious weaknesses that came to light. First and foremost, we were solidly in the zone of instability for most of our assemblies. There are two things that were suspicions now confirmed: first, we didn't have a very formal design process. I need to get better at perceiving my job at an architect level versus as a coder. The second is that we rushed. The rush was not just a schedule thing, it can also be attributed to our short release cycles. The agile folks recommend these, but it should be balanced with a period of silence at the beginning when overall design decisions are being made. The final item, which NDepend would have helped us with in a continuous integration cycle, was showing unused code. After a year's worth of work it's hard to look at so much and except oneself to clean it up, but as a weekly task it would be an easy way to keep things healthy and tight.

Final note: running NDepend is ridiculously easy. The hardest thing besides looking at metrics and trying to understand them is having the courage to look objectively at what you've done.


Slowly Back


After a weekend with a virus, and a horrible waste of time, I've got a clean installation of XP. The upside was that it forced me back to the iBook G4 that's been a little lonely without me.


Wednesday, June 06, 2007

Programming Personality


This programming personality test was interesting.

Your programmer personality type is: PLSC

You're a Planner.You may be slow, but you'll usually find the best
solution. If something's worth doing, it's worth doing right.

You like coding at a Low level.You're from the old school of programming
and believe that you should have an intimate relationship with the computer.

You don't mind juggling registers around and spending hours getting a 5%
performance increase in an algorithm.

You work best in a Solo situation.The best way to program is by yourself.
There's no communication problems, you know every part of the code allowing you
to write the best programs possible.

You are a Conservative programmer.The less code you write, the less chance
there is of it containing a bug. You write short and to the point code that gets
the job done efficiently.


Tuesday, June 05, 2007

Free Powershell Book


All I can say is that I'm loving powershell right now. Hopefully some more goodies will ensue upon this blog but if you're learning like me you can get a free book by leveraging the full length help that is offered on objects. You can print in the following steps:

Get the cmdlets and send the documentation of each to its own file:
get-command % {man $_ -full >"C:/Power/$_.txt"}

Now make an index page so you can navigate to the individuals:
$cmd = get-command % {write-output "<a href='$_.txt'>$_</a><br>"}
"<html>$cmd</html>" >C:/Power/index.html


Sunday, June 03, 2007

Partying with Palermo


Going to Party with Palermo tonight. Looking forward to meeting the jedi and getting TechEd started right!


Monday, May 28, 2007



Via Mads I watched Douglas Crockford present on quality in software development. I posted before on some of his excellent javascript tutorials, this is on par with them. While he's done a good job of granting some ideas in making software quality better, my train of thought goes towards my own workplace and how we can make information like that actionable.


Wednesday, May 23, 2007

Visibility, Alpha Geeks


Who are the alpha geeks out there? According to many, there are none outside of Microsoft using Microsoft tools. Ergo, I must be excluded unless my night sessions with perl in Komodo somehow grant me reprieve... very doubtful... but rather than bristle and come up with examples of people who are accomplished and effective while not being on Microsoft's payroll I'm prompted on a different question: how do we define "alpha geek" especially in a world where so many of us don't know if we're good or not?

I'll answer in the negative because the blogosphere seems to taint judgement in one respect: visibility. There are quite a few people who maintain a loud profile and acquire a status as "expert" and yet when you look more closely at the body of work it doesn't reconcile itself with the status their profile seems to afford them.

I respect people like Hanselman, Haack, Moise, Atwood, JLam, and so on - they seem to have jobs I can empathize with and still find time to be the large sounding boards online. Banking software is involved, complicated stuff, and not only that, it's the type of software that I write. When I compare the design goals of something like NStatic or RubyCLR to pretty web CRUD, I find myself with more respect for the former.

But these are people we all know because they are in our aggregators. They are good but for every one there are many silently effective "alpha geeks" that don't prioritize a web presence. Think game developers here... more specifically think of someone like John Carmack - not necessarily a Microsoft developer but neither a well dressed Web 2.0 pundit. These are people living a little lower level, cranking out stuff even as the blogosphere distends itself with opinions like my own.

So I keep going back to that wariness of visibility. For all the fashion against Microsoft, what makes or breaks my impressions are the body of work that accompanies the comments.


Sunday, May 13, 2007

RIA: Game of Thrones


Catching up on my aggregator yesterday I saw that Dare had posted about Sun's response to Silverlight: their own rich internet application (RIA) framework to supplant (though the politically correct answer is not that it would, it's just a "new opportunity") some of the Web 2.0/AJAXish things that have been popular of late. Mary Joe Foley presents a noncommittal analysis and Sam Ruby points to a few resources.

I went to Sun's page and although it seems like a real enough project the fact that it's applet based right now (and far slower than the Silverlight beta in installing) seems to point to it as an unfinished thought. Their demos at this point are not just slow, but rather underwhelming - compare that with the MLB demo at Silverlight and it's quite a contrast.

But I'm willing to assume that Sun is serious and that their technology has a lot of appeal, especially to many people who live on the "Not Microsoft" koolaid. If that's the case there is a three way battle going on between Adobe, Sun, and Microsoft for how RIAs will be developed.

I wonder if it's wise in a situation like this to hope for a clear winner; competition should hopefully produce the best technology out of each company. Although there will doubtless be compatibility questions that come up, but because each seems to be plugin/runtime based, it seems like developers will have an opportunity to choose a target and build with/for it rather than some of the monkeying around that needs to be done to make a web application work on multiple browsers.


Saturday, May 12, 2007

The Mighty DLR sans Perl


It wasn't until this morning that I had a chance to look at John Lam and Jim Hugunin present on the DLR at Mix. My response is a mixture of giddiness and shock - appropriate I hope for a programming language geek like me. Lam begins the presentation by writing a "simple" application with a mixture of C# (an onscreen button), with its click event handled in Ruby, obtaining parameters from Visual Basic and making a call to a Javascript function. Hugunin is not to be outdone: he follows up with an animation library he has written and his own mixture of onscreen manipulation with a mix of Python, Visual Basic, Javascript, and Ruby.

This is the part of Silverlight that I can grok as a developer of nary so flashy (pun intended) as much as practical pieces of software. The ability to put so many languages in concert, the development experience as text-based and interactive (edit text and refresh just like you do with HTML), and the cross platform support make my mind swim with potential uses. The fact that their demonstration was on a Mac was a brash in the best sense: it's a level of confidence that's not based on arrogance, but preference (Lam presented on a Macbook pro at Teched last year).

I was fortunate enough to meet John Lam at TechEd last year (I have this problem of "freezing up" when I meet people I respect as much as that - all my questions/ability to speak vanishes) and had I the foresight I'd have asked what his thoughts are on Perl. The dynamic languages Microsoft is supporting initially seem like smart choices and certain languages like Smalltalk may not be popular enough for them to justify an implementation. But Perl? I would have thought it would make the cut. I understand that it could be a syntactically difficult language but there are features in Javascript such as handling parameters on functions that seem to be on that order of magnitude in difficulty.

Although the Perl community is tremendous, it seems as fractured as 3rd century Rome. But that being said it's possible that either one of the monks or a clever company will start a project that makes it another language in the DLR family.

Or maybe I'll start a PerlCLR project and get hired by the b0rg. Not even in my dreams do I have skills like that ...


Sunday, May 06, 2007

What Is Silverlight - The Poster


Yeah, there felt like a little impedence mismatch in Scott Hanselman and the Mike Harsh describing Silverlight - ironically Scott being more excited than Mike who actually worked on the project. Let's allow for Mike just not being a visibly enthused sort of person -

Microsoft posted a graphic that is meant to be a resource on understanding what we're dealing with - sans (screen|pod|video)cast it's still not quite the nuts and bolts. Fortunately there are annotations and an entry Scott posted.


Monday, April 30, 2007

Mix Has Begun


I'll catch up with the keynotes later, but I'm monitoring the blog which seems to have a lot of good stuff.


Monday, April 23, 2007

Dreaming in Code


Dreaming in Code author, Scott Rosenberg is interviewd on IT Conversations here. You can impress your friends that you "read" his book even if you've only heard a few ideas. A recurring theme is just how hard it is to write software - a good reminder for me since I have frequent bouts of self doubt that is unwarranted. It's not just hard for me, it's hard for everyone.


Monday, April 16, 2007

Microsoft Silverlight


John Lam has let part of the cat out of the bag - the "new" thing he alluded to a while back appears to be linked to Microsoft Silverlight, what seems on the face of things to be a rebrand of WPF/E, an attempt at a Flash killer.

The programming details will have to wait for Mix 07, but for now the buzz should start. It's ironic that a matter of days after Paul Graham declared Microsoft "dead like IBM" that something like this should be announced.

It will be interesting to see how this fits into web development with Adobe's Apollo. Adobe has played a masterful first hand by making Apollo open source. It will be interesting to see how Microsoft responds.

The good news is there is a CTP for download, so for those of us who won't get to Mix, there is room to dig around.


Sunday, April 15, 2007

How much code do you write?


I've previously identified perl as my "night language." In other words, I'm hacking away at it in the off hours trying to get better. Maybe, just maybe, I will find a way to get paid for writing perl code. As of now, however, I write C#/.NET code to put food on the table.

As an exercise in perl, in order to demonstrate how fast it is, I wrote a small script that would count the number of lines of code I was responsible for last year. That's an easy task; I keep all the code I am working on for a given year in the same directory. There are a few projects that span a year's end, but it's okay since there's a lot of code that is written that doesn't make it to my directory, and there is a lot of code I write that isn't C#, which is all I was counting in this instance.

After a little tweaking, I had a script I felt happy enough with to point at my CODE06 directory. I was fairly curious - the folder is about 650MB but a lot of that is binary stuff, everything from installers to compiled bits of projects. My script - or perl, I should say - is unbelievably fast; when I changed output to a file it was able to run in less than a half minute. The first run showed that there were ~160,000 lines of code in the directories *.cs files.

Interesting - not an accurate estimate of things but 438 lines of code per day (160,000 / 365) and if you consider only business days (251), that's on the order of 637.5 per day. I can hear the Herbert song playing Something Isn't Right in my head at this point.

I do use Visual Studio, and one of the points of interest for me was the difference in how much code I actually wrote and how much was generated. Again back to estimating I excluded Visual Studio generated files from my project and that cut the number down to ~30,000 lines of code.

This is very imprecise because there are some *.cs files which are generated but it still has the Something Isn't Right going in my head because a little bit of help and organization from an IDE is fine, but the cost of 84% of output being machine generated is steep.

It's an Ellen Ullman moment; the realization that there are so many layers of abstraction between you and your tool - that you're unaware of all the hiding it does for you. It's a reminder of a moment a while back when I was showing someone how dangerous letting a tool do something for you can really be.


Sunday, April 08, 2007

Proper 0.1


A while back I made a property code generator I called t3rse::proper. It was an exercise to solve a problem I'd had as well as write something useful entirely in javascript. I've added a few new features to it that will hopefully make it even more useful in future:

1. Custom Shortcuts
Proper allows shortcuts for common datatypes - for int you simly type i_ and the same is true for bool (b_), string (s_), datetime (dt_), as well as a few others. If you have a classname that you need to build properties on, you can add your own prefix and follow that with an underscore when you're defining your properties. You could, for example, use sq for SqlConnection.

2. DebuggerStepThrough
More often than not properties have a simple definition that needn't be stepped through when debugging. A while back I started adding the System.Diagnostics.DebuggerStepThrough attribute to pieces of code like this - I've added this feature to proper with a checkbox option.

Future features? Whenever I have time the following:
1. Ability to remove custom shortcuts gracefully
2. Settings and shortcuts stored in a cookie

One final thing I'm pondering is whether to try to implement The World's Simplest Code Generator as an exclusively javascript/ajax application. I thought about it as a newer version of proper but I like the idea of proper being so dead simple that it doesn't become unwieldy. Does it suck? Tell me why at proper at t3rse dot com. Want to make it better? It's all there as javscript, just send me an update and I'll see if I can include it in a newer release.


Tuesday, April 03, 2007

Best Of SQL Server PDF


For a while now I've been a subscriber to Simple Talk, an excellent magazine/website put out by the folks at red-gate Software. They are offering two incredibly dense PDFs with the best stuff from the SQL Server Central website for FREE. If you use SQL Server in any form, it's a great value for nothing.

red-gate makes excellent tools as well - we use SqlCompare to synchronize development and test databases regularly.


Saturday, March 31, 2007

Tufte Would Be Proud


PingMag again with something very interesting for all of us.


Youth Obsession


I read Paul Graham's essays out of habit these days; I loved the earlier gems concerning matters of being a Great Hacker and even though less and less of what he says is designed for people like me, I still read them hoping for something special. Something inspirational.

The current essay, Why To Not Not Start A Startup, is geared towards people considering as much. Among Graham's many ideals for the person starting a company, a recurring theme revolves around youth and freedom.

I caught a bit of it earlier in the week and one comment that stuck was in reference to people like myself, who also have a family life. I have no children yet, but even then I'm within the target zone albeit to a lesser degree.

"What you can do, if you have a family and want to start a startup, is start a
consulting business you can then gradually turn into a product business.
Empirically the chances of pulling that off seem very small. You're never going
to produce Google this way.
But at least you'll never be without an income."

The emphasis in the quote is mine because I think it struck at the heart of what bothered me - it seemed to go further than the notion of not starting a startup to what Google symbolizes in the social imagination: the Next Big Thing, the Brilliant Idea, the Company After Which To Model. It was the feeling a few weeks ago I got at the airport when I saw a young woman - a UCLA college student - with a Google backpack and I got a strange envy thinking "How'd she get that!?"

The quote remained in my head and last night while I was finishing the essay, my wife was watching the TLC show What Not To Wear and I began to connect the youth obsession from the show to the kind of youth obsession I recognize creeping into my own value system with the help of quotes like the above. It's the obsession that the good ideas - the potence as it were - is gone once a threshold of age or lifestyle is crossed. It's not unique to programmers or "techy" people; it seems that mathematicians can be plagued with the thought that Einstein and others resemble a universal truth: the best ideas are to be had in youth and from there you live in the afterglow of them.

I wonder about this. I grapple with the difficulty of truth generalized - I think Graham is in many ways right - and the desire to be an edge case of his statement. Two books I read recently come to mind: Masters of Doom, the chronicle of the founders of Id software, and Weaving the Web, Tim Berners-Lee's recollection of how the web came to be. In Masters of Doom, John Romero and John Carmack seemed to model the notion of Graham's thinking: youthful obsession, low budget living conditions, energy and the freedom to have fun. Tim Berners-Lee is a massive contrast - less a picture of overnight "hacking" and pizza, and more of thoughtfulness, patience, and the desire for his idea to be bigger - an idea that would prove its usefullness and universality. I don't remember the exact day, but on one important occasion Berners-Lee was absent, his son was born on whatever "special day" it may have been. Even though he could have monetized his work, his values seem shifted. And I find ironic the fact that the afterglow of the web is bigger than the afterglow of Doom.

I'd be interested in discovering some older founders - people whose paths were a little more thoughtful and wise. I'm sure there are some out there who break the age and family barriers to become successful as they've defined success. Although I'm pressed to think of them in technology, elsewhere they come to mind quite easily - the company I spend most of my time at, Daktronics, is just one such case.

I still love reading Paul Graham though - one thing he's written that I think I'll always remember comes from his essay Hackers and Painters where he described the attribute of relentless:

"This sounds like a paradox, but a great painting has to be better than it has to be. For example, when Leonardo painted the portrait of Ginevra de Benci in the National Gallery, he put a juniper bush behind her head. In it he carefully painted each individual leaf. Many painters might have thought, this is just something to put in the background to frame her head. No one will look that closely at it."

"Not Leonardo. How hard he worked on part of a painting didn't depend at all on how closely he expected anyone to look at it. He was like Michael Jordan. Relentless."

"Relentlessness wins because, in the aggregate, unseen details become visible.
When people walk by the portrait of Ginevra de Benci,
their attention is often immediately arrested by it, even before they look at
the label and notice that it says Leonardo da Vinci. All those unseen details
combine to produce something that's just stunning, like a thousand barely
audible voices all singing in tune."

I can walk away, a thirty-one year old married guy or no, as relentless as I can be. I'm off to paint some leaves. (But first I have to go home and do some yardwork.)


Thursday, March 29, 2007



Tim posted about trying to explain Yagni on Twitter and after looking it up I realized it's something I've tended towards without having a vocabulary for it - you know that sense when something is so familiar that you think there's got to be a technical term for it.

And a person need not be an "Extreme Programming" proponent to see the truth; I have a Yagni moment almost each day when a person asks a question about how to do something and I'm more bothered with the question (why on earth would you do that???!!) than coming up with a solution.


Step In, Step Over, Step Out


Just a quick note from a late night's coding session, something that I sort of knew but finally got fed up enough to begin implementing everywhere. I'm working on a fairly large Windows Forms application and one library devoted to safe type conversion is filled with methods like this (yes, could've used Int32.TryParse, I'm not the original author though... ):

private int ToInt32(object val){
int ret = 0;
ret = Convert.ToInt32(val)
catch(Exception ex){
// suppress
return ret;

It's nice to just attempt conversion and expect a zero for an invalid value, but it's annoying when you've got a method call like:

MyCall(SafeConvert.ToInt32(num1), SafeConvert.ToDecimal(num2));

The easy, clean fix is to apply the System.Diagnostics.DebuggerStepThrough attribute to your method. Any calls to that method are stepped over, making your life in debug mode that much easier.

System.Diagnostics has quite a few other debugger attributes, one of which allows you to mark code that came from a library you didn't write (DebuggerNonUserCode). Very useful indeed, especially when you've got unit tests that can assert something needs never be "debugged" again.


Friday, March 23, 2007

Tech Support


This spot about medieval tech support is hilarious.


Thursday, March 22, 2007

Beane's Programmer


I recently finished Moneyball, Michael Lewis's tale about general manager Billy Beane, the Oakland As, and the sport of professional baseball (note: I'm African and knew nothing about baseball for a long time - but after a few years playing fantasy online, I'm a major addict; it's hard to love math and hate baseball). What's special about the Oakland As is that as a small market team with nowhere near the financial resources of a team like the Yankees or the Red Sox, they do quite well in the major leagues - better than many of the money-rich competitors the play. What's special about Billy Beane is that he's been able to buoy the As performance by picking players that would have otherwise gone unnoticed for cents on the dollar.

Far be it from me to overextend the anecdotes of sport to something like software development but in this case I can't help thinking that a dominant culture of the development community online is obsessed with Fizz Buzz and functional programming languages in a manner similar to the way that old baseball scouts have an infatuation with high school standouts, good looks, and the Adonis body. I couldn't help but wonder about what was boring and yet obvious - the decisive factor between a good programmer and a bad one that was right under our noses but we miss because we're reading articles on the new shiny meme that is traversing the "blogosphere."

And then one thing came to mind... really a few weeks ago as I was reading Larry O'Brien's column in SD Times on estimation at a moment when my own lack of precision in the department had begun (and is still) eating at me. Estimation seems so pedestrian in comparison to Haskell, editors, language foibles, language pleasures, clever interview questions, and all the other things we look at for entertainment online. But I wonder if it isn't more important to be able to look at a project and give a relatively realistic guess at when you'll be finished - certainly in my case where the client is not going to notice my beautifully terse recursion inspired by Scheme under the covers, and they will become progressively discontented for each month that goes by when I'm still "working on things." I wonder that it isn't important enough for a guy like Atwood to call people unfit for programming over, or a major idea that sweeps across the net. Perhaps Agile methodologies fit into that, but more in the sense of philosophy than selection of team members and teammates.

What confirms this even more so is Steve McConnell's book on Software Estimation parked in the same spot it has been in our office over the last few years when we've rushed to everything (anything!) else: Fowler's Refactoring, C# References, Object Thinking, and the list goes on.

Estimation isn't exclusive to other traits that good programmers seem to have; in the same way that a person who happens to keep their On Base Percentage high doesn't necessarily do this at the expense of their Fielding capabilities. Indeed, a person who can reasonably estimate that a task will take them 50x longer than it would take others is probably in the wrong career to begin with, kind of like a baseball player who hits better than anyone else but is so phenomenally slow while making it around the bases.

Okay, that's all the sports and programming I have for a while...


Wednesday, March 21, 2007

Be The Editor


Derek Slager, whose background sounds a lot like mine, makes a case for using Emacs as an editor. It makes me think of two occasions: first, when I guffawed at James Gosling saying that his favorite IDE was Emacs, and then later on when I was teaching a .NET development class at Countrywide and a person sitting the class (graduate of UPenn) sneered at using Visual Studio .NET and instead opted for Textpad (he hadn't used it before but still leaned towards a simple text editor and his ability with the command line). Needless to say he put everyone to shame.


Tuesday, March 20, 2007

Foo, Bar, Monorail, and being Test Driven


People I work with are always amused by my excessive use of "foo" in naming things while I do examples or sketch out ideas. I was equally amused with Hanselminutes 55 which I can roughly quote here:

... so once you've got your foo class accepting a bar class
and more likely it's going to be accepting a IBar interface... foo depends on bar which depends on blah and yada ... your instantiation looks like new foo, new bar which takes new yada...

Fun stuff, but the real conversation was about Monorail, a piece of the Castle Project, a .NET web application framework I've been interested to look at for some time. The most interesting argument for the use of Monorail/Castle was the ability to have greater and more precise test coverage than with a typical ASP.NET application using Watir or an equivalent technology. All the buzz about being Test Driven usually breaks down for me when I'm looking at the kind of web applications we build. Even something like Watir is a frightening prospect on an ASP.NET page with several grids, in a masterpage, loaded with javascript - and has about 10 different "directions" that a tester could take. Extend that to about 100 pages, many of which support different "views," and you've got, well, a bit of a problem in being "Test Driven."

The conversants, besides Scott were Aaron Jensen and Jacob Lewallen.