Subversion repository maintenance

Posted by batman on Nov 28th, 2011
2011
Nov 28

Upgrade to Subversion 1.7

I recently upgraded to Subversion 1.7 (if for no other reason than to keep up to date). I use VisualSVN (2.5.1), and the upgrade was seamless and painless – literally nothing more than running the installer (msi). At the same time I upgraded TortoiseSvn (1.7.1.xxx), and it too was seamless. The only thing I needed to do was upgrade my working copies of code under svn control.

Maintenance

Once I had completed this upgrade without pain, I decided to re-organise my repositories. My current repository structure looked similar to

tags
branches
trunk
    clientA
        projectA1
        projectA2
    clientB
        projectB1
        projectB2
    clientC
        projectC1
        projectC2

Now this is fine, except for the fact that over the years, it has gotten quite big. Additionally there is just something awkward about creating a tag “clientA-release” which will include clientB and clientC projects (apart from probably being a bad practice). It was clearly time for a split.

svnadmin dump %REPO_PATH%/repos > repos.dump
svnadmin dump %REPO_PATH%/repos -r162:178 > repos-162.dump

This will dump the entire repository in text format (with embedded binary) – which we will use later on. If nothing else it serves as a backup, albeit a rather large one. The first command will dump the entire repository, while the second one will only dump changes from revision 162 to 178. Be warned – this can take quite a while, so don’t start with it unless you have time to waste.

svndumpfilter --renumber-revs include /trunk/clientA /tags/clientA < repos.dump > clientA.dump
svndumpfilter --renumber-revs include /trunk/clientB /tags/clientB < repos.dump > clientB.dump

This will read from the dumpfile created in the previous step, and write only that specified in the “include” parameter.

  • Remember to specify tags and branches as well
  • There is also an “exclude” parameter available
  • I liked the “renumber_revs” option, that renumbers the revisions for this particular client, removing any revisions applicable to other code

sed.exe -b s/path:.trunk\/clientA/path:\x20trunk/g clientA.dump > clientA.mod.dump
sed.exe -b s/path:.trunk\/clientB/path:\x20trunk/g clientB.dump > clientB.mod.dump

At this point you may choose to modify your dumpfile, although please be aware it is very easy to mess it up – please create backups of it. In your new “clientA” repository you will probably not want the root folder “clientA” – as it was in your original repository. You must modify “trunk/clientA” to become “trunk” – in other words move everything up a level. Problems I encountered include the following :-

  • My favourite editor Notepad++ had a ceiling as to the maximum size dumpfile it could accommodate
  • Other editors that could handle large files e.g. ConTEXT messed up CR and LF special characters, rendering the dumpfile useless. I’m not saying ConTEXT is bad – I probably just wasn’t using it properly
  • WinVI worked fine for me, but was just really slow to open, modify and save large files
  • Be careful of just modifying “trunk/clientA” to become “trunk” – this combination may be in the content of a file e.g. batch file, or document, and will then cause the job to fail with inconsistent checkdigit counts. This is why I chose to replace “path: trunk/clientA” with “path: trunk”
  • Gnuwin SED was my solution – a commandline utility that worked really well, and quickly too – this is used in the scriptlet above

svnadmin create clientA
svnadmin load --ignore-uuid clientA < clientA.dump

svnadmin create clientB
svnadmin load --ignore-uuid clientB < clientB.dump

This will create a new respositories “clientA” and “clientB” and load them from the dumpfiles, including trunk, all tags and branches, with neatly re-ordered revision numbers.

Voila!

Powered by Zoundry Raven

Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Cool way to nuke rogue processes

Posted by batman on Feb 27th, 2010
2010
Feb 27

The scenario

Lets imagine we have a couple of rogue ‘apache2’ processes. This in no way implies that apache provide rogue processes – it is merely used as an example.

First just list all running processes (subset shown)

$ ps ef

