Feeds:
Posts
Comments

It is very typical from (us) students to don’t do our homework before entering applying to a Ph.D. program. I admit I basically made some research about universities that I wanted to apply to, and probably went a little further by looking for professors I wanted to work for. I found two very useful links directed to new potential Ph.D. students. They might look discouraging, but we should get the best from anything, including these links.

Dr. Michael Franz, from CS department at the University of California Irvine, posted these really interesting guidelines about sending him an email if interested in starting a Ph.D. with him: http://www.ics.uci.edu/~franz/Site/prospectivestudents.html. I admit that if I were interested in being his student, I would had doubts when I finished reading that page. It is interesting to see how a Ph.D. program from a top university in the U.S. will handle new Ph.D. students admissions.

Dr. Franz noted in his website a link about “Notes on The Ph.D. degree“, an even more interesting page from Dr. Doug Comer with different notes about entering a Ph.D. program. The section that I like the most, is the “warnings” section, about why and why not entering a Ph.D. degree. This is the coolest thing a potential Ph.D. student should realize about what a Ph.D. is not:

“A practical way to impress your family or friends: Your mother may be proud and excited when you enroll in a Ph.D. program. After all, she imagines that she will soon be able to brag about her child, “the doctor.” However, a desire to impress others is insufficient motivation for the effort required.”

But the most important section is the one that describes what a potential student should have, from which I would prefer this one:

Self-motivation: By the time a student finishes an undergraduate education, they have become accustomed to receiving grades for each course each semester. In a Ph.D. program, work is not divided neatly into separate courses, professors do not partition tasks into little assignments, and the student does not receive a grade for each small step. Are you self-motivated enough to keep working toward a goal without day-to-day encouragement?

This is key to have as a Ph.D. student. It will be a long journey, of many years, maybe 4, maybe 7 in some universities. Like I say to me, it’s not just starting it, is finishing it. Nobody will be behind you pushing to finish, not even your adviser. And years might pass and you will not even notice.

So, we as Ph.D. students should be aware of many things before starting the program. These kinds of things can make our lives much easier, and help us accomplish things that would make us more than happy at the end knowing that we accomplished them. To be prepared from the beginning is key to achieve things during our time at the Ph.D. program. And what we do during these 4 to 7 years is going to be the foundation of the career we will have when we finish.

Hacking Limewire

For those unfamiliar, Limewire is a very famous P2P file sharing application. It was not the most popular a few years ago, but it is one of the oldest still remaining (Bearshare practically dissapeared, Kazzaa also, and I might forget others).  Consumers like it because it is easy to use, and many people use it (with the potential of finding more files). Developers like it because it is open source, and well documented. I like it because it is the only one that has allowed me to do clean and fast small modifications to the code. Limewire uses the open source Gnutella P2P protocol. That is cool also because this protocol is easy, short and public.

The topic here is to hack Limewire for the following purposes:

  1. Content-Encoding: deflate. Make it use connections with the deflate option. Meaning the communication between peers is not going to be compressed (the default way) but uncompressed. This hack will mean more bytes being sent and received. For me it’s perfect because I need to see what is going on (trace the behavior of the Gnutella protocol).
  2. Force Ultrapeer mode. Make it connect to the network as an ultrapeer the minute it starts.

What you need first

Of course, I am talking about modifying Limewire. So, you need the code, and a tool to modify it. Check on Limewire’s website, more precisely here, how to do it. I did it the cool way, using Eclipse. You need Java, so install the latest JDK first. I downloaded Eclipse, then downloaded the latest Limewire code through the CVS, played with it, got lost in it, found some clues and then solved the problem.  So, hands on!

1. Content-Encoding: deflate

This is the option used by a Gnutella node to advertise that it supports compression. Because compression saves bytes, and thus bandwidth, it is used as default by all peers in Limewire. And there is no manual way to change it. This is simple as modifying the following file:

LimeWire/core/com/limegroup/gnutella/settings/ConnectionSettings.java

and from it, the following field:

public static final BooleanSetting ENCODE_DEFLATE =
FACTORY.createBooleanSetting(“ENCODE_GNUTELLA_DEFLATE“, true);

Change it to this:

public static final BooleanSetting ENCODE_DEFLATE =

FACTORY.createBooleanSetting(“ENCODE_GNUTELLA_DEFLATE“, false);

2. Force Ultrapeer mode

Limewire will connect as a leaf almost always. There is no precise (at least public) way to know when your node will turn into an ultrapeer. The say is that after several hours of being up (some say days), and sharing many files with a large bandwidth, and running on a very good, you have 50% chances to turn into an ultrapeer. Of course, you might also not turn. I needed to run as an ultrapeer for research purposes (I am being clear here, my interest is NOT sharing files, NOT downloading files and NOT helping others do so).  So, I got to find the way to make Limewire do so.

To be sure I turned into an ultrapeer immediately, I followed all the possible suggestions. Thanks to this post in Limewire’s forum, I modified the following file:

LimeWire/core/com/limegroup/gnutella/ConnectionManagerImpl.java

and from it, the following methods:

  • public boolean isSupernode(): I changed so that it returns TRUE always. This method is referenced in the code when asking if the node is Supernode or not. I have to note that I guess this change is not needed. This is the first change I did, and I just saw the node connecting to 32 ultrapeers. So this helps if more peers are wanted.
  • public boolean isShieldedLeaf(): I changed to return FALSE always. This method is referenced in the code to check if the node is a leaf or not. Shielded means that it will not accept a new connection. FALSE means is not a shielded leaf, so it is clear to accept new connections.
  • public boolean isSupernodeCapable(): I changed to return TRUE always. This is similar to the first method. Actually I would think the first one is the right one, but didn’t work for me. This should be used to check if the node can actually be a supernode (ultrapeer should be the same in this case). For example, Limewire has an option in  the GUI to avoid becoming an ultrapeer. I suppose this method checks that check in the GUI. I didn’t care, so I return a TRUE always.

I tried first modifying the first method, and as I said, the node connected to 32 ultrapeers. But didn’t accept new connections. (the response in the traces used the code 503, replying it was a leaf also as the node it was trying to connect to it). I then tried changing the last two methods (and left the first one returning TRUE) and it worked. Now it says: zero ultrapeers, 32 peers and 32 leafs. Yeaii!

Sobre los gastos del estado colombiano para el 2010, y ciertos numeros:

http://www.portafolio.com.co/economia/economiahoy/ARTICULO-WEB-NOTA_INTERIOR_PORTA-5454367.html

Datos a resaltar:

$2 billones de pesos se gasto Colombia en 2009 en la Seguridad Democratica (en realidad es un pequeño porcentaje del presupuesto anual) Aunque no estoy de acuerdo con el nombre belicoso, si estoy de acuerdo con que a los colombianos como que hay que ponerles un policia en cada esquina para que dejen de portarse como lo que somos, “delicuentes en potencia”. “Uy, que marrano, dejo esto aqui tirado, ya es mio”, “yo robo porque si no hay policia que me coja, pues que carajo”, “yo mato, porque se que no me van a agarrar”, etc, etc, etc

$23 billones de pesos es lo que hace falta para el presupesto del 2010. Pero no se preocupe, que hay de donde endeudarse para poder cubrilos. Sin saber mucho de economia, y por eso digo, toca volverse econmista para que no nos sigan tumbando, es esa la solucion?? “Mija, no tengo plata hoy para la comida, pero no se preocupe que ahi tengo la tarjeta de credito”. Que tal si mas bien buscan la bendita manera de hacer que el pais produzca mas y se roben menos para que alcance???? ah? que tal si en vez dicen: “Vamos a aumentar la persecucion a los corruptos que se roban la plata del pais. Empezare por renunciar yo!”. Ah?

