James Tauber's Blog 2006/04


blog > 2006 >


lighttpd and launchd

On a couple of occasions, I've noticed lighttpd silently dying on my remote Mac Mini that serves up a bunch of my sites including Quisition. I was switching hemispheres earlier in the week and so didn't notice for days. So I finally decided to get around to learning how to use launchd.

Turned out to be very simple.

I previously manually started lighttpd with:

sudo /usr/local/sbin/lighttpd -f /usr/local/www/lighttpd.conf

To start it (and keep it running) using launchd, I created a file:

sudo pico /Library/LaunchDaemons/net.lighttpd.plist

with the following content:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>net.lighttpd</string> <key>OnDemand</key> <false/> <key>Program</key> <string>/usr/local/sbin/lighttpd</string> <key>ProgramArguments</key> <array> <string>/usr/local/sbin/lighttpd</string> <string>-f/usr/local/www/lighttpd.conf</string> <string>-D</string> </array> </dict> </plist>

(note the extra -D option) and told launchd about it with:

sudo launchctl load /Library/LaunchDaemons/net.lighttpd.plist

Just for fun, I tried killing lighttpd and launchd had dutifully restarted it before I had time to type 'ps aux'

by : Created on April 29, 2006 : Last modified April 29, 2006 : (permalink)


Summer of Code 2006

I'm delighted to be a mentor again in Google's Summer of Code.

Although I can't guarantee acceptance, if people would be interested in doing something with Leonardo or Demokritos, I'm happy to help them come up with a project to do. I'm also open to mentoring other Python-related ideas.

Email me if you're interested.

by : Created on April 28, 2006 : Last modified April 28, 2006 : (permalink)


Two Browsers

Sam Ruby has a nice post on the cross-browser obstacles he's recently encountered.

The first two are exactly the problems I had with getting Quisition working on IE. The very first one had me stumped for ages even though it's dead simple (following the inverse law of bug complexity).

I'm still looking for more closed beta testers for Quisition. Just email me if you're interested in trying out online flashcards with clever spaced repetition.

by : Created on April 19, 2006 : Last modified April 19, 2006 : (permalink)


The Wealth of Networks and Non-markets

I've just started reading Yochai Benkler's book, The Wealth of Networks: How Social Production Transforms Markets and Freedom online, although I will probably pick up a printed copy at some stage.

It's fascinating so far but I was immediately confused by Benkler's frequent use of the term "non-market" which, in context, seems to suggest he has a much narrower sense of what the "market" is than I've come across before.

For example, consider the following quote (from the first chapter summary on the book's wiki):

Freedom and justice is best achieved through a combination of market action and private, voluntary (thought not necessarily charitable) nonmarket action. The state in this theory is a relatively suspect actor.

I'm not sure what he means by "market" if private, voluntary action is "nonmarket".

by : Created on April 16, 2006 : Last modified April 16, 2006 : (permalink)


Getting less to work with UTF-8

I've been working with UTF-8 files on the 'nix command-line for years, most recently on OS X.

I've been frustrated that things like cat and head work fine once Terminal is set to display UTF-8 but less doesn't seem to recognize UTF-8 even in that case.

I finally got around asking Google for a solution.

20 seconds later, I found it:

export LC_CTYPE="en_US.UTF-8"

via Notes on UTF-8 and locales

Boy do I feel stupid for not just looking it up earlier!

Anyway, maybe someone else will find that useful to know :-)

by : Created on April 16, 2006 : Last modified April 16, 2006 : (permalink)


Python Tuples are Not Just Constant Lists

Greg Wilson is suggesting things Python 3000 could leave out and suggests tuples.

In the comments, Phillip Eby holds him to task for the assumption that tuples are just constant lists:

Tuples are not constant lists -- this is a common misconception. Lists are intended to be homogeneous sequences, while tuples are hetereogeneous data structures.

I think it was years into my use of Python that I realised this and stopped thinking about them as just constant lists. It was a powerful revelation for me.

So while I agree with Greg that many (most?) programmers don't understand the distinction, I think they are missing out and that we'd be better off improving the way lists and tuples are documented than try to conflate what is, in my opinion, a very useful distinction.

