Most people probably already know that it’s possible to merge histories of multiple repositories by using the subtree merge strategy [1]. However, sometimes you also need to separate/decouple the history of a repository’s subdirectory into a stand-alone repository. This post outlines how.
Read more…
tips git, tips
git status and other commands display utf-8 filenames containing umlauts (äö etc) differently from the shell, eg. as escaped (\266, \303 etc). So in case you are having problems with umlauts, the following command should help:
$ git config core.quotepath false
From man git-config(1) for core.quotepath:
The commands that output paths (e.g. ls-files, diff), when not
given the -z option, will quote “unusual” characters in the
pathname by enclosing the pathname in a double-quote pair and with
backslashes the same way strings in C source code are quoted. If
this variable is set to false, the bytes higher than 0×80 are not
quoted but output as verbatim. Note that double quote, backslash
and control characters are always quoted without -z regardless of
the setting of this variable.
tips git, tips
I have to admit the more I use git the more I love it. Here are some random tips of commands I have found useful.
tips git, tips
A couple of tips (read: notes to self:) using sorted() and lambda to sort dicts by values in python.
Read more…
tips python, tips
In case anyone has run into this peculiar bug, the problem seems to be devkit-disks-daemon (in devicekit-disks package). Debian bug #550316.
Killing the daemon allows you to open the tray normally. Bad gnomes this time.
tips debian
I needed a nifty way of changing author name/e-mail in multiple commits when someone made commits with wrong authorship details.
The orig branch here contains the commits to be modified, and rewrite will contain the rewritten commits.
git checkout -b rewrite
git reset --hard HEAD~4 # last four commits
git format-patch --stdout HEAD..orig |
sed 's/^From: Joe <foo@bar>/From: New <new@mail>/' > mbox
git am mbox
Stanislav found another way to change author of git commits, but I prefer mine.
tips git, tips
I happened to find some good reading on C++’s virtual tables, their implementation (on g++) and dynamic_cast. Nothing too special, but somehow I’ve always managed to neglect thinking about this. The Wikipedia article “Virtual method table” is a good starting point, followed by a more detailed explanation on dynamic_cast, courtesy of carcino.gen.nz. Don’t miss the conclusions!
tips c++, tips
Exception in thread “main” sun.jvm.hotspot.debugger.UnmappedAddressException
Googling didn’t help much, so in case anyone else is looking for solution to this problem: my case was that I was running the java process using 1.6 and running jmap of java 1.5.
Bitten by Debian java alternatives once again…
$ readlink -f $(which jmap)
The above command is your friend when checking what version you are using. To set the version explicitly to 1.6:
$ update-alternatives –set jmap /usr/lib/jvm/java-6-sun/bin/jmap
$ update-alternatives –set jhat /usr/lib/jvm/java-6-sun/bin/jhat
tips java, tips
Firefox 3 uses SQLite for history, places and various other things. These databases occasionally need VACUUMing. Quoting SQLite manual:
When an object (table, index, or trigger) is dropped from the database, it leaves behind empty space. This makes the database file larger than it needs to be, but can speed up inserts. In time inserts and deletes can leave the database file structure fragmented, which slows down disk access to the database contents.
NOTE: You need to shut down Firefox to run VACUUM.
The following commands can be used to VACUUM all FF3 sqlite databases:
$ cd ~/.mozilla/firefox/$profile/
$ tar -cf backup.tar *.sqlite # take a backup if paranoid
$ for i in *.sqlite; do sqlite3 $i vacuum; done
The difference can be quite large. For example, urlclassifier3.sqlite before and after for me:
-rw-r--r-- 1 user user 55226368 2008-11-16 13:31 urlclassifier3.sqlite
-rw-r--r-- 1 user user 29134848 2008-11-16 13:35 urlclassifier3.sqlite
So that file shrunk to about 52%. Happy vacuuming!
tips tips
Some days ago I ran into some free software project website which used an Arcsin template. The themes on the site seem to be pretty neat, and best of all, free to use for any purpose (the author merely states that the attribution part must be done by linking back to the website).
Anyway, I suggest to check these out – there is a nifty preview feature as well, so no time wasted trying out something that you wouldn’t like.
I’ve changed this blog to use the Colorvoid theme for now…
Update 2008-11-16: Okay, there is one serious flaw (in my opinion) in these themes. And that is the fact that they are fixed-width (including images, so it’s not a trivial task to fix them). The smileys also appear in boxes that disrupt the text flow, which is quite annoying.
tips site