$2 billones dejaran de entrar al gobierno en el 2010 por concepto de ingresos. Pasaran de $80 billones a $78 billones. De nuevo, que paso?? sacan la excusa del desacelere economico. Que desacelere ni ocho cuartos. No hay en el pais dirigentes que piensen en buscar como resolver los grandes problemas economicos. Le echan la culpa al desacelere y quien sabe si diran ” es que nos tienen rezados”

Privatizacion, es la solucion para los problemas? si el gobierno no privatizara tanto, sino en vez de vender cuando ve que no puede solucionar, simplemente soluciona, espurga, limpia, reacomoda, busca como resolver, y mantiene su patrimonio? que demonios pasa con esa platica? se reinvierte? o se usa para pagar intereses de deuda? BTW, si te endeudas mas, mas intereses pagas. En fin, quien sabe si habiendo estudiado economia me sentiria mejor. Quiza peor, pues entenderia mas, y me sentiria mas frustrado.

16% el PIB son $80 billones de pesos. O sea, $500 billones de pesos (500 millones de millones) es el PIB de Colombia en el 2009 (al menos segun el numero en Portafolio). Esos son $250 mil millones de dolares. Para comparar con: $50 mil millones que es el deficit de California para el presupuesto del 2010. $750 mil millones es el PIB de Florida!!! $750 mil millones fue el ultimo bill que me acuerdo firmo Obama para ayudar al pais a salir de la crisis. $50 mil millones es la riqueza de Bill gates.  $263 mil millones fueron las ventas de Toyota en el 2008. $170 mil millones es el PIB de Chile (y esta mejor que nosotros!). Saben cual es el PIB de Costa Rica?? pais donde mucha gente dice que se vive mejor que en Colombia? donde no hay guerrilla, inseguridad, quiza mas empleo? $30 mil millones de dolares. Ja! y en Colombia vivimos peor con $250 mil. Estamos jodidos!

I’ve been always suggested by my adviser to look for books, links, or any publication about tips and recommendations about how to do research. For me it’s usually hard because it’s another task I have to add to the things to do. The problem is that the outcomes of performing this task are hard to measure in the short term. So I tend to postpone it.

But today, by doing something totally different, I randomly found what it looks to me like a good guide about how to do research and how to survive in the world of graduate students and be able to tell others how you did it (meaning getting your degree).

The source is this one: http://www.ecsl.cs.sunysb.edu/objectives.html,

last updated by Tzi-cker Chiueh in 2004. I consider it a good guide, short, precise, and honest. I’ll do my best to do as many as possible from the list of recommendations suggested by the professor.

I hope somebody else can give a good use to it too.

While searching for something totally different, I found the following page from Dr. Donald E. Knuth,  CS professor at the Standford University. To my knowledge, it was the first place where I found somebody having FAQs and IAQ, or Infrequently Asked Questions. Given how really infrequent those questions were, I thought they really deserved a place as NOT frequent questions. Probably, MIAQ, or Most Infrequently Asked Questions.

The link is as follows: http://www-cs-faculty.stanford.edu/~knuth/iaq.html

Just wanted to remember this …

First, let’s download the sources of a distribution, compile it as it comes and install it in the router. The next step would be to modify a part of it as you need. Download the source code from WhiteRussian distribution from this page:

http://downloads.openwrt.org/whiterussian/0.9/

Use this URL:

http://downloads.openwrt.org/whiterussian/0.9/whiterussian-0.9.tar.bz2

unzip and move to the whiterussian-0.9/ folder. You should start by reading the README file or follow these instructions.

type the following command if you want to change setup options before compiling the distribution:

> make menuconfig

In my case, I didn’t need to mess with that configuration. Probably you won’t need.

> make

