The install bundle in LyX does not include the IEEE Transactions Layout. You can try out the following steps that I found on this blog.  

  1. Download the IEEEtrans.zip file from here.
  2. Extract it to the path YOUR_DRIVE:\YOUR_Progra_Files_FOLDER\MiKTeX x\tex\latex where is the MikTeX version.
  3. Click Start Menu->Programs->Miktex x->Settings. Click Refresh FNDB and then click Update Formats.
  4. Start LyX. Click Tools->Reconfigure. Restart LyX.

These worked on my Windows machine. Let me know if they work for you.

 

And those of you who don’t know what Lyx is and how useful it can be: 

LyX  is a document processor that combines the power and flexibility of TeX/LaTeX with the ease of use of a graphical interface. This results in world-class support for creation of mathematical content (via a fully integrated equation editor) and structured documents like academic articles, theses, and books. In addition, staples of scientific authoring such as reference list and index creation come standard.  A broad array of ready, well-designed document layouts are built in.

I wanted to checkout some code from Google Code and was stuck behind ‘the beloved’ HTTP proxy server. Here’s how to solve this problem:

Go to your svn configuration folder and edit the servers file. If you are on Linux, the config folder is “~/.subversion” and if you are on a Windows system, the folder is “%APPDATA%/Subversion”. Open the servers file in any text editor and edit the values for http-proxy-host, *-port, *-username and *-password. Also uncomment the “[global]” group label.

That should do it. If you make some error, just delete the servers file and run any svn command. The default file will be created.

Get Subversion: http://subversion.tigris.org

1. Back to campus after a lazy vacation at home.

2. Got Sony PSP from bro. Looked at possible hacking opportunities, but it looks like Sony’s firmware is Fort Knox.

3. Sem# 8 begins tomorrow. Timetable shows:

- 13 hours of classes
- First Class at 9 AM
- All Classes end before 1 PM
- Only 1 class on Fridays

Undoubtedly this has to be the best schedule I could dream of. It (hopefully!) leaves me with plenty of time to fill in pages after pages of this blog.

Me off to bookclub.

Google recently released its voice search application for iPhone. You put the phone to your ear and speak your search query instead of typing it using those small keys.

Now, even though Google’s voice recognition does not show any improvement over previous voice recgonition software (See tazti, a free speech recognition software for your PC), but it sure has some intelligent features built into it. Instead of pressing a button for app to start listening, the app uses the in-built motion sensors to detect when the phone is put next to one’s ear. Also, it also uses iPhone’s GPS to correctly identify those location based searches, for example to find the nearest restaurant. 

Since improving on current voice recognition systems seems very difficult and voice operated PC’s are still a distant future, Google’s voice search is good application of the current technology. 

Read a little info about this application here or check out results of a hands-on test here.

Techkriti’09 will be hosting another Gimmick event this year. This year’s problem statement is same as the last year’s statement. You have to code a bot that will fight it out against other bots in a battle.

The problem statement is available here.

Lemme share a few tricks for those who have just started with Gimmick. I am assuming you have read these FAQs from the Techkriti site.

Creating a Bot
Creating a bot is fairly easy. However, coding a winning bot will take some effort. Once you get going, you’ll learn how to take those crucial shots, which bots to avoid, where to hide etc. with experience in the battle field. So the first thing that I will discuss is how you can make your first robot. A number of sample bots have been provided with Gimmick that you can look at for ideas, and to see how things work. Here, I will guide you to build your own brand new bot.

The first steps
Consider the simplest bot shown below.

import gimmick.*;

public class FirstBot {
  public static void main (String args[]) {

    String ip = args[0];
    int port = Integer.parseInt(args[1]);
    BI myBot = new BI(ip,port);

    int myID = myBot.myid();

    while (true) {
      GameCycle GC = myBot.getGC();
      myBot.move(40, 90, myBot.maxDis);
      myBot.turn(180);
      myBot.waitLong();
    }
  }

}

First let me describe the code that you will need in all your bots.

