Tuesday, June 30, 2009

Move a project from an SVN repository to another one

Today, I need to move a project from a first subversion repository to a second one. To do that, you need to have an access to your SVN server.

So, we will use the following commands :
  • svnadmin dump to backup the repositories (I insist on 'repositories'. I think it's important to have backups of all repos before doing such operations)
  • svndumpfilter to reduce the backup scope to a single project because the dump can only be done on the entire SVN repository
  • svnadmin load (I think you can guess what this wonderful command does)
To understand this commands, it's important to know that svnadmin uses standard inputs and outputs. Thus, we can combine commands with pipes.


Let's save our project (with all its history, tags, branches...)

svnadmin dump /home/subversion/svn/repo/ | svndumpfilter include myproject > svn.myproject.dump

Now, let's backup our target repository :

svnadmin dump /home/subversion/svn/new_repo/ > svn.new_repo.dump

And let's import the project on this target repository :

cat svn.myproject.dump | svnadmin load /home/subversion/svn/new_repo/

Important note : when you use svndumpfilter, the keyword you give to the filter is only a prefix. That's very important because if you have similar project names, you must excluse the ones you don't want like that :

cat svn.myproject.dump | svndumpfilter exclude myproject2 > svn.myprojectonly.dump

Wow, that's all!

Wednesday, June 17, 2009

Modify your host networking interface with Virtual Box OSE 2.0.4

In the previous post, I talked about how to start a Windows XP image downloaded from Microsoft to be able to test your web application with Internet Explorer.

On Ubuntu 8.04 and Virtual Box OSE (Open Source Edition) 2.0.4, there are some fixes to do before being able to work with the hosted mode network interface.

I took the following instructions from the french Ubuntu forum (http://forum.ubuntu-fr.org/viewtopic.php?id=217680).

1) install bridge-utils and uml-utilities (sudo apt-get)
2) add the vboxusers usergroup to your user :

$ sudo usermod -a -G vboxusers

3) Create a bridge by modifying you /etc/network/interfaces file

For DHCP conf

$ sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet manual

auto breth0
iface breth0 inet dhcp
bridge_ports eth0

# The loopback network interface
auto lo
iface lo inet loopback

For static IP conf

$ sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet manual

auto breth0
iface breth0 inet static
bridge_ports eth0
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1

# The loopback network interface
auto lo
iface lo inet loopback

Note that your dns should be declared in the /etc/resolv.conf file.

4) Add your virual interfaces toAjouter vos interfaces virtuelles dans le fichier : /etc/vbox/interfaces

$ sudo gedit /etc/vbox/interfaces
# Each line should be of the format :
# []
vbox0 breth0
vbox1 breth0
vbox2 breth0

5) Reboot (startup is longer due to this new interfaces)

6) Open your virtual box settings. Go to network pârameters, Select host interface and declare the following parameters :

Interface Name : vbox0
Setup Application : /etc/network/if-pre-up.d/virtualbox-ose
Terminate Application : /etc/network/if-post-down.d/virtualbox-ose

Internet Explorer free under Ubuntu Linux with VirtualBox

This is a title I found on a blog (http://www.railsgeek.com/). You all know this kind of crisis when delivering a web application developed on your favourite Linux with FireFox : your piece of software crashes on Internet Explorer. You also know how it's difficult to have a IE quickly running on your Ubuntu. Perhaps you tested IE4Linux but it's an old projet. Thanks to Microsoft (yes, I can say this), you have a solution from now.

1) Go to the Microsoft download website : http://www.microsoft.com/downloads
2) Enter 'vpc images' in the search text field
3) You will have an answer titled :

IE App Compat VHD
VPC Hard Disk Images for testing websites with different Internet Explorer versions on Windows XP and Windows Vista

4) Click on the link and download an image (I took IE7-XPSP3.exe)
5) Rename it with the rar extension (ie IE7-XPSP3.rar) and unrar it
6) Install VirtualBox with Synaptic. This excellent software is able to read Microsoft Virtual PC image disk (VHD)
7) The first time you start your Windows, you will probably have a blue screen on processr.sys. So, restart in safe mode with the command prompt.
8) Find and rename processr.sys

cd \WINDOWS\system32\drivers
ren processr.sys processr.old

9) Reboot and install the Virtual Guest Additions

Ultimate note : after guest additions installation, my VBox crashed and refused to restart due to a problem when accessing to the disk image. To fix this, I found the following solution which consists on converting de Virtual PC disk image to a VMWare one using QEMU like this :

qemu-img convert XP\ SP3\ with\ IE7\ 2009-Apr.vhd -O vmdk XPSP3.vmdk

Thursday, June 11, 2009

In love with my linux shell

Just a tiny link to a really interesting website which concentrate common and useful linux command lines :

http://www.commandlinefu.com

Thanks Marco for this URL!

Tuesday, June 02, 2009

An easy way to export java classpath on linux

Simple but powerful, you just need to be in your lib folder and type :

export CLASSPATH=$(pwd)/*

That's all!