The way OpenWrt is created is as follows: All you download are configuration files. When you run the compilation scripts, they will download the source files from the Linux kernel and other programs needed, like the sources of the gcc compiler, the libraries for STD, and others. In the case of WhiteRussian, it downloads the sources for kernel version 2.4. Be aware that it will download the zip of the sources only if it’s not found under the /dl folder of the root folder. So, the first time you compile it, it will download all the libraries and the kernel. The next time this won’t happen, unless files are deleted from /dl folder.

—–

If you want to modify the sources, what I’ve done so far is modifying the Linux kernel. Because WhiteRussian downloads the kernel from a well known Linux kernel download website, it’s necessary to tell the compilation scripts that I want it to download my modified version of the source files. In my case, I downloaded the source files for the kernel, applied a patch, zipped again, and uploaded it to my website. Then I found the configuration file I needed to modify, which is found here:

/whiterussian-0.9/toolchain/kernel-headers/

And opened the Makefile. There I found the variable LINUX_HEADERS_SITE, which was set to the Linux kernel download website, and changed it to the following:

LINUX_HEADERS_SITE=www.csee.usf.edu/~mjimeno \
http://www.fr.kernel.org/pub/linux/kernel/v2.4 \
http://www.kernel.org/pub/linux/kernel/v2.4 \

http://www.de.kernel.org/pub/linux/kernel/v2.4

I also modified the LINUX_KERNEL_MD5SUM, which of course changed when I compiled the sources again. (The md5sum the file comes with should be the one for the kernel files located in the Linux website, which of course doesn’t change)

Then I ran “make clean” and “make” to see the changes.

This is were the fun gets funnier. The existing packages usually have many of the applications you can think of to put in a small router. But, as you use your customizable router, you might start thinking about good tasks that your router should perform.

The first things you need to do are downloading and untar-ing the OpenWRT SDK. For this, you need to know which of the different versions of SDK you need to download. This could be trivial for some people, but it was not for me at the beginning, so this might help some of you. Quoting from a post found in a Linux forum, the following are the different versions you will find for the SDK, and you can select yours according to the description:

“Basically, the different kernel designations identify which instruction set the compiler was told to optimize for. An i686 CPU can run i586 and i386 instructions, so, as you observed, an i686 can run an i386 kernel. However, it may not execute as optimally as one specifically compiled for an i686.

These are the designations you will typically run into:

x86_64 Processors
* AMD’s Athlon 64, Athlon 64-FX, and Opteron
* Intel EMT64 processors – Nocona Xeon, Pentium 4′s using the E0 revision of the Prescott core (AKA Pentium 4, model F)

i686 Processors
* All Intel 32-bit Pentiums (excluding Pentium 1 and Pentium MMX)
* All AMD 32-bit Athlon

i586 Processors
* All 32-bit AMD Ks
* Pentium 1
* Pentium MMX

i386 Processors
* A generic “lowest common denominator” designation for Intel 80386 compatible CPUs (includes all of the above, but does not take advantage of extended instructions on those later CPUs).”

Taken from: http://www.linuxquestions.org/questions/linux-newbie-8/please-explain-386-vs.-686-versions-310099/

As I’m using WhiteRussian, I will download the SDK from here:

http://downloads.openwrt.org/whiterussian/newest/

Now, this is the OpenWrt link to create and build your own package:

http://wiki.openwrt.org/BuildingPackagesHowTo

The above tutorial could be too much for people starting in this idea of flashing routers, like me. It shows all the options available to create and install packages, but the authors supposed you were building a whole new big package. So, they assume your code is located under a URL, and is based on tons of files and makefiles. This is not what I was looking for, at least not at the beginning. So, I finally could find the tutorial that worked for me, here:

http://gargoyle-router.com/openwrt-coding.html

This is the most complete tutorial for creating packages I’ve found that has been designed for people willing to start from zero. The point is that the tutorial shows how to create a package for a simple helloworld. So, your only source is a C file with 6 lines of code. At the end, you have your own hello world! running in your router. From that, you can start building your desired functionalities.

