Why to get a smart phone — August 10, 2010

Why to get a smart phone

My friend Carl a while ago expressed some confusion about why he’d ever want to get a smart phone. It’s a reasonable question: carrying a computer on your person at all times is remarkably distracting. If you don’t send text messages, it may seem pointless.

This morning, as I edited the details on a calendar entry on my phone, it struck me that that’s the main thing I couldn’t do without. I enjoy when my phone rings to tell me that I have some event coming in an hour. I enjoy editing events on the phone and knowing that they’ll be synced up with the Google Mind, so that I’ll see the same information right away if I visit the Google Calendar website.

You might justify getting a smart phone by the sheer efficiency of the thing: if you’re carrying an iPod and a phone, why not combine them into one device (manufactured by Apple or otherwise)? Nowadays that efficiency argument seems weaker to me: if it helps me avoid spending endless time online, I’d prefer to have an iPod separate from a dumb phone. But then, iPod+camera+telephone+texting device? I wouldn’t want to carry four separate devices. And it’s really great to have a camera on me at all times. Taking photos and then uploading them immediately to some public service is something I don’t need; people can wait an hour or two to take a look at the food I just ate in a nice restaurant. So it’s not the instant nature of the photos that makes camera phones valuable; it’s being able to take photos at all.

The aggregate effects of omnipresent technology are interesting. For instance, some guy exposed himself on the T the other day, and Twitter helped catch him. That wouldn’t have been possible without omnipresent camera phones and (to a lesser degree) omnipresent social networking on mobile phones. We’re all carrying cameras nowadays; that has to have a marked effect on lots of things (think “police brutality”).

Texting is an interesting phenomenon: as has gotten a lot of notice recently, people are using their phones for voice calls a lot less nowadays, and replace those calls with quick texts. I certainly use my phone that way: for most anyone other than my girlfriend, I make initial arrangements for outings via email, then send little texts as the time approaches: “I’ll be 20 mins late”; “I’m there”; etc. These don’t take away from real in-person socializing at all; I certainly feel like my social life is better than it was 10 years ago when cell phones and texting weren’t so omnipresent.

When I hang out with my girlfriend’s 13-year-old son, I realize that this sort of *what does it all mean* conversation will be completely gone in 15 years, and that the 13-year-old would look at me as though I were the world’s dumbest man if I tried to have it with him now. Kids text much more than they speak on the phone. Period. We can try to shake our fists at the sea on this issue, but it would be incredibly pointless to do so. (Likewise, arguing against MP3s and in favor of physical media, or inveighing against casual file sharing between friends, has long since become the most wasteful use of your time. People share MP3s. Period. We may be unhappy about this because it denies artists some money, but it is a fact.)

One thing I definitely don’t miss from the dumb-phone era is that silly thing where you lose your phone and then email all your friends, “Hi, I lost my phone. Please send me your contact information.” That is totally played out. I sync all my contacts to Google now; if I lose my phone or get a new one or wipe and reinstall the OS, I take 30 seconds to create a new Google account on the phone, then start it syncing. Within a couple minutes I have all my contacts and all my calendar entries on the device. I enjoy that very much.

“Contacts” here also includes a lot of businesses; for some of those businesses I only have a physical address. It’s awfully handy, for someone with a sense of direction as bad as mine is, living in a non-Euclidean city like Boston, to be able to use a map, compass, GPS, and Google Maps to find my way from wherever I am to a favorite café.

The rest of what’s on my phone count as nice-to-haves. It’s nice to be able to write email from my phone, but I can certainly wait until I get in front of a full computer for that. It’s nice to have a web browser, so that I can settle some point of curiosity in the middle of a conversation; but as I think we’re all discovering, it would be a lot better for society in general if we put the phones away during any outing. So I’d actually contend that a mobile browser turns out to be a slightly net negative. Having Facebook and Twitter apps on the phone is probably a net negative: they’re little distracting games.

I’d say, then, that the main reasons to get a smart phone are

