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>
[destination_id=0x0]
[seq=0x10]
[controlmessage=0x7]
[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>
[seq=0x11]
[etx=0xd]
[parent=0x1]
[num_neighbors=0x9]
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>
[destination_id=0x0]
[seq=0x10]
[controlmessage=0x7]
[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> 
[seq=0x11]
[etx=0xd]
[parent=0x1]
[num_neighbors=0x9]
from node 119

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

…inserts a newline before every timestamp.

Adapt Lightbox 2.51 to resize larger files to viewport

From mr. Dragonzap here: 
http://lokeshdhakar.com/forums/index.php?p=/discussion/5886/resizing-bigger-images-to-screen-size

 

lightbox.js:

preloader.onload = function() {
$image.attr(‘src’, _this.album[_this.currentImageIndex].link);
$image.width = preloader.width;
$image.height = preloader.height;
return _this.sizeContainer(preloader.width, preloader.height);
};
to
preloader.onload = function() {
$image.attr(‘src’, _this.album[_this.currentImageIndex].link);
if (preloader.width > window.innerWidth * 0.9) {
preloader.height = (window.innerWidth * 0.9 * preloader.height) / preloader.width;
preloader.width = window.innerWidth * 0.9;
}

if (preloader.height > window.innerHeight * 0.8) {
preloader.width = (window.innerHeight * 0.8 * preloader.width) / preloader.height;
preloader.height = window.innerHeight * 0.8;
}
$image.width = preloader.width;
$image.height = preloader.height;
$image.attr(‘width’, preloader.width + “px”);
return _this.sizeContainer(preloader.width, preloader.height);
};

ligthbox.css:

#lightbox img {
width: auto;
height: auto;
}
to
#lightbox img {
/*width: auto;
height: auto;*/