Monday, May 24, 2010

Small suggestion on Python nested code blocks

I've been coding in Python for a while now, and there's one thing that I've found problematic with regard to nested code blocks. It comes down to the age-old Python debate about whether you like Python's "indentation level" approach to determining what block of code a statement belongs to.

In general I actually like the Python approach. For one thing it removes the debates (going back to at least C) when developing in most languages around what style to use for braces. Especially for people who don't realize that K&R is the way to go.

The problem I have is when I have multiple levels of nesting that ends up being like an overhanging cliff that you can fall off of if you're not careful.

if one_thing:
do_something()
if another thing:
do_another_something()
if third_thing():
do_yet_another_thing()
do_thing_after_cliff()

The two problems I have are that it is harder to keep track of what level of nesting a statement is in for some cases. The bigger problem is if the statement do_thing_after_cliff() accidentally gets modified to be at another indentation level it can be very non-obvious. This can come up when moving chunks of code from one indentation level to another.

I've started using a simple trick to help with this, and for me it really helps visually. Basically I use a double comment "##" where I would normally put the "}" if I was working in another language.

For me this provides the visual cue that helps. And it also should make it obvious enough if statements accidentally get modified to the wrong indentation level.

if one_thing:
do_something()
if another thing:
do_another_something()
if third_thing():
do_yet_another_thing()
##
##
do_thing_after_cliff()
##

I don't use it absolutely everywhere, but it helps in the cases where your eye doesn't immediately feel comfortable with how blocks might line up.

Tuesday, May 18, 2010

First startup nostalgia

Going through the bootstrap process on our company has brought back memories of starting day at my first startup.

It was back in '96. Not everyone was doing or had been in a startup before so it felt really new. I remember being surprised that we wouldn't be working in a garage or a basement. And that there'd be a 401(k) and health plan. I thought it was supposed to be tough?

Though I signed on before the Series A closed I wasn't to start until it did close. That felt like a looooonnngg wait. Probably about 4 weeks in reality.

The great memory that I have of that time was reporting for the first day of work, which was the first day there was office space. Walked into the office space, and there was - nothing. No cubicles. No chairs. No desks. No computers. A big empty room. (Cool! This WAS going to be a startup after all!)

Our VP of engineering brought in donuts that morning along with some chairs and a whiteboard and we were off and running... By the end of the first week we had cubes, desks, chairs, and some plans.

There's nothing like the feeling of starting from a blank slate. I'm on the 4th time with that feeling and it never gets old. There's also an excitement to getting by with less while you help get everything in place. In my second startup my personal laptop running Windows 98 served as our corporate Internet gateway using dialup while we waited for our T1 install!

The first three times there were network devices to install, desks to help put together, and of course fundamental early decisions to make sitting or standing around a whiteboard.

This time that's all replaced pretty much with services to provision in the cloud. No office space, so no office network. Email and collaboration via Google. Product deployment on servers in far off data centers.

One thing remains the same though. That great feeling of the fresh start. Balancing priorities and trade-offs and trying to maximize the value of what you're going to build.

Very addictive - I highly recommend it.

Monday, May 3, 2010

Unintentional Google Voice Humor

Been using Google Voice for a couple months and it can be somewhat amusing when the voice recognition for the voicemail transcription doesn't quite pick it up right. Had a good one yesterday though.

"If you i just wondering if you could give me a favor. When you come back or when you're on your way back. Can you pick me up like I D cap promo much at all at Starbucks just totally wiped out. I have no idea why I feel so it I think I've been drugs. But anyway, I, I'm gonna trying to the blood down for a nap this morning and I think, up opportunity. Thank you. I mean to you later. Bye"

As a friend pointed out - notice that it didn't have a problem picking out "Starbucks". No surprise, since Google's all about the advertising!

The full corrected message isn't worth it, but for the record, "I D cap promo much at all" is actually "a decaf Carmel Machiato".

The best message transcription fail might be this next one. Although in this case it isn't to be blamed because it was my wife and 17 month old daughter speaking in Portuguese.

"I saw what at the cottage for the dangers visa. Thank you. Bye bye these pages knows. Bye bye. Tom O these Aunt Karen these whoa whoa. Hey, but cos he meant 9 bye bye delivering basis hello."

If the system were a human it would have been pulling its hair out on that one!

Saturday, May 1, 2010

"Statistics is the new grammar" - Wired

This article in Wired this month is right along the lines I've been thinking for a while now. Our current education priorities so poorly set our kids up to deal with the world of today.

I truly think it's not useful to have opinions on a large range of topics without understanding how statistics and probability factor in.

If we're clueless about correlation vs. causation, anecdotal vs. statistical, how can we make sense of the world?

This dovetails with the thoughts I put down last month on the Tyranny of Intuition. If we can't make good educated judgments on something, then we're left with making our best uneducated judgments instead. Which I think is setting our selves up for an epic fail.

Thursday, April 29, 2010

Serious Uptime

I caught this article (Humming away since 1993) today and it definitely caught my eye and brought back fond memories of the start of my career.

It's about a server shipped by Stratus Computer that has been up and running since 1993. I consider my career as having started at Stratus (first as a Co-op then part-time through the rest of college), and it was in fact 1993. So this computer shipped from the company I first started working for around the time I started working and has been running my entire career so far. Crazy!

The money quote: "Around Y2K we thought it might be time to update the hardware, but we just didn’t get around to it."

