Going to PyCon 2008!

I’m very excited to be attending this year. I wanted to attend the last couple of years, but had some family matters to attend to. I’m hoping to learn a few things and run into a few people while I’m there. If you haven’t signed up already, click the badge and do so!

PyCon 2008: Chicago

Mail for ipod touch…

I downloaded the software upgrade for my ipod touch so that I could get the Mail application. Unfortunately, our mail servers use a self-signed certificate so whenever the Mail tried to verify the IMAP connection it would pop up a box asking to continue. I hit ‘continue’ and it’d sit there until several minutes later when it would time out. I logged into our mail server and watched the logs and it appears the Mail application was effectively terminating the connection after I hit continue. I decided to hit ‘cancel’ instead and then hit save again. It threw up a disclaimer saying I may not be able to receive mail, but low and behold: when I went to look at my inbox, mail was there! Yay! I’m really liking my ipod touch… too bad I can’t carry it around with me at work. :-(

My first dtrace script…

I had a misbehaving application (I believed it was connecting to the wrong port based on a preference setting), so I figured I’d give dtrace a try and see if I could capture the connect() system call. After a fair amount of tweaking, I was finally able to capture what I was looking for. Here’s the script:

#pragma D option quiet

typedef uint32_t in_addr_t;
typedef uint8_t sa_family_t;
typedef uint16_t in_port_t;

struct in_addr {
  in_addr_t s_addr;
};

struct sockaddr_in {
  uint8_t sin_len;
  sa_family_t sin_family;
  in_port_t sin_port;
  struct in_addr sin_addr;
  char sin_zero[8];
};

dtrace:::BEGIN
{
        /* print header */
        printf("%5s %5s %-12s %4s %5s %s\n",
            "UID", "PID", "CMD", "TYPE", "PORT", "IP_SOURCE");
}

syscall::connect:entry
/arg1/
{
        sa = (struct sockaddr_in *) copyin(
          arg1, sizeof(struct sockaddr_in));
        printf("%5d %5d %-12s %4s %5d %d.%d.%d.%d\n",
               uid, pid, execname, "tcp",
               ((sa->sin_port >> 8) | (sa->sin_port << 8)) & 0xFFFF, 
               sa->sin_addr.s_addr & 0xFF,
               (sa->sin_addr.s_addr >> 8) & 0xFF,
               (sa->sin_addr.s_addr >> 16) & 0xFF,
               sa->sin_addr.s_addr >> 24);
}

And here’s sample output from loading the Slashdot page in Safari:

:: sudo dtrace -C -s snoop-connections.d 
  UID   PID CMD          TYPE  PORT IP_SOURCE
  501 83317 Safari        tcp    80 66.35.250.150
  501 83317 Safari        tcp    80 66.35.250.150
  501 83317 Safari        tcp    80 66.35.250.55
  501 83317 Safari        tcp    80 66.35.250.55
  501 83317 Safari        tcp    80 66.35.250.55

Good idea, bad idea

Good Idea
Have a common dump file format that uses key/value pairs of the form:

key: value\n

Bad Idea
Chose not to have full paths start with a leading ‘/’, so that you end up with oddities like:

Node-path: \n

I figured I’d take a look at Bazaar again, since they’ve made so many performance improvements. So, as a starting point, I decided to see how well svn2bzr worked. So I ran it on a dump file of The Subversion Repository. After some other tweaks to the script, I managed to get to revision 26429 where it choked:

Traceback (most recent call last):
  File "./svn2bzr.py", line 1086, in <module>
    main()
  File "./svn2bzr.py", line 1079, in main
    opts.prefix, opts.filter)
  File "./svn2bzr.py", line 1001, in svn2bzr
    dump = Dump(dump_file)
  File "./svn2bzr.py", line 662, in __init__
    self._read()
  File "./svn2bzr.py", line 900, in _read
    field, value = line.split(': ', 1)
