for your eyes only
Knowledge Hurts – a blog of thoughts, things and stuff.

May
21

I have a nice script and want to read its return value in a “bash -c” statement. Here is my script:

#!/bin/bash 
exit 100 

and this is what happens when I execute it:

bash exit100.sh; echo $? 
100 

Nice! It shows me the return value! But wait – what if I use bash -c to run these 2 commands in a subshell? 

bash -c "bash exit100.sh; echo $?" 
0

WTF? It shows me 0 as return value? That can’t be! Well – yes it can. And here is the way to do it right:

bash -c 'bash exit100.sh; echo $?' 
100

Using single quotes (‘) instead of double quotes (“), I get what I want. I execute a subshell, run a script inside it and can read the return value from the $? variable! IT’S MAGIC!!!

Mar
30

Hi to all students and researchers out there who are left to wonder “how should I do this – how can I simulate something using NS2?”!

I have an answer for you, but you will NOT like it: You will have to implement your simulation.

Simply using what comes along in the ns2 package is not enough. You have to understand and adapt the simulator in order to have good results.  Otherwise you will not be able to understand the simulation results you are getting.

And yes, by implement, I mean program. Yes. In TCL and C…

A quick explanation why I am writing this here: A simulation always derives from reality. It can never achieve 100% accuracy. So you have to know where you cut corners and why. If you don’t know the limitations of the simulation, you will not know why you see certain results. And what do you really want? Good results. Unfortunatelly, You cannot get good results without changing the simulators source code. Even if a certain protocol, standard or technology is already included in NS2, be vigilent! It was implemented for a certain purpose and has probably bugs all over it. Take the simulation of energy consumption  in the IEEE 802.15.4 implementation in NS2 as an example: It is quite basic (certain actions have a certain cost, which is deduced from an initial power level). Does this include battery aging? Does this include standby current? Don’t be too sure that it does. Are those things relevant for your thesis? Probably. Do you have to find a way to include what you consider important into your simulation? I bet you do.

So here are the steps you need to take to perform a simulation that is worth its computing time:

  • Think what you want to simulate in what detail (3 weeks)
  • Look into the source code of the main technology that you are using, find out what it does and look if the things you want are included. (2 weeks)
  • Look into the source over and over again, make yourself drawings, try to understand what happens in a simulation. (3 months)
  • Implement what you additionally need (2 months)
  • Simulate (2 weeks)
  • Verify, think, verify. Debug. (1 month)

Please don’t forget to share your code afterwards using GIThub and if you achieved something, share it with the NS2 mailing list!

Mar
30

Hi. It’s me again. Some problem, that I have seen wrongly described in forums is the following:

When I compile mISDN under Debian with Kernel 2.6.26 (mISDN is included in the kernel version 2.6.27 and up), I get the problem “kernel build tree does not exist” thrown at me by the ./configure script in the mISDN directory.

configure: error: kernel build tree does not exist build:/lib/modules/2.6.26-2-686/build /

source:/lib/modules/2.6.26-2-686/source

All that needs to be done is to install the package kernel-headers-2.6-686

sudo apt-get install kernel-headers-2.6-686

and to link the headers to /lib/modules/2.6.26-2-686/source with the command: cd /lib/modules/2.6.26-2-686/source

ln -s /usr/src/linux-headers-2.6.26-2-686 source

After this, ./configure and the whole build process succeeds!

Read on! Knowledge hurts.

Jul
13

The way you can turn off a Motion Computing Tablet PC when it is no longer reacting:

* Remove any power source (cable, battery)
* press camera, key-symbol and the square in the circle (right-top corner of dpad) at the same time
* put battery back in, turn pc back on.

Apr
06

This is a howto to get more free space on your X10 min smartphone. And some rambling that I wanted to get out there desperately. Let’s start with my rambling.

The X10 mini is a nice phone. It is in fact the best phone I have ever had. Not because it is a good phone or because it’s well supported by Sony (no, it clearly isn’t, if it were, we had Android 2.2 on it and frequent security upgrades). No. But I like the camera. I like the fact that it is small and runs Android smoothly all the same. I like a lot about it. But what I don’t like is the memory size (and – if you happen to have read over my commentary above without taking notice of this  – I feel it needs an update to recent versions of Android!)

So. Why do I think we need Android 2.2 on this phone? Well, because Android 2.2 has App2SD functionality. And because my X10 mini is not even a year old, so it is far too new to be abandoned by its manufacturer. Back to App2SD, though. App2SD means installing Apps directly to the SD card and not the internal memory. And since the memory is so damn small, we need that. Badly.

For the time being, I had to hack myself to get a solution for the problem on my own to increase memory for installing more applications. Here I will explain how I did it.

You will need a PC with Windows XP (neither Wine on Linux nor Win7 worked for me) with .Net Framework 2.0 (no higher version, no lower one) installed.

1. Update to the latest Firmware (the one with ANT+ was the newest as I am writing this)

2. Download and unpack SuperOneClick.rar from this forum http://forum.xda-developers.com/showthread.php?t=906742 (you need to register for free)

3. Open “SuperOneClick” and select “Root”.

4. Connect X10 mini with the cable to the PC.

5. Wait! Look at what it says on the screen and click through the dialogues that pop up.

6. When everything is done, reboot.

7. Install “busybox installer” and “Titanium Backup” from the market. Download busybox 1.19 with the help of the installer and then start titanium backup. Go into Chuck Norris mode there and uninstall shit like Facebook or other garbage apps you could not uninstall before.

8. Install Link2SD from Market and move your biggest and least used apps to SD. More info here: http://www.xda-developers.com/android/move-selected-apps-to-sd-with-link2sd-app/

