Inert Detritus The Internet's dust bunnies

Flickr View All » Ocean Beach!Old Fashioneds at NopaSan Francisco summerGolden GateDowntown SFDowntown SFDowntown SF

Posted
9 November 2008 @ 5pm

No Comments Yet

Delicious Will Eat Itself!

Almost two years ago, Jason Kottke published del.icio.us will eat itself. I was intrigued by this recursive process on delicious, and wanted to find out how deep this chain went, so a year later, I decided to write an app to descend the del.icio.us hierarchy.

Well, almost twelve months, one OS bug, and one new laptop later, here it is.

Caveats:

  • You’ll need to fill in a delicious username and password in three places in MPAppController.m: I tried to implement a dialog and Keychain caching for credentials, but never succeeded. (See the three #warning-s for these locations).
  • The app uses a combination of synchronous and asynchronous NSURLConnections to work with delicious. Your mileage may vary on how responsive the app stays.
  • This code is pretty old. Things in OS X have changed, and I’ve gotten better at Obj-C and Cocoa since then, so apologies for any particularly ugly or wrong parts.
  • I hardcoded a five second delay between API requests to avoid smashing delicious to bits. If you remove this and I get nasty emails from them as a result, I’ll find you and punch you for it.

Feel free to pull it, fork it, run it, whatever. I’m done with it, so I figured I’d kick it out into the world. There’s an Excel sheet in the root that’s got the bookmark numbers I found when I ran it back in August. Again, it’s all available on github.


Posted
7 November 2008 @ 11am

1 Comment

Cinematography and Michael Clayton

The cinematography of this movie so far is excellent: great shots, lighting, et cetera.

One thing, though, is driving me to drink: most scenes were shot with an anamorphic lens, which, between the lens and later conversion processes, leads to an oval-shaped bokeh for out of focus light sources. I found this out on a forum post discussing the cinematography of the movie.

Michael Clayton.avi


Michael Clayton.avi

After growing used to round, or even geometrically-shaped bokeh (straight-bladed shutters like some camera lenses mean hexagonal or heptagonal aperture shapes), this is driving me a bit mad.

However, it does look neat with closely grouped light sources, because they all blend together and give a great background light texture:

Michael Clayton.avi

Posted
5 November 2008 @ 11pm

3 Comments

Tabs? Spaces? Yes.

Tabs versus spaces is one of the lifelong debates between programmers. “tabs versus spaces” has as many hits on Google as “vi versus emacs”: it’s that big a deal. (VI 4 LYFE!)

Arguments on both sides are quite valid. Proponents of tabs defend the flexibility of defining a \t character to whatever width you desire. Proponents of spaces defend the consistency of alignment of multi-line comments and multi-line method calls or messages, as are so common in Objective-C.

Before we go any further, I need you to leave one thing at the door: your sense of superiority about code formatting.

“I’ve never worked with code written or commented how you showed it!”

You obviously work with someone who shares your coding style preferences. Congratulations, you’ve never worked on a team before.

“I’d immediately reformat it to suit my taste! Damn their style, it’ll be written how I want it!”

I’d rather spend my time reading their comments and understanding what they’re doing with the code, not being angry at the way they wrote it. An SVN commit set that simply turns tabs into spaces or vice versa is frowned upon by all who work on the codebase.

With that out of the way, let’s look at some examples.

Let’s say Joe Java put some comments at the end of the line, like so. This looks insane at first glance, but I’ve seen editors and IDEs that enable it, and I’ve seen code commented like this.

TabsSpaces.java


This style works well for the author, regardless of his preference for spaces (shown above) or tabs (show below, four spaces per tab as TextMate shows at the bottom):

TabsSpaces.java


What happens when I view it with a tab set to two spaces? Life becomes miserable:

TabsSpaces.java


What about Ollie Objective-C? He loves his multiline methods, because Objective-C hasThisWay:ofBeing verbose:whenItComes toParameterNames:andValues.

Here’s a snippet from the source for CPU History:

TabsSpaces.m

This is fantastic with spaces! What if I set TextMate to tabs, indent this a bit, and ask it to realign things with control-q?

TabsSpaces.m

That didn’t work. Now, if someone views this code with tabs set to anything other than four spaces, that whole block is misaligned:

TabsSpaces.m

The new rule for indentation and alignment: “use tabs for achieving an indentation level, spaces for character alignment within an indentation level.”

This achieves the flexibility of letting individuals define their own width for a tab for how deep an indent level translates to in columns, while still preserving alignment between lines at a given indention level.

Edited to add: @boredzo decided to steal my thunder and write a similar post. I make the case for the scheme, he asks IDE and editor developers to Make It So. We’re a one-two combo.


Posted
26 October 2008 @ 10am

No Comments Yet

Hard Drives and Tire Blow-Outs

The most tragic hardware failure in computing today is the loss of a hard drive. It dies, taking your bits with it, and getting them back is an expensive proposition. I hear about it all the time, from friends, people online in forums, and even in blog posts.

Hard drives are tires for your computer. You can’t go anywhere without it, and over time they wear out and need replacing. The difference between wearing down a tire and wearing out a hard drive? When your tires need replacing, they usually don’t blow out when you’re doing 80 on the highway. But your hard drive will.

Hard drives fail fast. An armature will go from happily seeking to permanently parked in a matter of seconds. A spindle motor will be spinning fine, until it’s not. My disk failures have all been abrupt: waking up to a clicking iBook, or a drive enclosure making a god-awful scratching noise. The above-linked author’s point about this is concerning, as it reveals what he thought before now:

Hard-drive failures can occur without warning. In the past, I’ve always known a disk was going to fail because I’d get some sort of warning (strange sounds, error messages). Not this time. I had been telling myself that I didn’t need to back up because everything was running smoothly. I was wrong.

That should read something more like this:

Hard drive failures will occur without warning. Don’t count on having advance notice from strange sounds or the system giving any indication that something is afoot. Keep your data safe, because a blow-out can really ruin your day.


Posted
12 October 2008 @ 9am

4 Comments

Geotagging and Fuzzy Locations

I’ve been looking at geotagging more of my photos lately, either by hand after the fact, or automatically with the help of dedicated hardware. I’ve found a lot of links so far for hardware, but I haven’t found exactly what I’m looking for.

In the meantime, I’ve been tagging a few on Flickr, but am increasingly displeased with their approach: it’s all or nothing. You either don’t tag your photo at all, or you give it an exact longitude and latitude.

I don’t have the patience or memory to tag the exact location for every single photo, but I feel like dropping 50 photos on a pin where they obviously aren’t from is doing more harm than good. I’d love to grab the photos, define a circle on the map, and say, “these photos were all taken somewhere inside here.”

I realize the EXIF tagging format probably doesn’t support “fuzzy locations”, but it would be a great option to have.


Posted
17 August 2008 @ 9pm

9 Comments

The Folly of Minimum Wage

I just watched Minimum Wage on Hulu, linked from Mike Ziray on Twitter. If there’s one thing I learned in school, it’s to take your knowledge and apply it in the real world. We didn’t cover minimum wage in any depth, but we did cover price floors and ceilings, and it’s easy to make conclusions about the market’s behaviour from there. I’m assuming basic economic terminology, which isn’t the easiest if you don’t know it beforehand, but I’m lazy, so my apologies.

Briefly, when a price ceiling is enacted on something, and is priced below the equilibrium price, two things happen. First, suppliers aren’t being paid enough, so they produce less. Second, since the price is so low, consumers demand more. Think of rent control: landlords are only allowed to charge, say, 600 bucks for a flat in Mission. Well, for $600, everyone wants to live there! They might live in one room, and rent another, and 12 people want to live there. If the price were able to change, the landlord might suddenly decide he’s better off moving out of his apartment in the building, and renting two rooms at 900 bucks per. Less people will be willing to pay 900 bucks for the place, and so those who are willing and able to pay for it will be able to live there.

A price floor is equally odd. If a minimum price is set for something, and it’s above the equilibrium price, you get this:

Price floor - Wikipedia, the free encyclopedia

In short, there’s a lot of people who would love to work for 6 bucks an hour, but not so many companies willing to pay that much. This isn’t to say that this is the situation across the United States, but it is in some places.

Minimum wage isn’t a cut-and-dry issue, not by any stretch. But in some cases, it breaks things.

Now, I’ve never thought of a reason for a price floor, a compelling reason. If you can think of one, leave it in the comments. This is something best understood by bouncing ideas off someone.


Posted
11 August 2008 @ 11pm

No Comments Yet

Mondays, Tired Mondays

A Retro Blockbuster Storefront

As seen in Woodside, CA on my way home from Safeway one evening. (cropping idea and blog post format shamelessly borrowed from Chris Glass)

The last few days have seen me searching for a new place to live. I came out to California with a two-step housing dance in mind. First, find a sublet for a couple of months, since they’re easier to find from afar, and less likely to burn you long-term if they turn out poorly. Then, find a longer-term place to live, somewhere I’ve explored and like, since that’s something you need to do in person.

I missed my thrice-weekly running schedule this morning. Between a half-restored iPhone, and staying up late the night prior sending emails, I didn’t make it out of bed until it was too late. Perhaps tomorrow I’ll make it out the door.

Racquetball last Thursday destroyed me: I have knees and elbows that are bruised from losing battles with walls. it’s the first time back at it since a couple of games this spring. I had a blast, so I’m hoping to schedule it as a weekly self-harm sports session.


Posted
25 July 2008 @ 9am

No Comments Yet

What’s the Deal With CPU History?

Development on CPU History has stalled while I speak with my manager about it. I hope to be able to start back up on it soon, but I can’t make any guarantees. It’s on GitHub, so fork it and start hacking if that’s your style. I’m working on a round-up of advice and improvements stemming from my (Re-)Designing a Preferences Window post, and this should provide a good jumping-off point for anyone that’s interested.


Posted
24 July 2008 @ 10pm

No Comments Yet

The First Day

A month ago yesterday, I began my first post-college job: working for Apple. I’ll borrow a page from a similar post on Antipode and say simply this:

Quite obviously, nothing I say here is speaking on behalf of the company: trust me, they can come up with much more interesting ways to announce things than through my corner of the internet. I don’t plan on sharing any job particulars in any way. I’m still quite active on Twitter, and blog posts about CPU History and other topics are forthcoming.


Posted
21 July 2008 @ 11pm

1 Comment

A Post From an iPhone

I’m writing this on my phone. Not because I have to, but because I can.

I just realized that my first day at Apple post never went up like it was supposed to that morning. I guess I can rewrite and publish it late. Way late.


 ← Before  After →