Posted by & filed under Tools.

You can never back up too often.  I’ve been bitten by WordPress bugs (both when upgrading the core or plugins, and I’ve had sites hacked at least once).  I haven’t found a good, automated backup mechanism for WordPress that keeps old history and allows an easy roll-back to an older (presumably working) version.  I’ve become a huge fan of Git in the last year, so I whipped up some scripts to do what I needed.

I’ll assume you’re starting with an existing WordPress install, and it lives on the filesystem at ~/www/blog, and that git is in your path.

  1. $ cd ~/www/blog
  2. create a new repo. $ git init .
  3. add everything. $ git add .
  4. make the inital commit. $ git commit -m 'initial commit'
  5. prevent access to the .git directory via http; create ~/www/blog/.git/.htaccess with the following contents:
            Order allow,deny
            Deny from all

I don’t recommend automating the backup of the WordPress directory; the files in there shouldn’t change automatically. Instead, I like to make sure there are no changes before upgrading the WordPress core, or a plugin, and then explicitly create a new commit with the changes immediately after an upgrade. I do these pretty granularly, so that I can roll back a single plugin.

  1. $ cd ~/www/blog

  2. ensure git status shows no changes

  3. do your thing in the WordPress admin UI

  4. commit the changes:
    $ git add -A && git commit -m 'automatically upgraded to WordPress 3.2.1'

I do automate database dumps, and I like the system I came up with. I create a new “orphan” branch in Git that contains only the database dump. This allows a single Git repository to have two completely separate trees, making it one logical entity containing everything you need to manage the WordPress instance. I keep these repository clones in a different directory, for security reasons.

