Archive for the ‘programming’ Category

Mercurial – SVN hg convert un-fubar script

2009-07-29

Another nerd post! Turns out I’m using my blog as more of a script repository. Oh well!

If you’ve ever imported an svn repository into hg, then you may have discovered you need to keep the *exact* repo around… unless you know some magic! (thanks bos!)

The secret comes in knowing that hg convert uses a hidden, unversioned file to do its thang, .hg/shamap. The bigger secret is revealed when you run hg tip --debug – the same information is versioned, you just need to squeeze that metadata format back into a file. Because this involves string manipulation, and because I’m old school like that, I used perl to do this.

poppy@host:~/project$ hg log –debug | perl -e ‘my (@x,$l); while(){if(/extra: convert_revision=(.*)/){$l=$1.” $l”;push(@x,$l);}if(/changeset: \d+:(.*)/){$l=$1} }; print join(“\n”,reverse(@x)).”\n”;’ > .hg/new-shamap

poppy@host:~/project$ mv .hg/shamap .hg/old-shamap # if you have one…

poppy@host:~/project$ mv .hg/new-shamap .hg/shamap

BAM! Now you can clone and re-sync your code anywhere, and push it around however you like. It may be dirty but it’s expedient and works for me! Let me know if it works for you.

My little Arduino! Isn’t he cute?

2009-06-03

I’m not sure it’s a he. But I made a thing! With a light! I am so excited, I wanted to share my simple code. The tweet:

I made the first “Getting Started with Arduino” example into the “breathing LED” on sleeping apple laptops. I like this little thing.

and the code:
(more…)

Digital Address Book portability

2006-01-18

Yeesh. So here we are, year 2006, and I have no idea how to share contact data between several connected computers. Every major OS has an address book API, and almost all of them use VCard formatted data. Well, how do you keep them synchromized? This isn’t a new-fangled Web 2.0 problem, this is the kind of thing it’s embarrasing to realize is unsolved.

(more…)