* never again needing to bother your friends with requests for contact information
* your calendar and contacts, available at all times and synced with an external service
* not needing to carry a separate camera, iPod, and phone

Everything else is nice to have, or actively harmful to your attention span.

I’ve certainly found that having a mobile computer has reduced my attention span. When I’m reading a book, I typically pull out my iPhone every few minutes: email, Facebook, Twitter, repeat. Sometimes I put my iPhone and laptop in another room while I’m reading. When I go on vacations, I leave all technology behind and bring a stack of books with me. (My lovely girlfriend, bless her heart, realizes that all I want to do on vacation is read books and spend time with her, and she’s more than willing to accommodate me on both.)

These reactions to my own distraction are possible because I remember when it was otherwise. I’m very curious how life will be for Stephanie’s sons, who didn’t exist before the Web and who became conscious entities during the era of the cell phone. They may not realize that a world with longer periods of focus is even possible or desirable.

Lest you think that I’m going to predict doom and gloom, I’m not going to. When I read John Ruskin, I saw an earlier generation of this descent-into-darkness brand of pessimism. Ruskin saw his beloved pastoral England destroyed by mass production and the dark satanic mills, and assumed that cities would always be destructive to the human soul. It’s possible that he was right: maybe, if you transplanted me back into late-18th-century England, I’d be brought to tears by the beauty of that lost world. Granted, though, that macro changes often bear no resemblance to the desires of any individual actor, I think people tend to adapt the world around them to what they want. The city I live in now serves my needs pretty well.

In 150 years or so, I suspect the techno-pessimists of today (like George Packer) will look a lot like Ruskin: correct in some points, maybe tragic in their correctness, but shortsighted and naïve and futile.

In defense of AT&T — June 22, 2010

In defense of AT&T

People love to bust on AT&T, but I have to say that I have no — zero — complaints about them:

* __Reception__: AT&T’s reception has been better than it ever was when I was on Verizon. I can make calls from inside my girlfriend’s house in New Hampshire, and from inside my parents’ house in Vermont; on Verizon, I always had to step outside in both those places. And AT&T doesn’t even have service in Vermont! Needless to say, their reception in Boston is just fine. I’ve had some problems in the immediate vicinity of my workplace in Kendall Square; I believe that’s because the volume of electronic equipment there is over the top and causes lots of electromagnetic interference. I’ve had some problems with their reception in New York City. (NYC people: has AT&T gotten any better there?)

* __Their online store__: People were bitching and moaning about being unable to buy an iPhone 4 because AT&T’s website got slammed. I had no such problem. I ordered an iPhone from them on the day it became available, and was notified today that it’s shipped. (By the way: is “I’m going to have to wait a few days to order my several-hundred-dollar pocket computer, *and I am pissed*” the definition of “first-world problem”?)

* __Customer service__: Verizon’s customer service was always great, and they always tried to find me the plan that fit my needs. AT&T has done the same. (Bank of America’s customer service is also stellar. I guess I’m supposed to hate BofA too, but I don’t.)

Others may have had worse luck, but I kind of wonder if people just like getting mad at big companies.

Little Eclipse nits I want to fix: a series of notes to myself — June 18, 2010

Little Eclipse nits I want to fix: a series of notes to myself

As I think of them, I’ll add notes here on what I want to add to Eclipse. Eclipse is really pretty fantastic, and it’s 90% of the way to feeling like a really comfortable tool for me. Here’s what would make it perfect. Since it’s an open-source tool, I should be able to fix it.

1. Sometimes — but not always — you can Select All in the Project Explorer. When you can’t, you can click the first project in the list, then shift-click to the last project in the list. I submit that if that is possible, then Select All ought to be possible.
2. Periodically, Eclipse or Maven or m2eclipse or somesuch will have a mild freakout: *I can’t build project X until I get project Y!* But it’s just that project Y is closed. So: *get the various plugins to open project Y when necessary.*
3. run-jetty-run ought to honor the pom.xml, specifically the XML directive that tells jetty to use a specific port.
4. Command+Shift+R (under OS X)/Ctrl+Shift+R (everywhere else, I guess) doesn’t let your cursor keys wrap around the list control. My cursor starts at the top of the list of matching resources; I should be able to press the up arrow to go to the bottom-most matching resource, and vice versa.