9. Finally you are done and have gained free memory to install new applications. Or you could use the freed memory to simply breathe in a bit more deeply when using your X10 mini now.

Read on! Knowledge hurts.

Mar
02

Without much bragging about it:

After I read here that it was possible to run the Mannasim framework for ns2 on version 2.32, I thought that this might be as well possible for 2.34. Instead of philosophying about this (the source claims that it would take months and 1.5 years of C++ knowledge), I simply did it.

Here is a patch that installs mannasim into ns 2.34. http://www.box.net/shared/th6qi9b5v0

It is missing the tcl maker, but should otherwise work fine.

Read on! Knowledge hurts.

Mar
02

Linus criticized it. Everybody criticized it. Config options in Gnome just keep disappearing. Instead of diversity and openess – dull generic choices.

A good example is that you cannot seem to change the GDM scheme in Ubuntu 9.10. The options provided are just plain ridiculous. And no one likes brown. NO ONE LIKES BROWN!

Login screen

Here is what you have to do:

1. log out

2. go to the shell by holding ctrl-alt and pressing F1

3. set your X display to be the gdm login screen (type export DISPLAY=:0.0)

4. start sudo -u gdm gnome-control-center

5. Got to the Appearances Dialog and change Background image & everything. It can only get more beautiful!

Kudos go to ubuntumini.com

You might as well switch your xsplash and usplash theme.

Boot screen (Usplash)

Changing usplash is looking for themes with

apt-cache search usplash

installing themand then changing them with the command

sudo update-usplash-theme [theme]

Intermediate Screens (Xsplash)

Changing your xsplash theme is done by going to /usr/share/images/xsplash and using gimp. 😉

Have fun!

Jan
20

The product after running ns2 will probably be some tracefile. They are terribly documented (as everything I am working with at the moment).
A typical example of a line could be:

r 3.052590420 _75_ RTR — 14 SPAN 40 [0 ffffffff 5e 0] [energy 999.989886 ei 0.000 es 0.000 et 0.001 er 0.009] ——- [94:-1 -1:-1 32 0],

So… here it is, all beautifully laid out and explained for you:

Entry r 3.052590420 _75_ RTR 14 SPAN 40 [0 ffffffff 5e 0] [energy 999.989886 ei 0.000 es 0.000 et 0.001 er 0.009] ——- [94 :-1 -1 :-1 32 0]
Interpretation action time node number kind of trace reason for logging identifier for this event packet type size of cmn header expected time to send data mac destination address mac sender address protocol type remaining node nergy idle energy sleep energy energy transmit energy receiv ip source address src port dest
address
dest
port
TTL next hop
possible entries r(ead)
s(end)
D(rop)
f(orward)
time stamp src_ name of object type tracing why ch->uid(), packet_info.name(ch->ptype()) ch->size() mh->dh_duration ETHER_ADDR(mh->dh_da) ETHER_ADDR(mh->dh_sa) GET_ETHER_TYPE(mh->dh_body)) ih->src ih->ttl if no next hop: 0

Note: This applies to CMU trace files that were created using the span protocol. Your ns2 output could be a bit different, but still: you will find this very helpful.

P.S.: Oh… I’m out of luck publishing this on wordpress. It’s all cut off on the right. Please, do simply copy this article to the clipboard and paste it somewhere to read, ok?

Read on! Knowledge is lazy today.

Jan
18

As stated at http://www.isi.edu/nsnam/ns/ns-debugging.html ns2 is compatible with Don Libs’ Tcl debugger.

What that site doesn’t tell you is how to install it. There is a nice howto by tk424 here, but that wasn’t written for a recent version of ns2. All the same I recommend it, as it’s very useful. However I have contributed here a patch for the configure file of tcl-debug2 in order to make it compatible with recent versions of ns2. This was tested in ns2.34.

Ah, yes another thing. I am not going to go into as much detail as the howto above. Refer to it if you have questions. It’s totally fool proof.

The quick way is this.

  1. Download http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz (apparently thats the most up-to-date version out there since dinosaurs populated the earth.) If that link does not work, try my mirror: http://www.box.net/shared/0fah87994s
  2. Untar it and move it to your ns-allinone-x.xx folder
  3. go into the ns-allinone-x.xx/tcl-debug-2.0 folder and try calling ./configure
  4. if that fails apply my patch from http://www.box.net/shared/20z8klbpjy and call ./configure again (applying the patch is as simple as calling “patch -p1 < tcl-debug-2.0-configure.patch”)
  5. call make
  6. you will get a file called “tcl-debug-2.0/libtcldbg.a” if everythings fine
  7. copy that to “ns-allinone-x.xx/ns-x.xx/lib”
  8. go to “ns-allinone-x.xx/ns-x.xx”
  9. do “./configure –with-tcldebug”
  10. call make (perhaps you have to make clean; make)
  11. insert the line “debug 1” at the line of your script that you wish to debug
  12. follow this PostScript document for instructions how to use the debugger

So… that’s about it. And with that tool installed, you will finally know what your _o?? reference that is in the backtrace of ns2 really stands for. Plus know the type of the object simply by using its OTcl handle _o??. Cool, isn’t it. Happy debugging!

Read on! Knowledge hurts.

Dec
23

Slitaz (version: Cooking 200911…) is really a great distribution. It’s lean, it’s full featured, it offers a great choice of software and a package management system!

But don’t you try installing openssh. The dropbear ssh server comes preinstalled & offers everything you want. If you try openssh, beware: some bug causes the $DISPLAY parameters not to be set up correctly. Like that, you cannot forward X sessions!

My workaround: Use dropbear it works out of the box.

I also got some issue with the vmware soundcard. Apparently the soundcard modules are not all precompiled…

Read on! Knowledge hurts.