You usually think in terms of whether something you worked on might still have the code out there running somewhere (I'm sure I have code dating back to 1996 running on Nortel Contivity switches somewhere out there, and code dating back to 2000 running on CIENA switches). But to think about an actual instance of hardware up and running nonstop for that long just kicks it up to a whole new level.

This made me reflect back on my time at Stratus. It was a great place to start, and back in another era. It was before any real open-source projects, and before you could go online and get answers around your programming problems almost instantly. Everything was in your head, in-house or in a book on your shelf, and all the expertise needed to be inside the company.

From a technology point of view it was great experience. It not only helped ingrain *how* to think about high availability and fault tolerance, but also that it *should* be thought about in the first place. The best lesson is probably that it forces you to think at a full-system level. Everything was redundant in the hardware - power supplies, memories, CPUs, backplane, boards. Anything could fail and be removed and replaced without the system missing a beat.

Now, this is super expensive of course. And around that time (1993-94) Stratus itself was moving away from mainframes with fault-tolerance to high availability clustering approaches. But still - it's cool as hell that there are kids out there driving cars around that were born after this thing first booted.

I worked in the HAL (High Availability LAN) group, mostly around the development of FDDI - itself a fault tolerant networking technology.

I got to work at the application level, in kernel code, and especially enjoyed in an embedded environment - the firmware running on the FDDI board itself.

It was a great kick-start to my career because Stratus had layoffs followed by attrition, which led to my being the sole software engineer running the FDDI project for a good chunk of time at about the time that my Coop stint was over (after which I was a part-time software engineer). Even better, the hardware engineers that had started the project also had left the company. There was great fun to be made of the fact that the project was being led forward by a Coop and a couple lab techs.

I suppose if it had been 2003, then the cool thing would be to drop out of college and start my own company. But in 1993, having responsibility of a full project within a large company was good enough! I loved having a challenge to rise to and doing it.

In the end I can't believe the article didn't say whether this sever is running VOS or FTX though. I bet VOS.

Saturday, April 10, 2010

A Strange Anniversary

A couple days ago passed the two year anniversary of my last paid workday. Well, hopefully not last *ever*. I joked with my wife that we'd celebrate by not going out to dinner.

I'm lucky enough that this was voluntary. It has resulted in the best two years of my life, without a doubt.

The plan at the time was to find an idea that would become a company that I would start. At that point I thought it would actually be one of the ideas that I had at the time. I had only worked for startups, 3 of them, since 1996 - the year after I graduated college.

I was looking to get out of networking and telecommunications specialties and work in the more general consumer internet space.

We found out my wife was pregnant before I made the plunge, but that timing was really perfect. It allowed me to be working on my own projects at home through the pregnancy and has allowed me to be working from home through the entirety of my daughter's life so far (17 months).

I worked on a few of my own projects independently, and worried my wife a little bit when I'd move from one to the next - just when she was getting used to the idea that the one I had been working on was going to be "the one".

The whole time I figured the worst case was I was acquiring experience in *lots* of new technologies that I'd put to good use at some point. And as it turned out, that was the perfect warm up for what came next.

Last fall I got introduced to someone looking for a technical cofounder, and the result is now Yieldbot.

Which is a great way to mark the two-year point. We've launched recently, in private Beta, and learning a ton from our first customer experiences, and being pushed by customer demand. Which is good, as this should mean not too much longer before my little family can spend some money again.

It's been a heckuva two years - wouldn't change a thing.

Wednesday, April 7, 2010

Long Tail

This isn't about the usual "long tail" you hear about, but about something similar that for some reason I find amusing - having just received a check for $39.78.

Back in 1998-99 I wrote a book on a VPN networking protocol called L2TP (Layer-2 Tunneling Protocol). I had written (in C/C++) our L2TP (as well as PPTP and L2F) implementations at my first startup, New Oak Communications, and then had gotten involved in the IETF process around the standardization of L2TP.

I wasn't looking to write a book, but based on some I-D's I had written on extensions to the base L2TP at the time, I was contacted by an editor in an email and asked if I'd think about writing a book. I had no delusions this would be a best seller, and said yes expecting (correctly) that it wouldn't really pay back in money for the time I spent on it, and that it would be a useful experience.

This makes me think of the long tail in two ways. First, this is obviously a niche subject. I wrote it for the audience of software developers who would be implementing the L2TP protocol, and secondarily for those that might be involved in the network planning around deploying its use. Yeah, there's gonna be a lot of those.

Honestly, I completely forget I even wrote a book unless one of two things happen. First, someone says (for some random reason) something about "your book" to me. It usually takes me a good 5 seconds to know what they're even talking about. Second, twice a year when I get the royalty statement. I say "statement" because it only becomes a royalty "check" when it accrues > $25 due to me.

So that's the second, and most significant, way it seems like a "long tail" to me. Because a full 11 years later the royalty stuff still dribbles in on this seriously niche-subject book. I wonder how much longer the poor publisher will need to keep sending me these statements.

It's most interesting to me just to see that 11 copies sold the second half of 2009. It must've been the holiday season. I'm really surprised it is more than zero at this point.

It's sold 4046 copies over these 11 years (technically only 10.5 so far), which is pretty cool. All in all it was worth the experience. The most surreal thing was one day years ago coming home to a small package that came in the mail from the publisher that contained a few copies of the Japanese translation. That was worth it just for the joke from my mother that she understood about as much of it as the original in English.

The thing I'm happiest about is the positive reviews on Amazon that it got. That's what I was most worried about back then, having direct access, and for all to see, to someone's potential negative take on something that I put some real effort into. That was a new thing back then, and it was scary.

Anyway, whenever this statement comes it just makes me chuckle. I was pretty sure I wouldn't break the $25 threshold again and get a check. I've got to imagine though that this one really will be the last one.