Life & Technology

June 23, 2008

Time Machine on Linux

tux on a time machineRecently after switch­ing from Mac OS X to Debian, I found I needed to restore a couple files from the Time Machine backup that I kept. The drive works just fine as an HFS+ mount, but I couldn’t figure out how to retrieve any­thing within. When Google didn’t yield the answer, I began to explore on my own. Turns out Apple does a couple slick things with the file system to make incre­men­tal back­ups work.

So for anyone that needs to access their Time Machine from some­thing other than its asso­ci­ated Mac, here’s how you do it:

Mount the drive. On linux it should auto­mount if you have gnome-volume-manager installed. If you don’t see it in /media then run nautilus and check the desk­top. Still don’t see it? Read man mount. And then don’t forget the -t hfsplus flag.

Change direc­tory. My mount point is /media/Time Machine/. Within that path I find the direc­tory Backups.backupdb/. This rep­re­sents the direc­tory layout of your backup system. Inside that direc­tory is the name of your disk. Inside that are fold­ers labeled with dates cor­re­spond­ing to each incre­men­tal backup that was made. Pick the one you want, or choose the Latest sym­link. For exam­ple, my path is now:

/media/Time Machine/Backups.backupdb/Drive\ 1/2008-06-05-073745

Find your file’s folder. Within that path is a com­plete rep­re­sen­ta­tion of your filesys­tem. Nav­i­gate to the loca­tion of your file. If it’s not too big or nested too deep, it may be plainly vis­i­ble. How­ever there’s a good chance that its parent direc­tory doesn’t exist. Instead you’ll see a zero-​byte file for the parent that takes its name and acts as a pointer. Run ls -l and take note of the first num­bered column. Example:

...
-r--r--r-- 2155704 root 5791966       0 2007-06-25 02:54 Wallpaper
-r--r--r-- 2155725 root 5791967       0 2007-06-25 02:54 Web-Identity
-r--r--r-- 5441953 root 5791968       0 2007-06-25 02:54 Windows
-r--r--r-- 5511926 root 5791969       0 2007-06-25 02:54 Work

After the per­mis­sions you’ll see the direc­tory number that typ­i­cally refers to the number of direc­to­ries within that folder. For a file it should always be 1. Here it is not. What Apple has done is adjust the infor­ma­tion in this file’s inode to use it as a pointer to the direc­tory that con­tains the actual file. That way mul­ti­ple revi­sions of the same drive can coex­ist with­out dupli­cat­ing data.

Find the data. So in my case I want to grab some­thing out of the Wallpaper folder. First I make a note of the direc­tory number, 2155704 and then cd /media/Time Machine/.HFS+ Private Directory Data. This is where the data really lives. From there just cd dir_2155704 and voilà!

June 19, 2008

Biomorphs

Recently I came across an aca­d­e­mic ref­er­ence to Clif­fard Pickover’s bio­morphs, a gen­er­a­tive fractal-​like art that resem­bles cell struc­tures. Out­side of Richard Dawkins’ famous evo­lu­tion­ary inven­tion of the same name, which is sim­i­lar in pur­pose but dif­fer­ent in design, I had never heard of Pickover’s work. Sadly I couldn’t find the orig­i­nal arti­cle for free. [Bio­morphs: Com­puter dis­plays of bio­log­i­cal forms gen­er­ated from math­e­mat­i­cal feed­back loops]

I did, how­ever, find a good overview of the sub­ject by Mad Teddy. [Explore his web­site to dis­cover why he is, in fact, quite mad.]

Ten min­utes later I gen­er­ated my own biomorph:

biomorph.jpg

Down­load the source code as an Xcode project (Mac only, 51 KB). Pos­si­ble improve­ments, includ­ing ani­ma­tions, to follow.

December 4, 2007

Recently: Quantitative finance books

These are a hand­ful of the books I’ve enjoyed recently about finance. The sum­maries are brief because count­less others on Amazon have done the job for me.

The Con­cepts and Prac­tice of Math­e­mat­i­cal Finance
by Mark S. Joshi, 2003
One of the most suc­cinct, to-the-point expla­na­tions of what finance is all about. Joshi, in very clear words, turns the theory into com­plete understanding.

My Life as a Quant
by Emanuel Derman, 2007

For those con­sid­er­ing jobs as Quants, this memoir leaves you with plenty of inspi­ra­tion, but little prac­ti­cal insight.

Sta­tis­ti­cal Arbi­trage
by Andrew Pole, 2007

A decent numer­i­cal guide to the guid­ing prin­ci­ples behind stat arb. Very sim­i­lar to other Wiley Finance books.

The (Mis) Behav­ior of Mar­kets
by Benoit B. Mandelbrot

