IOI Site is back

Tuesday, March 13th, 2007

Today, after going through a lot, I managed to get the ioi site running. Just drop in there if you are interested in programming.

The grader is written in C++, and the interface is written in PHP using AJAX. This whole project is open source, you can download it from the sourceforge project page. Current release version is bit old, hopefully I’ll upload the current working version tonight.

Downloading DVD iso

Wednesday, January 31st, 2007

Yesterday, I tried to download debian DVD images from their site. One image is about 4 GB which is bigger than 2^32 bytes. So, here is the problem; since all the download accelerators use 32 bit integers for the file size, it doesnt work at all. I tried prozilla and axel. Then I also tried to wget the file into my server, split it and download the files. Wget doesn’t work either.

I sent an email to LKLUG and one of them suggested to use jigdo. But It takes hell of a lot of time to download it file by file. The other solution is to use bittorrent, but I have port limitation problems. So, the only solution left is to download and modify the source code of an accelerator. I downloaded the axel code, but It’s seems bit messy to change it. So, I decided to code my own one to download it. It’s time to start coding again.

Learning python

Thursday, December 28th, 2006

Last few days, I was sleeping at home enjoying the lazy days of Christmas vacation. Except sleeping, went on a trip to nuwaraeliya, and more interestingly after Anjana pointed out some key features of python, I decided to give it a try, so started learning it. After spending few hours, I managed to learn the syntax which was well managed so that easy to learn. However, the syntax itself doesn’t make python special; so I went little deeper down to the python lib. That’s what makes a real difference. Python comes with a large collection of libraries, and those are damn powerful and easier to use.

Learning is not only reading and going through the example source codes. It’s actually writing something, writing a real world application. So, I started to write a web log analyzer. First I separated the log file by the date, and calculated the statistics for each day and saved them in different files. After that I wrote a small php script when the two days are given, it collects statistics and generates a xml file. After that it’s all about the interface; My ajax interface process the xml file and gives a nice output of what I have calculated, of course with some graphs(plotkit did the graph magic with javascript). However it needs some cleanups (I originally hard coded the log urls/search engines/etc), and the config file support should be added to it. Once I’m done with those, I’ll upload the source code soon… Yes, it’s distributed under GPL.

Google prime number problem

Tuesday, December 19th, 2006

Few years ago google placed a bill board in Silicon Valley (Well, I haven’t seen that but read the googleblog post). The board was about a small programming problem.

Somehow, that blog post became one of the top stories in digg recently; after seen it, I decided to give it a try. I just used the straight forward brute force method and it was surprisingly easy. It was just like a old days doing an IOI code, and more to the point, runtime doesn’t matter, memory limits doesn’t matter, and coding time doesn’t matter, so, what make it an IOI code is that code quality also doesn’t matter.

I just code like I always did… just coded… coded… coded… never bothered about the coding standards… and finally two small programs (e.zip). First I generated factorials up to 100, divide 1 by all those and saved the result (upto 500 decimal places) in a file. Then from the next program I added all those things together and checked for a prime. Pretty simple. The answer was 7427466391

wget hack

Tuesday, December 19th, 2006

Today, I recursively downloaded a web site to my web server using wget, and for some reason it didn’t work well. Some of the immediate files are missing. After running through the original site source, I realized that it’s about the files inside the style sheets. So, I made some quick modifications to the wget source.

It’s just a hack to get my download working, however it will also work on some other sites as well(I hope ;-) ). errr…. Sorry about the quality of code.

Unfortunately, I lost the original source code(I have no intention to download it again using my dialup; ah! I forgot to tell you, I’m enjoying the vacation at home; Ratnapura), so I can’t create patch files. wget version is 1.10.1. Download recur.c and html-url.c.

Coding.. Coding.. Coding.. I’m addicted.

Tuesday, December 12th, 2006

Today, I was writing some documentation for a project and suddenly noticed that I was using semicolons instead of dots. :P