Archive for the ‘Uncategorized’ Category.

Long Silence

If you have been following my blog you have probably noticed I haven’t been writing, or in fact doing anything publicly in the last few months. A lot happened in my personal life, for example I moved to Santa Clara, but more importantly I was buried with work.

It is weird how I always read about other people working insane hours at startups, but it hadn’t really happened to me. Sure, especially early on in my career I did put in a few all nighters, but not consistently. This time it was different.

I had been working on a large project for several months, of which I was the main architect and developer, and we finally deployed it into production. And all hell broke loose! Some problems could have been avoided by having had a better test setup (especially load testing), some was my inexperience dealing with heavily loaded system, some we could caulk to 3rd party software not quite ready for prime time, some to running software on VMs when we should have run on bare hardware, some to bizarre VM freezes (like minutes at time, which is obviously disastrous for a server), some lessons learned with Python GIL and multithreaded applications, plus various other bits and pieces and finally made worse by our steady and respectable growth in both number customers and sizes of data sets. I plan to write about some of that in later posts.

Since customers were being affected, and we didn’t see the full scope of problems in advance, I thought I would work extra hours and fix the issues. I was being optimistic, and assumed just the most pressing issue that was killing us was the one that would get us over the hump. This turned into days, then weeks, then months of working 60-70 hour weeks, 6-7 days a week on 5-6 hours of sleep, fixing issue after issue after issue. Combine this with the move to a new city and things were really crazy for a while. I don’t understand how I did it, given how little time we had to test on many occasions, but I believe I never introduced a catastrophic bug that got rolled into production (if you discount the initial deployment ;) . Finally, just before Christmas, things started humming the way I had planned and how they had worked in our tests months before. Of course there is still a lot of work to do to improve things, but they can be addressed in a more sustainable pace.

Luckily the work I was doing was very interesting, or I wouldn’t have been able to do it for such a long period. In retrospect I can now finally say that I have now personally faced the problem of scaling, and while I’ve always said it is a good problem to have, I now also realize trying to solve it can easily lead to exhaustion because the pressure is huge to solve the issues quickly.

While I learned a lot of things and will be able to avoid some of the issues in the future, this also clearly showed what kind of testing we still need to do better. Besides being better for users of the software, it is also better for developer health and sanity…

I am still recovering from that ordeal both mentally and physically, but I have been feeling much better. I do realize I am suffering from some burnout, but I am also starting to get the itch to continue developing my own software, both free and paid. M2Crypto release has been pending for around 6 months now, and my Android apps are really in need of an upgrade.

I am also months behind in some personal correspondence. So sorry! I will try to get my inbox in order in the next couple of weeks as well.

Space-Time Tradeoff

It is a pretty common strategy in programming circles to make programs run faster by making them use more space (for example, by caching some results from long computations so they don’t need to be done too often). But there is also another kind of space-time tradeoff: something not very elegant is taking a little too much space, but cleaning it up would take too much time and there are more important things to do. It occurred to me that I do this space-time tradeoff in my life outside of programming as well.

I have gathered piles and piles of once-important papers, magazines, books and so forth that I don’t think I will ever read. Likewise, I own a pile of clothes I will probably never wear again. I am sure I have lots of other things I basically never use, but I still have them stored somewhere, taking up unnecessary space. But if I wanted to get rid of all this stuff, I would need to spend quite a bit of time going through each potentially unneeded thing, deciding if I was ever going to use it, and if not, what should I do with it. So I reason that it is better to not worry about the unnecessary junk, as long as I have a place to put down a few important-for-now-at-least things…

Or it could just be that I am trying to rationalize being a pack-rat.

2009 Statistics

Looking back at my website traffic in 2009 shows pretty amazing growth:

year	#reqs	#pages
2006	2362	1657	+
2007	14982	9867	+
2008	335897	227906	++++++++++++
2009	1149221	826814	++++++++++++++++++++++++++++++++++++++++++

Compared to 2008, I blogged much more frequently. I actually tried to post at least once a week, but couldn’t quite keep up during the second half. I also put up the M2Crypto API documentation, which gets a fair bit of traffic.

The most popular 2009 blog post was Multicolumn ListView in Android with about 5,100 page views according to Google Analytics. Most of my posts dealt with Python, however, and I posted several snippets of code that touched projects like Django, CherryPy, boto (Python interface to Amazon Web Services), Fabric and so on.

