Setting Static IP of NAT network interface in VirtualBox

Posted by admin on Feb 9, 2012 in Unix

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default
where x corresponds to the instance of the NAT interface +2.
So x is 2 when there is only one NAT instance active.
In that case the guest is assigned to the address, the gateway is set to
and the name server can be found at

This means that for Ubuntu, the /etc/network/interfaces entry for the network card settings are something as below:

iface inet static
address (e.g.

Also, add the following nameserver entry to /etc/resolv.conf



Cyanogenmod on Defy

Posted by admin on Dec 5, 2011 in Android

After a few anxious attempts, I managed to root and upgrade my phone to Cyanogenmod ROM. These are the steps.

1. Rooting the phone.

I tried a few versions of SuperOneClick and had no success but then I found SuperOneClickv2.2-ShortFuse.zip and it ran without problems. The prerequisites are the Motorola USB drivers and MotoConnect. SuperOneClick is a windows program. The phone must first be set to USB debugging under Applications.

2. Installing 2nd Init


This is required to bypass the locked boot loader. It used to be available as a Market app but now has to be dowloaded from one of many sites. Look for bootmenu 0.6.1.

Prerequistes are Android SDK (installer_r15-windows.exe) from Android Developers http://developer.android.com/sdk

2nd Init also installs ClockworkMod Recovery for backup and recovery. (AKA CWM)

After installing and booting, the phone may end up in the boot menu which is disconcerting. However, selecting the default boot mode as Normal fixes the boot process.

Perform a custom backup (AKA Nandroid Backup) in case something goes wrong. Copy the backup directory to your PC for safety.

3. Installing Titanium Backup Free

This is not required for upgrading the ROM but is in case something goes wrong. Run a Batch backup of everything and then copy the backup directory to your PC for safety.

4. Download RSD Lite and stock (Full) SBF

This is not required for upgrading the ROM but in case something goes wrong and you need to flash a Full ROM. I downloaded JRDNEM_U3_3.4.2_177-003_BLUR_SIGN_SIGNED_USAJRDNEMARAB1B8RTGB03A.0R_PDS03C_USAJRDNFRYORTGB_P019_A010_HWp3_Service1FF.sbf.gz from http://and-developers.com/sbf:defy

5. Download Cyanogenmod ROM from http://www.cyanogenmod.com/

I downloaded update-cm-7.1.0-jordan-signed.zip and renamed it update.zip in the top level directory of the SD Card

6. Download Google Apps if you need GMail, Maps etc

I downloaded gapps-gb-20110828-signed.zip and renamed it gapps.zip in the top level directory of the SD Card.

7. Installing the ROM

I followed this guide http://forum.xda-developers.com/showthread.php?t=1054447 and it ran in about 10 mins with no problems.

8. Adding themes

I downloaded Ice Cream Sandwich CM7 Theme, Black Glass ADW theme and Sense Analog Clock Dark from the market.



HTPC Specs

Posted by admin on Sep 27, 2011 in HTPC

MediaPortal Version: 1.2.0
MediaPortal Skin: StreamedMP
Windows Version: Windows 7 Home Premium 64bit
CPU Type: i3-2100
Motherboard: ASUS P8H67-I Deluxe
HDD: Samsung 2TB EcoGreen HD204UI
Optical Drive; LG CH10LS20 Blu-Ray Combo Drive
Memory: 4GB DDR3-1333
Video Card: Intel HD Graphics 2000 (Onboard)
Sound Card: Realtek ALC892 (Onboard)
HTPC Case: Silverstone ML03B
Cooling: Thermaltake Slim X3, Arctic F8 Pro
Power Supply: Antec EA-380D
Remote: Windows MCE remote
MPEG2 Video Codec: PDVD11
MPEG2 Audio Codec: ffdshow
h.264 Video Codec: PDVD11
TV: SAMSUNG Plasma PS50B650
TV – HTPC Connection: HDMI


Reset MySQL root password

Posted by admin on Jul 7, 2011 in Database, Unix

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

mysqld_safe –skip-grant-tables

You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.

mysql –user=root mysql
update user set Password=PASSWORD(‘new-password’) where user=’root’;
flush privileges;


Oracle User Locking

Posted by admin on Jul 4, 2011 in Uncategorized

The DBMS_LOCK package can be used to lock sections of code for concurrency control. Simple usage is as follows;

      lock_handle VARCHAR2(128);
      lock_status number;
DBMS_LOCK.ALLOCATE_UNIQUE (lockname => 'mylockset', lockhandle => lock_handle);
    -- If this is taking a long time to run check if a lock is being held and kill the session
    -- e.g. select osuser,program,sys.v_$lock.type,lmode,request
    --         from sys.v_$lock,v$session
    --         where v$session.sid = sys.v_$lock.sid
    --         and sys.v_$lock.type = 'UL'

lock_status := DBMS_LOCK.REQUEST(lockhandle => lock_handle, lockmode => DBMS_LOCK.X_MODE, timeout => 60, release_on_commit => FALSE);

--- Some protected code ---

lock_status := DBMS_LOCK.RELEASE(lockhandle => lock_handle);


Add a user to a group in linux

Posted by admin on May 9, 2011 in Unix

Simple things I always forget

Add a user
useradd -p howardb howardb

Add a user to the wheel group
gpasswd -a howardb wheel

Edit sudoers


Ampersand in SOAP body

Posted by admin on Feb 17, 2011 in perl, Unix

Broadworks OCI interface uses SOAP as its transport. In the past, I’m sure I replaced ampersands in the request body with the html equivalent & just using the encode function.

$req = HTML::Entities::encode($xmlrequest);

This has stopped working and hangs the request. I have found a work around using
$req = HTML::Entities::encode($xmlrequest);
$req =~ s/&/&/g;


Oracle group_concat

Posted by admin on Feb 17, 2011 in Business Intelligence, Database

Oracle has the MySQL equivalent of group_concat using the following procedure

group by 

user1 servicepack1,servicepack2,servicepack3
user2 servicepack3


Read a file backwards in linux – the elegant way

Posted by admin on Feb 3, 2011 in Unix

Sometimes you may need to read a file such as a log file backwards to see the most recent events first. This can be easily done using tac – cat backwards

e.g. tac soapserver.log


Cloning a VirtualBox Drive

Posted by admin on Nov 19, 2010 in Uncategorized

I recently tried to clone a 3G virtual disk to a 40G virtual disk. i.e. resize a disk. This was much more difficult than I thought.

After reading up blogs on the internet such as using VboxManager “cloneHD”, “cloneVDI” and “internalcommands sethduuid” which all failed, I was able to do it by booting an ISO of clonezilla and using the advanced options.

I setup my 2 virtual drives and the CD image in VirtualBox and booted up clonezilla. Then I chose a partition to partition copy (not disk to disk) and used the default options except not to install grub and keep the mbr.

I then was able to shutdown the VM and remove the original 3G disk and boot from the 40G disk.

Copyright © 2008-2017 Brinsmead Data Services All rights reserved.