Friday, July 25, 2008

BOLO and Python

We worked on BOLO for some time but we found it very complex. The code is unnecessarily too much (less code could achieve the same functionality). One manager for each POJO is defined although those manager methods could be defined in POJOs. So, crawling in the code is a funny(!) way of spending time for us (me and Melih). We tried to implement the search by status functionality but got stuck at the enumarator types for the Status class properties. Showing them on JSF and selecting them is a problem. Then we tried to add a timestamp on the CVs uploaded. But finding the code where the file is uploaded, where the filepath is inserted into the database were the problem in that case. Moreover, the service had been giving "Out of memory" errors after 10 minutes of run.

Getting bored from all these stuff, I tried to write the model in Python/Django. It was a good try. I found a model to UML Diagram script and generated a database model diagram. Showing the diagram, Melih was impressed by the easiness and practicality. Then he wanted me to show my work to the team leader and I showed what I did:
But he did not welcome my work as much as I expected: "Good, but when your internship ends, there's nobody to maintain it here. I don't want my staff to learn Python for such a thing. Because nobody uses Python". I didn't know what to fell sorry for. For my effort, or the misknowledge for Python. Nevermind, I'm spending my time with some trying on that BOLO stuff, and some with fixing some errors in my Python projects.

By the way, some colleagues wanted me to give a talk about Python and how it is used. I'm going to get prepared for it and give a brief presentation called "Python for Java Geeks". So, first of all, I have to find some resources on the differences between Java and Python so that making it easier to understand, I can go faster. Maybe in 3 hours, instead of 8 hours that I had given at school for programming newbies.

Tuesday, July 22, 2008


After the crazy boring minutes of trying to develop a new project with appfuse, my guide told me that he has found a project of his colleagues: BOLO. This is an interview manager, developed using appfuse (JSF+Hibernate) as a final thesis in Ege University. We are going to improve it by fixing some lackness and adding new features on it. We are going to work on it this evening (overtime) to understand its structure. Now, I'm preparing my internship report, filling the part for SOA. This is at the same time a preparation for my SOA presentation which will be at the end of my internship.

Sunday, July 20, 2008

Google Code Jam

Last Thursday, I saw a blogpost on a Python related RSS, mentioning about the Google Code Jam. I saw that it was a programming contest and took a look at it. Reading the rules, I saw that there was a 4 - 8 minute limit. At first I thought that it was the time to solve a problem that is given to you. I thought it was a crazy idea to solve a problem in 4 minutes and code it. As I was at the company, I put it off to the evening for details. When I came home, I did some stuff I needed to do and when I realized that the limit is not for solving but submitting the output after downloading the input, I was angry with myself. Why didn't you read it! There had been 4 hours left. It was 10 pm and the contest was going to end by 2 am. So I started to look at the questions. There were 3 questions of which I had to solve 1 of them correctly to qualificate to the first round. I needed to code to solve the problem and then download two (small and big) inputs and submit them.

I started with the first question, here you are a summary: "In a planet, there are some search engines. When you search the name of a search engine on itself, the planet explodes. So you shouldn't search for Gogool on the Gogool engine. Scientists developed a central system to prevent this. This system forwards the search requests to the engines other than the engine with the name in the request. The question is that with the least switch between the engines, how many switches are required to serve all the search requests."

I developed a greedy algorithm. First, I was going to determine the indexes of the engines where they were first seen. Then I was going to find the furthest one and serve the request before that with this engine. For example below, the furthest first seen engine is NSM. So I should handle the first 4 requests with NSM:

Dont Ask

Then I had to remove the indices below 5 which belongs to NSM. Then I looked ahead like having a new beginning from NSM:

So, it is now obvious that the index 11, (i.e. Yehhaw) is the engine to be used for serving 5-10 (NSM-Gogool). And then the previous indices would be removed after that and so on. The input files were large with the 20 different cases in the number of various engines and the number of searches.

I coded this algorithm on Python and when I ran the sample input, it was successful. Then I downloaded the input file but it told me that my output was incorrect. After the contest, I learned that there were only 3 digits wrong, possibly caused by boundary checking or exceptional conditions.