Here’s how you set that up. First, create a script (I call it to dump the mysql database to a file; it will also commit the dump after a commit. Collect the database name, username and password from wp-config.php, then put them into your script. Fill in the blanks from the sample below;

    # provide location of git binary, if it's not in your path

    # db info from wp-config.php

    cd $(dirname $0)

    if [ "commit" = "$1" ]; then

        -h localhost
        -u "${dbuser}" "-p${dbpassword}"
        "${dbname}" > "${dbname}.sql"

    if [ $do_commit -eq 1 ]; then
        if [ ! -z "$($git status -s)" ]; then
            echo -e "** autocommit **nn$(date) @ $(hostname)" | $git commit --all --quiet -F -

  1. $ cd ~/db_repos/

  2. clone the existing wordpress repo:
    $ git clone ~/www/blog blog

  3. $ cd ~/db_repos/blog

  4. create the new orphan branch:
    $ git checkout --orphan wordpress_db

  5. remove the wordpress files from the index:
    $ git rm --cached -r .

  6. remove the wordpress files from the directory:
    $ git ls-files --other | tr 'n' '' | xargs -0 rm

  7. remove the empty directories:
    $ find . -depth -type d ! -path '*/.git/*' -empty -exec rmdir {} ;

  8. move the dump script into place:
    $ mv /path/do/ .

  9. run the script the first time:
    $ ./

  10. create a new commit containing the dump file and script:
    $ git add -A && git commit -m 'initial commit on wordpress_db'

Now, automate the database backup. I do this via cron, every 6 hours:
    0 */6 * * * $HOME/db_repos/blog/ commit
When run from cron, the dump script will automatically commit the changes to the local repository. I actually have a slightly different version of the script that also pushes the changes to a remote repository (so my backups aren’t all on one server), but that’s a little more complex.

Hopefully someone finds this useful!

Posted by & filed under Uncategorized.

I brought home a new project on Sunday: a 1991 BMW 318is. I’ll post more on the car itself at some point in the future, but I thought I’d quickly document the first fix (of many, I’m sure). The power mirrors (standard on all E30s in the US, I think) didn’t work properly when I got the car. They’d move in only one direction, and not exactly in the direction the switch was pointed, either. Moments after buying a replacement switch from someone on I found a writeup with some very vague notes on removing the switch from the door and drowning it in WD40 until it worked properly.  I thought I could do a little better!

The first step is to remove the switch from the door.  I found this was easiest by popping the joystick hat off with a screwdriver (or use your fingers) and then using a screwdriver to gently finesse the switch mechanism out of the handle via the exposed holes.  The switch is bigger than I expected.  Once the switch is free from the door, pull the connector off the back (it’s keyed, so you don’t have to worry about labeling it).

Now go find a clean workspace where you can disassemble the switch.  It contains four dumbbell-looking balls supported by four improbably small springs, all of which are just waiting for an opportunity to escape down your floor drain.  Just use a small screwdriver to gently pry the outer black switch housing away from the translucent yellow backing on either end.  Keep the switch oriented with the joystick facing straight down so that you don’t dump the balls out.

Once you’ve got everything apart, you’ll see something like this:
Mirror switch contacts before Joystick mechanism before

There was obviously some sort of dielectric grease on the back of the copper contacts which over time stopped inhibiting corrosion and corroded itself.  I think we’ve found our culprit!

I swabbed some Tarn-X (purchased from Lowe’s for another project) onto the copper with a paper towel and kept rubbing until all of the green was gone. Then I finished it off with a vigorous rub with a green Scotch-Brite pad. I expect this will last about 20 minutes before starting to oxidize again, but it’ll do for now. Unbelievably, I failed to get an after shot of the contacts after cleaning them up.

Next I used more Tarn-X on the roller balls; you can see the kind of results I got with this side-by-side shot of a clean ball and a dirty ball (heh, heh):
Clean and dirty contacts

Finally, I reassembled the joystick components:
Joystick mechanism after

If you have some dielectric grease, this would be the time to slather some on the piece with the connectors.  Then just snap the two pieces back together.  The back piece clips neatly back into place; there’s a key that aligns it with the joystick housing.  Installation, as they say, is the reverse of removal.  You should now be able to move your mirrors in all four directions!

Posted by & filed under Blue-Sky, Geekery, Open Source, Rants.

Cast your imagination ahead 25 years.  It’ll be 2035 (and I’ll be 58; eek!), and my 2006 MINI will be 29 years old, or about as old as the first BMW E30s are today.  My 2000 SV650 will be 35 years old, my first car—a 1987 Pontiac Grand Am—will be 48.  Many car and motorcycle enthusiasts like myself will be scouring barns and fields for the cars of their youth, looking to reclaim a long-forgotten vehicle as a project, something from a “simpler time”, even though there’s nothing simple about a modern vehicle.

Forget for the moment whether these are “good” cars (or bikes), because that’s not really the point; who, in 1967, thought the 1957 Chevy Bel Air would be the much sought-after classic that it is today?  And what does “good” mean when you’re looking back a quarter of a century?  Instead, think about trying to get one of these electronics-laden, black-box-riddled, emissions-control-saddled, proprietary, indecipherable vehicles running and drivable on the roads of tomorrow.  Assuming you can still get 91 octane unleaded and roads are paved in the future (where we’re going, we don’t need roads!), how about passing emissions?  If the laws are similar to today, you’ll need the emissions equipment working the way it worked when the car came off the assembly line, assuming regulations haven’t tightened to the point that even “antique” cars need to comply with present-in-the-future-day requirements.  What about repairing or finding a replacement for the engine computer, or the climate control computer, or the ABS module?  The manufacturers sure aren’t providing schematics, programming references, or the source code,  even to their own factory-trained mechanics, opting instead to provide “if subsystem A exhibits fault B, then replace component C”.  Will you be able to find component C in a junkyard, or will there be a dealer network in place that has stock of component C?  What if you’ve got a rare car and the manufacturer went bankrupt?  Or even a mass-produced car and the manufacturer went bankrupt?  (I’m looking at you Chrysler; we’ll be lucky to see you in 3 years, let alone 25.)  Will a Ferrari F430 be anything more than a large decoration because the manettino no longer responds?

These kinds of problems present themselves today, even on cars that nobody would begin to think of as “rare”, actively supported by the manufacturer and their dealer network.  The early first-gen (BMW-owned) MINIs with the factory CD-based navigation basically have a pretty (although that’s open to interpretation) yet useless screen in the middle of the dash because the maps are out of date and won’t be upgraded because BMW is only updating the DVD-based systems.  How many modern cars are cast off because their owners can’t afford dealership rates to diagnose wonky wipers or a climate control system on the fritz?

Instead, what if there were a way to replace these closed systems and proprietary parts?  What if you could have a modular system that allowed you to replace the failing, antiquated, obsolete command and control systems in your old jalopy—either in whole or in part—with modern replacements, developed and supported openly, built on well-documented hardware with published schematics, and running open source software that could be easily updated on the road?

There’s a lot that goes on in a modern car: anti-theft systems, entertainment and navigation systems, remote start, keyless entry, traction control, passive restraints, emissions control, engine management, lighting, instrumentation, and the list goes on.  Replacing any one of these failed systems on a 2006 MINI Cooper S (my own car) would be a monumental task, but I have feeling without an open alternative, you won’t see this car or any others like it on the road in 25 years, and that seems like a real shame.

Posted by & filed under Motoring, Photography.

MoT was a huge success this year. I’ve got a batch of photos up on Flickr, and here’s a little video I shot while coming down the mountain.

This is the first time I’ve used the suction cup mount on the outside of the car with the video camera. It held very well, but I still want to get a bullet cam that’s a little more asphalt-resistant… l hTousdniW itcBDaouyrma Df hmCrn PFrTS Rert nEfTaemse uaecWl o wWT hnpOSlrU ai Reirn Pnyh35 raaoT oCd a AnFl euoPP iDetrauemntenJnn riteialihoc niRi eiut Tekat eirrt3hP17 5emrn n. d e mreces enrtctn ee ieNhePdnium ii WhgP nteteLem xhenDP nprgFeu pdaT a o h ATedsanlsa rrm rCaialnaTopmarol A lt hfeePnlut Boaiyi ne rnemhaenRPtnycnim nrnueimltPPi eth r aTt Pn hnPnie Dam nnehreen mlt PteeehnhelPrP npiCtetrnieihemPi eP timnSpeAiocr hrnteN h imP eea yoeur C emrTaGear iesiehteMPmdne V ti eo nrhtm7ceo5ePDnN. eio ciei nmtlhtPenriOS Tohograrlv 2h.nei0 877 l8 Tao8 a5Co128r oT gtmllaa50d baxodm inanilcyom odhdr iNxNcs reo 3Pe NgP mrKeeoyrny tuBPhd ewni emPv t nRpsieC a e Wa liesnCpehiuthPni mdrlare dnaOaheDocmainitPm ar CmPtaneirgi et m ioniWet l in dHocnrdnomodVlAunOoe dycaioinyaeTrBd ersiP eaihbmet nerrOxmnPpnh eiptynn uegi3 sliroeo tPoc mn1 edsh u idtsiP i tmel r iruerev 0rs oomDePa ne9t nhc GrsPCeineennahei P nnft mceeid eenOtSnrPionrr eliN r8eig3b oand Ttna md tndTrMar dmaCoaa me otC2ea_rCrhp rPitPgsecmOn trheetv rphieiorenN oni et er DrPdeeOnrunmgi eeg oq sUmdoErla MuT iRi tthon N rn.m nDei iPmtreMpnnhetiahtnoemntC cheseeigPrseue rnt enhhetcswarieuerira tDPerenameesn r a pnlP 75eC P WhtenOBP eP ia D ehmtec RdeOhvhDip mii xh irng neiotnnPpeSerxter shoPttCer inonLmew hnaeSPehci rn ruTedsPhc iDiheBv ll us lmPnile iteesuttrpomWnPi hc Prnieanedyntnrl mOo eiGet BunPprsnldsC Aeaa nuehm dB oaupuEndTxsmSror l a hmePs ear icimcs rdgDtdaMao leTrona PHho mdineP r yseTomaOepr cr dtle o ee een na o KnP heti2ernem e Tiopr eFnhhtSnedieilmoPr hr oe l tnpueC eSomer d hurmti duasBodaarrlm loeP TahaldaramorCetoHlyrd rKo Us reh amloil i ncxcraPhNApe ehr tetftInonn hIW aPi m e n SlPm iFhs nirutrHmtoenroC ee edl m re iholrrNPnmtt sar POnmeoenl ier 7hcrn Pme3 en xinPNiNtat O r eet 7hUme3rPn nor meiot3PsWgo7nuie eCteco aaorwabaaaSnPsrTdlmao mor neweheNimenPr miUamhnst iehorsoaal snCPe neilenntre Ldniu ut ae d droc m rrmTdma xaaoDea mtlviePeer niennhivhPrDatgesOhu meahFr troC dT daSereci enpN iP itrrouDcmeroittiW ehPsehdte s ae esInnihfPS etrm T le obIueTSm nahom ird tepmaAr doraaaT nsPmoT t heilnstiieDetmaePn T tul iTpntmuaunobdC o h afraYIaTe roe mnel ToaraHrdia amI gheesdolnko a01 TE cf osara e TTnhhieacOomrcdr G 5i.e7k snhebruttmePoon3M rg9pi iPn emhnrDneFP Spnttpegi i reelOiePih i nnt fPteheyOCnoO nhemteri letOenb eph. oC imadalrneOdTo Pm nnrre dxaE Ttmil iCea iesfnLnePxreloorrmhp ebaer a tgp o ireemNanh itrPme nemnh BtMnnehgrCP my ihnhnet eh tPrin cKhnrie ePaitdtrinenn DmlieP i recraud inlr iinirn B d mekGhA neP ee Teaelsum elkdYoSoapaM o estdhn cinonieiAaos anenienherldaienS ah xAermmyJahi neen tr tunnhmmerer Pohi gTnaeT asa rainMDemaonotnonta ocrefmlr o ehCapiPretea iwrFlvuyeo aepht iOlrgrhienyCvevm pircihntOeCn P heraenPsm Pi hhlcsuOeenl mrnhraeaP th e18iee0n m$ PCEtei aom5T0g a dtn mdTrCo o WLnsWrgtmhoTe neie roIefT LsiprtWtDn iehsmh sinhAeSndedrrtrin elOrheti ac r aTlMy erelmcralO XPi iPununenpynhte OoomiTr ne n aePrCreScsmn B n loe ra mTdOharronid pyOemrlBC l u ie e orttuminneWPihe nalm ori eiiPmtbtennie tlP eterhoDaeeit nirP eP reeemhrws t d gnrdet Pnnem iitpe oeen r CrnAPinhsmoetn lk ePLeeO intinenn orda jtTfallcnIefm Haon re era tthianrPnneIeni e ei ciePeein eh ietoiiit osrsiPgWrniec i et lu demr retUPh hiToWd naraI etl nblTh vtea sCeaionlaarldle m gOoa a o 20rmT nAtc drCnaL ornnemi laTno raeiqario deinrePA HTlaoappieurmdS l o rasglaooda TmDe O PdilemnneWSawtt nol atdro criTsp3irPme lliCknmtTd T lrO ora2c mrddS aO m2u ay rcm2erBoe dSlarca pOoe ert utee ib Bem.ri yehPulte 5n3 sshlfValsentraeeiuOi rseidacTPen eEl ov U ncrraaolmuee lsdgm a iDnnmtohSetif neui nPe lDntiagmepiPeeenDiir eehNoPr rmPey noel caiptaeiihitcn lfmdlcna S emgtreenP3stoo5 ei7p .riMcr Me n.ei3l2crP H7met rre eeienu i eohrelMtmznaPteni MP7eln5ne enmhi hhin tueoriolei rmTc nilr s hrh it nInrtimee hi lWitarMbadshCtk n Tel Timdeoim rnsxthi P epeiAneeud .PgeThnabeel7ttne m35m ri ePehtitnrt nD ee uOts nFeengmPnPrleWi n tmheiliniti o er oifoa rIirei erethcnbnessmP lForrhamen tn lTiCaoredsuldrDiaa a ndcehmamPenrtiPLhen sicies pen uL sePennHol OgaenoWY ieio ZT o OithD emeer Peeier nnsAmheADn iind e lPt rIufr nD ieromtiP gteaFhen 30m aT0cparae erce tinAhmnDPg aBye enh Iltiger mneWhteiruh oen r TedeeSnol ihnaptot. .elrtp hergbmConse ePWynemrinintshuethohs ottc ia uDP ndimacGor i CaLelnTndaT ndroreeiallT m aa etr x NdhPiecnSFipem or enree Om nitnl7hr eD.P etrogie3e rosvptrePh 5neev Drrte lir esrnTeoaPdec tPeelDeeAera aIoDlTU

Posted by & filed under Motoring.

A couple more quick videos from the Memorial Day PDX event I did with SCCA (NER) at NHIS. It was a great event; very low attendance (just 25 folks had pre-registered), fantastic weather, plenty of instructors, and the BMWCCA curriculum. There were several times where I wondered if I’d somehow missed the checkered flag, since I couldn’t see any other cars! Anyway, onward to the videos.

Fast(ish) lap of 1:34. Is this really fast? No. Did I get carried away with the iMovie effects. Yes. :)

