Every so often, I solve a problem with a hammer

For reasons beyond the scope of this entry, I maintain a specialFirefox profile and instance for uploading pictures to my Flickraccount . Back in theold days, Firefox had a very convenient behavior for this: when itasked you to choose files to upload in an upload form, the defaultdirectory was the current directory that you'd started Firefoxin. This meant that I could cd to the day's photo directory, startmy Flickr Firefox instance, and have the GTK file chooser dialog start in exactly the


My view of the purpose of object orientation

A while back I read Rise and Fall of Classic OOP .This caused me to realize that I am kind of a heathen as far asobject oriented programming is concerned, probably because I cameto explicit OO late and never actually learned how to do it the'right way'. You see, to me object orientation is a techniquefor code organization and nothing more.

This gives me a very pragmatic view of when to write OO code and whennot to; I use objects and classes where they make my code


The C juggernaut illustrated

Perhaps it is tempting, looking back at history from the vantage pointof today, to say that C succeeded so much because it was at the rightplace at the right time. As you could tell the story, all sorts of peoplein the 1980s wanted a low level programming language, C was around,and so they seized on it. Any similar language would have done; it'sjust that C was lucky enough to be the one that came out on top, partlybecause of


Another Russ Cox regexp article: How Google Code Search Worked

Russ Cox has just added another article in his series on regularexpressions ; this one is titled RegularExpression Matching with a Trigram Index, or How Google Code SearchWorked . It's as worthwhileas all of the previous three .


Let's make it official: Solaris 11 is closed source

You may remember back in August 2010 when therewas a leaked Oracle memo that said, among other things:

We will distribute updates to approved CDDL or other opensource-licensed code following full releases of our enterprise Solarisoperating system. [...]

At the time I noted that 'full releases' might be construed to be'Solaris 11' instead of the next 'Solaris 10 update X' release and wasunhappy about it. That was then. Now it's been


How not to do repeated fields in web forms

There's a certain sort of web form which really wants to make sure thatyou've entered something correctly, so they ask you to enter it twice intwo different fields. You've probably seen this in some web form sooneror later; this is the 'please enter your password again in this fieldtoo' or 'please re-enter your email address' field. I tend to think thatthis is bad on its own, but I've now seen an even worse implementationof this


SOPA and PIPA matter for everyone

If you are visiting WanderingThoughts on January 18 2012 withJavaScript turned on, you're being annoyed about the US's StopOnline Piracy Act (SOPA) and the Protect IP Act (PIPA) bills. Unlessyou've been living under a rock, you probably know something aboutwhat these are. If not, see here , here , here , here , here , here , or, really, anywhere. Try Wikipedia .

It may seem quixotic to black out my little techblog corner


The first browser blinks on XHTML parsing

I'm late to the party, but Opera has decided to stop strict parsingof XHTML (via Sam Ruby ):

[...] we've decided to stop throwing draconian XML parsing failederror messages [on invalid XHTML], and instead, attempt to reparse thedocument automatically as HTML.

I have long said that draconian XHTML error handlingis an unstable equilibrium and it would only last as long as all of thebrowser vendors didn't blink. Well, Opera has blinked; they've


What you can find out about the memory usage of your Linux programs

Recently I wound up reading Linux Memory Reporting ( via Hacker News ),where Robert Haas talks about Linux's lack of clear reporting onprocess memory use. Today I'm going to sort of answer his questionby covering what information Linux gives you about the varioussorts of memory usage that you couldbe curious about. My primary focus is going to be on the numbersthat you can get with ps , top , and smem . The background information ongeneral Unix memory management will be helpful.

So, what


Understanding isinstance() on Python classes

Suppose that you have:

class A(object):  passclass B(A):  pass

As previously mentioned , the type of classes is type , which is to say that class objects are instances of type :

>>> isinstance(A, type)True>>> isinstance(B, type)True

Both A and B are clearly subclasses of object ; A is a direct subclassand B is indirectly a subclass through A. In fact every new-style Pythonclass is a subclass of object ,