tag:blogger.com,1999:blog-9075243338213742852024-03-05T00:59:58.701-08:00Sydney Cyber ArmyI am a Postdoctoral Research Fellow with The SUTD-MIT International Design Centre (IDC), Singapore University of Technology and Design (SUTD). My research topic is about protocol and algorithm design, resource allocation and localisation in wireless sensor network, UAV network and Ad Hoc network. I also enjoy the mobile programming (Android and Objective-C) and web server development. Thanks for sharing.IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.comBlogger62125tag:blogger.com,1999:blog-907524333821374285.post-22572762395033839312015-08-05T01:26:00.000-07:002015-10-04T20:23:27.535-07:00Use Raspberry Pi to scan smartphones<font color="#ffff00">
We use Raspberry Pi to scan the smartphone which enables the Wi-Fi connection. The data is uploaded to the server through ethernet. <br /><br />
1) connect the Pi with an ethernet cable, and set up a cable connection either from direct wired network or network bridge. <br /><br />
2) connect the Pi with a USB Wi-Fi dongle so that it can scan the smartphone. <br /><br />
3) Auto Login Configuration <br />
<ul>
<li>Turn on the Raspberry Pi. For the first time, we need to manually type the username and password. The username is pi, and password is raspberry</li>
<li><i>sudo nano /etc/inittab</i></li><br />
<li>Find "1:2345:respawn:/sbin/getty 115200 tty1". And comment it by "#1:2345:respawn:/sbin/getty 115200 tty1"</li><br />
<li>Then type "<i>1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1</i>"</li><br />
<li>Ctrl+X to exit, and save the file</li><br />
</ul>
4) Running Python script on startup <br />
<ul>
<li>Make a shell script "starter.sh":
<i>#!/bin/bash
tcpdump -i mon0 -e -l type mgt subtype probe-req | python probe_request_gather.py &</li><br />
<li>chmod 755 starter.sh</i></li><br />
<li>Create a log directory under HOME: <i>mkdir logs</i></li><br />
<li><i>sudo crontab -e</i></li><br />
<li>Write the line: <i>@reboot sh /home/pi/bbt/launcher.sh >/home/pi/logs/cronlog 2>&1</i></li><br />
<li>Reboot the Pi to see if it works: <i>sudo reboot</i></li><br />
<li>The error can be found in the log file: <i>cd logs & cat cronlog</i></li><br />
</ul>
5) Tools installation <br />
<ul>
<i><li>sudo apt-get update</li>
<li>sudo apt-get upgrade</li><br />
<li>sudo apt-get install libssl-dev libnl-3-dev libnl-genl-3-dev build-essential tcpdump iw ntpdate</li></i><br />
<li>Install aircrack-ng:
<i>
wget http://download.aircrack-ng.org/aircrack-ng-1.2-beta1.tar.gz<br />
tar -zxvf aircrack-ng-1.2-beta1.tar.gz<br />
cd aircrack-ng-1.2-beta1<br />
sudo make<br />
sudo make install<br />
airodump-ng-oui-update</i></li><br />
</ul>
6) Now copy the Python script which is used to scan the smartphones and upload data, and “starter.sh” to a location, e.g., ~/Desktop/data_gather/. <br /><br />
7) Edit “~/.bashrc” to start the python script after startup <br />
<i>
sudo /etc/init.d/ntp stop <br />
sudo ntpdate sg.pool.ntp.org<br />
sleep 5<br />
sudo airmon-ng start wlan0<br />
sudo airmon-ng start wlan1<br />
sleep 5<br />
sudo bash /home/pi/Desktop/data_gather/start.sh <br /><br />
</i>
8) Add a file “id.txt” in root directory “/” to specify the node ID.
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com1tag:blogger.com,1999:blog-907524333821374285.post-5588320656579630442015-04-07T11:19:00.001-07:002015-04-07T11:19:57.989-07:00Configuration for passive Wi-Fi<font color="ffff00">
Gateway node for smart tracking <br /><br />
<img style="display:block; margin-left:auto; margin-right:auto;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqGR6jwuP4kMZ35T_W5SvEXh-ViDwTvnnBaIhdTG4FQdut9k-Dwz_4da9pW0Ok6svVJq7vWuxeWPMtg6Vpa36IcEj-usvUM4ik5pNer63GftzcrgQiMJNRNJsOBmfqhx3K0KvVGq_phEel/?imgmax=800" alt="File 8 4 15 2 14 32 am" title="File 8-4-15 2 14 32 am.jpeg" border="0" width="600" height="449" />
Configurations for gateway node: <br /><br />
1) configure Wi-Fi username and password: <br /><br />
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf <br /><br />
2) update server address: <br /><br />
cd ~/Desktop/data_gather <br /><br />
sudo vi probe_request_gather.py <br /><br />
Then, modify "SERVER_ADDRESS" <br /><br />
Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-62532244518427566202015-02-02T05:15:00.001-08:002015-02-02T05:15:24.770-08:00Dia cannot be run on Yosemite<font color="#ffff00">
After I upgrade my Mac OS to Yosemite, Dia can not run. From a developer forum, I see the solution. <br /><br />
Run this command in X11 to run Dia from command line: <br /><br />
DISPLAY=:0 /Applications/Dia.app/Contents/Resources/bin/dia <br /><br />
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-28231382721035614082014-11-10T17:46:00.001-08:002014-11-10T17:46:56.665-08:00A test for my Arduino working with NRF24L01+PA transceiver<font color="#ffff00">
There are two computers, one is called Joker and the other is called Batman. They use Morse code to communicate. The microcontroller is Arduino and the wireless transceiver is NRF24L01+PA.
I find that sometimes it works fine especially at night when few people are in the lab, but sometimes transmission failed (both of them can not talk to each other or just one-way communication works). Not sure if the reason is the interference from wifi.
<iframe width="560" height="315" src="//www.youtube.com/embed/E69ASX2HkeU" frameborder="0" allowfullscreen></iframe>
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-14805994616977343592014-09-29T18:31:00.000-07:002014-10-29T17:33:35.696-07:00A simple office desk safety alarm system <div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/APq2ogEIMWQ?feature=player_embedded' frameborder='0'></iframe></div>
<span style="color: yellow;">
Something you need: 1 arduino microcontroller, 1 breadboard, 1 LED, 1 PIR sensor and some wires. <br /></span>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-17613535549844606602014-05-26T18:44:00.000-07:002014-05-26T18:45:14.416-07:00A shortcut to convert PDF to EPS<font color="#ffff00">
Just find a good way to convert pdf file to eps. This is quite useful when you edit a paper with Latex. Before we do it, we need to download the Texshop (<a href>http://pages.uoregon.edu/koch/texshop/</a>):<br /><br />
To convert pdf → eps (Mac OS X will only do (e)ps → pdf & pdf → ps),<br /><br />
- open the pdf in TeXShop, choose the 'Selection' tool in the Preview window toolbar<br /><br />
- select the desired rectangle (or all, either with ⌘-A or manually),<br /><br />
- choose 'Preview>Save Selection to File...', & save as eps."<br /><br />
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-81525652507562571962014-03-17T22:37:00.001-07:002014-03-17T22:37:22.576-07:00Research Diaries: Brano Kusy<iframe allowfullscreen="" frameborder="0" height="270" src="//www.youtube.com/embed/k6Kjugj-wzw" width="480"></iframe>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-22656022918478537702013-09-02T22:34:00.001-07:002013-09-02T22:34:09.569-07:00Link bibliography with Latex<font color="#ffff00">
We compile the latex file on command line:<br /><br />
1) latex XXX.tex<br /><br />
2) bibtex XXX<br />
Notice that there is no .tex here!<br /><br />
3) repeat to run command "latex XXX.tex" twice<br /><br />
4) dvips XXX.dvi<br /><br />
5) ps2pdf XXX.ps<br /><br />
6) A pdf file is created. :)<br /><br />
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-74161986171363134272013-08-14T23:19:00.001-07:002013-08-14T23:19:10.814-07:00Edit a paper with LNCS format in Latex<font color="#ffff00">
Some paper may require LNCS format. You can download the package from <a href="http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0">http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0</a>. Here I use llncs2e.zip and the sample file typeinst.zip.<br /><br />
You can import your latex file into the sample file "typeinst.tex". Notice that if your figures include subfigure, you need to add three packages:<br /><br />
\usepackage{caption}<br />
\usepackage{subcaption}<br />
\usepackage{subfig} <br /><br />
If it has some equations, add:<br /><br />
\usepackage[cmex10]{amsmath,mathtools}<br />
\usepackage{mdwmath}<br /><br />
If it includes algorithm, add:<br /><br />
\usepackage{algorithm}<br />
\usepackage{algorithmic}<br /><br />
Then, copy two files "llncs.cls" and "splncs.bst" (can also choose "splncs_srt.bst" or "splncs03.bst") from llncs2e folder to typeinst.<br /><br />
If the paper has some references generated by XXXX.bib file, then at the end of the paper, add:<br /><br />
\bibliographystyle{splncs}<br />
\bibliography{XXXX}<br /><br />
After finish the editing, we just follow the previous tutorial (<a href="http://itantenna.blogspot.com.au/2013/08/compile-latex-file-with-eps-figures.html">http://itantenna.blogspot.com.au/2013/08/compile-latex-file-with-eps-figures.html</a>) to compile the latex file.<br /><br />
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com2tag:blogger.com,1999:blog-907524333821374285.post-52470812337996968552013-08-13T23:25:00.001-07:002013-08-14T01:02:07.468-07:00Compile the latex file with eps figures<font color="#ffff00">
Sometimes we are required to use eps figures instead of pdf ones in the latex file. Here we show a method to compile your latex file by command line. Before this, please make sure you have installed latex editor.<br />
1) Go to the directory which includes XXX.tex<br /><br />
2) type "latex XXX.tex" and we will see a XXX.dvi file is generated<br /><br />
3) then, type "dvips XXX.dvi" and a XXX.ps file is created<br /><br />
4) type "ps2pdf XXX.ps" and the PDF file is created<br /><br />
This pdf file will display the eps figures properly.<br /><br />
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-61580034149522604072013-07-18T21:04:00.000-07:002013-08-11T21:11:28.023-07:00Add a new MAC protocol in NS2<font color="#ffff00">
I just install the NS2 in my machine. If you are not sure, please read: <br />
<a href="http://itantenna.blogspot.com.au/2012/01/install-ns234-on-ubuntu-1004.html">http://itantenna.blogspot.com.au/2012/01/install-ns234-on-ubuntu-1004.html</a>;<br />
<a href="http://itantenna.blogspot.com.au/2011/11/install-ns21b9a-tens-in-ubuntu-1004.html">http://itantenna.blogspot.com.au/2011/11/install-ns21b9a-tens-in-ubuntu-1004.html</a>;<br />
<a href="http://itantenna.blogspot.com.au/2010/10/ns2macintosh.html">http://itantenna.blogspot.com.au/2010/10/ns2macintosh.html</a>;<br />
Now let`s add a new MAC protocol.<br />
1) Put your new MAC program files (newMAC.cc and newMAC.h) to ns-2.34/mac<br />
2) Modify common/packet.h<br />
<i>#define HDR_NEWMAC(p) ((hdr_newmac *)hdr_mac::access(p)) // add newmac here</i><br />
Find "enum packet_t{}" and add <i>PT_NEWMAC</i>. Notice that it must be added before <i>PT_NTYPE</i>.<br />
Find "class p_info{}" and add <i>name_[PT_NEWMAC] = "newmac"</i>. It must be before <i>name_[PT_NTYPE] = "undefined"</i>.<br />
3) Modify tcl/lib/ns-default.tcl<br />
Add <i>Mac/NEWMAC set syncFlag_ 1</i><br />
Add <i>Mac/NEWMAC set selfConfigFlag_ 1</i><br />
Add <i>Mac/NEWMAC set dutyCycle_ 10</i><br />
……<br />
In the later line, <br />
Add <i>Mac/NEWMAC set syncFlag_ 0</i><br />
4) Modify tcl/lib/ns-packet.tcl<br />
Find "foreach prot{}" and add <i>NEWmac</i><br />
5) Modify ns2.34/Makefile<br />
Add <i>mac/newmac.o \</i><br />
6) Now a new MAC protocol has been added to NS2. We will modify some trace files in the next.<br />
7) Modify trace/cmu-trace.h<br />
Add <i>void format_newmac(Packet *p, int offset);</i><br />
8) Modify trace/cmu-trace.cc<br />
Find "void CMUTrace::format_mac_common(Packet *p, const char *why, int offset)"<br />
<i>
struct hdr_cmn *ch = HDR_CMN(p);<br />
struct hdr_ip *ih = HDR_IP(p);<br />
struct hdr_mac802_11 *mh;<br />
struct hdr_smac *sh;<br />
struct hdr_newmac *ph; // add newmac pointer<br />
char mactype[SMALL_LEN];<br />
strcpy(mactype, Simulator::instance().macType());<br />
if (strcmp (mactype, "Mac/SMAC") == 0)<br />
sh = HDR_SMAC(p);<br />
else if (strcmp (mactype,"Mac/NEWMAC") == 0) <br />
ph = HDR_LMAC(p);<br />
else<br />
mh = HDR_MAC802_11(p);<br />
……<br />
if (strcmp (mactype, "Mac/SMAC") == 0) {<br />
format_smac(p, offset);<br />
}<br />
else if (strcmp (mactype, "Mac/NEWMAC") == 0) { <br />
format_newmac(p, offset);<br />
}<br />
else {<br />
format_mac(p, offset);<br />
}<br />
return;<br />
</i>
Find "if(newtrace)"<br />
<i>
offset = strlen(pt_->buffer());<br />
if (strcmp(mactype, "Mac/SMAC") == 0) {<br />
format_smac(p, offset);<br />
}<br />
else if (strcmp(mactype, "Mac/NEWMAC") == 0) {<br />
format_newmac(p, offset);<br />
}<br />
else {<br />
format_mac(p, offset);<br />
}<br />
……<br />
(ch->ptype() == PT_SMAC) ? (<br />
(sh->type == RTS_PKT) ? "RTS" :<br />
(sh->type == CTS_PKT) ? "CTS" :<br />
(sh->type == ACK_PKT) ? "ACK" :<br />
(sh->type == SYNC_PKT) ? "SYNC" :<br />
"UNKN") :<br />
(ch->ptype() == PT_NEWMAC) ? ( <br />
(ph->type == RTS_PKT) ? "RTS" :<br />
(ph->type == CTS_PKT) ? "CTS" :<br />
(ph->type == ACK_PKT) ? "ACK" :<br />
(ph->type == SYNC_PKT) ? "SYNC" :<br />
"UNKN") :
<br />
packet_info.name(ch->ptype())),<br />
ch->size());<br />
……<br />
if (strncmp (mactype, "Mac/SMAC", 8) == 0) {<br />
format_smac(p, offset);<br />
}<br />
else if (strncmp (mactype, "Mac/NEWMAC", 8) == 0) {<br />
format_newmac(p, offset);<br />
}<br />
else {<br />
format_mac(p, offset);<br />
}<br />
……<br />
</i>
Add a new function <br />
<i>
void CMUTrace::format_newmac(Packet *p, int offset)<br />
{<br />
struct hdr_newmac *ph = HDR_NEWMAC(p);<br />
sprintf(pt_->buffer() + offset,<br />
" [%.2f %d %d] ",<br />
ph->duration,<br />
ph->dstAddr,<br />
ph->srcAddr);<br />
}<br />
</i>
9) Find "void CMUTrace::format(Packet* p, const char *why)"<br />
Add <br />
<i>
switch(ch->ptype()) {<br />
case PT_MAC:<br />
case PT_SMAC:<br />
case PT_NEWMAC: <br />
break;<br />
case PT_ARP:<br />
format_arp(p, offset);<br />
break;<br />
</i>
10) Finally, add the header files <i>#include <newmac.h> </i><br />
</font>
Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com10tag:blogger.com,1999:blog-907524333821374285.post-21522997283051622252013-06-24T04:17:00.001-07:002013-06-24T04:18:39.816-07:00A book about Knapsack problem<span style="color: yellow;">
You can download this ebook for free.
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">Knapsack Problems: Algorithms and computer Implementations
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">Download link: http://www.or.deis.unibo.it/knapsack.html
</span>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-76042560512441606802013-06-23T18:23:00.001-07:002013-06-23T18:23:05.052-07:00STUDY MATERIALS FOR ENGINEERING STUDENTS WITH SOME MATLAB PROJECT: MATLAB CODE FOR ZIGBEE<span style="color: yellow;"><a href="http://deepeshrawat987.blogspot.com/2013/02/matlab-code-for-zigbee.html?spref=bl">STUDY MATERIALS FOR ENGINEERING STUDENTS WITH SOME MATLAB PROJECT: MATLAB CODE FOR ZIGBEE</a>: THIS PROGRAM FOR ZIGBEE IS IN 3 PART SAVE ALL THREE PART IN DIFFERENT EDITOR FILE AND THEN RUN %>>>>>>>>PROGRAM 1...</span>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-17791373340045906392013-05-15T04:15:00.000-07:002013-06-24T04:20:58.101-07:00How to install NS3 on Mac OS Lion<span style="color: yellow;">
1) Install XCode
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">You will find XCode in the App Store. Alternatively, you can download the most recent version of XCode from the Apple Developer Connection website (http://developer.apple.com/mac/). The XCode development environment includes the gcc compiler and critical libraries required to build applications to be run in Mac OS X. Mac OS X Lion, requires XCode 4.1+.
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">2) Install MacPorts
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">2.1) Download MacPorts package installer for Lion release version 2.02 from https://distfiles.macports.org/MacPorts/MacPorts-2.0.2-10.7-Lion.dmg
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">2.2) Click on the downloaded "pkg" file, to install MacPorts.
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">2.3) This will place a fully-functioning MacPorts installation on your system
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3) Install Required packages for ns-3
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3.1) Open a Terminal window and run each command to install the required package
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3.2) Install Mercurial and Python:
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> sudo port install mercurial python26
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3.3) Install Bzr</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> sudo port install bzr
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3.4) Install LibXML
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> sudo port install libxml2
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">3.5) Install GDB
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> sudo port install gdbm
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">4) Download ns3 source code
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> hg clone http://code.nsnam.org/ns-3-allinone
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> cd ns-3-allinone
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> ./download.py
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">5) Build the local repository
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> ./build.py
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">6) Test the installation</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> cd ns-3-dev
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">>> ./test.py </span>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-26263564672614047532013-03-31T20:06:00.000-07:002013-06-29T21:08:28.323-07:00Batch operation in AMPL<span style="color: yellow;">
</span><span style="color: yellow;">To speed up the operations, you may put the commands into a file, and run them all automatically by typing include and the filename. The following is an example batch file (routing.run):
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">reset;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">model network.mod;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">data network.dat;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">option solver cplex;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">solve;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">display N;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">display x;
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">So you run the optimization in AMPL command line:
</span><br />
<span style="color: yellow;"><br /></span>
<span style="color: yellow;">ampl: include routing.run;
</span>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-434471793000286192013-03-13T16:19:00.000-07:002013-05-30T17:24:53.947-07:00TCP/IP Protocol Suite By Behrouz A. Forouzan [E-Book] ~ Dhruv Solanki<font color="#FFFF00">
<p><a href="http://dhruvsolanki.blogspot.com.au/2012/07/tcpip-protocol-suite-by-behrouz.html?showComment=1369957952613#c6688558159036295837">TCP/IP Protocol Suite By Behrouz A. Forouzan [E-Book] ~ Dhruv Solanki</a>: </p>
<p>(Via.)</p>
</font>Sky in My Eyes.bakhttp://www.blogger.com/profile/11884592629831242005noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-28427105208115910532013-02-27T22:33:00.000-08:002013-03-07T02:05:03.768-08:00AMPL optimization tool on Mac OS<font color="#ffff00"><br />AMPL is a mathematical programming language. It can be downloaded from <a href>http://www.ampl.com/DOWNLOADS/index.html</a>. There are some useful solvers as well. <a href>http://www.ampl.com/DOWNLOADS/details.html</a>. Most of them require student ident. <br /><br />After you download or install AMPL and those solvers, you need to use command "chmod +x ..." to convert them to executable program on Mac.<br /><br />Then, you must edit environment variables (in ~/.bashrc file) to add ampl and related libraries/licenses.<br /><br />export PATH=...:/your/AMPL/path/ampl<br /><br />export DYLD_LIBRARY_PATH=/your/knitro/path/lib<br /><br />export ZIENA_LICENSE=/your/knitro/license/path<br /><br />For the testing of AMPL, we create a file named as <i>myprog.mod</i> and write a simple model,<br /><br /><i>var XB;<br /><br />var XC;<br /><br />maximize Profit: 25 * XB + 30 * XC;<br /><br />subject to Time: (1/200) * XB + (1/140) * XC <= 40;<br /><br />subject to B_limit: 0 <= XB <= 6000;<br /><br />subject to C_limit: 0 <= XC <= 4000;<br /></i><br /><br />Then, change directory to the <i>myprog.mod</i> file. type <i>ampl</i> on the command prompt and we can try to solve it by different solvers. (the default solver of AMPL is MINOS)<br /><br /><i>1) ampl: model myprog.mod;<br /><br />ampl:option solver knitroample;<br /><br />ampl:solve;<br /><br />2) ampl: model myprog.mod;<br /><br />ampl:option solver gurobi;<br /><br />ampl:solve;<br /><br />3) ampl: model myprog.mod;<br /><br />ampl:solve;<br /><br />4) ampl: model myprog.mod;<br /><br />ampl:option solver lpSolve;<br /><br />ampl:solve;<br /><br />5) ampl: model myprog.mod;<br /><br />ampl:option solver snopt;<br /><br />ampl:solve;<br /></i><br /><br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-83768767821568271372013-02-22T21:59:00.000-08:002013-03-11T03:03:31.127-07:00Download and install IBM Cplex solver (Academic version) for your AMPL<span class="Apple-style-span" style="color: yellow;"><br />By default, AMPL uses MINOS as an optimization solver. However, Cplex which was developed by IBM is the most useful solver. The official website of IBM is not so friendly and they do not remove some web pages which are out of date.<br /><br />To download Cplex, you have to register a academic membership at first. <br /><br />1) Go to <a href="http://www-03.ibm.com/ibm/university/academic/pub/page/software">http://www-03.ibm.com/ibm/university/academic/pub/page/software</a> and find the link "Join now - at no charge"(if the first time) or "Renew your membership"<br /><br />2) Then, step 1: you will be asked to Register for a universal IBM ID and password (use your academic email address to do it). step 2: Complete the Academic Initiative program membership process (click "apply as a faculty member"). <a href="http://www-03.ibm.com/ibm/university/academic/pub/page/mem_join">http://www-03.ibm.com/ibm/university/academic/pub/page/mem_join</a><br /><br />3) After that, you will receive a confirmation email saying the application has been approved.<br /><br />4) Visit the page <a href="http://www-03.ibm.com/ibm/university/academic/pub/page/sof_all_software">http://www-03.ibm.com/ibm/university/academic/pub/page/sof_all_software</a>, and click the link where is at bottom <a href="https://www14.software.ibm.com/webapp/iwm/web/reg/signup.do?source=scholars">Search the Academic Initiative Software Download Catalog</a> (This is pretty tricky)<br /><br />5) After submitting your request, you will go to "IBM Academic Initiative Software Downloads" page.<br /><br />6) Type "cplex" on "Find by search text" and you will see a list of cplex version choose one and you will see the software list.<br /><br />7) Since the download needs java applet, you have to enable it for your browser.</span><br />
<span class="Apple-style-span" style="color: yellow;"><br /></span>
<span class="Apple-style-span" style="color: yellow;">8) After the download is finished, you will have a .bin file like "cplex_studio125.macos.bin"(here I download cplex12.5). DO NOT put it to your Application folder as it is not an application which can be run by your Mac.</span><br />
<span class="Apple-style-span" style="color: yellow;"><br /></span>
<span class="Apple-style-span" style="color: yellow;">9) Put it to some other directory. Open a terminal and find that directory. This bin file is a shell script, so you have to run it by bash. type and run this command </span><br />
<i><span class="Apple-style-span" style="color: yellow;">"/bin/bash ~/your/path/cplex_studio125.macos.bin"</span></i><br />
<span class="Apple-style-span" style="color: yellow;"><br /></span>
<span class="Apple-style-span" style="color: yellow;">10) Follow the instruction and you will install it successfully.</span><br />
<span class="Apple-style-span" style="color: yellow;"><br /></span>
<span class="Apple-style-span" style="color: yellow;">11) Finally, do not forget configure the environment variable for the license: export ILOG_LICENSE_FILE=/your/license/path/access.lim</span><br />
<span class="Apple-style-span" style="color: yellow;"><br /></span>
<span class="Apple-style-span" style="color: yellow;">12) The access.lim is generated from your IBM Academic Initiative.</span><br />
<span style="color: yellow;"><br /></span>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com23tag:blogger.com,1999:blog-907524333821374285.post-21874479403104812012013-01-29T21:43:00.000-08:002013-01-30T21:33:10.546-08:00Compile threshold.cc in NS2<font color="#ffff00"><br />In ns2, if you want to calculate the receiving power threshold of a node, you may want to use threshold tool which has been integrated in ns2 source code.<br /><br />I don`t know why the threshold.cc is not compiled in the new version of ns2 like ns-allinone-2.35. So we have to do it by ourselves. In ubuntu, if you try to do "gcc threshold.cc", you will get an error message of "<iostream.h>". <br /><br />So, we replace this line "#include<iostream.h>" by<br /><br /><strong><em>#include<iostream><br /><br />#include<cstring><br /><br />using namespace std;</em></strong><br /><br />Then, compile it with g++,<br /><br /><strong><em>g++ threshold.cc -o threshold</em></strong><br /><br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com7tag:blogger.com,1999:blog-907524333821374285.post-40044317869186773402013-01-15T00:39:00.000-08:002013-01-30T21:55:28.351-08:00Generate random number in old version Matlab<font color="#ffff00"><br />If you want to have different a sequence of random numbers when the program is run for multiple times, a seed has to be set. The function <em>"rand('state', int)"</em> can not do it.<br /><br />The old version Matlab which is lower than v7.7 has no some common random number generators. You can not use RandStream or rng() to set the random seeds. So I use an extended random number generator which can be downloaded from <a href="http://people.sc.fsu.edu/~jburkardt/m_src/asa183/asa183.html">http://people.sc.fsu.edu/~jburkardt/m_src/asa183/asa183.html</a> (r8_random.m). <br /><br /><em><strong> s1 = mod ( 171 * s1, 30269 );<br /><br /> s2 = mod ( 172 * s2, 30307 );<br /><br /> s3 = mod ( 170 * s3, 30323 );<br /><br /> r = mod ( s1 / 30269.0 ...<br /><br /> + s2 / 30307.0 ...<br /><br /> + s3 / 30323.0, 1.0 );<br /><br /> return</strong></em><br /><br /><br />We just need to set different seed s1,s2,s3 at the beginning of your program each time when you run it and it will generate different random sequences.<br /><br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-54246886756984720492012-12-15T08:01:00.000-08:002013-01-30T21:35:29.059-08:00E: Internal Error, No file name for libssl1.0.0<font color="#ffff00"><br />The problem of libssl1.0.0 in Ubuntu 12.04 is "E: Internal Error, No file name for libssl1.0.0". So we can type:<br /><br />sudo apt-get update<br /><br />sudo apt-get clean<br /><br />sudo apt-get install -fy<br /><br />sudo dpkg -i /var/cache/apt/archives/*.deb<br /><br />sudo dpkg --configure -a<br /><br />sudo apt-get install -fy<br /><br />sudo apt-get dist-upgrade<br /><br />This method could solve the problem.<br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com3tag:blogger.com,1999:blog-907524333821374285.post-20190414745688138982012-11-25T03:56:00.000-08:002013-01-30T21:32:03.576-08:00Ubuntu login from GUI and command line<font color="#ffff00"><br />Switch to command prompt: Ctrl + F1<br /><br />Switch to GUI: Ctrl + F7<br /><br />Command line to start GUI: sudo lightdm<br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-10766494947453553622012-11-11T16:08:00.000-08:002013-01-30T21:29:08.774-08:00Programming on Tinyos<font color="#ffff00"><br />Installation (a simple way)<br /><br />1) deb http://tinyos.stanford.edu/tinyos/dists/ubuntu natty main<br /><br />2) sudo apt-get update<br /><br />3) sudo apt-get install tinyos<br /><br />4) sudo apt-get install tinyos-2.1.1<br /><br />5) Add the following line to your ~/.bashrc or ~/.profile file in your home directory to set up the environment for TinyOS development at login<br /><br />#Sourcing the tinyos environment variable setup script<br /><br />source /opt/tinyos-2.1.1/tinyos.sh<br /><br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-52574133309977203372012-10-03T07:37:00.001-07:002012-10-03T07:37:38.099-07:00How to decompress multiple files on Linux<font color="#ffff00"><br />To unzip multiple zipped .zip files:<br /><br />for file in *.zip; do unzip "${file}"; done<br /><br />To unzip multiple zipped .gz files;<br /><br />gunzip *.gz<br /><br />To unzip multiple zipped .bz2 files;<br /><br />bunzip2 *.bz2<br /><br />To extract multiple .tar.gz files;<br /><br />for file in *.tar.gz; do tar zxf "${file}"; done<br /><br />To extract multiple .tar.bz2 files;<br /><br />for file in *.tar.bz2; do tar jxf "${file}"; done<br /><br /></font>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0tag:blogger.com,1999:blog-907524333821374285.post-8385131164000318172012-09-19T23:51:00.001-07:002012-09-19T23:56:27.063-07:00Generate ssh key on Mac OS<span style="color: yellow;"><br />Open a terminal and enter the following commands,<br /><br />$ cd ~/<br /><br />$ ssh-keygen -t rsa<br /><br />It will ask you to specify the location, so just use the default one (~/.ssh/id_rsa.pub) by pressing return. If you do not need passphrase, just press return. After that, you may get something like this,<br /><br />Your identification has been saved in /Users/username/.ssh/id_rsa.<br /><br />Your public key has been saved in /Users/username/.ssh/id_rsa.pub.<br /><br />The key fingerprint is:<br /><br />45:a0:5b:34:23:73:8c:43:03:27:b5:92:9d:80:b1:7d<br /><br />yourusername@XXXmac<br /><br />The key's randomart image is:<br /></span><br />
<span class="Apple-style-span" style="color: yellow;"></span><br />
<span class="Apple-style-span" style="color: yellow;">+--[ RSA 2048]----+</span><br />
<span class="Apple-style-span" style="color: yellow;">| ... o*+=*o.|</span><br />
<span class="Apple-style-span" style="color: yellow;">| ... = -+++ |</span><br />
<span class="Apple-style-span" style="color: yellow;">| .. + ..+.|</span><br />
<span class="Apple-style-span" style="color: yellow;">| .. .|</span><br />
<span class="Apple-style-span" style="color: yellow;">| P . |</span><br />
<span class="Apple-style-span" style="color: yellow;">| .. Y |</span><br />
<span class="Apple-style-span" style="color: yellow;">| x |</span><br />
<span class="Apple-style-span" style="color: yellow;">| . |</span><br />
<span class="Apple-style-span" style="color: yellow;">| |</span><br />
<span class="Apple-style-span" style="color: yellow;">+-----------------+</span><br />
<br />
<span style="color: yellow;">Then you can find your public key in the "file ~/.ssh/id_rsa.pub".</span>IT Antennahttp://www.blogger.com/profile/07759411686742488984noreply@blogger.com0