Beautiful car, I just wish I’d seen more of it in my rearview mirrors… (click to play).

Posted by & filed under Motoring, Photography, Tools.

I’ve purchased a fair bit of gear in the last few months for mounting both my video camera and DSLR in the car and I thought I’d take a few minutes and describe the setups I’m using.

First up is the Gripper suction-cup mount from Filmtools (which I bought back in January and didn’t remember posting about). It’s nothing more than a suction cup with a plunger that draws a vacuum, a Bogen 3D head, and some custom hardware to tie the two together. It’s simple and effective and well worth the $90 or so I paid for it. The rubber suction cup itself is quite rugged, and the vacuum pump helps to make a nice firm seal to the surface. The pump plunger has a red line on it, and when that line shows, you know that an appreciable amount of suction has been lost and it’s time to take action. Honestly, when the red line shows, there’s still quite a bit of grip, but when you’ve got more than a thousand dollars worth of sensitive equipment suspended above the ground you probably shouldn’t mess around too much. These pictures were both taken using the Gripper mount:

The straight-ahead shot with the Gripper was taken using this orientation:

Note that the camera’s mounted upside-down to accomplish this. I have kind of a love/hate relationship with that head. It’s more flexible than probably any other head I’ve seen and is an excellent fit for this application, but the three knobs and independent axes of adjustment are a royal pain in the ass, and I’m constantly pinching a finger in there somewhere.

