handy utility: watchpaths

Imagine you are working on a set of files on your computer, and each time you change one of those files, you want to run a program to process the files again. This comes up all over the place, whether it’s software development, statistics, image processing, or lots of other domains. Recently, I was editing some source code, and each time I changed a file, I wanted to run a series of tests to make sure everything still worked. I made this process automatic with the help of a really handy utility called watchpaths.

Installing watchpaths

First, download watchpaths and place it somewhere in your path. I use ~/bin, so try something like this:

cd ~/bin

wget http://watchpaths.googlecode.com/svn/trunk/bin/watchpaths

chmod 755 ~/bin/watchpaths

Using watchpaths

Let’s say I want to monitor a folder containing images, and each time a new image is added I want to sync the folder to a remote computer. Using watchpaths, that will look like:

watchpaths "rsync -a ~/my_pictures user@example.com:public_html" ~/my_pictures

To convert that command into English, it would sound like this:

“Watch the my_pictures folder for any changes (new files, deleted files, updated files, etc) and each time a change happens in that folder, synchronize the contents of that folder with my web server.”

More Information

The project page is http://code.google.com/p/watchpaths/, and if there is any interest, I am happy to incorporate feedback.

Disable sharing

Imagine you are a member of a successful mega-band with expensive music videos and everything. You started out small, worked your way up, and now you’ve sold millions of albums. The band’s music is owned and distributed by a big Label, and the Label has reluctantly put your music videos online. It is easy to show that Music Labels are wary of video sharing sites (such as youtube) because the Labels often choose to disable sharing when they are given the option. Makes sense, right?

Since you’re a band member in our hypothetical mega-band, what this means to you in practical terms is that bloggers cannot put your videos in their blogs, among other things. Naturally, the music label wants to disable sharing, because they want fans to be dependent on the label to get band updates. In Internet terms, this is a de facto walled garden of content, which in the music labels’ ideal world would be something completely separate from the Internet.

Ideally, as a band member, you’ll get a cut of everything the Label sells, so there’s a lot to say for the walled garden concept. The big problem is this: by definition, sharing is disabled between the Internet and the walled garden. For as long as the Label was the best way to promote your music, there has never been any benefit to sharing content. Ever since broadcast radio music was used to promote albums, and even through the whole music video era, sharing has never played into the promotion scheme.

Maybe sharing should be a part of music promotion.

I’m not talking about ripping whole albums or bittorrent filesharing, per se, although there are some people would riff on this. They might go so far as to argue that if you give an artist some money as a result of downloading an entire album worth of mp3s, then that artist got some free promotion via filesharing. It’s happened before.

But I’m not even going to touch that. The situation I am talking about is when a music label on youtube clicks that one checkbox to “disable embedding.” In the picture below, these are some of the options youtube gives you.

embedding.jpg

It’s worth considering why someone would ever decide to disable sharing, but the inescapable observation is that many music labels have made this choice. A practical consequence is that they are missing out on potentially free promotion through the Internet. More on this point later.

Passwords, and the Apple Keychain

Some time around 2006, I started thinking about my online passwords in a new way. Until this point, I had used a collection of perhaps a dozen gibberish passwords, which I reused on various sites depending on the sensitivity of the site. For example, my bank account would use a nearly unique password, whereas a random forum would use a very commonly reused password.

This worked acceptably well, but I frequently had to ask myself: “which password did I use when I signed up for this service?” In response to having to guess my own passwords, I made two decisions: I would start writing my passwords down, and I would make them all unique and randomly generated. Four years later, I am using a totally different system, and I’ll explain all of my reasoning.

Read on…

There’s a spider in the kitchen

I noticed a spider in the corner of the kitchen, so I zoomed in for a closer look.

spider.jpg

After some analysis, I decided it had to go, even though it was totally harmless. I was going to chase it into my specialty spider-catcher, consisting of a bowl and an old piece of cardstock.

spider catcher.JPG

They never see it coming.

Read on…

The Reverse Auction