root 5726 0.0 0.0 1856 304 ? Ss 06:08 0:00 /usr/bin/ ...
root 5727 0.0 0.0 1860 304 ? Ss 06:08 0:00 /usr/bin/vmnet-dhcpd -cf ...
root 5738 0.0 0.3 20944 6448 ? Ss 06:08 0:00 /usr/sbin/apache2 -k start
www 5755 0.0 0.7 28608 14480 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5756 0.0 0.6 27304 13384 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5757 0.0 0.6 27508 13092 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5758 0.0 0.5 26464 12056 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5759 0.0 0.5 25664 11192 ? S 06:08 0:00 /usr/sbin/apache2 -k start
root 5830 0.0 0.0 2948 620 ? Ss 06:08 0:00 /usr/bin/kdm
root 5851 0.8 2.5 55928 51996 tty7 Ss+ 06:08 1:31 /usr/bin/X -br -nolisten tcp :0 vt7 -auth ...
root 5869 0.0 0.0 3932 1460 ? S 06:08 0:00 -:0
bruce 5961 0.0 0.0 1756 536 ? Ss 06:08 0:00 /bin/sh /usr/bin/startkde
bruce 6004 0.0 0.0 4432 588 ? Ss 06:08 0:00 /usr/bin/ssh-agent /usr/bin/startkde

or then for a specific user –

$ ps efu -u www

www 5755 0.0 0.7 28608 14480 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5756 0.0 0.6 27304 13384 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5757 0.0 0.6 27508 13092 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5758 0.0 0.5 26464 12056 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5759 0.0 0.5 25664 11192 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5961 0.0 0.0 1756 536 ? Ss 06:08 0:00 /bin/sh /usr/bin/startkde
www 6004 0.0 0.0 4432 588 ? Ss 06:08 0:00 /usr/bin/ssh-agent /usr/bin/startkde

now filter out only those processes we’d like to kill

$ ps efu -u www | grep ‘apache2’

www 5755 0.0 0.7 28608 14480 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5756 0.0 0.6 27304 13384 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5757 0.0 0.6 27508 13092 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5758 0.0 0.5 26464 12056 ? S 06:08 0:00 /usr/sbin/apache2 -k start
www 5759 0.0 0.5 25664 11192 ? S 06:08 0:00 /usr/sbin/apache2 -k start

now extract the second column i.e. the process id

$ ps efu -u www | grep ‘apache2’ | awk ‘{print $2}’

5755
5756
5757
5758
5759

and finally kill them all

$ ps efu -u www | grep ‘apache2’ | awk ‘{print $2}’ | xargs rm -f

All of your apache2 processes for user www have been killed.

As always, there are probably hundreds of ways of doing this, and probably many more elegant | more efficient | faster | easier | etc | etc | etc… This particular one worked for me on the day.

I hope you find it helpful!

Powered by Zoundry Raven

Technorati : , , , ,
Del.icio.us : , , , ,
Zooomr : , , , ,
Flickr : , , , ,

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Creating a SAMBA share on Kubuntu Linux

Posted by batman on Feb 27th, 2010
2010
Feb 27

Kubuntu 8.10 (Intrepid Ibex) Linux Server

  • $ sudo apt-get install samba
  • $ sudo smbpasswd -a SOMEUSER
  • Edit /etc/samba/smb.conf: (place the following code snippet at the bottom of the file)
path = /SOME_FOLDER
available = yes
valid users = SOMEUSER
read only = no
browseable = yes
guest ok = yes
admin users = SOMEUSER
  • You will need to ensure that your folder (in this case “/SOME_FOLDER”) has full read/write permissions by the user SOMEUSER
  • I’m not sure if it is a requirement, but I have my server and client sharing the same username/password combination – it just seems to ask for passwords less frequently.
  • $ sudo /etc/init.d/samba restart

Windows XP Client

Browse “Microsoft Windows Network” to find your shares, and if desired map a drive letter to this share.

Troubleshooting

Periodic timeout, or where Windows “drops” the connection – use “regedit” to modify your registry.

Modify [My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters] – set property [autodisconnect] to “0xffffffff” (4294967295) minutes – effectively disabling the timeout.

Powered by Zoundry Raven

Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Apache ANT – javac classpath

Posted by batman on Feb 27th, 2010
2010
Feb 27

Have you ever wondered exactly what the classpath is you’re using when compiling your java classes using the ant task “javac”? Well, here’s a useful little addition that can easily be added to your ant builds. It’s really no rocket science, but just provides a “visual” listing of the contents of the classpath.