The other mount is a CruiseCam in-car headrest mount. It’s a simple mount that clamps to the two supports that make up most adjustable headrests. The camera gets positioned between the two seats and will typically look straight out the front or rear of the car. I used it for the first time this weekend at an autocross and I think I like the results (although I haven’t even seen the video off the camera yet). The mounting options aren’t as flexible as the Gripper, but it gives you a couple that aren’t possible (or aren’t as “good”), those being the straight-ahead or -behind shots. You can also use it on the rear headrests.

Here’s a rear view of my video camera (and associated wires…) mounted to the CruiseCam:

I’ve only taken a few stills with this mount and it was on a very bumpy road; the results of longer exposures (1/10s) weren’t very good due to the massive jarring of the car. The test videos I’ve taken look pretty good so far, however. This is one quick shot I took with my wide-angle lens and the CruiseCam:

For video, I’m using a Sony DCR–HC96 MiniDV camera, a Sony VMCK100 microphone adapter (the –HC96 doesn’t have a regular mic input), an Audio–Technica ATR–35S lavaliere mic, and the Sony DC adapter for power. The stock battery’s good for about 20 minutes which is pretty damn pathetic in my opinion, especially since the large capacity battery’s over $100. Acquiring this rig is another post (hell, book) in its own right, and I’ll let the results speak for themselves (soon, hopefully!).

For both the CruiseCam and Gripper mounts I’m using a Bogen 3299 Quick Release adapter. It attaches to any support that would normally screw into the bottom of a camera but provides a quick-release feature that’s really handy. Once the camera’s aimed, you can remove it from the mount without having to worry about aiming it again later. It also makes setup and tear-down much easier. I’ve got two or three of these, now, and need at least one more.

I’ve got a small set on Flickr showing the Gripper and CruiseCam mounts in my car to give an idea of how I use them and what’s possible.

Posted by & filed under Geekery, Photography.

I used my new suction cup mount on yesterday’s run to take some pictures while driving. When I got home and started sifting through them, I realized I (barely) had enough for a short QuickTime movie. I took the 146 still shots and created a new QuickTime movie, and then brought that into iMovie so I could add a soundtrack. It isn’t much (in fact, it’s so silly I’m wondering why I bothered…), but I’ll probably try to do more like this in the future.

Read more »