ns2.1b9a which is an old version NS2 has very strong OS dependency, so I choose Ubuntu 10.04(64-bit).
-------------------------------------Install NS2-----------------------------------------------------------
1) First of all, download the NS-2 package ns-allinone-2.1b9a-gcc32. http://www.isi.edu/nsnam/dist/ns-allinone-2.1b9a-gcc32.tar.gz
2) Install "build-essential" and "libxmu-dev"
sudo apt-get install build-essential
sudo apt-get install libxmu-dev
3) Because in Ubuntu10.04, the gcc compiler version is gcc-4.4 which is too high to compile ns2.19b, we have to install gcc-3.3 and g++-3.3 by ourselves.
Go to http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/ and download "cpp-3.3_3.3.6-15ubuntu6_amd64.deb" "g++-3.3_3.3.6-15ubuntu6_amd64.deb" "gcc-3.3-base_3.3.6-15ubuntu6_amd64.deb" "gcc-3.3_3.3.6-15ubuntu6_amd64.deb" and " libstdc++5-3.3-dev_3.3.6-15ubuntu6_amd64.deb"
. (Depend on your system, the version may be different) Then install them by sudo dpkg --force-depends -i xxx.deb
To check compiler version, we use ls /usr/bin/gcc* -ll or ls /usr/bin/g++* -ll. We also can add the compiler options
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.3
To change the default gcc version, we use
ln -sf /usr/bin/gcc-3.3 /usr/bin/gcc
ln -sf /usr/bin/g++-3.3 /usr/bin/g++
4) Now we are able to install NS2. First of all, tar xzvf ns-allinone-2.1b9a-gcc32.tar.gz and touch ns-allinone-2.1b9a/tcl8.3.2/generic/tclStubInit.c
5) Before running "./install", we have to modify some files (This is very important!!). Go to ns-allinone folder,
find . -name configure
You will see a list of configure files. Replace any line which is like system=MP-RAS-`awk '{print $3}' /etc/.relid'` to system=MP-RAS-`awk '{print $3}' /etc/.relid`
The original one will cause the error in tcl8.3.2, tk8.3.2 and otcl-1.8, checking system version (for dynamic loading)... ./configure: 1: Syntax error: Unterminated quoted string tcl8.3.2 configuration failed! Exiting
6) Modify otcl-xx/config.sub, tclcl-xx/config.sub and configure file in Nam folder. Where "| x86 |"
appears, you must put "| x86 | x86_64 |". Where "| x86-* |" appears, you must put "| x86-* | x86_64-* |".
In nam config.sub file, it may not have "|86|", so just find out "case $basic_machine in"
It will cause the error, checking build system type... Invalid configuration `x86_64-unknown-linux-gnu': machine `x86_64-unknown' not recognized configure: error: /bin/sh ./config.sub x86_64-unknown-linux-gnu failed otcl-1.8 configuration failed! Exiting ... or x86_64-unknown-linux-gnu failed nam1.0a11a configuration failed!
7) After the modification, ns2 may be compiled successfully. Just run ./install
8) When it is done, edit .bashrc file and configure environment variables. Put them at the end of file.
export NS_HOME=/home/XX/ns-allinone-2.1b9a
export PATH=$PATH:$NS_HOME/bin:$NS_HOME/tcl8.3.2/unix:$NS_HOME/tk8.3.2/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NS_HOME/otcl-1.0a8:$NS_HOME/lib:$NS_HOME/tcl8.3.2/unix:$NS_HOME/tk8.3.2/unix
export TCL_LIBRARY=$NS_HOME/tcl8.3.2/library/
9) Finally, source .bashrc
cd ns-2.1b9a
./validate
The Test may not be successful, but it will not effect too much.
--------------------------------------Install TENS------------------------------------------------------------
10) After the NS2 installation, we will start to make The Enhanced Network Simulator (TENS). So just follow the tutorial (http://www.cse.iitk.ac.in/users/braman/tens/)
The only thing is that when type in make depend, it may have an error pcap.h is not found. So open the Ubuntu Software Center, search libpcap and install all the related packages.
11) Congratulation! It is done!
Here is some of the written exam questions in the interviews I attended. They are just based on my memory, so maybe I forget some parts. And mostly they are about IT, mobile programming, software engineering and networking technology.
# What do you think is the most important ability for a software developer? And why?
# What is TDD? Plz describe it.
# What are the differences between composition and inheritance in OO programming? Which one do you prefer?
# What are the heap and stack? Plz give an example by C or C++ to explain them respectively.
# Now you have a table like this,
Name      Home      Phone      Email
Paul      London      92821921      paul@abc.com
Amy      NY      92712345      amy@abc.com
John      HK      54378722      john@oefd.com
Paul      NY      86433478      paul_ny@abc.com
Plz use SQL to make it as the name is unique, like "Paul, Amy, John".
# Plz give three database engines.
# What is the difference between auto-generated primary key and item`s primary key? Which one will you use and why?
# Plz give three mobile OS. And What is their processor structure respectively?
# What are the three primary data types in C programming? What are the three non-primary data types?
# What is the exact output of the follow PHP script?
< ?php
$i = 1;
$a = &$i;
$b = $a++;
print $a;
print $b;
print $i;
?>
# Plz illustrate the two way communication process of an instant message software. You just need to write the pseudo codes.
# In object-oriented programming, what are the meanings of a) abstract class, b) object interface?
# In MySQL, what is the difference between left join, right join and inner join?
# What is bad about this line of code and how can you improve it?
$db->query(“SELECT username FROM user WHERE userid=”.$_REQUEST[‘uid’]);
# Please write a function to remove all html tags in a string, using regular expression.
# Please describe how to do character conversion from Traditional Chinese to Simplified Chinese using PHP.
# Please write a function to calculate the number of days between 2 dates.
# Please describe how you can schedule a daily job to remove log files older than 3 days, under a certain directory in a Redhat/CentOS Linux machine.
# In IE6, how to make a < div > 1px height with CSS?
In OS X, when we use X11 terminal we may think it`s too small and not customized.
On command line of X11, we could activate one more terminal windows using this command < xterm -fa Monaco -fs 14 -fg white -bg black & >.
Although this command provides us as many self-defined terminals as we need, it still has some limitations, such as it does not support text copy on the window, we can not know current path name unless typing pwd and etc.
Anyway, here we just talk about the usage of this xterm command.
If you want to perform Factory Reset your HTC mobile phone, you could do it like this,
1 Switch off the phone (either removing the battery or shutting down by holding the "end call" button for few seconds
2 While being switched off, hold the "home" (house) and "back" (the arrow in the lower right corner)
3 Hit briefly the "end call" button" while still holding the "home" and "back" buttons.
4 Release the "home" and "back" button, a white screen containing technical information should appear, with a red message asking
for hitting the "menu" button.
5 Hit the "menu button", the Hero will now boot with factory settings.
Somebody says you also have another way which is "HOME > MENU, then tap Settings > Security > Factory data reset" to reset the phone. But I do not find there is an item called "Factory data reset" under "Security" tab. So I think the first method is easier and better.
if we want to record the output in Linux command line, we could use "script" command.
script [-a] [-f] [-q] [-t] + file name
-a
Append the output to file or typescript retaining the prior contents.
-f
Flush output after each write. This is nice for telecooperation: One person does `mkfifo foo; script -f foo' and another can supervise real-time what is being done using `cat foo'.
-q
Be quiet.
-t
Output timing data to standard error. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays.
To exit the recording, we need to use "ctrl + d".
For example, we record the command line output to a log file whose name is "MyRecord".
$ script MyRecord.log
Then it will begin to record all the information displayed by command line. Finally, "ctrl + d" will exit and it will show "Script done, file is MyRecord.log"
#include < time.h >
#include < stdio.h >
int GetTime()
{
   struct timespec tsp;
   clock_gettime(CLOCK_REALTIME, &tsp);   //Call clock_gettime to fill tsp
   fprintf(stdout, "time=%d.%d\n", tsp.tv_sec, tsp.tv_nsec);
   fflush(stdout);
}
When VNC is working in full screen mode, we need to use the key combination
"[CTRL] + [alt/option] + [Apple command] +[`]" to exit it.
1) On Mac OS (According to http://wiki.videolan.org/OSXCompile)
[*] Set the development environment
Install the Mac OS X Developer Tools or get them online.
You need at least Mac OS X 10.5 and Xcode 3.1.4 for compilation. Mac OS X 10.6 and its 3.2.x Xcode releases are also supported. Make sure that the LLVM GCC 4.2 compiler is installed.
Compiling with earlier releases of Mac OS X and/or Xcode will not work.
Additionally, you may need to install Subversion (SVN) and more importantly Git on your Mac.
[*] Get the source
Download the VLC media player source code (using Git) as described on the "Get the source" page or get a recent source tarball.
Note that the 3rd party libraries will probably break a few months after the release's publication.
[*] Build external libs
$ cd extras/contrib
$ ./bootstrap
$ make
[*] Prepare the VLC build
Now we return to VLC itself. Go back to the top level VLC source directory.
$ cd ../..
$ ./bootstrap
This will create configure and Makefiles for VLC media player (snapshots and releases already include this).
[*] Setup the correct compiler
Current revisions of VLC need to be compiled using Apple's llvm-gcc-4.2 compiler in its latest version. In case of failures, make sure that the latest version of Xcode is installed. To use this compiler, you need to export the respective variables. In a Bourne Shell, type this (if Xcode is installed to its default location; bash is the default shell on OS X):
$ export CC=/Developer/usr/bin/llvm-gcc-4.2
$ export CXX=/Developer/usr/bin/llvm-g++-4.2
$ export OBJC=/Developer/usr/bin/llvm-gcc-4.2
[*] Configure the VLC build
The next step is to configure, in the top level VLC source directory. In current revisions, you can simply run
$ ./configure --enable-debug
[*] Build VLC
After configure is finished, we can finally build VLC media player. A simple make will do the trick. If you want to use the resulting application package on a different Mac or a different account on the same Mac, run
$ make
$ make VLC-release.app
2) On Fedora Linux
[#] Download vlc source code 1.1.5 and log on Linux as root user
[#] $ tar -xzvf vlc-1.1.5.tar.bz
[#] Compile vlc by ./configure --prefix=/usr --enable-run-as-root
(--prefix=/usr is the directory for the installation)
[#] If get an error "configure: error: Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.
configure: error: Could not find lua. Lua is needed for some interfaces (rc, telnet, http) as well as many other custom scripts. Use --disable-lua to ignore this error."
Then search and download lua-devel from internet. And install it by "yum install lua-devel"
[#] Compile libmad
Download source from http://www.underbit.com/products/mad, and compile ./configure --prefix=/usr
If it has make error, "cc1: error: unrecognized command line option "-fforce-mem"
make[2]: *** [version.lo] Error 1
make[2]: Leaving directory `/home/izhier/download/libmad-0.15.1b' ", modify the makefile to delete -fforce-mem.
[#] $ ./configure --prefix=/usr --with-mad=/usr
If it has error, "configure: error: Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.", download ffmpeg from internet.
compile ffmpeg by "./configure --prefix=/root/soft/ffmpeg --enable-swscale --enable-postproc --enable-gpl" and then
$ make
$ make install
[#] If it has error about libavcodec, use
$ export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/ffmpeg/lib/pkgconfig"
To test it,
$ pkg-config --modversion libavcodec
Then it will show "52.20.1"
[#] Compile vlc by "./configure --prefix=/usr --with-mad=/usr"
If it has error, "configure: error: Could not find libswscale. Use --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.", use
$ ./configure --help|grep swscale
it will show "--enable-swscale enable GPLed software scaler support [no]". Then, go back to ffmpeg directory and install it again,
$ ./configure --prefix=/usr/ffmpeg --enable-swscale
$ make
$ make install
[#] If it has error, "checking for ffmpeg/swscale.h... no checking for POSTPROC... no configure: error: Could not find libpostproc. Use --disable-postproc to ignore this error.", use
$ ./configure --help|grep postproc
it will show "--enable-postproc enable GPLed postprocessing support [no]"
Then,
$ ./configure --prefix=/usr/ffmpeg --enable-swscale --enable-postproc --enable-gpl
[#] If it shows error "checking for a52dec/a52.h... no
configure: error: Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.", download a52 from "http://liba52.sf.net" and then,
$ ./configure --prefix=/usr
$ make
$ make install
[#] Compile vlc,
$ ./configure --prefix=/usr --with-mad=/usr --with-a52=/usr
If it has error, "checking for FRIBIDI... configure: error: Package requirements (fribidi) were not met:
No package 'fribidi' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables FRIBIDI_CFLAGS
and FRIBIDI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.", download fribidi from website "http://fribidi.org/" and then install it,
$ ./configure --prefix=/usr
$ make
$ make install
[#] Compile vlc,
$ ./configure --prefix=/usr --with-mad=/usr --with-a52=/usr --enable-run-as-root
$ make
$ make install
[#] Now VLC on Fedora could be installed successfully!
I use MatLab R2008b all the time. But after I upgrade my Mac OS, it always crashes when the PLOT or FIGURE function is called.
Now MathWorks post the solution as the following,
The crash is possibly related to upgrading the Mac OS to version 10.5.8 or 10.6.8. This issue has been seen in MATLAB R2007a, R2007b, and R2008a, including both Professional and Student versions. Please note that OS 10.6 is not officially suported for MATLAB R2007a, R2007b, and R2008a.
Configurations reported with this crash:
================================
Mac OS 10.6.8 with Java 1.6.0_26
Mac OS 10.5.8 with Java 1.5.0_30
================================
If MatLab upgrading is not an option, as a workaround, replace a statement in the matlabrc.sh file as follows:
< Step 1 >: Close MATLAB, if there is any session open.
< Step 2 >: Locate the file, 'matlabrc.sh' as follows, In Terminal or xterm , type:
open -a TextEdit /Applications/MATLAB_R2008a/bin/.matlab7rc.sh
< Step 3 >: Open the matlabrc.sh file in the editor to replace a line as follows,
Navigate to Line 407,
if [ "$DYLD_LIBRARY_PATH" != "" ]; then
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
else
DYLD_LIBRARY_PATH=
fi
Change the line "DYLD_LIBRARY_PATH=
" to "DYLD_LIBRARY_PATH=/System/Library/Frameworks/JavaVM.framework/Libraries
"
< Step 5 >:
Save the changes by pressing "Command" + "s" keys.
< Step 6 >:
Restart MATLAB.
Reference: http://www.mathworks.com.au/support/solutions/en/data/1-F37IJB/index.html
JVLC is a java version of VLC player, it can be downloaded at 'http://code.google.com/p/vlcj/'. But it is not easy to be set up. I also encounter some hectic problems. And JVLC does not support Mac OS at present!!!
1) download Eclipse at 'http://www.eclipse.org/downloads/'. We should download the matched version with the OS, such that my computer need to use Windows 32-bit instead of 64-bit.
2) ensure Java Runtime Environment(JRE) has been installed.
3) install and run Eclipse directly.
4) extract vlcj to the workspace of Eclipse. Build up a project and import it into Eclipse.
5) If we run the project now, probably we will get some error like this, "Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found."
6) So we need install VLC and it can be downloaded at 'http://www.videolan.org/vlc/releases/1.1.5.html'.
7) After the installation, the solution to that error is that the system PATH should be redirected to the directory which contains the module of "libvlc.dll". "libvlc.dll" is in 'C:\Program Files(x86)\VideoLAN\VLC'.
8) So what we need to do is to configure the environment variables, putting this path into the System PATH. The details and steps is illustrated on the website of Java (http://www.java.com/en/download/help/path.xml).
9) And do not forget to Reboot your computer. This is very important to activate PATH variable.
10) Now, JVLC could be compilable and work.