Saturday, January 8, 2011

Coupling together DC and SSH: Management Issues

These are a few issues relating to the IITGDC++ project.

First, the people involved. We would require:
  • 1 Account Arbitrator
  • Lots of volunteers who have a CSE lab machine.
Responsibility of Account Arbitrator:
  • He/She would be required to attend to all requests pertaining to user accounts by the junta.
  • On receiving a request, allocate the account to one of the volunteer machines in the project.
Responsibility of volunteers:
  • Install Ubuntu 10.10 Maverick Meerkat on their lab machines.
  • Install the following software on their lab machines:
    • ssh
    • openssh-server
    • sshfs
    • eiskaltdcpp-gtk (Relevant packages can be found at http://jatinga.iitg.ernet.in/~k.pranav)
  • Create a user group called "iitgdcpp" on their machines.
  • Upon receiving a user account request, create a user account on their machines and add the account to the "iitgdcpp" group.
  • Download the file 'iitgdcpp_server.zip' from http://jatinga.iitg.ernet.in/~k.pranav/ and unzip it in the home directory of all iitgdcpp user accounts.
  • Configure the eiskaltdcpp-gtk installation for each user account according to the instructions in the README file.
  • Finally, send the user account password to the user who sent the request.

Monday, January 3, 2011

Coupling together DC and SSH: Detailed Procedure

This post will detail the procedure to connect to your DC client via SSH. I am publishing this because even though the automation has not been set up, Linux users having access to CSE lab machines can use them for accessing DC by following this procedure.

OK, first of all, you need 2 computers for this. One in the CSE labs, and the other your personal computer at your hostel. Ensure that both the machines are running Linux. Now make sure that the following packages are installed in these machines:

For the CSE lab machine:
  • ssh
  • openssh-server
  • sshfs
  • eiskaltdcpp-gtk
For your personal computer:
  • ssh
  • openssh-server
Now follow these steps:
  1. From your personal computer, establish an SSH connection to the lab machine. You know how to do this.
    $ ssh -Y username@lab_comp
    Enter your password and log in.
  2. Now this is a one time step only. "cd" to the directory ~/.ssh and open the file "config" in your favorite editor. If it does not exist create it. Add the following lines to it.
    Host *
    ServerAliveInterval 240
  3. Setup the downloads and shared folders using sshfs.
    $ sshfs username@personal_comp: personal_comp_dir lab_comp_mount_point
  4. Now run eiskaltdcpp-gtk.
    $ eiskaltdcpp-gtk
    Now remember that eiskaltdcpp comes with 2 frontends: GTK and QT. I recommend GTK as it is lighter and faster over SSH connection.
  5. Go to preferences and setup shared and download folders according to the mount points you used in step 3. Also, setup the "Incomplete Downloads" directory to be the same as the Downloads directory.
  6. Now, enjoy the normal use of EiskaltDC++.
Now that this is explained, I am still looking for volunteers who would like to help me with the shell scripting.

    Saturday, January 1, 2011

    Coupling together DC and SSH: Initial Tests and Breakthrough

    Hello folks. I am pleased to announce that it works. \m/
    I did some test runs today and was able to run DC from my linux machine without any glitches.

    This is a pretty serious breakthrough. Now, if we can automate the process, we can run this mechanism on an institute scale. And the poor authorities would only be able to look and sigh at our ingenuity.

    Now, the process I followed is pretty simple. It requires a 2-way SSH connection with a computer in the broadcast domain of the DC server.

    Now, to explain this, there are 3 machines involved here: the machine running the DC hub, the user's machine, and an intermediate machine in the broadcast domain of the machine running the hub. Let us name them A, B and C respectively.
    The process, then, goes something like this:
    1. Using 'ssh -Y' establish a connection from B to C.
    2. After logging in, use 'sshfs' to connect back from C to B.
    3. Mount the shared and download directories in B to specific mount points in C using 'sshfs'.
    4. Now run your favorite DC client on C. Enter the shared and download directories as the mount points where B's directories are mounted.
    5. Operate your DC client normally.
    And voila, you have successfully converted all DC traffic going through the routers to SSH traffic, which cannot ever be banned by the authorities.

    OK, now this is the basic idea. What remains is the automation part of it. And for that we need people with extensive knowledge of shell scripts. Interested people, please get in touch. Thank you.

    Coupling together DC and SSH: Initial thoughts

    DC has been the main medium for file sharing in my institute. Now the authorities have begun a covert operation to ban the DC and ADC protocols. As you can imagine, this will hit the student community really hard as DC is a medium we have relied upon since the inception of the institute network itself.

    As the authorities tighten the noose around the 2 protocols, it is high time we did something about this.

    The idea is to hide DC behind a protocol that they can never think of banning. One of the key protocols used at our institute is SSH. If we can use SSH such that the DC traffic converts to SSH traffic, then no one will ever be able to lay a hand on our beloved DC.

    Now, we must understand that DC traffic cannot be restricted inside a single broadcast domain. The restriction comes from the routers, which filter off the packets pertaining to the DC and ADC protocols.

    Now my initial thoughts are that we run DC inside a single broadcast domain, for example, the B.Tech 4th year lab, and then we provide an interface to each student implemented via SSH such that it feels that a person is running the DC application on his own machine.

    In this case, there are 4 mechanisms relevant to us:
    • GUI
    • File Sharing
    • File Uploading
    • File Downloading
    GUI will be taken care of by SSH, the rest has to be implemented. This requires a lot of knowledge on shell scripting, and will require hours of planning and coding. I am willing to do that. Any one else, if interested, is invited to join me in this endeavor. For the end of DC will surely mark a historic calamity in the history of IITG.

    Tuesday, April 6, 2010

    GAlib: The Genetic Algorithms API

    I came across this excellent C++ library for programming Genetic Algorithms: GAlib.

    It offers a really simple interface to program any type of GA's. Any GA comes with 3 design issues:
    • Deciding the encoding
    • Deciding the genetic operators
    • Deciding the evaluator function
    GAlib comes with many inbuilt representations and operators for almost all kinds of GA-related problems. The evaluator function is, predictably, left for the user to define.
    GAlib comes with inbuilt genome representations like binary strings(1-D, 2-D and 3-D), arrays(1-D, 2-D and 3-D), lists, and trees.
    Also inbuilt are various GA paradigms like 'simple', 'steady-state', and 'incremental'.
    For each representation, GAlib includes various operators for crosssover, mutation and selection, etc.
    GAlib also gives you freedom to create your own representations and operators if you wish so.

    Personally, I found it quite helpful in my projects, and would recommend it to anyone looking to study genetic algorithms.
    Cheers.

    Tuesday, March 9, 2010

    Genetic Algorithms

    All great innovations have been inspired by observation from nature. Even Newton's laws came into being when Newton observed the falling apple. Likewise genetic algorithms were derived from the "Survival of the fittest" theory. For those who don't know the theory, I will give a brief description here.

    The theory suggests that in a population of individuals, some individuals have better characteristics than others. These characteristics allow those individuals to better adapt to their environment. These individuals are said to be fitter than the rest. Due to the environmental conditions, these fit individuals survive while those that are unfit perish away. The fit individuals reproduce and pass on the characteristics to their offspring. Thus, over successive generations, the individuals become fitter and better suited to survive in their environment.

    The characteristics described above are encoded in what is known as a gene, which are present in every organism's DNA. It is from these genes that the term "genetic algorithms" was coined.
    Genetic algorithms are basically search algorithms that employ the concepts of natural selection and survival of the fittest to find the optimal solution to a problem.

    A typical genetic algorithm has the following stages:
    1. Encoding of characteristics on a chromosome.
    2. Generation of a random population of chromosomes.
    3. Evaluating the fitness of each individual on the basis of a fitness function.
    4. Selecting the individuals that would act as parents for next generation.
    5. Forming a new generation through recombination and/or variation.
    6. Repeating steps 3-5 until the population converges to an optimum solution.
    In a real-life scenario, the fit individuals are selected on the basis of ability to survive in the environment. Similarly, in a genetic algorithm the factors that simulate this environment are:
    • the encoding of chromosomes.
    • the fitness function.
    Other factors that that are important are:
    • the criterion for selecting parents for next generation.
    • the techniques used for recombination and variation.
    These are quite important in that if they are too strict we might end up converging to a local maximum, and if they are too lenient, it might take a long time to get the population to converge to an optimal solution. So, the optimal genetic algorithm should be balanced enough to explore new regions in the solution space and yet be able to achieve convergence in reasonable time.

    Genetic algorithms have been employed in a wide variety of problems, ranging from biology to chemistry to finance. One of the major applications is to use genetic algorithms to evolve neural networks. For more info, you may want to follow these links:

    The _uck starts here!

    Hello reader,
    This is the first post for "The AI effect", my official technical blog. Every now and then I would be putting up posts related to Artificial Intelligence and my work in the field. I hope it is worth it. If any of my posts helped you in any way or gave you a new idea, please do comment and let me know.
    Thank you.