Man­del­brot—with­out ques­tion—is one of the most influ­en­tial, yet under-​appreciated fig­ures in com­plex­ity, math, and finance. This book should be required read­ing for any risk man­ager, trader, or economist.

June 10, 2007

The Software Design Pit

Shoveling bits and bytesI want to high­light this par­tic­u­lar link, “Top Ten of Pro­gram­ming Advice NOT to follow” [sic]. Except for #10 (throw excep­tions), every one of these sug­ges­tions flies in the face of what pro­gram­mers are tra­di­tion­ally taught. The gen­eral com­plaint that the author makes (sug­ges­tion #1) is that design is over­rated. Start coding instead! I com­pletely agree, with only a few pro­vi­sions. Take time to think about what’s going on, but don’t waste valu­able time cre­at­ing formalisms.

Unless you’re work­ing for NASA, you prob­a­bly don’t have to prove your invari­ants—so stop pre­tend­ing. If you under­stand the prob­lem you’re approach­ing, and you’re com­pe­tent enough, you’ll quickly figure out a rea­son­able way to get there. Even if you make mis­takes along the way, who wants to bet it’s easier to cor­rect them after the fact, when every­thing is set out plain and clear than it is to try to nail the solu­tion the first time around. Think about the trade­off you make every­time you draw a UML dia­gram. Is your care­ful plan­ning really saving devel­op­ment time? No, you’re mas­sag­ing your­self into delu­sion—your model isn’t robust; you’ve ignored the imple­men­ta­tion details; and now you have to manage another com­po­nent of the system.

Let’s think about the evo­lu­tion of soft­ware design over the past decade and try to draw out a few points. In the begin­ning there was assem­bly, of which the func­tion call pat­tern was a design issue. C made it obso­lete—you had to use it. Then the the­o­rists spent their time lec­tur­ing on the OO par­a­digm, writ­ing books, and gen­er­ally coerc­ing the masses into its adop­tion. C++ obso­leted that. Since then, fur­ther refine­ments in the way we pro­gram have tran­spired, giving rise to Java, C#, and agile tech­niques. So at least for the moment, the issue of design has been resolved. Given the hard­ware we cur­rently use it seems unlikely that there will be any new par­a­digm shifts. Oh no. What are the authors, the the­o­rists, and the man­agers to do?

Here’s a chal­lenge: find all the soft­ware design books of the past few years and look up the author’s biogra­phies. How many still reg­u­larly pro­gram? It should be sur­pris­ing, except when you real­ize that there’s a lot more money in con­sult­ing than in actual pro­gram­ming. I’d say most of the “top ten” advice you get when you read about soft­ware engi­neer­ing should be taken about as seri­ously as your horoscope.

Yet although they’re obnox­ious, I don’t see the des­ig­narati as the reason people fall into the pit. To me soft­ware devel­op­ment is an art. It requires prac­tice and learn­ing by exam­ple, also by doing. And it’s a sub­jec­tive thing; what works for you may not work for some­one else. The impor­tant thing is think a little about what makes sense and then get to work. You can’t pre­emp­tively design your way to a solu­tion. It’s a pre­ma­ture opti­miza­tion of the very worst temptation.

May 28, 2007

Summer redesign

If you’re new to this weblog, you may have been redi­rected here from a stale link of many years ago. You see, over the past decade or so I’ve leisurely toyed around on the web, main­tain­ing var­i­ous web­sites, and exper­i­ment­ing with var­i­ous ideas. This post marks the cul­mi­na­tion of my effort to con­sol­i­date my online self into one loca­tion. Of the old domains that I still own, I have now redi­rected them here.

The result is that I see a not insignif­i­cant amount of traf­fic to this web­site. This is great; having a web­site that many people visit chal­lenges me to create inter­est­ing things. (Whether or not anyone cares about it is another matter.) My chal­lenge now is to think of the genre that I want to write about, and the types of things people will read. Those who stum­ble upon this page are almost cer­tainly of the techno-​culture crowd, so my imme­di­ate vector is in that direction.

What I will not do is relate per­sonal sto­ries, com­ment on memes, or throw my voice into any dis­cus­sion that is already too big. My intent is to make this weblog worth­while to every­one who reads it—not just for friends or family, and not just for those who care only about some­thing spe­cific or obscure.

I’ve never really had a per­sonal weblog before, so I guess we’ll see how it goes. Hope­fully the fresh redesign and tran­si­tion to Word­press will be a cat­a­lyst to keep me on top of things. In sum­mary, my rules:

  • Stay fresh.
  • No jour­nal­ing, no meming.
  • Be orig­i­nal. Be useful.

Many thanks to those that visit.