5 – Install XWRT

Xwrt is a web interface for WRT. I’ve have tried and can say that is much better than the original the WhiteRussian comes with. The basic interface allows you to do only basic stuff like installing a firmware, changing the IP of the router, and other simple tasks. The XWRT allows you the same, but you can also install a package from the web interface, uninstall any exisiting package, see memory usage, CPU usage, reboot the router, and many other tasks I haven’t tried yet.

It can be downloaded from the site www.x-wrt.org.

I run this command:

> ipkg install http://ftp.berlios.de/pub/xwrt/webif_latest_stable.ipk

Some packages might be needed, due to an error generated while trying to install it. I got the following error:

An error occurred, return value: 1.
Collected errors:
ERROR: Cannot satisfy the following dependencies for webif:
ipkg-upgrade-fix base-files-uci

Then I had to download the above mentioned packages from the following url:

ftp://ftp.berlios.de/pub/xwrt/packages

For example, for base-files-uci, I did the following:
> cd /tmp
> wget ftp://ftp.berlios.de/pub/xwrt/packages/base-files-uci_0-3_mipsel.ipk
> /bin/ipkg install base-files-uci_0-3_mipsel.ipk

Then the same for the package ipkg-upgrade-fix

After installing those packages, I tried to install the x-wrt and worked fine.

Is good you read this tutorial for the ipkg command

http://www.dd-wrt.com/wiki/index.php/Ipkg

Almost for sure you would like to install new packages, there are 2 list of packages for whiterussian. I’m still trying to know which is the difference. The lists can be found here:

http://downloads.openwrt.org/backports/0.9/
http://downloads.openwrt.org/whiterussian/packages/

Given that OpenWrt is documented, but not as desired, and besides that, many of the packages are developed by different people, you will find that many of them are not well or not even documented. For this reason, the best I’ve found to get some previous documentation before installing the packages is doing the following:

>ipkg update

This will create two files, one called WhiteRussian, the other non-free. Both can be found under the folder /usr/lib/ipkg/lists. Anyhow, the same information will be given by OpenWrt when you type the above command. Take a look at the WhiteRussian list. Has the same list of packages found in the http://downloads.openwrt.org/whiterussian/packages/ URL. But, it has a lot of extra information, including a very very brief description of what the packages does. Reading the descriptions I found one that sends WoL magic packets. Another one is the libpcap, the well known package to sniff the network. So, you might find one that interests you…

I personally needed srelay, that can be found in the backports url. This slreay is an implementation of a Socks proxy server. So, I needed to download it to the router, so I first browsed to the tmp folder, as recommended in the ipkg tutorial, and then I used the following command:

> wget http://downloads.openwrt.org/backports/0.9/srelay_0.4.6-1_mipsel.ipk

then I installed the package:

> /bin/ipkg install srelay_0.4.6-1_mipsel.ipk

While trying to run the srelay, it threw an error message, it was needing another package. So thanks a post found in the OpenWrt forum, I realized I needed to install another package, a libwrap. So, I did the same:

> wget http://downloads.openwrt.org/backports/0.9/libwrap_7.6-1_mipsel.ipk

And then installed it the same way. Then the proxy worked fine.

SSH: Now that you have a new firmware, you can talk to your router using ssh. So just type “>ssh 192.168.1.1″ in a terminal window, and the router will ask for password for root. When logged in, you can navigate through your router’s folders almost as if you were in a regular Linux machine. It doesn’t have many of the fancy applications from a regular Linux distribution, but it has as much as necessary.

TFTP: You will need it if you want to upload a file to the router. I will eventually update this part (I tried TFTP but found it not intuitive).

I actually found the way to upload files (actually download files) to the router. I uploaded the file first to my website, then issued a wget command from the ssh command prompt to download the file.

Older Posts »

Follow

Get every new post delivered to your Inbox.