Much larger than mere nits:

1. I wish Eclipse worked at all for Python development. I don’t know anyone who’s had good luck with Pydev, though maybe I need to give it another shot.
2. I wish Eclipse integrated better with FreeMarker: syntax highlighting, proper indenting and reformatting, jumping from macros to their definitions and their uses within your workspace, etc.
3. There are times when the only way I can unbreak my m2eclipse environment is by dropping to the command line and running various incantations like `mvn clean install eclipse:clean eclipse:eclipse`. I should never have to drop to the command line (that’s the point of an IDE, no?), but much smarter people than me say that they’ve never been able to control Maven flawlessly from inside Eclipse.

I finally had my first exposure to programmers who can’t program — June 7, 2010

I finally had my first exposure to programmers who can’t program

This sort of madness is apparently commonplace. I had never directly encountered it, so I was shocked when I interviewed someone today who was incapable of performing a basic programming task. This was someone with a master’s degree from a prestigious university, and he couldn’t code something that you should be able to write as a freshman in college. Fortunately it only took, by my estimate, $18.07 in salaried time to screen him out: I put him in front of the excellent See[Mike]Code after a few minutes of pleasantries and “what would you like to know about our company?”-type questions, watched him fail to code, and ended the interview. During in-person interviews, we “fail fast”: if the first interviewers raise a red flag, they relay this to the second pair of interviewers; if the second pair of interviewers is negative or only neutral, we show the candidate the door. I’m now inclined to fail phone-screen candidates fast: program first, talk about the company second.

I’ve thought for a very long time that the hiring process is largely a *negative* affair: it establishes those people whom you screen *out*, but it doesn’t do a very good job screening *in*. You filter out the obviously incompetent programmers. Then you filter out those with bad social skills. Then you filter out those who fit badly with the company’s culture. You still may end up with disasters. At my company, we give candidates three to six months to prove their mettle even after we hire them, which is (it seems to be) an admission that the hiring process is imperfect.

In large, advanced market economies centered around anonymous transactions, you avoid some of these problems with credentialing organizations like universities. The assumption is that (apart from MBAs, which I gather are high-cost multi-year networking events) a prestigious school wouldn’t just put its stamp on anyone. After today, I’m not at all convinced that that’s true. I want to call up today’s candidate’s master’s-thesis adviser and demand that he pay me $18.07. Perhaps that would start shifting the incentives the right way.

iPhone 4 FaceTime/Infinite Jest mashup —

iPhone 4 FaceTime/Infinite Jest mashup

Apple’s introduction of FaceTime, their videophone protocol in the forthcoming iPhone 4, reminds me of this great passage in David Foster Wallace’s [book: Infinite Jest]:

> (1) It turned out there there was something terribly stressful about visual telephone interfaces that hadn’t been stressful at all about voice-only interfaces. Videophone consumers seemed suddenly to realize that they’d been subject to an insidious but wholly marvelous delusion about conventional voice-only telephony. They’d never noticed it before, the delusion – it’s like it was so emotionally complex that it could be countenanced only in the context of its loss. Good old traditional audio-only phone conversations allowed you to presume that the person on the other end was paying complete attention to you while also permitting you not to have to pay anything even close to complete attention to her. A traditional aural-only conversation – utilizing a hand-held phone whose earpiece contained only 6 little pinholes but whose mouthpiece (rather significantly, it later seemed) contained (62) or 36 little pinholes – let you enter a kind of highway-hypnotic semi-attentive fugue: while conversing, you could look around the room, doodle, fine-groom, peel tiny bits of dead skin away from your cuticles, compose phone-pad haiku, stir things on the stove; you could even carry on a whole separate additional sign-language-and-exaggerated-facial-expression type of conversation with people right there in the room with you, all while seeming to be right there attending closely to the voice on the phone. And yet – and this was the retrospectively marvelous part – even as you were dividing your attention between the phone call and all sorts of other idle little fuguelike activities, you were somehow never haunted by the suspicion that the person on the other end’s attention might be similarly divided. During a traiditional call, e.g., as you let’s say performed a close tactile blemish-scan of your chin, you were in no way oppressed by the thought that your phonemate was perhaps also devoting a good percentage of her attention to a close tactile blemish-scan. It was an illusion and the illusion was aural and aurally supported: the phone-line’s other end’s voice was dense, tightly compressed, and vectored right into your ear, enabling you to imagine that the voice’s owner’s attention was similarly compressed and focused … even though your own attention was *not*, was the thing. This bilateral illusion of unilateral attention was almost infantilely gratifying from an emotional standpoint: you got to believe you were receiving somebody’s complete attention without having to return it. Regarded with the objectivity of hindsight, the illusion appears arational, almost literally fantastic: it would be like being able both to lie and to trust other people at the same time.

