Monday, July 31, 2006

Slick Domain Search


Via a friend of mine, White African, InstantDomainSearch.


Thursday, July 27, 2006



An excellent online book covering the software.


Google Code


Wow, this is an interesting development: Google Code is an online project hosting/collaboration site. I'm sure they wouldn't describe it as an "answer" to Microsoft's own new project hosting/collaboration site, Codeplex, but the timing is interesting. The question that begs itself is "whatever was wrong with our old friend, Sourceforge?"


Wednesday, July 26, 2006

Generics + Bad Idea Jeans


I can't get the Bad Idea Jeans SNL sketch out of my head, but I'm not sure I trust myself. At the request of a coworker, I wrote the following to show how a generic Dictionary could be returned from a method with underlying types for key/value stated ahead of time:

public static Dictionary<X, G> BuildDictionary<X, G>(string cmd, string keyColumn, string valColumn) {
Dictionary<X, G> myDictionary = new Dictionary<X, G>();
SqlDataReader rd = new SqlCommand(cmd, GetConnection()).ExecuteReader();
while (rd.Read()) {
myDictionary.Add((X)rd[keyColumn], (G)rd[valColumn]); // ? good idea?
return myDictionary;

It leverages generics to define the returned dictionary so that a call could be made like this:

Dictionary<int, int> data = DBDictionary.BuildDictionary<int, int>("myproc", "key", "val");

Perhaps I'm paranoid, or I've been burned too much, or I'm not scared of a little type dynamism, but this seems like a Bad Idea. The big reason, of course, is the casting that goes on in the method:

myDictionary.Add((X)reader["someField"], (G)reader["someField"]);

Reasons for my anxiety?
1. What if the underlying field has a change of type? You won't know until runtime when things blow up.
2. Maintenance if underlying field type does, in fact, change. If being type specific is avoided, you can gracefully accept these changes without a recompile. Even if your lookup (what's in the dictionary) is used, if it's passed to a SqlCommand as a parameter (which is the way I normally do it), the reference it expects is to an object type as in:

SqlParameter para = new SqlParameter("@Foo", objectRef);

3. I'm not afraid of strings. Over time I've been more reluctant to convert things, especially numbers. For example, if a numeric value is passed in the querystring, like:


Why should we convert custId to a numer if it's going to be passed to a parameter (see code above)? Another scenario is when some underlying value is going to end up in a textbox. I do not fear the string, just the Convert.ToXXYYZZ code I'd have to type out if I did want to be "type safe."

But some may feel differently, especially the ones who think that if something in the database changes you may want to intentionally have your code break so that you're aware of it. That's the only idea besides premature optimization that I can use to justify this approach...


Powershell Password Gen vs Hobbitwerk:::pwd


Scott Hanselman just posted an example of a password generator in powershell. Very cool, and reminding me of Hobbitwerk:::pwd. His script, however, is 7 lines of clean code.

Speaking of Hobbitwerk:::pwd, I'm surprised by how useful it's become not only for myself but for a lot of the people I showed it to. It's nice when a guy who's used to writing Me-ware makes something that other people leverage too.


Tuesday, July 25, 2006

Reddit Expansion


I'm cheering for Paul Graham's Reddit minions. The Reddit concept is brilliant, and now it's spawning into some really interesting variations (have I got them all?):

  1. Reddit Reddit
  2. Joel on Software Reddit
  3. Slate Reddit
  4. NY Times Reddit

All of which are now subscribed now on my aggregator. It would be interesting to see the original Reddit code, which was written in LISP.


Jean Paul Understands


After listening to the .NET Rocks podcast he was on covering Test Driven Development, I glanced at his blog and saw this post/rant against declarative databinding. Since the Visual Basic 5 Form Data Wizard, a lot of this automated stuff has remained beyond my liking. Well, actually that VB 5 Form Data wizard did work out really well once: I had a meeting with a client and nothing to show so it bailed me out that time...

Here are my big problems with declarative databinding:
1. When does it happen?
I have no idea based on the demos. You set things up at design time and run the app after which you're supposed to smile and think that it's cool, but databinding for me in the "real world" never seems to happen that way. Sometimes binding is conditional or based on circumstances that can only be evaluated programmatically. Not only that, but sometimes I'm binding many many things (think 10 dropdown lists) and don't want a data source control for each one.

2. Embed SQL statements in the ASP.NET Page?
Never, ever, ever. Usually stuff like this is tucked in the business layer with a stored procedure. I like the idea of object data sources, but it seems like a lot of work for the small stuff, like lookup values.

3. It's never that simple.
Like the last project I worked on, in which some fields displayed in a grid were too long, so I had to iterate bound data and make tooltips. Or the column that's an encoded link based on some data outside of the grid. Or the column that displays various images based on some criteria (think: sometimes a PDF icon, sometimes a Word doc icon, and so on).

Don't get me wrong at all: databinding is good and I use it every day. Declarative databinding, however, has never proved useful to me.


Say Hello


bdos equ 0005H ; BDOS entry point
start: mvi c,9 ; BDOS function: output string
lxi d,msg$ ; address of msg
call bdos
ret ; return to CCP

msg$: db 'Hello, world!$'
end start

Oh, that's just me saying "Hello World" in assembler. There's a massive list of the program to begin programs over at Wikipedia.


Love For Apple


Leander Kahney gushes about the little things that are so well designed in Mac software. I agree in the sense that it's small things you'd have never thought of that clinch software. I disagree that this can be applied to all Mac software; I am just now coming back from a session with ProTools, powerful software to be sure, but filled with lots of hidden menus, features, and quirks.

Nothing makes me happy like good software, especially in the moments when it's obvious that something I want to do has really had some thought applied to it. Printing in gmail, for example. Multiple tabs in Firefox. The ! shortcuts for searching in yahoo. iTunes burning an audio file that's too big across multiple CDs. Oh, and the smart playlists on iTunes too. I should make a list someday...


Monday, July 24, 2006



Thought of the day from the work desk: I'd rather be at OSCON in Portland.


The Design of Data


First spotted on the Scott Guthrie blog, there's a library of database schema models here. The world owes you, Barry Williams.

Of course, most of the schemas are more like design sketches; I seem to live in a world where strange business rules seem to retard any design of elegance when it comes to data.


Sunday, July 23, 2006

Java Weekend


The secret's already been partially out that I'm attempting to return to school to study Computer Science. Part of the requirements for the school I'm trying to attend is a program of some sort written in Java along with a personal statement. I submitted a ported variation of a program I wrote a while back in C# as a response to this blog entry. My program applies a Haar transform on an image file.

It's been a while since I've used Java. I downloaded and used Eclipse as my IDE, and that was a great experience - I'm curious to know if the GUI development parts of Eclipse are well developed.

Working in Java, after all this time in C#, was a bit strange. There are the small arbitrary things, like camelCase for methods rather than PascalCase, and then there are the bigger things, like doing type conversion (in .NET I just use Convert.ToXXYYZZ (e.g. Convert.ToInt32, Convert.ToDouble, and so on... )), and then there are the massive things like trying to emit an image file to disk. In C# this is very trivial. In Java, it's painful enough that doing a search on Google will yield all kinds of Bitmap implementations that people have written to make up for a lack of support in the language.

Speaking of which, the program took about 2 hours to port but for these lines:

File output = new File(filePath);
ImageIO.write(myBufferedImage,"bmp", output);

The kept succeeding only in writing an empty bmp file. I didn't stop to figure out the debugger in Eclipse (wouldn't have mattered if I did), but couldn't for the life of me get to the root of the issue.

I used to think Javadoc comments were such a beautiful thing until I began searching Google for ImageIO.write examples. Apparently everyone has taken it upon themselves to have a copy of the Javadoc online with redundant information. And the Javadoc itself has no clear information about the method either, especially for cases like mine where it succeeds, over and over again, at creating nothing. (Why not use an enumerated type for the format parameter of the write method if it's going to be limited?)

After a few hours I'm at the video game point of debugging (just trying different things) and ran it with the following:

File output = new File(filePath);
ImageIO.write(myBufferedImage,"jpg", output);

Lo and behold, a file is created on my machine. And it sort of clears up for me that the write method's format is limited out of the box ( I think, but did not confirm) to jpg / gif / png formats. I'm guessing at a disdain for "bmp" as a Windows specific format or something of that nature pushing ImageIO to exclude it in its base support. Although there may be ways around this (I saw a class called ImageWriter which may have had those capabilities) it makes me really wonder.

I think it also shows a difference between Microsoft and other companies. At Microsoft, they'll spend extraordinary efforts for a guy like me on a weekend like this to be able to write:

Bitmap bmp = new Bitmap();
// do stuff

We could all write our own implementations of a Bitmap helper class, but IMHO, I'd rather be thinking about other things like perfecting the transform.


Wednesday, July 19, 2006

Monad vs. Unix Grey Beards


An interesting post from the Monad folks (make sure you read the comments) on a look at syntactical differences between Monad vs. Korn Shell.


Agile Perlcast


The latest Perlcast features Andy Hunt, one of the Pragmatic Programmers, talking about Agile Programming. Although my use of perl in a professional context is limited, Perlcast is one of my favorite developer podcasts in no small part to its host, Josh McAdams -

The following are discussed:

1. Pair programming
Andy gives an analogy of a driver and navigator. Interesting, but I have to admit the whole pair thing has never quite had appeal for me. At least, not as the "navigator."

2. Learning sessions
Andy recommends company learning sessions in the middle of the week (my own company does it on Friday). It's a good idea since the beginning of the week is catch up usually, and by the end a lot of people have checked out. I do like the fact that on Friday, however, there is a bit more of a relaxed atmosphere in the office, making the learning sessions double as a sort of group bonding where the developers can hang out and not feel too much stress.

3. On keeping up with what's current
Focus on awareness, not necessarily depth. It's impossible to know about absolutely everything going on, but keep your radar going and understand the big picture meaning of what's new. Easily said, but I will admit to frequent moments like today: feeling utterly overwhelmed by the amount of useful information that's out there. And no time to process the little I get a handle on from time to time.

4. Estimation
Andy's gotten companies to go with incremental estimates of time for projects. This is a great idea, but as Andy seemed to concede, it's sometimes hard to get a client to look at things that way. Because budgeting for a project is usually based on a proposal, and the proposal must take into account the entire scope of work, I wonder at a good angle from which to introduce this... maybe with shorter cycles up front. Unfortunately, the beginning of a project is usually a lot of design work and may not involve a ton of demonstrated progress. Hm...

5. Testing
Wow - this was the best part of the podcast. Andy goes through a bunch of acronyms to use to remember the different ways to approach unit testing. I'm not usually one for acronyms, but in this case I think it can't hurt. He recommends as much test code as production code... a really tough sell since I don't think any of the clients I've worked with run numbers on bug fixing costs. Because of that what's important to budget both time and financially is the "development" cycle and whatever is left over before the magic deadline must be applied to bugs.
But here's where I take it: the half/half production/test code thing is about the effort a developer makes to test and have automated unit tests available for their code. And, from a guy who's spent the last many days almost exclusively fixing bugs, I'd rather invest in test cases than bug fixes. I'll have to strategize on having lots of shiny things to throw at the client in order to demonstrate progress but somehow pace development so that much more is invested in unit testing.

Andy finishes with some talk about SCRUM as a lightweight development process. I'll have to read into that a bit; it seems to formalize some of the things that I've done in the past but it seems like a magical ideal that is very difficult to be disciplined with in real life. For example, quick meetings at the beginning of each day tend to expand in the amount of time they take. A lot of the time, if there's something that is really involved (like it's going to take a few days or weeks to develop) I prefer to just get to work and get into my code since mornings are one of the more productive times of day for me.
One thing we've done on my current project is have an email sent out that lists what everyone is working on, seems like a good compromise.

7. Write readable code
'nuff said.

8. Some OO design commentary, bleeds into contracts, encapsulation.

9. Architects should code.
I think Joel said it all when he wrote about Architecture Astronauts. Another funny article I recently refound online a humorous essay about UML Fever.


Monday, July 17, 2006



The most recent Hanselminutes podcast is the second in discussing MONAD, or the new windows command shell. I decided to listen to the first one, published in late March during the commute and got my quote of the day:

"comparing Monad to ... bash or any of the Unix shells is the difference between shooting a bullet and throwing it."

Tomorrow I'll listen to part two.


Enterprise Architect (Sparx Systems)


I'm not one for exhibit halls; even the "swag" is sometimes not worth having to talk to the sales people. At TechEd, I did happen upon the Sparx Systems booth and after a brief exchange with the Australian guy who was manning the booth and who was definitely a developer (takes one to know one), I became interested in their Enterprise Architect software.

UML modelling for $200? Most of the tools I know of are the Rational "don't even bother if you're not a large government" scale. It supports code generation for many languages: Java, Python, PHP, Delphi, as well as the Microsoft staples, C++, C#, and VB.NET. Wow, now I'm really interested. More? It generates Xml Schema as well.

It's all really interesting since certain people (who I'll avoid mentioning on the blog since it will sound redundant) have me really interested in Model Driven Architecture and the idea of modelling and coming up with contracts and then generating code.

I am using the trial version now (arg! I installed it a few weeks ago but only started using it seriously over the weekend which gives me 10 more days left to work with it) and find myself really comfortable with the interface and functionality. I used the documentation to see how enumerations worked and that was a snap. I generated C# code which worked quite well.

The last thing I did was to post on Joel on Software to see if anyone had had any bad experiences and it seemed like everyone said nice things.

Now I am working up the courage to ask the boss to buy it. I can anticipate two questions:
1. Why not Visio?
me: not as light weight, code generation is a bit clunky, adding new types doesn't work as well, not as many diagrams supported, no XML Schema generation support that I know of...

2. Why not Class Diagrams in Visual Studio 2005?
me: Even more light weight than Visio.

Update: I am now a licensee of Enterprise Architect. Life is good!


Sunday, July 16, 2006

Perl is dying


According to this article from "Anonymous Monk." I'd remain anonymous too if I made the claim since people tend to get passionate when it comes to Perl.

My personal reaction is this: I like Perl, and I'd love to use it more, but I've only experienced evidence that supports his arguments as I've been dinking around in Perl over the last few years.

Update: Interestingly enough, the direct link is now dishing out 403 errors. I doubt the perl community would actively censor anything so I'll assume it's a glitch with the url I used. But, as the Keymaker says: "Always another way..."


Saturday, July 15, 2006

Grok the Functional


"Functional Programming" is a term I've been long accustomed to hearing and generalizing about, but whoever is at the end of defmarco has done a great job in this essay of unpacking the basics of Functional Programming for those of us who never encountered it in an academic setting. I found it referenced via John Lam.

The essay sweeps through the logic and ideas of Plato, the geniuses at Princeton who started thinking in lambda expressions, and John McCarthy's innovation at MIT of LISP. From there a case is made for the benefits of Functional Programming along the following lines:

1. Unit Testing
2. Debugging
3. Concurrency
4. Hot Code Deployment
5. Machine Assisted Proofs and Optimizations

The latter part of the essay is defmarco explaining the basics of Functional Programming. Even though the essay is "for the rest of us" I admit that the differing style from what I'm used to in impatrive style did require frequent stopping and mulling. But it's well written and very accessible in its explanation of some of the fundamentals:

1. High Order Functions - functions operating on other functions
2. Currying - reusing functions by assignment
3. Lazy Evaluation - evaluation as needed
4. Infinite Data Structures - based on functions
5. Continuations - like the stack, but oh so powerful
6. Pattern Matching - functions match calls based on parameter values matching
7. Closures - state management function to function

Great essay, well worth the time and effort.


Wednesday, July 12, 2006

?? Operator - I'm late to the party


I shouldn't have glossed over those "new features" ReadMe files for .NET 2.0. Today I found the ?? operator which is probably going to get me into even more trouble than my use of ?: with other developers.

In short, you can test for a null and return an alternative like so:

string test = (myObject ?? "");

Fritz Onion posted about its use with the ViewState some months ago. I'm sorry I missed it then...


Does Scott Hanselman Sleep?


His level of productivity is frightening; every time I try to relax and watch TV I get a mental picture of him furiously spitting code, or working on his next book, or presentation, or whatever. But he exposes at least one secret an online presentation: know your tools and customize to avoid wasting time.

This presentation is about tools to enhance developer productivity.

On his site he's got a great list here.

I wonder if anyone has documented the old DOS commands / techniques for those of us whose digital life was born in the Windows era. I'll have to look around -


Tuesday, July 11, 2006

Saturday, July 08, 2006

Martin Fowler at RailsConf 2006


You can watch the entire keynote here, many a good thought. Some interesting thoughts:

1. Ruby on Rails, as an opinionated framework with limited focus is good.
2. Fast development cycles are good, better than Big Design Up Front.
3. People think in the mistaken trade off of quick & dirty (VB, PHP) and "enterprise." Just because something was done quickly doesn't mean it's dirty.
4. Keep programmers and customers in close quarters, combine with quick release cycles and allow for observation of how software is used. (I love this idea, I learn *so* much when I watch people use the software I've written for them).
5. Disdain for libraries (and I read along with that unnecessary abstraction) with several jokes about java.util.Calendar
6. Ruby the language is essential for Rails.
7. Postmodern Programming: embrace inconsistencies, cobbled together world and realize software is the same way giving the example of Unix.

I found myself agreeing with Martin, blow for blow most of the time.


Meeting Sahil and Ambrose, Becoming Famous


The Saturday night before TechEd I noticed a gathering online - the "Party with Palermo" - organized by C# MVP Jeffrey Palermo. This was courtesy of Google so I didn't have a personal connection with any of the players there other than knowing they were some of the higher profile attendees.

The first person I got to meet was Sahil Malik; I have his ADO.NET 2.0 book from Apress but didn't make the connection at the time. I wish I had although it's probably a good thing since I'd have pestered him with more than a few questions. But Sahil did the courtesy of talking to me a little bit about Concurrency - expanding the notion in my mind from just database locking mechanisms and settings to the statefulness of objects and their interaction in the .NET Framework. Sahil was very courteous.

After Sahil excused himself I noticed a guy wearing an Infragistics shirt and, completely forgetting myself, pounced upon my opportunity to dialogue with a representative of a company I've blessed and cursed in the same breath.

Almost forgetting to introduce myself I began firing off comments - the shortened version of which is that Infragistics makes powerful stuff but leaves gaps in documentation, and that the dark, voodoo magic that is left on an ASP.NET page in the form of cryptic javascript is quite disconcerting - perhaps before I learned that I had met Ambrose Little, another C# MVP who had only just started at Infragistics as a technical evangelist of sorts.

Ambrose played it well, allowing me to get my frustrations off my chest asking questions like "what do you think we can do better?", and then pausing for my excited bursts of opinion. My excited babble only continued when I discovered he was presenting on the Microsoft Enterprise Library. I asked him what he thought of it, really, as a very large layer of abstraction of other libraries (which themselves are layers of abstraction), and he gave a neutral response along the lines of it depending on the developer and their approach. I've met many people and I've got to think hard of a person who was able to deftly answer questions while choosing not to really commit a strong opinion, as well as steer an encounter like ours into therapeutic venting rather than debate or contention. I didn't go to his session about the the Enterprise Library but I'm really looking forward to the TechEd DVD when I can get a real sense of his thoughts and what he presented upon.

During my excited conversation I noticed a picture taker and now these moments are recorded for posterity on an offshoot of the Atlanta .NET Regular Guys website. They were taken by Heidi Schwartz whose husband Brendon is a developer actively involved in the INETA organization.

Sahil's blog is here, Ambrose writes a blog here, and Brendon contributes to a blog here.


Thursday, July 06, 2006

TDD is like flossing


Everyone knows they should be flossing as well as writing their tests first. They've heard of the tools like NUnit, but they just don't do it. Take it from a guy who got drilled for several hours recently because of cavities between the teeth: it's not worth it.

On a serious note, I'm spending most of my time in my current project on bug fixing. I know that leveraging unit tests and a tool like NUnit will not only make me more productive, but also trim the amount of time I spend like today fixing bugs (all day long).

The big question is how to apply that to a web application. Many of the examples given for tests in NUnit really lend themselves to libraries (DLLs) and not to Web Forms with postback cycles.

I haven't had much time to dig into it, but pretty soon I'll have to roll up my sleeves and do a comparison of the new Visual Studio Team System test capabilities and NUnit. The NUnit people blogged a comparison but I'd like to have a look for myself. My leanings would probably be toward NUnit for simplicity, less overhead, and availability, but I'll withhold judgement until I've had a chance to get dirty.