« | » Main « | »

Subversion branching quick start

Sunday 29 October 2006

I've written up a quick introduction to branching with Subversion: Subversion branching quick start. I've found that there are two hurdles for developers with source control. The first is getting started at all, moving from a file server to a Subversion server. The second hurdle is branching. It's a really powerful tool to have at your disposal. If you've never been comfortable with it, read the article.

The difference between Democrats and Republicans

Thursday 26 October 2006

In these days leading up to the mid-term elections, there's been a great deal of excitement about the possibility of control shifting from Republicans to Democrats. There's also a steady undercurrent of the disillusioned claiming that there's really no difference between the two parties.

In some ways, they are right: both parties are prone to scandal, both spend more than their constituents would like, both tend to grow government, both need to practice more what they preach, both are likely to be beholden to "special interests", both fight dirty when their backs are against the wall, and so on. In short, they both tend toward the typical negative behaviors we find among those in power everywhere. This is what people mean when they say there is no difference.

And it doesn't help that the cliche distinguishing characteristics are contradicted frequently. Bush is a Republican, but spends a lot of money. Kerry is a Democrat, but is wealthy and privileged. When Bush came into office, there were those who pointed out that he was anything but conservative: in some ways he was a true radical, and they were right. So the classic differentiators are often proven wrong.

But I've been pondering this point for a long time: is there an essential difference between Democrats and Republicans? What is at the core of the character of the two parties? There is an essential difference, and it is summed up by their attitude towards Community.

By Community, I mean the balance between the needs of the individual and the needs of the group. Democrats lean toward the community, Republicans toward the individual. This inclination emerges in many aspects of political life:

  • Taxes: Should you keep your money, or should it go to the community?
  • Labor: Corporations are individuals in the eyes of the law, workers are a community.
  • Environment: Preservation for the common good often conflicts with individuals' use of natural resources.
  • Foreign policy: The US is an individual country, the UN represents the community of countries.
  • Demographics: Urban areas (where many people live closely) are more Democrat, and rural areas (where people are relatively isolated) are more Republican.

These characterizations are simplifications of complex issues. Some classic differentiators are not explained well by this distinction (abortion comes to mind) but the general theme holds: Republicans tend toward individuals, Democrats toward communities.

I'm not making a value judgement. It's no secret that I vote Democrat, but my point here is not to sway anyone. I'm just trying to unravel a political puzzle.

Too dynamic?

Sunday 22 October 2006

Here's a debate that arose recently, about the extent to which dynamic typing can be taken, and whether it is too far. We have a function that takes a list of ids, but it can also be used in a way that gets the ids from another well-known place. It was originally coded like this:

def insert_ids(ids):
    """ Insert the ids, or the global ids if ids is 'global'.
    if ids == 'global':
        ids = get_global_ids()
    for id in ids:
        # blah blah blah

# Now we can insert ids two different ways:

ids is an argument that can either be a list of ids, or the string 'global', meaning go off and get a list of ids from somewhere else. But this use of the same argument as either a string or a list felt funny, so we changed it to this:

def insert_ids(ids=None, use_global=False):
    """ Insert the ids, or the global ids if use_global is True.
    if use_global:
        ids = get_global_ids()
    for id in ids:
        # blah blah blah

# Now we can insert ids two different ways:

But now we have two arguments, both of which have to be defaultable, making it possible to call the function with no arguments, which is not a valid form of the function. Am I being too squeamish about the dynamic nature of the first form? Although Python doesn't mind, it feels strange to me for a variable to sometimes be a string and sometimes be a list. Is this pythonic? Or just a confusing abuse of power?


Saturday 21 October 2006

Pygments is a new pure-Python package for syntax highlighting source code. It seems very well done, and quite full-featured. Not only does it lex and color a bunch of languages, but it handles embeddings too, like Django templates in HTML. I use SilverCity on this blog, but have never liked that it calls into Scintilla DLLs to do the hard work, and isn't up to the task of two languages shuffled together. Pygments seems like a good alternative.