This is only the beginning of a several-pages-long discussion of why videophones (from the future-retrospective stance) failed. People notice first that they look really gross on camera. Then they get self-conscious, so they wear masks when they’re on their videophones. This makes them terrified to meet people in real life, because those people will discover that they’ve been lied to during their videophone chats. So people stay indoors. There are a few other steps in there that I forget (and Google Books is no help), but the end result is that society eventually makes one big coordinated move to drop its videophones.

(You really need to read [book: Infinite Jest]. It’s one of those books that everyone knows about but few read. You should be one of the few to read it. I reviewed it on Amazon back in 2001.)

By the way: I’ve been considering switching to any of the new Android phones when my AT&T contract expires in August, but the new iPhone seals the deal for Apple.

jQuery and XMLHttpRequest objects — May 31, 2010

jQuery and XMLHttpRequest objects

I’m trying to find an answer to this, but the web has been remarkably unforthcoming. This includes the usually stellar Stack Overflow. Here’s what’s going on:

* I’ve gotten comfortable in jQuery over the past few months. It is awesome.
* I’ve just started playing with XMLHttpRequest objects (i.e.,“Ajax”).
* jQuery has a few methods to help you do XMLHttpRequest calls, e.g., .get() and the lower-level .ajax().
* If a .get() request succeeds, you can attach a success callback to it. The arguments handed to the callback include the XMLHttpRequest object itself.
* XMLHttpRequest objects, according to the spec, have a getAllResponseHeaders() method.
* It would seem to follow, then, that the XMLHttpRequest object in jQuery.get() and jQuery.ajax() would also contain a getAllResponseHeaders() method. If it does, I can’t get Firebug to print its results; it only tells me “null.” Null is a kind of sadness.
* Other pages, including the Stack Overflow one that I mentioned, indicate that other people have had this same problem. But no one seems to have solved it. So I’m putting the description up here; when I solve it, I will contribute to the world’s stock of knowledge, and a great light will shine forth upon the land. Hosannas, etc.

The iPhone is not on the side of the angels — May 24, 2010

The iPhone is not on the side of the angels

One of the very infuriating things about reading Jon Gruber is his constant “Apple rocks, open-source sucks” mantra. If you didn’t know that constant refrain, it might seem as though he links to “open is for losers” without comment; knowing Gruber, you know that he’s either doing it approvingly, or as a stick in the eye of his non-Apple-fanboy readership. He’s, honestly, a dick like that.

Paul Graham says in the linked piece that “Of course [he would invest in] iPhone. Im talking about what I hope will set us free, not what will generate opportunities.” This is a perfectly sound point, and doesn’t take away from the fact that *the iPhone is an anti-freedom device.* I say this as a happy iPhone owner. Or rather, I say it as a *conflicted* iPhone owner: I realize that by using this device, I am harming the cause of freedom. But it’s also a spectacular piece of consumer technology.

The open-source movement has always treated software as speech: if it’s not free, it doesn’t matter how good it is. If all the books that you could read had to be personally vetted by Barack Obama, you’d never stand for it. Open-source advocates feel the same way about software that needs to pass through a censor first to make sure it doesn’t conflict with what Apple is trying to sell.