One way I'd express it (in addition to Phillip's quote above) is that the index in a tuple has an implied semantic. The point of a tuple is that the i-th slot means something specific. In other words, it's a index-based (rather than name based) datastructure.

This notion of 'tuple' is very important in relational algebra (as Phillip also points out) and so I've been thinking about it in the context of relational python too.

When I started playing around with relational python (which I need to get back to blogging about), it occurred to me that it might be useful to have the notion of a tuple whose slots could additionally be named and then accessed via name. I implemented it that way in Basic Class for Relations.

UPDATE (2011-11-22): of course, the idea mentioned in that last paragraph is now a reality in the form of Python's namedtuple.

by : Created on April 15, 2006 : Last modified Nov. 22, 2011 : (permalink)


Fire Someone Today

Even if you're not interested their products, Logos Bible Software is a fascinating company on a number of levels. From the look behind the scenes you get from their blog to their innovative community pricing model where the market votes on the product priorities and pricing before production even starts, Logos is an interesting company to watch and learn from.

So I was delighted last August to discover that founder and CEO, Bob Pritchett, was writing a book on practical advice for startups called Fire Someone Today. Bob kindly sent me a PDF draft and I loved it—entertaining but also honest and very insightful.

Well, the book is now available from Amazon and, in typical Bob Pritchett style, Logos is offering $20 credit on their online store for anyone who buys the book from Amazon by midnight tomorrow. A nice deal given the book costs less than $10.

Even if you have no interest whatsoever in Bible software, it's a book worth taking a look at if you're interested in startups and entrepreneurship.

by : Created on April 15, 2006 : Last modified April 15, 2006 : (permalink)


Get Paid for Upgrading Aperture

I commented to my friend James Marcus recently that I liked Aperture but it was definitely overpriced.

Well, Apple has just released Aperture 1.1 for $299 instead of the $499 price tag on the original.

And, in a great move, they've offered anyone who bought 1.0 a $200 credit at the online Apple Store (and it's a free upgrade).

by : Created on April 14, 2006 : Last modified April 14, 2006 : (permalink)


Economics Precepts

Jason Fried says his favourite economic precept is 'sunk cost'.

I think sunk cost is mostly interesting because of the prevalence of the sunk cost fallacy where people say things like "I don't feel like going to the concert but I've already spent the money on the ticket so it would be a waste not to go".

This fallacy, like many in economics, comes down to not appreciating opportunity cost, particularly applied to that most precious of resources: time.

Another favourite economic precept of mine is comparative advantage. Comparative advantage is key to understanding why voluntary trade is win-win, even when one party can produce all the goods most efficiently. At its core, though, comparative advantage is a corollary to opportunity cost.

Yet another favourite economic precept of mine is Frédéric Bastiat's broken window fallacy where people say things like "at least this natural disaster will be good for the construction industry". But again, the broken window fallacy is about (not) understanding opportunity cost.

So I would have to say opportunity cost is my favourite economic precept because it is foundational to so many other important precepts.

Of course, I've mentioned before on this blog that I also think marginal utility and the subject theory of value are very important to understand.

If I made a list of "100 things everyone should know" I think I would put all the precepts mentioned here on it.

by : Created on April 12, 2006 : Last modified April 12, 2006 : (permalink)


Stats and Spam

When I commented on my January stats I said

Looking at my web stats, it appears that last month I had almost 100,000 visits (97,571) from almost 20,000 distinct IPs (19,484) averaging almost 10,000 hits/day (9,801).

In February I had a slight decrease in visits (93,441) from slightly more distinct IPs (19,528) and broke 10,000 hits/day (10,826).

However, I have very mixed feelings about March: 129,719 visits and 17,265 hits/day. I should be delighted (a 60% increase in hits month-over-month!) but I can't help but think most of the increase is meaningless (and possibly malicious).

Especially when I had 10,980 hits from just one IP address (80.77.80.46) in March accessing two blog entries repeatedly.

Certainly the tripling of the number of bytes served from the start of the year until I added the maths CAPTCHA is directly attributable to comment spam.

But there also seems to be a relationship between which web pages got hit with comment spam and which are now getting accessed disproportionately by the same IP addresses over and over again.

by : Created on April 3, 2006 : Last modified April 3, 2006 : (permalink)