Saturday 21 October 2006

Larry Sanger is one of the two guys who founded Wikipedia. He had a difference of opinion with the other founder, Jimmy Wales, over the role experts would have in Wikipedia's content. As a result, he has announced an online encyclopedia called Citizendium. It will start as a fork of Wikipedia, but with be based far more on experts' contributions.

Mike (no last name) at Modern Dragons has a long and thoughtful piece about the prospects of Citizendium, with many links to other thoughtful pieces.

This is a long and nuanced story, involving complex themes of scholarship, community, and inter-personal conflicts between the two founders. Complicating the prognosis for Citizendium is the fact that a precursor to Wikipedia was an online encyclopedia called Nupedia, which relied more on experts than amateurs, and was founded by, you guessed it, Larry Sanger and Jimmy Wales.

It'll be very interesting to see how this plays out. Citizendium seems to be willing to go slowly (they plan to have a charter written within the year); the internet doesn't generally reward hierarchical structures; and it will be hard to "compete" with Wikipedia. But if it means we have a higher-quality encyclopedia, I'm all for it.

Slide art

Thursday 19 October 2006

The venerable Tate Modern has a new art installation: Carsten Höller's Slides. It is what it looks like: a handful of big slides that "patrons" slide down.

What interests Höller is both the visual spectacle of watching people sliding and the ‘inner spectacle’ experienced by the sliders themselves, the state of simultaneous delight and anxiety that you enter as you descend.

I wish it were in Boston. I think it's an art museum I could get my kids psyched about. BTW: Here's the cool thing (for me): I discovered this via this tabblo.

Porter stemming algorithm

Saturday 14 October 2006

From a roundup of the new full-text search feature in SQLite, I found a reference to the Porter Stemmer, an algorithm for reducing an English word to its root (sort of):

cat --> cat
catatonic --> cataton
catatonically --> cataton
catch --> catch
catched --> catch
catches --> catch
catching --> catch
caught --> caught
abstemiously --> abstemi
manliness --> manli
mainlines --> mainlin

I say "sort of" because abstemi is not exactly the root of abstemiously, but is close enough. The point of the algorithm is to map words from the same root onto the same value. In this way, it's like a hash algorithm. The fact that the value it comes up with is often the root, or usually very similar to the root, is a nice side effect, but if it mapped all of the "catch-" words onto 117243, it would still work as the basis for a full-text search engine.

And of course, English is a bastard when it comes to this sort of thing, as you can see from the "caught" case.

BTW: Martin Porter (the author of the algorithm) has a marvelously (root: marvel) dry witty home page which starts off with a startlingly accurate prediction (roots: startlingli accur predict).

Also BTW: abstemiously is a word with all six vowels, in alphabetical order.

Actual conversation

Thursday 12 October 2006

The following is an actual conversation that occurred tonight between me and a stranger on the telephone.

(phone rings)

Me: Hello?

Him: (longish pause, giving away the commercial nature of the call)

Him: Good evening sir, would you be willing to help me with a short survey about electricity use? It will only take two minutes.

Me: (reluctantly) OK.

Him: Thank you, now, um, just a minute, .. Uh, my computer seems to have frozen.

Me: (chuckling on the inside)

Him: Um, I'm having a little difficulty right now. Can I call you back?