import gimmick.*; Tells Java that you will be using objects from the gimmick package in your code.
public class FirstBot { Tells java that the object that you are describing is called FirstBot
public static void main (String args[]) { Java calls your main() method when the game runs, passing server ip and port number as arguments.
String ip = args[0]; Gets IP address of server passed as first argument
int port = Integer.parseInt(args[1]); Gets Port Number to connect to. Each bot gets a separate port number
BI myBot = new BI(ip,port); Creates a new object for BI or Bot Interface.This object will take care of all communication with the server. This is the most important class that you will use.
int myID = myBot.myid(); Get a unique ID for this bot. Will be used to identify information about this bot from GameCycle objects.

Now let me describe the rest of the code.

First we have a while loop that is always true. The Bot keeps executing the code inside the while loop if it is alive.

Inside the loop, the first statement calls the getGC() method of the BI object. This in turn fetches the latest GameCycle object which is referred to by GC variable.  For the uninitiated, GameCycle object contains all the information about the battlefield that your bot can see at a given time.

The second line calls the move method of the myBot object. The first parameter is the distance to be moved, the second tells the heading, relative to the direction the bot is currently facing and the third tells it at what speed should the bot move. In the example, we move a distance of 40 at a angle of 90 degrees. Setting the third parameter to myBot.maxDistance makes the bot move at maximum possible speed.

The third line tells the bot to turn 180 degrees. The command to turn will be pending till the bot has moved. So before looping again we call the waitLong() method of myBot object. This method blocks till all pending moves are completed. After this method returns, we loop again.

So far so good. Now let us compile this code and test it against some other bots.

  1. First save the file as FirstBot.java and place it in the root directory that contains gimmick, javadoc and SampleBot folders.
  2. Go to command line/terminal and change the working directory to the above directory.
  3. Compile your Java code using Java SE Development Kit (I am assuming you have one and path to javac is set in your environment variables).

    javac FirstBot.java

  4. Edit the run.bat (on windows) or run.sh (on linux) file and change replace the names of the sample bots by “FirstBot” on the first and the third lines.

    Here’s what your run.bat filemay look like:  

    start java FirstBot localhost 8000
    start java MySittingDuck localhost 8001
    start java FirstBot localhost 8002
    start java MySittingDuck localhost 8003 

  5. Run ’server run.bat’ to start the server and ‘run.bat’ to start the bots.

You wil see that the bot moves and turns, and that is all that it does. Not bad for a start.But we are still missing the part where we fire!

Fire At Will
What we have done til now is implemented a simple movement algorithm. We will now add a simple targeting algorithm which I will call “Fire At Will”.

What we will do is look at the GameCycle object that we fetch once every time we loop and look for enemies that are visible. If any enemy is visible, then we turn and shoot straight at it. Here is the code to implement this:

import gimmick.*;

public class FirstBot {
  public static void main (String args[]) {
    // Get Server IP and Port number from command line
    String ip = args[0];
    int port = Integer.parseInt(args[1]);
    // Create a BI object
    BI myBot = new BI(ip,port);
    // Get ID for this bot
    int myID = myBot.myid();
    // Get team ID
    int teamID = myID % 2;
    // Loop
    while (true) {
      // get new GameCycle
      GameCycle GC = myBot.getGC();
      // loop and heck if any enemy is visible
      for (int i=0; i< myBot.numBot; i++) {
        if(GC.visibleBot[i] && (i % 2)!= teamID) {
          // Firing at Bot i
          double newAlpha = fireAt(GC.bots[i], GC.bots[myID]);
          // Turn to aim at enemy
          myBot.turn(newAlpha - GC.bots[myID].alpha);
          // Fire!
          myBot.fire();
          // Wait for turning and firing to complete
          myBot.waitLong();
        }
      }
      myBot.move(40, 90, myBot.maxDis);
      myBot.turn(180);
      myBot.waitLong();
    }
  }

  /* Helper Method. Uses info about position of enemy to calculate at what angle to turn */
  private static double fireAt(BotSpec enemy, BotSpec self) {
    double diff_vector_x = enemy.r * cos2(enemy.theta) - self.r * cos2(self.theta);
    double diff_vector_y = enemy.r * sin2(enemy.theta) - self.r * sin2(self.theta);
    double newAlpha = Math.toDegrees(Math.atan2(diff_vector_y, diff_vector_x));
    return newAlpha;
  }

  /* Helper Method. Returns sine of given angle in degrees */
  private static double sin2(double angle) {
    return Math.sin(Math.toRadians(angle));
  }

  /* Helper Method. Returns cosine of given angle in degrees */
  private static double cos2(double angle) {
    return Math.cos(Math.toRadians(angle));
  }
}

Try it out against the Sitting Duck sample bot. Works fine, huh? Not quite. Notice that while it is moving/turning, it ‘overlooks’ all visible enemies. We can do better if we use the information about these game cycles that were skipped while the bot was turning/moving. One approach to use this info is to call the getSkippedGC() method of BI class. This will return an array of all the GCs that we missed. However, this is more complicated approach and should be used only by experienced players. What we will do today is that we will move /turn by smaller amounts, and check for visible enemies in between. For example, instead of turning 180 degrees, turn, let say, 45 degrees in each loop. When you turn less, you spend less game cycles waiting for these moves to finish at the call to waitLong() method. I will leave this as an exercise to you.

When you have made changes, you may want to try out new movement and targeting algorithms on your own. Test out your bot against other sample bots and get ready for the challenge other players when the online rounds begin!

I wanted to read about what Google had done to make Google Chrome better than Firefox, before I actually made the switch. So I googled and came across this nice ‘technical comic’.

Geeky details look geeky no more. Good Job.

Back Home :)

Here’s another thing I have planned for the next semester - Techkriti.

For those who don’t know what Techkriti is, it is IIT Kanpur’s annual technical festival. Usually held in the month of Febuary, the next edition is  planned  from February 12th to 15th, 2009.

Banner

Having missed other events last year ( I was busy organizing Software Corner, and had 3 straight night outs in the CC), I sure do look forward to this year’s Techkriti.

Some of the interesting events returning from last year are:

Some new entrants this year:

  • CUDA Workshop by NVIDIA  on parallel programming – What is CUDA?
  • Crypto Contest

I will post more details on what events I decide to take part in. I am also considering finishing some of my older projects like the Hindi OCR one and putting them up in the Open Software Contest.

The question is will this year’s Techkriti stand up to last year’s success. Considering the global meltdown, it will be a question not easily answered.

Blogger was too slow. Moving to WordPress.

I am planning to restart work on the confbot project. Here’s some brief history on the project:

My friends discovered GTalk Bots a month ago. Together with Zatacka and Quake, it proved to be the source of this semester’s end sem exam time fun. Again Kush aka Transporter broke all anagram records, and at one time, 4 of our wingmates were in the top ten scorers.

I found the idea pretty neat but the implementation wasn’t very good. With an intention to do better and some other ideas of my own, I decided to code my own bot for Gtalk. I had always wanted an always-on group chat, where I could send out a message, and it would be forwarded to all wingies. Sort of a conference bot. That sort of thing would be handy in the everyday situation where I buzz each person, calling them to the canteen/mess. And I wanted to beat Kush at Anagrams, or at least make a bot that could do so :P

So I started my search for API that would be available for GTalk. The first thing that I find leads me to this implementation of a Conference Bot for Gtalk. It is exactly the thing that I had in mind. Alas, it does not work behind proxies!

Now, I am not the kinda guy who would try and read somebody else’s python code, but with some encouragement from Kush, the two of us dug into the source code for the conference bot. We found out that the bot was based on python module for Jabber clients available here. It turns out that it is this library that needs to have proxy support. The newer version of jabber.py did provide proxy support, so we replaced the jabber.py library included with Conference bot with the newer version. But some problem with authentication over SSL caused other problems.

Since GTalk is based on Jabber/XMPP, a number of other APIs have been developed. One Java library for XMPP that looked promising was available from Jive Software. A basic client could be ready in less than 15 lines of java code. The proxy support had been added only in the last beta release and turned out not to be so good. With some help from this article, I coded a SocketFactory class to tunnel my http traffic through the proxy but again I encountered some problems.

Now with my own SocketFactory class with me, I was ready to write my own API. After getting me hands dirty with the specification for Jabber, I wrote java code that could connect to the gtalk server. I was successful in authenticating to the server (with some crucial help provided by this blog). But unfortunately, the connection to the remote server closed after I had sent one message. So all I could do was authenticate myself :( I tried all combinations of Keep-Alive and Proxy-Keep-Alive in my HTTP headers but had no success. With the more important Computer Networks course exam coming close, I had to give up reading about HTTP headers for some time and mug up useless info for the exam.

Now that I am free again, I hope I can implement some of the cool ideas that are brewing in my mind.