Monday 7 September 2009

Fixing NAM bug

I am using ns-2.31 on Ubuntu and had this error message when i tried to run NAM
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."



I found two patches to solve this problem from http://bugs.gentoo.org/show_bug.cgi?id=225999

i made correction to both files as

--- generic/tk.h.orig 2008-02-06 16:31:40.000000000 +0100
+++ generic/tk.h 2008-07-24 08:21:46.000000000 +0200
@@ -635,17 +635,15 @@
  *
  *---------------------------------------------------------------------------
  */
-#define VirtualEvent     (LASTEvent)
-#define ActivateNotify     (LASTEvent + 1)
-#define DeactivateNotify    (LASTEvent + 2)
-#define MouseWheelEvent     (LASTEvent + 3)
-#define TK_LASTEVENT     (LASTEvent + 4)
+#define VirtualEvent     (MappingNotify + 1)
+#define ActivateNotify     (MappingNotify + 2)
+#define DeactivateNotify    (MappingNotify + 3)
+#define MouseWheelEvent     (MappingNotify + 4)
+#define TK_LASTEVENT     (MappingNotify + 5)
 
 #define MouseWheelMask     (1L << 28)
-
 #define ActivateMask     (1L << 29)
 #define VirtualEventMask    (1L << 30)
-#define TK_LASTEVENT     (LASTEvent + 4)
 
 
 /*
And for other one as
 
--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200
+++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200
@@ -586,6 +586,9 @@
    /* ColormapNotify */  COLORMAP,
    /* ClientMessage */  0,
    /* MappingNotify */  0,
+#ifdef GenericEvent
+   /* GenericEvent */          0,
+#endif 
    /* VirtualEvent */  VIRTUAL,
    /* Activate */  ACTIVATE,     
    /* Deactivate */  ACTIVATE,
 
finally it worked. Thank god. i can sleep now.  

Installing NS2.31 on Ubuntu

Now i am validating ns2 and since it takes lot of time to complete it i thought why not write about what i just did to install NS2.31.

From the begining, steps i have taken:

I downloaded Ubuntu 9.04 Desktop edition and burned it on a cd. Then i installed it from windows. It has been made so easy that you can install Ubuntu like any other software in windows. After installation you have to boot computer and you will get a prompt to choose OS, if you have dual OS. Boot it from Ubuntu and its done so easy. Then you have to configure network. It is required to install required packages for NS.

Then since i have been working on NS-2.31. I mounted windows drive and  i copied ns-allinone-2.31.tar to my /home/ananta folder.

Now you are need to install and upgrade your system in order to install NS. Do following steps. Open terminal and type following line.

$ sudo apt-get install build-essential autoconf automake libxmu-dev

prompt will ask you to install dependent files and upgrade your system. please do  whatever you are asked to do. it will take some time depending upon your internet speed. Remember you have to restart after upgrading your system.

Then,
$ tar -xzvf ns-allinone-2.31.tar.gz
$cd ns-allinone-2.31

Then before installation of NS2.31 if you want to use NAM then you will also have to fix a bug. Yes a bug, i searched ofcourse its not mine, but i have written solution in next blog find it, fix it and then only install it.

$./install

Now you have to update Environmental Variables
$ gedit ~/.bashrc



Add the following lines and do replace “/home/ananta/” by something like “/home/yourname/”
——————————————————————————————–
# LD_LIBRARY_PATH
OTCL_LIB=/home/ananta/ns-allinone-2.31/otcl-1.13
NS2_LIB=/home/ananta/ns-allinone-2.31/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_
LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/home/ananta/ns-allinone-2.31/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/ananta/ns-allinone-2.31/bin:/home/ananta/
ns-allinone-2.31/tcl8.4.14/unix:/home/ananta/ns-allinone-2.31/tk8.4.14/unix
NS=/home/ananta/ns-allinone-2.31/ns-2.31/
NAM=/home/ananta/ns-allinone-2.31/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM
————————–
and since you have changed environmental variables they arent active yet so you need to either restart your computer or
$ source ~/.bashrc
 to check whether you have successfully installed ns
type ns and you should see "% " you can type exit to return back.
$ns
%


Then you have to validate your installation
$ cd ns-2.31
$ ./validate


still now my validation is going on......

Tuesday 1 September 2009

Khangwando beach

It was a nice and pleasant evening. The sun  had already taken its path below the terrestrial line. The crowd we had seen in the afternoon was already gone. My personal plans were to see every interval of time in the beach. I wanted to see the morning, afternoon, evening and the night. Since we were in the group we couldn't make it to the morning view. I wonder how would it look like in the morning. I have heard several times that sun rises from the Japan and we were in the beach where Japan and Korea share same sea. But unfortunately not in the morning. Anyways the evening was also wonderful. I sat there near the water on my solitude, watching the evening tide and thinking what ever comes in the mind. The picture definitely shows the condition or the requirement that you need to be alone to engulf the nature. You wouldn't want to leave that place and in particularly this moment that i had captured in the picture.