<target depends="_setup" name="_compile" />
      <pathconvert property="echo.path.compile" pathsep="${line.separator}| |--" refid="project.class.path"></pathconvert>

      <echo message="|-- compile classpath" />
      <echo message="| |" />
      <echo message="| |-- ${echo.path.compile}" />

      <javac debug="${compile.debug}" srcdir="src" target="1.5" destdir="build" source="1.5">
             <classpath refid="project.class.path" />
      </javac>
</target>

Output similar to the following can be expected:

init:
compile:
|-- compile classpath
|   |
|   |-- /home/bruce/projects/quartz/lib/activation.jar
|   |-- /home/bruce/projects/quartz/lib/log4j.jar
|   |-- /home/bruce/projects/quartz/lib/mail.jar
|   |-- /home/bruce/projects/quartz/lib/commons-cli-1.1.jar
|   |-- /home/bruce/projects/quartz/lib/commons-configuration-1.5.jar
|   |-- /home/bruce/projects/quartz/lib/commons-dbutils-1.1.jar
|   |-- /home/bruce/projects/quartz/lib/commons-dbcp-1.2.2.jar
|   |-- /home/bruce/projects/quartz/lib/commons-pool-1.3.jar
|   |-- /home/bruce/projects/quartz/lib/commons-io-1.3.2.jar
|   |-- /home/bruce/projects/quartz/lib/commons-lang-2.3.jar

Powered by Zoundry Raven

Technorati :
Del.icio.us :
Zooomr :
Flickr :

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Record JMeter Web TestPlan

Posted by batman on Feb 27th, 2010
2010
Feb 27

These steps should help you to record a Test Plan for browsing a website.

  • run JMeter
  • add a Thread Group to the Test Plan
    • add a Recording Controller to the Thread Group
    • add a Http Request Defaults to the Thread Group
    • add a Http Cookie Manager to the Thread Group
  • modify Http Request Defaults:
    • set protocol=http
    • set server name=
    • set path=/
    • set port number=80
  • add Http Proxy Server in Workbench
    • set port :8999 (can be anything – but use the same one in your browser)
    • set Target Controller ( Thread Group > Use Recording Controller)
  • save your Test Plan
  • open your browser
    • set proxy=localhost; port=8999
  • click on Start in JMeter
  • click on the links you would like to be recorded
  • click on Stop in JMeter
  • these links should have been recorded by JMeter
  • reset the proxy settings in your browser

Technorati :
Del.icio.us :
Zooomr :
Flickr :

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit

Install VMWare Tools

Posted by batman on Feb 27th, 2010
2010
Feb 27

The following procedure shows how to extract and install the VMware Tools image from the VMware Workstation “tarball” (.tar.gz file).

Is it legal to do this? According to this thread, yes.

1. Download the latest “Archived Version” of VMware Workstation in .tar.gz format at http://www.vmware.com/download/ws/. You do not need to be registered nor have a VMware Workstation license key to download this version.

Example:
$ wget http://download3.vmware.com/software/wkst/VMware-workstation-5.5.0-18463.tar.gz

2. Locate and extract the linux.iso VMware Tools image from the tarball.

Locate the linux.iso file (example):
$ tar ztvf VMware-workstation-5.5.0-18463.tar.gz | grep linux.iso
vmware-distrib/lib/isoimages/linux.iso

Extract the linux.iso file (example):
$ tar zxvf VMware-workstation-5.5.0-18463.tar.gz vmware-distrib/lib/isoimages/linux.iso

3. Mount the linux.iso file as a loopback file system, and either share the loopback file system with Samba, or copy the VMware Tools files to a location accessible by your guest system.

$ mkdir /tmp/vmware_tools
$ mount -o loop linux.iso /tmp/vmware_tools

4. In your guest system, run vmware-install.py from the VMware Tools directory.

Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

Technorati : , , ,
Del.icio.us : , , ,
Zooomr : , , ,
Flickr : , , ,

Share and Enjoy:
  • Facebook
  • Twitter
  • Digg
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • laaik.it
  • Google Buzz
  • Technorati
  • Slashdot
  • Reddit