After the wrong answers, I decided to look for the other questions and started the second question, the train question. There were two towns, A and B between which there were train routes. Input file consisted of the turnaround time for the trains, the timetable from A and timetable from B. The question is that with how many trains at minimum you can handle these timetables such a way that a train coming from A, after completing the turnaround can handle the closest train route on the timetable B to go back to A.

A: 9.00 - 12.30
Turns around in 5 minutes
B: 13.00 - 15.00
The turned around train undertakes the 13.00 route and goes to A. So there's no need to have an additional train to go from B to A at that time.

At first I did not have a clear algorithm but I thought it would be great if I could match the trains as complement and show the complement pairs on the screen so that I could draw inferences on it. Maybe I could develop a matching algorithm after marking them as complements. But the things were not the same as they seemed to be. When marking as complement, I fell into a infinite loop, the train from A matched B and the train from B matched A and A did the same, etc ... They matched each other again and again. Then I realized the time was nearly up. I could not do anything but to post my code and the small output. They were incorrect, of course. But at least a hope that they would look at the codes.

So, I could not qualificate to the first round. I wish I could know it before. For months, they had been practicing for the contest and I hadn't ever heard about it. It was the contest day (last day) when I saw it. So all I can do is this in four hours. Maybe I can do better next year, using all the 24 hours. :)

Friday, July 18, 2008


I have never seen such an un-documented framework, tool or whatever it is! You just can’t know what it is and what you have to do. There are lots of directories with the same name and nobody describes you which directory is for what. It always errors... I don’t want to use it, I want my Python baaaaaaaaaack!

Wednesday, July 16, 2008

First days in the Alcatel-Lucent Internship

Hello everybody, now I decided to write here about my internship journeys. I won’t be able to write all the details of my previous days but I’ll give you some summary. First of all, I normally write on my personal web site in Turkish and I had my first internship as a Network intern in Tellcom, a telecommunication company and now I’m in Alcatel-Lucent, as a Software intern.

The first day, I was taking a look at the Eclipse and the J2EE plugins when they saw me that I’m using Linux and asked me to install one on their server which needed to be re-installed. Then I installed Fedora 9, but with a wrong preference: KDE4. It was a terrible experience. I could not do any kind of basic desktop operations. We could not install gnome on it either just because we didn’t know the package names required for it. Then I installed RHEL5 and installed/configured Oracle 10g Enterprise server, for a test purpose. After that, I installed and configured the VNC server. Both were to launch at startup. Then I wrote some documentation about it. You can reach them here: Oracle 10g on RHEL5 , VNC Server on RHEL5.

I worked on the pre and post configurations a lot. So I wanted to automatize this process. So I worked on a Python Script, pyorainstaller for two days. This script does all the pre-configruation like configuring kernel parameters, security levels, some prerequisite checking, etc. and post-configuration like hostname and launching at startup. You can download this program from its site.

I worked a lot on testing this site, as I did not have any testing machine at work so I had to test it on my desktop PC at home which meant I had to spent my nights with it. Then I was faced with JSF. They told me that I was going to develop two projects with JSF and gave me a book called Core JavaServer Faces 2nd edition. There were examples on glassfish but the examples did not work :) So they told me ’Nevermind, just use Tomcat.’ But there was nothing about Tomcat in the book. So I got crazy; because there was no short and smart tutorials for the first learners. Then I finished the day, looking over the web sites. Some collegues told some stuff about the JSF architecture but there were too many things to keep up in mind. I cought the general idea up.

Then at the weekend, I upgraded to Pardus 2008 on a clean system and on Tuesday, I worked on Tomcat+JSF to build a login form. I wanted to get the session information and used the core jsf libraries but they conflicted with the Tomcat’s catalina. I just was going to fix that but they told me to move on appfuse. As I was told, I am going to develop an HR system for the employment, managing the reviews about recent employee candidates.

Appfuse is an project-automator which gathers the tools required for you depending on your project-type. I now just created a new JSF Modular project and run the mvn command but it gave a strange error:

Embedded error: The following error occurred while executing this line:
/home/emre/dev/hr/web/src/test/resources/web-tests.xml:52: Wrong document title found!. Expected value ".*Login.*" but got "Error - Error calling action method of component with id passwordForm:execute | AppFuse"

I’m now trying to figure out what it is. I can’t do anything just because of these silly errors.