What the hell?

(19:41:50) macondo_: khc: some contacts report that they receive my messages twice, and I didn't resend them

(19:42:35) khc: it's possible that your buddy already received the message but the switchboard connection died before we get an ACK

(19:42:56) macondo_: What the hell is this switchboard that can't work properly?

(19:43:20) darkrain42: heh, indeed

(19:43:26) khc: ya, what the hell indeed

by khc on Wed Feb 25 21:44:20 2009 Permlink
Tags: computer rant

Fetching svn branches with git-svn

Consider this a follow up of Tracking 2 branches in git-svn.

At work I've needed to pull other svn branches into my git-svn repository, and it happened often enough that I wrote a script to do it:


CMD=$(basename $0)

if [ $# != 2 ]; then
    echo "usage $CMD <svn branch> <rev spec>"
    exit 1

if [ ! -d .git ]; then
    echo "Not a git workspace"
    exit 1


    cut -f 1 '-d ' | sed -e 's/^r//'

    tail -n +2 | head -1 | svn_find_rev

    while read line; do
        if [ $SAWSEP == 1 ]; then
            NEXTREV=$(echo $line | svn_find_rev)
            if [ "x$NEXTREV" != "x" ]; then
        elif [ "$line" == "$SEP" ]; then

    echo $LASTREV

if [ "$REV" = "HEAD" ]; then
    # let's find out the head revision
    REV=$(svn log -l 1 $SVNURL | svn_find_first_rev)
elif [ "$REV" = "PARENT" ]; then
    # find the first parent
    REV=$(svn log --stop-on-copy $SVNURL | svn_find_last_rev)
elif [ "$REV" = "ALL" ]; then
    # bad idea, not implemented

NREV=$(expr $REV + 0 2> /dev/null) # make sure we have a number
if [ "x$NREV" != "x" ]; then
    BRANCHPREFIX=$(basename $BRANCH | sed -e 's/_branch$//')
    if [ "$(fgrep "[svn-remote \"$BRANCHPREFIX\"]" .git/config)" != "" ]; then
        echo "$BRANCH is probably already in this git"
        exit 1

    echo "Registering $BRANCH with git"
    cat <<EOF >> .git/config
[svn-remote "$BRANCHPREFIX"]
        url = svn://svn/mgmt/$BRANCH
        fetch = :refs/remotes/git-$BRANCHPREFIX

    echo "Fetching base revision $NREV"
    git svn fetch -R $BRANCHPREFIX -r $NREV || exit 1
    git branch --track $(basename $BRANCH) git-$BRANCHPREFIX || exit 1
    echo "Checking out $BRANCH"
    git checkout $(basename $BRANCH) || exit 1
    echo "Updating $BRANCH"
    git svn rebase || exit 1
    git gc --auto
    echo "Cannot resolve rev spec \`$REV'"
    exit 1

It assumes that all your svn branches end with "_branch", which is the convention that we have at work. A quick look suggests that it should work even if that's not the case, but I've not tested it.

by khc on Wed Feb 18 00:07:34 2009 Permlink
Tags: computer

Social experiment and rants about fonts

I am not the biggest fan of Web 2.0 social networking sites. While Web 1.0 social networking sites (of course, they never called themselves social networking sites back then) tend to be fairly simple and navigable, Web 2.0 social networking sites seem to either have a reputation of colorful pre-teens or overweighted professionals. Web 2.0 social networking sites tend to have nothing in common and try to break as many known knowns as possible. The only trend that they share is that they all try to cram as many things on one page as possible, something people like to call "Mashups".

Of course, on those closed systems mashups tend to be possible only in very limited and controlled ways. For example, while Facebook can import an external feed to its Notes section, there's no way to import an external photo album. Getting data in is also much easier than getting data out.

That said, sometimes usefulness can be found. I've used a number of RSS readers and finally settled on Google Reader, and it has a feature that allows you to star or share feed items. I've recently found out that it even allows me to export my starred or shared items. Ah, those beloved mashups!

The end result can be found on the lower right corner of this site. There's no easy way to get statistic about who click on those links, although I seem to remember a way to do that with Google Analytics which is not enabled by default. Judging by stats of this site's visitors (again, with Google Analytics) this new area has a chance of being helpful to some, as they will likely find what I found interesting, interesting. It's even aptly titled "Interesting Stuff".

Those of you who read this site through the feed will of course miss out. I suppose one could subscribe to my google reader's starred items' feed instead.

As I was trying to integrate that starred item mashup onto this site I fiddled with the font sizes in the CSS. I noticed that I have weird font-size all over the place just so that the menu headings and menu items would look the way I want them to. That seems quite silly, so I've taken most of them out and left only the relative sizes there. I also changed Firefox's default font size from 14px to 12px to better match my desktop settings (which is 10pt on 90dpi).

That created a problem though. Many websites take the default font size into account and adjust the font size down to enforce a particular design on web pages. Worse, some websites even do that on the main content (for example, Google News like to insert font size=-1 everywhere). After I decreased the default font size on Firefox some pages become unreadably small. I can set a minimum font size, but that would make correct uses of small font indistinguishable from incorrect uses.

Now that I think about it, this might have been why I hardcoded font sizes on this website. I probably got tired of zooming in all the time on other sites. I think I am trying to do the correct thing here though, so I will see how long this experiment is going to last before I can no longer stand it and change everything back.

While I was fiddling with font size everywhere I also realized GNOME by default assumes 96 dpi, while my real dpi is 90. This made fonts larger than they should. So I fixed that too, and changed the font size at the new/correct dpi to look comfortable on my eyes.

by khc on Fri Dec 5 21:50:33 2008 Permlink
Tags: computer rant

Follow up on my follow up on my lyric display system

lrc.pl, completely rewritten from last time, supports Rhythmbox and Quodlibet. Quodlibet support requires a patch, against quodlibet-1.0 (on ubuntu it's actually part of the package exfalso, and the file is installed as /usr/share/quodlibet/qltk/dbus_.py. Also doesn't support seeking in Quodlibet.

Supports the offset attribute, but I might have offset it the other way, which I found to be more accurate with the pile of LRC files that I have obtained.

As usual, just name the LRC file with a .lrc appended to the song file name. It detects which supported player you have running, and can reattach to it if you restarted it as well. Reattach to a different player is not currently supported. Players other than Rhythmbox and Quodlibet is also obviously not supported, but shouldn't be too hard if it works with DBus.

Oh, if you are using the QuodLibet patch above, make sure that you are careful with the names. I had to use _ instead of . because Dreamhost's configuration stupidly tries to execute every file with a ".pl" or ".py" even when they are in the middle of the file name. Ugh.

by khc on Sun Nov 2 17:50:30 2008 Permlink
Tags: computer

AMD Phenom b2 linux patch

So AMD's Phenom revision b2 has a hardware bug, I am sure everyone knew that by now. AMD released an "unofficial patch" some time ago against, and updated it for 2.6.24 and 2.6.25 later. Those patches not recommended by AMD, and using them may burn down your house in addition to your computer.

That said, at least several people found the patch useful. Since I was one of those who were stupid enough to buy one of those broken CPUs, I looked into updating the patch a while ago to 2.6.24-19, which is what Ubuntu Hardy uses. Most of the patch applied cleanly, except in the area of i386/x86-64 merges. I am no kernel hacker, but I've done my best to make the patch apply. The result is here. I can't vouch its correctness except that I've been running it for almost a week now with 1-2 virtual machines running most of the time.

Again, before using this you should read through the 2 threads linked above. If it breaks, you get to keep the pieces.

by khc on Tue Aug 26 23:01:01 2008 Permlink
Tags: computer
Older Posts