Erlend's Lookout Post

Concerning ns-3, Xubuntu and other stuff.

git aliases

Here are some nice-to-have aliases and config setup for git:

git config --global checkout
git config --global branch
git config --global commit
git config --global status
git config --global alias.fe fetch
git config --global push
git config --global alias.pu pull
git config --global alias.unstage 'reset HEAD --'
git config --global credential.helper cache
git config --global credential.helper "cache --timeout=86400"
git config --global core.editor nano
git config --global color.ui true


Remove false errors in Eclipse



Eclipse may or may not be pulling the paths to index from your build setup, depending on the configuration. Most likely, it is not…it’s building correctly because your build setup is just fine, and you can probably build by hand.

The CDT indexer (which is the engine for deciding where all those pretty underlines, as well as code completion, F3 declaration jumping, etc comes from) isn’t smart enough in a lot of cases to parse out your Makefiles and know where to look for headers and source. You need to tell Eclipse that information manually.

Go to Project Properties -> C/C++ General -> Paths and Symbols.

The amount of work you need to put into this can vary greatly, depending on your environment. For me, it was only necessary to add scratch and src as library paths. If this external library is the only thing giving you headaches, then you probably just need to add the paths for that library and reindex:

Right-click on the project and select Index -> Rebuild

Change popup text background color in Eclipse


Change it in Preferences > C/C++ > Editor > Source hover background

Resizing a VirtualBox Linux guest Partition

This very good tip comes from norbert over at and the original article can be found here. I’m only keeping the info here as reference.

Three easy steps:
Enlarging the virtual drive
Enlarging the partition holding the root file system with parted
Enlarging the file system with resize2fs

Step 1: With the host computer running Windows, resizing the .vdi harddrive to 16GB is done like this:

C:\Users\Netzgewitter\VirtualBox VMs\BackTrack5>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "BackTrack 5.vdi" --resize 16384

Step 2: Resizing the Partition

Boot the virtual machine with a live cd where you can run parted.
Turn off the swap partition:
user@bt:~$ sudo swapoff /dev/sda5

Check the partitions with parted:
(parted) unit cyl
(parted) print
(parted) rm 2
(parted) print

Recreate the swap partition at the end of the drive with the command mkpart:

(parted) mkpart extended -51 -1
(parted) mkpart logical linux-swap -51 -1
(parted) print

The new swap partition also needs to be activated:
user@bt:~$ sudo mkswap /dev/sda5

Now delete the first partition and recreate it at the exact same location. Just bigger.
Switch the displayed units to chs (cylinder/head/sector).

(parted) unit chs
(parted) print

If the second partition starts at 2037,171,54, and the geometry of the disk is 2088,255,63 then let partition 1 end at 2036,254,62, as it will be the last cylinder before partition 2. If the numbers are different, then just make sure you don’t overlap the partitions. Also make sure that the partition 1 begins the same place as before. For me it’s at 0,32,32.

(parted) rm 1
(parted) mkpart primary ext4 0,32,32 2036,254,6
(parted) print

Make the partition bootable:
(parted) toggle 1 boot
(parted) print

Modify /etc/fstab to make sure the UUID are correctly sat:

user@bt:~$ sudo blkid

Example of the /etc/fstab:
# / was on /dev/sda1 during installation
UUID=f9ae2c40-1edd-47c0-9ae7-11c4c08dcf50 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=91eaafab-b4e2-4821-90d7-2b3ef093bdcf none swap sw 0 0

Step 3: Enlarging the File System
Restart the virtual machine booting from the harddrive, and run the following command when booted:

user@bt:~$ sudo resize2fs /dev/sda1


Compile git on xubuntu 13.04

Install libcurl first:
sudo apt-get install libcurl4-openssl-dev

Installing ns-3.16 on (x)ubuntu 13.04

Install the tools necessary:
sudo apt-get install g++ python-dev python-pygccxml python-pygoocanvas python-pygraphviz

For convenience, and if enough disk space, install doxygen also:
sudo apt-get install doxygen

Installing ns-2.35 on Xubuntu 13.04

First update all pending updates to the OS.

Then install the development files for X Windows plus the g++ compiler:
sudo apt-get install xorg-dev g++ xgraph

And finally edit linkstate/ls.h line 137 to read

void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

Then you are set to run ./install from the main catalog of ns-2.35

Alter the format of a log file to start every event on a new line

File looks like this:
[15:41:36] Received packet Message <AmMcmp>
[data=0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 ]
from node 119
[15:41:36] Received packet Message <AmSystemCtp>
from node 119
and we want every event beginning with a timestamp on its own line. We do this in two steps:

Remove all newlines: for t in `cat comms.log`; do echo -n $t" " >> comms.tmp; done

Insert a newline before every timestamp: sed "s/\[..:..:..\]/\n&/g" comms.tmp > commsline.txt

AWK inserting a newline based on regular expressions

[15:41:36] Received packet Message <AmMcmp>
[data=0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 ]
from node 119
[15:41:36] Received packet Message <AmSystemCtp> 
from node 119

cat comms.log | awk '{if (/\[..:..:..\]/) {print "\n"$0} else {print $0}}' > comms.txt

…inserts a newline before every timestamp.

Blog at

Up ↑