Wednesday, February 8, 2012

Installing NS2.35 on Fedora 15 and 16

NS is a discrete event simulator used primarily for networking research. It provides support for simulation of TCP, routing, and multicast protocols over wired and wireless networks.

ns can be installed on computers that run on Windows and Unix. But most users out there to use the simulation software on a Unix system.

For this short tutorial, I am going to discuss briefly how to install ns2.35 (the latest version of the software at the time of this writing) on Fedora 15 and 16. I am also a beginner at using ns and I have to admit that I also had my shares of frustrations and confusions during the whole process right from when I first started using Fedora (it was my first time to use a Linux machine).

So if you are advanced user, maybe this tutorial is going to be very basic since I prepared it in a way that even beginners (those who have just started using Linux) could understand.

Almost everything in this installation process is done using the terminal. The terminal is Linux's version of the Command Prompt in Windows operating systems. It provides us with a way to type commands to the computer much like the way computer users did about 20 years ago. That may sound strange but it is actually easy to use and you can do more with your PC once you know the basic operations. Here's a good tutorial for you to read just so you can prepare for the next few steps.

Alright! Now, I assume that you already know some basic terminal commands, let's proceed to installing your ns software.

1. Open terminal and become root by typing:
 
    su -
 
2.You will then be prompted to type your root password.
3.Go to the directory where you want to install your ns software by using a series of "dir" and "cd" commands.

    dir
    cd

The command "dir" outputs a list of all the files and directories within the current directory where you are in. The "cd" command when proceeded with the name of a directory(folder) opens that directory.
4.First we need to install all the prerequisites of ns starting with our C++ compiler:

    yum install gcc-c++
    yum install tcl-devel
    yum install libX11-devel (that's one-one)
    yum install libXt-devel

5. Next step is for you to download the all-in-one package of ns2.35 here. Go to the directory where you downloaded the tar file and transfer it to where you want it installed.
6.Going back to the terminal, navigate to the directory where you saved the ns-allinone-2.35.tar file.
7. Execute the following commands:

    tar -zxvf ns-allinone-2.35.tar

8. Finally, navigate into the ns-allinone-2.35 directory and type the following command in the terminal:

    ./install

Tuesday, February 7, 2012

fatal error: pcap.h - Error in Fedora terminal

I am using ns2 for my simulations. Whenever I changed something in the C++ codes of the package, I had to reconfigure everything again. The steps were to:
    make clean
    configure
    make clean
    make depend
    make


But every time I execute the command "make depend", I get this nasty bit of error:
fatal error: pcap.h: No such file or directory compilation terminated.
So one of the solutions I found in the internet was to install libpcap-dev.
"...Usually, the library packages only provide the library files that programs using them need to run. They don't provide the header files that developers use to write programs using the libraries and the "dev" or "devel" packages containing the headers."


So I installed libpcap-devel following this short tutorial.

In the terminal (Fedora), enter the following commands:

$ yum search pcap-devel
libpcap-devel.i686 : Libraries and header files for the libpcap library
Note that you must be the root/administrator to install the package. To install this package in Red Hat/Fedora Linux.
$ yum install libpcap-devel.i686
You can check the details of this package pcap-devel
$ yum info libpcap-devel.i686


And that solves the problem. When I went back to my ns2 installation and executed "make depend", the command didn't encounter any errors.

Friday, July 22, 2011

Stumbleupon's Effect

I am a newbie at blogging and I am currently maintaining a design blog. And I am usually contented with the number of page views I get every day.

One night, while browsing through my unread emails, I came across an article that talked about how StumbleUpon can greatly increase the traffic going to your website.

I already had a StumbleUpon account but when I used it for the first time about a few months ago, I didn't notice any effect on my website.

So, out of boredom partly wanting to scratch that itch of curiosity, I opened my SU account and started posting links of my posts without even fixing the reviews. I just wanted to post links and see for myself what the effect would be.

After about 5 minutes, I checked my stats. From 25 page views earlier that evening, it went up to 65!
I got interested and excited.

I removed all of the links that I posted and opened one category in my blog - the shoe design category. I copied all of the links and posted them to StumbleUpon. I tried my best to fill up the reviews text box and waited for my views to change.

It looked like this:


The first large spike on the left is the one representing the number of page views that I had that day. From 65 views, it went up to 106. Then, it surpassed the 143 page view mark and went up to 206. After a few minutes, it reached 600 page views and finally stopped at 765!



My jaw dropped as I watched my page views rise by the minute! StumbleUpon can really drive tons of traffic into a website, given that you provide your viewers with rich content or content that's just simply cool. :)

If you're a blogger or an owner of a website, you should definitely try StumbleUpon for your SEO.

Tuesday, July 19, 2011

Starting with Android Development

I recently started developing applications for Android. For a beginner, I felt the need of creating a basic Hello World application. I followed the tutorials from this website:
http://developer.android.com/resources/tutorials/hello-world.html
They explained here everything about making and setting up your very first application. I followed everything from step one and was able to come up with this code in the end.




Everything was set. When I pressed F11 to run the application, an error occured:
invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe
I researched about the error and was able to stumble upon some very useful forum posts at www.stackoverflow.com.


Some of the posts were useless to me. I tried the solution that the first member posted and I only arrived with a warning that I should select an existing directory.
"There is currently a problem with R12 where the SDK location cannot contain any spaces.The default installation location is: C:\Programme Files(x86)\Android\android-sdk. They are currently fixing the problem but you can currently work around it by changing the SDK location path in eclipse to C:\PROGRA~2\Android\android-sdk."
 But I later found out that this process was not going to work on my computer. The reason was because I only had 1 "Program Files" folder. This was only applicable to a directory with 2 folders with that name.


I found my answer in one of the posts by Dennis.

"Doesn't work here. I did everything what the tutorial said, and i got a invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
also "C:\Program Files (x86)\Android\android-sdk\tools\emulator-arm.exe" @foo or C:\Program Files\Android\android-sdk\tools\emulator-arm.exe @foo didn't work also. I am a scripter myself and this is just not good.
ok i fixed it. SOLUTION: change it to C:\PROGRA~1\Android\android-sdk IF you only have 1 folder named program files.
Maybe this helps for others also
With the @foo i did nothing, i just changed the folder to C:\PROGRA~1\Android\android-sdk It is indeed true that this version don't allow spaces in folder paths so in this case with PROGRA~1 he grab the first folder that begins with PROGRA while PROGRA~2 grabs the second folder named program files IF it exists, otherwise if not, the program will say that that folder don't exist."


After fixing the problem, I ran my application and everything went well except for the application's boot time. It took quite a long time to boot and show my first Hello World output in Android. It's normal because When the emulator is booted, the Eclipse plugin installs your application and launches the default Activity. 
When my application finally ran, I noticed that the screen was too wide that I couldn't see the output of my application. In order to fix this, follow these very simple steps:

  1. Go to Window -> Android SDK and AVD Manager -> Virtual Devices
  2. Select the AVD you want to launch and click Start
  3. Check the "Scale display to real size" button
  4. Enter how big you want it to appear in inches and press Launch.

    OR you can also do it in a different way:
  1. Go to Window -> Android SDK and AVD Manager -> Virtual Devices
  2. Select the AVD you want to launch and click Edit
  3. Under the Skin section, you can enter your preferred dimensions of the emulator screen.
  4. Click Edit AVD and close the Android SDK and AVD Manager Dialog box.
Hope this helps you guys on running and setting up your first application!