That said, I used Linux exclusively for years, and no longer use it as my everyday computing environment; I use a Mac. Macs and iPhones are designed with a level of polish that you don’t appreciate until you suddenly realize that your computing experience has been painless for the first time in decades — that everything works as it should, and that you’re actually giddy at your ability to experiment without fear.

So I’m conflicted. And I’m not going to take the (as it has always seemed to me) lazy way out and say “Do I contradict myself? / Very well then I contradict myself, / (I am large, I contain multitudes.)” I think one is actually obligated to bring one’s life into harmony with one’s principles, so long as one has principles. I’m the first to admit that I suck at doing this. But it’s a conflict, and it’s an *obvious* conflict: I believe in free speech, I believe that regulated speech is not speech worth having, and it’s obvious that Apple peddles regulated speech. Yet they make operating systems that are head and shoulders above everyone else’s, despite the fact that they’ve been *sitting out there*, just *begging* for someone to make a comparable interface. No one has. Surely Apple deserves to be rewarded for making the best product.

When my iPhone contract expires in September or October, I am seriously considering switching to an Android phone of some sort. Maybe an HTC Incredible, maybe a Nexus One, maybe something else. Before I do that, I will probably pick up an Android device purely for development purposes. It may turn out that I love Android devices, and the contradiction in my life melts away. I hope so, because in the meantime it is uncomfortable.

svn commit “unable to lock” error under Mac OS X — May 3, 2010

svn commit “unable to lock” error under Mac OS X

This will be interesting to approximately none of you, but I feel I need to spread the knowledge of hell to a wider world.

I will perhaps go into greater detail at a future date about all the *other* problems preceding this one while I used svn (and Maven, and Eclipse) under OS X. They all essentially stem from the fact that OS X’s filesystem is case-insensitive. … Or rather, not case-insensitive: you can’t do

(16:41) slaniel@Steve-Laniels-MacBook-Pro:~$ mkdir test_dir
(16:42) slaniel@Steve-Laniels-MacBook-Pro:~$ mkdir test_Dir
mkdir: test_Dir: File exists

But you can do

(16:42) slaniel@Steve-Laniels-MacBook-Pro:~$ mv test_dir test_Dir
(16:42) slaniel@Steve-Laniels-MacBook-Pro:~$ rm -rf test_dir

Since it’s not entirely case-insensitive, it is *sometimes* — but not always — a problem to have both ‘foo’ and ‘Foo’ in the same svn checkout. More to the point here: what if you have ‘Foo’ and want to rename it to ‘foo’? You’d want to do `svn mv Foo foo`. There will be bequeathed unto you a sadness:

(16:45) slaniel@Steve-Laniels-MacBook-Pro:~/svn/sandbox/slaniel$ svn mkdir foo
A foo
(16:45) slaniel@Steve-Laniels-MacBook-Pro:~/svn/sandbox/slaniel$ svn mv foo Foo
svn: Unable to lock ‘Foo’

The reason it can’t lock ‘Foo’ is that it already has ‘foo’ locked, and it thinks that ‘foo’ is the same as ‘Foo’. So it can’t move, in other words, because the filesystem is case-insensitive.

To redress this just now, I had to do something like

svn mv foo bar &&
svn ci -m “Temporarily moving foo to bar” &&
svn mv bar Foo &&
svn ci -m “Moving bar to Foo”

You need to do the commit after each move; you can’t just do

svn mv foo bar && svn mv bar Foo

Maybe all of this was obvious to all OS X svn users other than me. I assure you that it was *not* obvious to me.

Mac filesystem case-insensitivity just wasted an inordinate quantity of time and money from some of my company’s smartest engineers. I am displeased. Perhaps this post will save someone else some time in the future.

At a later date, after I’ve actually completed some work, perhaps I will explain all the *other* badness that resulted from this case-insensitivity.

A Subversion problem: who was first responsible for an errant line? — May 2, 2010