Yesterday was eventful: we acquired two chairs that can be pushed together into a sort of bench, and we got rid of a table that didn’t quite fit. If you’ve ever read Bruce Sterling’s Shaping Things, or if you’ve considered the entire lifecycle of the products you purchase, then like me, you may have grown to dislike disposing of things – because it’s a bit of a chore. I asked myself: what is the easiest way to get rid of this table? The obvious answer – throwing it away – is full of problems, not the least of which is that there is a city schedule for throwing away big items. Then the answer struck me: the Reverse Auction.

Read on…

The fastest way to download a youtube video

A recent comment on BoingBoing asked if there was a way to download a video from youtube, such that it could be reposted elsewhere. One solution, suggested by Cory Doctorow, is to use pwnyoutube.com, but there exists a general method that works on all flash video (not just youtube), and happens to be faster than using pwnyoutube.com. Behold! For I shall demonstrate a painless use of lsof, the under-appreciated and extra-useful command line tool.

Read on…

Posting this before it’s cool: Hipster jokes

Q: How many hipsters does it take to screw in a lightbulb?

A: You don’t know?!

posted by shakespeherian at 7:38 AM on November 25 [2 favorites]

Q: How many hipsters does it take to screw in a lightbulb?

A: Lightbulbs? We tape fireflies to our PBR hats with duct tape and can see just as well as YOU.

posted by pyramid termite at 8:29 AM on November 25

Q: How many hipsters does it take to screw in a lightbulb?

A: All of them. One to screw in the lightbulb, while the rest brag to each other about how they were changing lightbulbs before it was cool.

posted by The Great Big Mulp at 10:17 AM on November 25 [3 favorites]

Q: How many hipsters does it take to screw in a lightbulb?

They don’t need lights. Macbooks have backlit keyboards.

posted by Pogo_Fuzzybutt at 10:44 AM on November 25 [6 favorites]

Q: How many hipsters does it take to screw in a lightbulb?

Oh, are those the new light bulbs? I liked the old ones better.

posted by Parasite Unseen at 1:32 PM on November 25 [3 favorites]

Q: How many hipsters does it take to screw in a lightbulb?

I have the answer on vinyl.

posted by ichthuz at 5:06 PM on November 25 [4 favorites]

Q: How many hipsters does it take to screw in a lightbulb?

A: an obscure number you’ve never heard of.

posted by meadowlark lime at 7:22 PM on November 25 [8 favorites]

via The Crazy World of andernestborgnineasdominic! | MetaFilter.

How is it 2009 and we still can’t write dates in a coherent way?

I have lived in North America my whole life. Most of that time was spent in the United States, but recently I moved to Canada. I really like it in Canada, but I have one gripe to share. Actually, it’s not so much a problem with Canada as it is a problem with humans, or perhaps it relates to the curious relationships between our planet, its moon, and its sun.

Read the rest of this entry »

curl: HTTP/1.1 100 CONTINUE and multipart/form-data POST

I’m working on a REST interface at the moment, and there’s nothing I need more than a quick utility to test out various functions.  Curl fills this role perfectly, but I have run into a strange problem that interferes with multipart/form-data form POSTing.  Let me explain some of the evidence I’ve collected, as well as tell you a workaround I learned from an IRC conversation.  In the end, this comes down to the HTTP 1.1 100 CONTINUE response code, which plays a critical role in HTTP 1.1 POST.

Read the rest of this entry »

The Free Beer Speech House: discussing the meaning of the word “free”

Freedom, glorious freedom.

Once upon a time, I took a class based on  a single question: “what is freedom?”  We meandered through US history, identifying several distinct stages in the evolution of the definition of “freedom.”  I was horrified to learn, during a discussion, that so many of my classmates wanted what I will call “freedom from information.” Ah yes – Professor Sandage had a way of bringing the ugliest truths to the surface, for all to witness.

On the one hand, I can understand this desire for freedom from information: telemarketing, advertising, spam, the scrolling headlines at the bottom of a newscast…  well, any unsolicited attempt at selling things you don’t care about.  On the other hand, I think we need more information instead of less, and we need effective tools to filter and manage that information so we only see what we care about.

The term “freedom” is muddied by historical contexts, but also through the process of etymological erosion.  With that said, I want to take a moment to discuss the expression, “free as in speech, not beer.”

Read the rest of this entry »