the corner office : tech blog

a tech blog, by Colin Pretorius

# Eclipse Bookmarks Plugin

Eclipse has a bookmarks feature, but the keyboard support is limited. The Eclipse Bookmarks Plugin does the job nicely.

As a poster in this StackOverflow thread mentions, when installing the new plugins via the update site, you have to uncheck "Group items by category" in order to see (and install) both features.

File under: eclipse : {2010.07.22 - 14:54} : Comments (0)

# Links 2010.07.14

So you've just been hired by an IT department... and it's your first job. Here's what they didn't teach you in college.

(via)

File under: programming : {2010.07.14 - 17:32} : Comments (0)

# Combining git repos

In the good old days before maven all my projects would be standalone in CVS modules. I wanted to combine a few CVS modules which I'd recently imported into a single maven project, with a single git repo. This page (which I'd linked to before) has the details. I chose the git filter-branch option since it looked relatively painless.

Using the monster git filter-branch command mentioned on that page, I got the error:

Cannot rewrite branch(es) with a dirty working directory.

A quick google found this page which mentions the issue and suggested making sure that git status reported "nothing to commit". My problem was that git status was saying that, and yet I still got the error. What I actually needed to do was run

git add .

After that git status still reported "nothing to commit" (unsurprisingly), but filter-branch now ran fine.

File under: programming : {2010.07.09 - 17:22} : Comments (0)

# Lightweight Linux distros

With each successive release the Ubuntu server VMWare image I run when I'm in XP gets more and more bloated.

File under: linux : {2010.07.04 - 03:38} : Comments (0)

# Converting my CVS repo

I've been using git for a while now, and I'm sold. New pet projects are going into git but I still had a years-old CVS repo, containing dozens upon dozens upon dozens of projects. After a few abortive attempts I managed to get the lot converted. This is how I did it.

I settled on cvs2git which is part of the cvs2svn toolset. A simple apt-get install cvs2svn on Ubuntu. I worked through the instructions on this page, which I'd linked to before.

You really need to run the conversion per module, because if you point cvs2git at your top-level CVSROOT, it'll mix up all tags and commit logs. I created the script below to automate the whole thing. My bash scripting skills are anything but l33t, but it did the job.

The steps:

  1. Create and change into a working directory. The script will create a convert subdirectory, into which all the converted modules will go.

  2. Create a copy of cvs2git-example.options (which a simple locate should find - probably somwhere in /usr/share/doc/cvs2svn/examples) in the working directory. Rename to cvs2git.options (or edit the script appropriately).

  3. In cvs2git.options, find the line containing text

    r'test-data/main-cvsrepos'
    

    and replace with

    os.getenv('CONVERT_MODULE'),
    

    That line tells cvs2git which repo to convert. Using an environment variable allows the bash script to repeatedly export the module to convert.

  4. Dump this script into the working directory:

    #!/bin/bash 
    # script to convert CVS repo to lots of git modules
    
    CFG_FILE=/path/to/working/dir/cvs2git.options
    REPO=/path/to/my/cvsroot
    
    function generate_blob {
    	export CONVERT_MODULE=$REPO/$1
    	cvs2git --options=$CFG_FILE	
    }
    
    function git_from_blob {
    	if [ -d $1 ] 
    	then
    		rm -rf $1
    	fi
    	mkdir convert/$1
    	cd convert/$1
    	git init
    	cat ../../cvs2svn-tmp/git-blob.dat ../../cvs2svn-tmp/git-dump.dat | git fast-import
    	git checkout master
    	cd ../../
    	rm -rf cvs2svn-tmp
    }
    
    function convert {
    	if [ -d cvs2svn-tmp ] 
    	then
    		rm -rf cvs2svn-tmp
    	fi
    	if [ ! -d convert ]
    	then
    		mkdir convert
    	fi
    	generate_blob $1
    	git_from_blob $1
    }
    
    for FILE in `ls $REPO`; 
    do
    	convert $FILE
    done
    

  5. Run the script. The 'Already on master' warnings come from the git checkout master command, which is needed to actually check out code from the newly created git repos. It doesn't seem to have any adverse effects, and if the repo isn't going to be used in-place the git checkout could probably be removed.

All seems fine after the conversion, which is to say all tags and commit logs seem to be in place.

File under: programming : {2010.06.24 - 16:12} : Comments (0)

# YAML

StackOverflow: Which Java YAML library should I use?

File under: java : {2010.06.23 - 16:46} : Comments (0)

# Slow Ubuntu server logins

Getting rid of all the login startup gumpf in recent versions of Ubuntu server: (see eg. Ubuntu forums Server 10.04: How to Eradicate the MOTD System?)

sudo apt-get purge landscape-common landscape-client
sudo chmod -x /etc/update-motd.d/*

You can probably delete 'em just as easily. Put something friendly in /etc/motd to compensate.

(As a reminder, the other slow login culprit can often be if the server can't resolve the client's hostname, usually fixed on local machines or VMs by adding an entry to /etc/hosts.)

File under: linux : {2010.05.30 - 03:08} : Comments (0)

# More git links

File under: programming : {2010.05.25 - 14:04} : Comments (0)

# git on windows

Not as simple as on Linux.

File under: programming : {2010.05.22 - 03:56} : Comments (0)

# The Dark Magic of Structured Finance

The Dark Magic of Structured Finance:

Suppose that we misspecified the underlying probability of mortgage default and we later discover the true probability is not .05 but .06. In terms of our original mortgages the true default rate is 20 percent higher than we thought--not good but not deadly either. However, with this small error, the probability of default in the 10 tranche jumps from p=.0282 to p=.0775, a 175% increase. Moreover, the probability of default of the CDO jumps from p=.0005 to p=.247, a 45,000% increase!

I still think that the popular idea that the people creating these things were too stupid to know that there would be these 'glitches' is unsatisfying.

{2010.05.14 - 17:27} : Comments (0)

« Previous | Next »

meta

about
main blog

Categories

eclipse
java
linux
programming

RSS Feeds

rssfeed all posts
rssfeed all comments

Archives

2010.09
2010.08
2010.07
2010.06
2010.05
2010.04
2010.03
2010.02
2010.01
2009.12
2009.11
2009.10
2009.09
2009.08
2009.07
2009.06
2009.05
2009.02
2009.01
2008.12
2008.11
2008.08
2008.07
2008.06
2008.05
2008.04
2008.03
2008.02
2008.01
2007.12
2007.11
2007.10
2007.09
2007.08
2007.07

© Colin Pretorius