A Subversion problem: who was first responsible for an errant line?

Suppose you want to find the first Subversion checkin where a particular string appeared. `svn blame [filename]` gets you some distance toward that goal, but it doesn’t entirely work: `svn blame` will tell you the person *most recently* responsible for tweaking the particular line of code where that string appears. If someone came along between when that line was introduced and now and, say, changed all Unix line endings to DOS ones, `svn blame` will suggest that the interloper is the one responsible for that line.

So what you want is the *first* revision number in which that change appeared. So far as I can tell, there’s no built-in svn command to give you this information. This shell-scripting business is the best I could come up with:

#!/bin/bash
string=$1
filename=$2

if test -z $string; then
echo “Must supply a string to search for”
exit 1
fi

if test -z $filename; then
echo “Must supply a filename to search”
exit 1
fi

# Get all svn revision numbers in which $filename
# was involved, in ascending order.
all_rev_nums=`svn log $filename
|grep -o ‘^r[0-9]+’
|grep -o ‘[0-9]+$’
|sort -n`

for revnum in $all_rev_nums; do
if svn cat -r$revnum $filename |grep -q $string; then
svn blame -r $revnum $filename |grep $string
# Since they’re in ascending order, we’ve found
# the first one. So we can quit now.
exit 0
fi
done

# If we never found $string in any revision
# of $filename, return an error.
exit 1

Exporting an MP3 mix from iTunes — April 24, 2010

Exporting an MP3 mix from iTunes

Suppose you make an MP3 mix for someone in iTunes. It’s easy enough to export the *list* of songs in that mix. And it’s easy enough to burn those songs to a CD. But it seems nontrivial to export *the actual MP3s*. Am I just not seeing an obvious way to do this?

Using a little shell-scripting, you can do this fairly easily:

#!/bin/bash
m3u_file=$1
export_dir=$2

function check_for_executables() {
# Paths to executables
TEST=/bin/test
MKDIR=/bin/mkdir
GREP=/usr/bin/grep
CP=/bin/cp
BASENAME=/usr/bin/basename

bad_execs=()
# Test that all executables are there
for executable in $TEST $MKDIR $GREP $CP $BASENAME; do
if ! $TEST -x $executable; then
bad_execs=”$bad_execs $executable”
fi
done

if ! $TEST -z $bad_execs; then
echo “Some required executables are missing: $bad_execs”
exit 1
fi
}
function process_args() {
if $TEST -z “$m3u_file”; then
echo “Must give the path to an M3U file.”
exit 1
fi

if $TEST -z $export_dir; then
export_dir=$(realpath $(pwd))
fi

echo “Exporting to $export_dir”

if ! $TEST -d $export_dir; then
echo “$export_dir does not exist or is not a directory; trying to create it”
if ! $MKDIR -p $export_dir; then
echo “Failed to create export directory $export_dir; quitting.”
exit 1
fi
fi
}
function export_playlist() {
i=0
cat “$m3u_file” |while read line; do
# Skip comment lines and blank lines
if echo $line |$GREP -q ‘^#|^s*$’; then
continue
fi
let i=i+1
if `echo $line |$GREP -q ‘^s*$’`; then
# line is blank, so skip it
continue
fi

filename=$(printf ‘%02d’ $i)_$($BASENAME “$line”)
export_path=${export_dir}/$filename
$CP “$line” “$export_path”
done
}

function main() {
check_for_executables
process_args
export_playlist
}

main

(Obvious improvements:

1. The `printf` statement prepends each track with its track number in the mix, and assumes that there are at most 100 songs in your mix. Have the script figure out the number of tracks in the mix, then compute the appropriate number of digits from that. The appropriate number of digits would be something like floor(log10(n))+1, where n is the number of tracks in the mix and floor(x) is the greatest integer that’s no larger than x.
2. If the script is longer than about 10 lines, contains nontrivial logic, could usefully stand to compute logarithms, and can be meaningfully decomposed into functions, shell is no longer an appropriate language; use something like Perl or Python instead.

Exercises for the reader.)