NS2 on Ubnutu

Written by

I had a lot of trouble installing Network Simulator 2 (NS2) onto my Virtual Ubnutu 9.04 Linux install. After much work, I have created a short set of terminal scripts that will allow NS to be compiled and installed.

apt-get install -y build-essential autoconf automake libx11-dev libxmu-dev libxmu-headers libxt-dev libtool g++-4.3
cd /
wget http://downloads.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnsnam%2F&ts=1295461023&use_mirror=sunet
tar -zxvf ns-allinone-2.34.tar.gz
wget http://www.aboutcher.co.uk/files/configure
cp configure ns-allinone-2.34/otcl-1.13/
mv ns-allinone-2.34/ ns/
cd ns
export LD_LIBRARY_PATH=/ns/otcl-1.13/
export LD_LIBRARY_PATH=/ns/lib/
export TCL_LIBRARY=/ns/tcl8.4.18/library/
cd /usr/bin
ln /ns/ns-2.34/ns ns
ln /ns/nam-1.14/nam nam
cd ~
ln /ns/ns-2.34/tcl/ex/ NS\ TCL\ Examples
apt-get install -y xgraph

Just copy and paste the above code into a root terminal.
to get a root terminal type

sudo su

Hope this works for you too. This should work for newer versions of Ubuntu too.

New year, New site

Written by

Well, after much deliberation I have change my site once again.

My past website layout was nice and clean but a little too white for my likings and it wasn’t easy enough to update. I have thus opted for a more blog style site.

This should hopefully get me to update it more, I have chosen to turn comments off just to save me time moderating them for spam n stuff.

This change was not taken lightly as my previous site was completely hand written by myself and conformed to standards, which this new site currently does not; this will be rectified when I have time.

I hope you like the new style and find it just as easy to use as the previous.


PHP Log Function

Written by

Since developing several sites, I have found that the default error/notice output can be vague or not flag the error up where it is.
This is why I have developed a PHP function which logs what ever you want it to.

function logger($type,$action,$msg){
 // Three types of logging, debug(anything not User/Security/), user and Security (Sec)
 $buffer = "\r\n".date("d-m-y(H:i:s)")."; ".$action."; ".$msg."; ".$ip;
 $buffer = "\r\n".date("d-m-y(H:i:s)")."; ".$action."; ".$msg."; ".$ip;
 $type = "security";
 $buffer = "\r\n".date("d-m-y(H:i:s)")."; ".$type."; ".$action."; ".$msg."; ".$ip;
 $type = "debug";
 $logfile = "logs/".strtolower($type).".log";
 $handle = fopen($logfile, "a") or $bool = FALSE;
 $write = fwrite($handle, $buffer);
 $bool = FALSE;
 $bool = TRUE;
return $bool;

Just call it up by doing

logger("MYSQL Error","MySQL_Connect","MySQL Error".mysql_error());

which for example will produce

01-01-11(22:31:27); MySQL Error; MySQL_Connect; Database Returned Error - You have an error in your SQL syntax; at line 1;

As you can see the logs are delimited with a semi-colon (;) which makes it easy to import that data into a spreadsheet.
The logs are saved in logs/ of the page that executes the function, but you can change this if required; there are 3 logs, ‘user‘,’security‘ and ‘debug‘.

The debug log catches any $type that is not ‘user‘ or ‘sec‘.

And finally it returns TRUE on log and FALSE on error.

Hope this code helps you as much as it’s helped me.

Useful wget options

Written by

Just because it took me ages to figure some of this out as –help is HUGE and doesn’t contain some of the options.


Continue a Download

-r / --recursive

Recursive download

-L / --relative

relative Links only


Don’t check the SSL certificate


Limit the rate of download ie 100k


wget -c -r -L --no-check-certificate --limit-rate=100k http://example.com/file


wget -c --recursive --relative --no-check-certificate --limit-rate=100k http://example.com/file

Web2Messenger Gone

Written by

Well, after less than a year since I wrote the Web2Messenger (W2M) PHP API, it looks as though it has finally died.

When I was using the system for my dissertation and also writing the API, I did notice a lack of support and now finally it ha totally gone.

The forums return an SQL error and all the bots are offline which means all is sleepy in the W2M world.

It it sad to see such a service to but no worries, Microsoft have released some code for Windows Live Messenger to integrate into PHP.

Check it out over at CodePlex.