ValueError: need more than 1 value to unpack
Exception exceptions.OSError: (2, 'No such file or directory', '/var/folders/9W/9WK-dXFfH2eMq+dEVqJZg++++TI/-Tmp-/tmproKrc3-saved-trees') in <bound method Dump.__del__ of <__main__.Dump object at 0x69a730>> ignored</bound></module>

Classic sign of expecting a value to be there, only to find out it’s not. :-( Turns out the empty Node-path is technically correct, since it was the root of the repository that was modified. It got there because a merge ticket was written as a property of the root directory by SVK in r26429. However, we really should have included a leading slash in the node paths to prevent having an “empty” value. I guess hind-sight is always 20/20.

Installed Leopard!

Nice to see that Mac OS X shipped with Python 2.5. I need to figure out how to migrate a number of my Python modules to the mainline tree though. I should really just install them into a different tree. :-)

The only weird thing I’ve seen so far is that Terminal had some bogus key bindings set up. I don’t know why they chose to use page-up and page-down as a way to scroll the buffer… I guess they figured no one uses tools like Vim. :-) I use Vim constantly, so I changed the bindings to be more like the Linux defaults. I’m not particularly fond of all the translucency… it’s neat eye candy but stands in the way of productivity.

Other than that, things have gone smoothly. I’m definitely eager to try some of the dtrace tools out. I really wish I had a similar solution for Windows and Linux though.

Matthew dancing to Christmas songs…

At least one member of the house can get into the Christmas spirit!

Going from a prototype to production in software

Something that has bothered me for a long time is the idea of prototyping software.  I think the problem resides in how other engineering disciplines view prototyping.

Continue reading Going from a prototype to production in software

Where interfaces fall down…

A few of us at work are working on a fairly sizable equipment control application. Because various pieces of the equipment are pluggable and a single piece of equipment can actually perform several different tasks, we broke the equipment down in terms of interfaces.  So far, that has been a great decision… until yesterday.

Continue reading Where interfaces fall down…

Java The Unfriendly…

I must preface this with saying that I don’t do much Java work. Perhaps it’s more friendly for a different domain of work, but at least for me I find that it’s overly complicated to do simple things.

Continue reading Java The Unfriendly…

GUI Programming with Qt4…

So, I just finished reading the The Book of Qt4 and it has almost convinced to do more C++ programming again. I say almost because there are Python binding for Qt4, so I’ll just use Python instead. However, I did sit down and write several simple applications with it and I must say it is the most well thought out, well designed C++ library I have ever seen. I’ve written several X apps (Motif), MFC, wxWidgets, and several other apps using some obscure toolkits and I must Qt4 is absolutely the best GUI framework I’ve ever seen. The signals and slots paradigm is awesome and exactly the loose coupling that GUI developers need. I wish Java had something similar… I could definitely use it on a project or two right now.

Setting up a buildserver…

Several of our projects have grown to the point where the test suite and/or the full suite of builds has become time consuming. Moreover, we’ve been faced more and more with the need and desire to have a set of “official” builds that we use for testing. The current scheme of embedding the version number in the binary doesn’t include enough information to let a tester know where the binary came from. That includes which developer as well as which revision of what branch in the source tree. So I finally got a build server cobbled together (actually two: one for Windows and one for Linux). Myself and one other co-worker did a pretty exhaustive survey of build servers and finally settled on one: Quickbuild. We did so mainly because it seemed the easiest to configure, authenticated against Active Directory, and could support multi-platform builds.

Continue reading Setting up a buildserver…

Beautiful Code

I just got finished reading an interesting book call Beautiful Code. The editors sought out a number of developers and asked them to author chapters about what they felt was the most beautiful code they had seen. Karl Fogel, of Subversion fame, had a chapter about Subversion’s delta editor (congrats to Karl!). There were some interesting stories about some optimization techniques, testing, and even style. But that one that stood out the most was the final chapter of the book: Writing Programs for “The Book” by Brian Hayes. That chapter wholly lined up with my vision of beautiful code. In the chapter, Brian states:

…a program must be more than just correct; it must also be lucid, elegant, concise, even witty

I couldn’t agree more. Throughout the chapter, he talks about a small piece of code that felt dirty… that there was a better way, but he just couldn’t see it. The story took you over several iterations of this small chunk of code, which seemed to get closer to a solution, yet still seemed so far. Until one day, when Brian read a paper that had the one nugget that he had been looking for. In the end, the answer turned out to be short, sweet, sensible, and had no special cases… it was beautiful. That story alone was worth the purchase price.

Those of us who love to write software often view it as a work of art. I think the editors where right on in attempting to collect some of those works, and I hope this is the first of a long series of books to follow.

Management…

Probably one of the most difficult tasks in front of me at this point in my career is managing people. Unlike some of my counterparts, I was not born with the social side of my brain intact. :-) What I mean is that the social skills that I have are learned, and not instinctive. It took a lot of personal strength and mistakes to get where I’m at, and will take a lot more to get where I need to be. But one book that I’ve read recently was more insightful than I could have possibly imagined: Managing Humans: Biting and Humorous Tales of a Software Engineering Manager by Michael Lopp. Michael Lopp spends the entire book running through semi-fictiional stories that would hit home with any reader. He’s got a wonderful writing style, and his insight into management is inspirational. But, the best part of his book is not just how he handled difficult situations, but that he captured his thought process. For those of us who don’t have that innate ability to grok other people, it was amazing to see how that thought process works. For me, it was very inspiring to see a way to manage that wasn’t based on a dictatorship—not that I practice it, but it is something that I see all too often. I hate the idea of being a dictator, especially when I work with many very smart people. Now I see a goal that’s a lot more clear to me. Thank you Michael Lopp. You can purchase the book from here. And no, I don’t get any sort of money for doing this. I just believe Managing Humans is an amazing book.

Recommended reading…

I just added a new page called Recommended Reading that talks about some books that I’ve found invaluable as a software engineer. I’ve got a few more books to add, but the big hitters are on there already.

More playing with Mercurial…

I’ve spent some more time playing with Mercurial, and discovered a few things. First, renames actually track unlike Subversion, where updating my working copy may result in the old filename being updated, but the new won’t receive those changes.

Continue reading More playing with Mercurial…

Back up and running…

Well, that was an adventure I don’t care to repeat. For those of you who are suffering from the 10.4.10 update, use the Archive and Install from your install CD and rescue yourself. :-) It kept most of my preferences and applications. However, it does look like I need to re-install Python 2.5 (and a bunch of packages), XCode, and a VPN client. I’ll definitely think twice before accepting another update to the OS, that’s for certain. :-(

Still broken…

I’ve had zero success in trying to recover from 10.4.10’s brokeness. I’m know going to have to attempt an “Archive and Install” to get 10.4.8 on the system, and then update back to 10.4.9. I thought I left the days of PC stupidity behind. Grrr.

Updating to 10.4.10 on Intel…

In a few words, don’t do it. Many things are now broken on my nice Mac Pro box. USB Flash drive doesn’t work. VMware Fusion is broken (yes, I even tried updating to the 4.1 beta, which doesn’t seem to install correctly). SoftRaid is giving me a warning about needing 10.4.8 or better. It’s not pretty. I was up until midnight last night trying to resolve some of these issues with no luck. How disappointing.

Taking a look at Mercurial

So, now that the dust has settled—to some degree—on distributed version control systems being the answer to every development problem, I decided to try a few out. To be honest, I tried a number of tools out months (a year?) ago, but many of them were still in the early stages of development and had a number of shortcomings. One of the tools I revisited recently was Mercurial.

Continue reading Taking a look at Mercurial

Another update to fsfsverify…

There was a regression in fsfsverify that prevented it from detecting overflowed windows when the instruction stream wasn’t corrupted. That has been fixed, along with a couple of other minor adjustments. The new version is up and ready for use!

Older | Newer