I continued to maintain Caltroid, the first Caltrain schedule application for Android. I also released three other Android applications: d20 Ability Calculator, 20 Ability Calculator Lite and ChandlerQE for Android. All in all I made about $250 on Android software sales (gross), but since the expenses were less I actually made a slight profit. Hourly pay would counted in pennies, though.

I continued to maintain CaltrainPy and CaltrainJS as well. Other projects that I did maintenance releases on were M2Crypto.

I ported Office Resource Locator to Django.

I created a little encryption library called m2secret in Python.

2009 Donations

Time for my yearly donations to Open Source projects I use. As I mentioned when I launched ChandlerQE for Android I planned to donate 20% of the sales to OSAF. Here are the statistics:

Market           Price  Copies
==============================
Android Market   $1.99  4
Android Market   $0.99  6
SlideMe          $1.99  0
SlideMe          $0.99  3
==============================
TOTAL                   $16.87
20%                      $3.37

Somewhat of a disappointment, but understandable given that nobody seems to be working on Chandler code anymore. But I sent the 20% to OSAF anyway.

I decided to donate to three other projects this year:

Like last year, I would have wanted to donate to Mozilla Thunderbird, Pidgin, Enigmail and Pylons but didn’t see any ways to donate directly to them.

Site Breakage Fixed

Last Sunday Dreamhost went and switched the host on which all of my sites run to a different machine. There was no advance notice, just an email after the fact informing me the change occurred and hopefully they did not break anything. As it turns out, they changed quite a bit. I am not sure if the old host was 64 bit or not, but the new one definitely is. Some of the apps I had compiled myself no longer run, complaining about wrong architecture. Some paths were different, some Apache settings were different, and mail filtering through procmail broke. As a consequence, my blog, M2Crypto Tinderbox and all my Python web applications broke. Those are the things that I know of, because I have now fixed all of them as far as I can tell. It was reasonably straight forward to recompile everything (luckily I had saved the previous configure options), find and change the changed paths, and google the Apache error. The procmail filter started working after I redid the mail filtering settings through the Dreamhost panel.

While this unannounced change was definitely not cool, it is the only time (so far) when I have been really unhappy with Dreamhost since I started hosting there in early 2006. So I am still recommending them as a cheap hosting provider: for under $9/month you get unlimited bandwidth and disk space, and cheap and anonymous domain registration to boot.

Anyway, Murphy’s Law still rules, as this all happened while I was on vacation with no net or even cell phone coverage. Sorry for the extended downtime.

My Amazon Store Open

I looked at the Amazon Associate store options, and since it was so easy to do I decided to open up my own store concentrating on books of interest to people in the software engineering trade. I have read a lot of technical books especially on software security, although my pace has slowed down recently. I also realized the store can act as a reasonably good way for me to keep track of the good books in my own library, and an easy way to recommend great books to other people.

There is also a section on electronics, geared towards people who use Linux (all things in my store should play reasonably well with Linux).

Switching from XEmacs to Emacs

My first editor in the *nix world was Emacs. When I started university, some friend showed me how to get started. I have never really become a power user with it, but it is the tool I use for random small editing tasks. At some point in time when I started using Linux on desktop more often I put some effort into making Emacs work well with my habits, and in the process I actually settled on XEmacs. At the time I believe it was more advanced than Emacs, more defaults worked out of the box, and the GUI actually had a button for copying text. This was important since I could never remember how to do that from the keyboard (I could only remember how to cut).

It is now 2009, and I think Emacs has long since eclipsed XEmacs in features etc. At least on Ubuntu, Emacs also comes with the important copy toolbar button ;) . Besides, when I log in to remote systems they will almost certainly have Emacs but not XEmacs, meaning I can’t just upload my XEmacs customizations file and expect things to work. So I decided to see if I could make Emacs work at least as well as my XEmacs does.

Most of the settings were trivial; just copy to .emacs. Keyboard customization uses slightly different syntax in Emacs, but it was an easy conversion. The problematic things were font size and clipboard functionality. I wanted a bigger font size, and the best solution I found was to set the font face height explicitly (actual value will depend on your resolution and your likes), but the following gives me a nice 80×63 Emacs window that will use half horizontal and 100% vertical space:

;; With my resolution, dpi and fonts this let's me display 80x63 geometry
(set-face-attribute 'default nil :height 100)

The XEmacs clipboard worked out of the box with my X and Gnome settings, but Emacs needed some tweaks:

;; Make copy and paste work with other applications
(global-set-key [\C-z] 'undo)
(global-set-key [\C-x] 'clipboard-kill-region)
(global-set-key [\C-c] 'clipboard-kill-ring-save)
(global-set-key [\C-v] 'clipboard-yank)
(setq x-select-enable-primary nil) ; stops killing/yanking interacting with primary X11 selection 
(setq x-select-enable-clipboard t) ; makes killing/yanking interact with clipboard X11 selection

Incidentally, with those settings I have no problems with copying and pasting text since the key combinations are the same as in any other program I use. So I could even take out the toolbar, since I only needed it for copying.

Since I do most of my programming in Eclipse, I also wanted matching comment/uncomment region settings:

;; Comment/uncomment reqion similar to Eclipse: C-/ and C-? (control shift /)
(global-set-key [(control /)] 'comment-region)
(global-set-key [(control \?)] 'uncomment-region)

Probably my nicest customization (although not written by me) is to be able to cycle between buffers with Ctrl-tab and Ctrl-Shift-tab. They are kind of long, so see the links below.

I think I found the answers to most of my problems on EmacsWiki.

I have always found other people’s (X)Emacs customization files fascinating reads, so if you are like me, here you go: .emacs and .xemacs/custom.el.

Update: As was pointed out in the comments, binding C-x etc. breaks havoc with many Emacs bindings. However, I did this only after I was unable to get CUA mode to work properly (namely, copy and paste did not work between Emacs and other applications). But I gave it one more try, and it seems like adding these things to .emacs does indeed make copy and paste work like I want:

(cua-mode t)
(transient-mark-mode 1) ;; No region when it is not highlighted
(setq cua-keep-region-after-copy t) ;; Standard Windows behaviour

Of course, remove the lines that bound C-z, C-x, C-c and C-v (since CUA mode does that).

Year 2008 Metrics

I worked a lot on my site(s) in 2008. I started a couple of new open source projects, and started experimenting with advertising to counter my hosting and domain costs. Oh, and I switched jobs.

Software

I made a new release of M2Crypto. I also updated my Caltrain schedule applications, both the Python and online version.

I created a Caltrain schedule application for the Google Android platform. I also created a simple office resource finder.

I also created a Pylons project, although it isn’t Open Source: horsetrailratings.com.

Check the list of my software projects.

Traffic

I started blogging pretty regularly around January. It wasn’t until I asked to be included in the two Python planets that my blog traffic skyrocketed. Someone seems to be submitting almost all entries to those planets to Reddit, which brings additional readers.

I also wrote a number of articles on how to run Linux on various laptops and submitted them to Linux on Laptops site, which seems to bring in a fair amount of traffic. Linux on Laptops has been a great resource for me over the years, so I am glad I am finally contributing to the effort as well.

My most popular blog posts include SSL in Python 2.6, Pythonic application deployment and how to use decorators to add arguments.

Below are the raw statistics for my main site:

month	#reqs	#pages
Jan	4303	2647	++
Feb	9524	5846	++++
Mar	7626	5542	++++
Apr	9281	6677	+++++
May	9469	7363	+++++
Jun	8549	6787	+++++
Jul	12690	9282	+++++++
Aug	25567	18250	+++++++++++++
Sep	38036	27645	+++++++++++++++++++
Oct	96574	56477	++++++++++++++++++++++++++++++++++++++
Nov	54221	38583	++++++++++++++++++++++++++
Dec	58537	41648	++++++++++++++++++++++++++++

Advertisements

Google AdSense statistics show over 15,000 impressions (I started in the summer), which have resulted in about $10 of advertising revenue. At this rate it will take about five years to get the first check from Google. Quite disappointing, but in retrospect understandable: the topics I write about tend to interest people like me who are pretty unlikely to even notice the ads.

Dreamhost referral links have been clicked something like 500 times, but nobody has signed up. Again, a bit of a disappointment, but after doing some searches again understandable, since there are pretty good promotion codes out there.

Amazon has been the most disappointing. Just a handful of clicks and no purchases. I will probably be phasing that out in 2009.

I also briefly experimented with an AdSense competitor, but realized quickly that splitting the small ad revenue between several ad providers would mean even longer wait for the first check.

All in all, the results are so insignificant that unless something drastic happens in 2009 I might as well get rid of the ads since managing them does add a little bit of work (not to mention the addiction of checking the statistics to see how much you made at any given time period).