Me: (rolling my eyes, knowing I won't pick up the phone next time) Sure.

Him: Great. What's your telephone number?

Me: (in disbelief, hangs up the phone) [Click]

Cameras with wireless

Sunday 8 October 2006

I just recently got a new camera (point and shoot, SLRs still scare me), and it has an SD card in it. My laptop has an SD reader in the side, so I don't need to use a cable to upload my photos any more. Very cool.

But not as cool as a camera with wireless built into it. The Nikon S7c not only has WiFi built in, but it auto-sniffs access points, and makes connecting extremely easy. Antonio has a complete review and more thoughts here. One of the great things about equipping the camera with WiFi is that they didn't do the more obvious thing and make it Bluetooth. Bluetooth is designed for short hops, to replace cables. Nikon could have made a small change, getting rid of the need for a cable by adding in Bluetooth. But WiFi is much more powerful, since it means you can be out in public, snap pictures, find an open access point, and start sending pictures. Very nice.

At Tabblo, we think the camera is cool enough that we're launching the first in a series of theme contests, with a Nikon S7c as the prize.

Google code search

Sunday 8 October 2006

Google announced Google Code Search the other day. It's the Google search engine, but pointed at chunks of source code rather than at web pages. Koders and Krugle have both been doing this for a while, but it's interesting to see how Google's take on it differs.

Right off the bat, it looks like Google gives more results, but they are not always as useful. My first test search was for, what else?, my name. Google's returned 192 results, but many were lexicons for natural language parsers, where 'ned' appears at the end of 'aforementioned'. Koders returned 3 results, and Krugle returned 17. One immediately noticeable difference is the Google is finding code wherever it may be, while the other two are only looking in known code repositories. For example, Google found the zip files on my site where I distribute code, while the other two did not.

Krugle has more features, for example, the ability to limit search to comments, or to function definitions. I haven't used it enough to know whether that will be helpful or not, but it is cool to see that they parse the code deeply enough to provide the feature. Krugle also has an Ajaxy interface, which seems like overkill for a search engine. If I get used to it, it may be really nice, but it breaks all my habits in dealing with search engines and their results. On a non-search-related note, they have hip help-wanted ads on their site:

another reason not to work at krugle:
you like to set the bar low & surpass expectations with average work.

Overall, Koders seemed like the poor relation, with the fewest results and the fewest features.

One more thing: Jason Kottke has a list of interesting stuff (like passwords!) that you can find out with Google code search.

Iterator merge in Python

Tuesday 3 October 2006

Although I've been working in Python for a long time, every once in a while I come across a chunk of code that makes me stop and think, and admire its elegance and Pythonic nature. Raymond Hettinger's recipe for merging multiple sorted iterators is one of those pieces of code. It's only 29 lines including the supporting stuff, but it opened my eyes in these ways:

  • It works with iterators in unusual ways, including taking a list of objects, turning them into iterators by mapping iter over them, and then iterating over the list of iterators.
  • It manipulates the iterators directly, by calling the next() function explicitly. Usually I'd think about the implementation of iterators involving the next() method only when considering writing an unusual iterator, not when using an iterator.
  • It uses a standard module that had escaped my attention, heapq for using a list as a sorted heap.
  • It uses object methods as first-class objects that can be pushed into the heap along with the data to be sorted.

There's nothing like a succinct thought-provoking snippet to start your day.

Glimpsing the garden over the wall

Monday 2 October 2006

Luke Plant has written a plaintive post about the difficulty of learning nice programming languages, but not being able to use them at work: Why learning Haskell/Python makes you a worse programmer. I know just how he feels, because I was in that position up until a year ago. It's difficult knowing that there are better tools out there, but having to work with what feels like stone axes during the day.

In my case, I was using C++ and C# during the day, and Python at night. I found a few ways to cope with the distance between the two worlds.

Get inspired. Sure, you can't express yourself in C++ the way you can in Python. But you can try to bring some of the dynamic or agile ethos to your static waterfall world. Maybe you can think about using functions as first-class objects, or start an automated testing effort. It's difficult, but if they're good practices in the open-source world, they're good practices in your environment. Be the change you want to see in the world. It's not all about what language you use, it's also what you do with it.

Side projects. Anything I did on my own time, I did in Python. This allowed me to explore the new world, and to express myself in it. Examples of this work were Nat's World, and the software that runs this blog.

In some ways, side projects only make the tension worse. Your fun project scoots along nicely with the new tools, while work continues to be difficult. Part of this may be because of the tools, but keep in mind: there's a reason they call work "work". Side projects are always more fun than real work, and you may be mis-attributing the reason for the joy. Maybe it isn't Python that makes the fun project fun, maybe it's that you get to pick the project, and you don't have to deal with Deadwood Dirk in the next cubicle! Your side project has no deadlines, no business goals, and so on. Side projects are a good way to stretch your skills, focus on areas of interest, expand your influence, and build new connections. But they aren't "real" in the hard ways that work is.

Tools. When an opportunity arose at work to create a tool, I wrote the tool in Python. This is how Cog came about, for example. There's bound to be some friction at work when the tool is introduced, since others there may not be able to maintain it. They may even view it with downright suspicion because it's written in a "toy language". But if writing it in your dream language gets it built when sticking to C++ would keep it from being written, then you should write it in Python and present it as a fait accompli. If it does a useful job, it will be accepted, and you'll have infiltrated the fortress walls with your language of choice.

Network. Read the newsgroups, read (or write!) a blog. Join a Meetup group. You can hang out with people that think like you do, and you won't feel like an outcast anymore. And they'll probably sympathize with your crummy work stories.

Get a new job. This of course is easier said than done. But jobs using the new languages and environments are more and more prevalent, and may be more possible than you think. And if you do get a new job, you can finally test your theory that work would be easier if you didn't have to deal with C++ (or C#, or VBscript, etc).

Yearning for better tools and languages is nothing new. Even once you get your dream development environment, you'll wish it were better. Doing something about it is the challenge.

Cameras and Wookiees

Monday 2 October 2006

Encouraged by the success of Wikipedia, I've noticed specialty groups starting their own niche encyclopedia. The first I saw was the cleverly-named Wookieepedia, related to all things Star Wars. The latest is Camerapedia, about photographic topics.

Wookieepedia is needed because the Star Wars community exceeded Wikipedia's tolerance for articles about fictional minutiae, and it will flourish because of its community's bottomless desire for such minutiae. It has its own wiki culture: the notices on pages requiring maintenance are all voiced by Star Wars characters. For example, the accuracy of Fifth Battle of Coruscant is called into question by Luke Skywalker screaming, "No! That's not true! That's impossible!".

But I wonder about the longevity of Camerapedia. Wouldn't all of it do well within Wikipedia itself? Can they attract an audience away from the ever-expanding Wikipedia? Should they? Is it better to have a separate dedicated photography encylopedia?

Design Barcode

Monday 2 October 2006

Some clever Japanese graphic designers realized that just because barcodes are functional doesn't mean they can't be pretty as well. They play around with the edges of the barcode to make them into integrated elements of package design, rather than blots on the landscape: Design Barcode. The video isn't a good way to study what they've done, but the Japanese-only Design Barcode site isn't yielding any nuggets either.

Drying out

Sunday 1 October 2006

Since the flood Tuesday night, Tabblo has been returning to normal.

Considering how much water was spraying around Tuesday night, we came out very well. The guys on hand did a good job getting rid of most of it, and we called ServiceMaster to come take care of the rest.

They put water droids all over (actually, just powerful fans and dehumidifiers), which hum and spin all the time, dribbling into buckets to get rid of moisture.

Everything was placed on small styrofoam blocks (including one slow-moving engineer!). We don't know if they're to keep the tables from getting wet, or to allow the carpet to dry.

Remarkably, our Wall of Fame was mostly intact. The posters were subjected directly to the full force of the water, but they look brand-new.

Many offices have had their walls ripped open to let them dry out, and the power is off as a result. So we move into the public areas with our laptops, and keep on cranking.

Tabblo: Drying Out


Sunday 1 October 2006

I've redesigned this site. I'd been using the same design for the past 4½ years. Let me know if there are any problems.

Once again I looked into using a no-tables approach, but I didn't see how I could accomplish everything I wanted to with pure CSS. If anyone wants to take a crack at it, I'd be very interested to see how it can be accomplished.

There are a few things I couldn't get right. One of them is that the gap between a blog title and its date is different in Firefox and IE. I played with all sorts of margins and paddings and line-heights, and could not get them to agree.

« | » Main « | »