Archive for the ‘Open Source’ Category

Upgrading Gallery2

Sunday, March 18th, 2007

Today, I wanted to install Ajaxian theme for my photo gallery. So, I just download it to my gallery2 themes folder, extracted the contents, the tried to install. But my gallery 2 version is way too old for the theme, so that I had to upgrade the gallery 2 itself.

The first step was to overwrite the old files with new ones. Then, I started the installation process. It went smoothly, and then they have asked to dump the mysql database and make a backup. But, as usual without doing anything, I continued. OMG.. There is an error. I got shocked. Fortunately, they have a nice debugging output. The error was regarding a mysql table. So, I opened the database manually, it was there. Oh!! The table names are case sensitive (only in Linux). I have set the mysql to only use the lowercase names, so it saves everything in lowercase, but when gallery2 tries to access them, it also uses upper case. So, the answer was simple, I went through the code. It was using adodb, found the Execute function, use the strtolower() function to convert all the sql commands to lowercase and it worked perfectly. After all my albums are there.

After upgrading, I changed the theme and uploaded some more photos. Then, I wanted to delete an unwanted album; So, I deleted that.. after the next refresh I realized I have mistakenly deleted all the albums :P

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.

5 steps guide to enlightment

Friday, March 2nd, 2007

Did you ever wanted to ascend(Either ascend as in stargate, or nirvana as in buddhism)? As far as I know, even if you want to do it, it’s very hard to ascend. No one will ascend you(Daniel Jackson is a special case), you have to do it by yourself. But when it comes to computers, there are always hell of a lot of open source software and documentation. So, at least, let your computer to get ascended.

Step 1 : Install Ubuntu

When it comes to enlightment in computing, there is no doubt that I’m talking about linux (There is a x-windows manager in linux called enlightment, but I’m just refering to word enlightment - nirvana). If you are new to linux, I strongly suggest that you install Ubuntu. Ubuntu is a very popular linux distro, so it has a huge amount of users around the world; which simply means there are hell of a lot of tutorials, documentations and forums for it. However, if you want you can also choose another distro such as debain, gentoo, etc. It doesn’t really matter, after all it’s linux.

Step 2 : Upgrade your system

Linux is built using many small software modules, called libraries. Since all those are open source, even the 3rd party software developers use those libraries, and the libraries are developed independantly from the software, also get upgraded separately. Now, you might be wondering, what if I don’t have those libraries in my computer? Does the software comes with all it’s dependent libraries? No, they don’t. That’s why you have something called package managers(apt-get, synaptic). Package managers take care of the all dependency problems, it’ll calculate the dependencies and install those. But when it comes to downloading packages from the internet, you have to feed the urls of the package repositeries on the internet. Note that this is a very important step in ubuntu, otherwise you’ll only see a limited list of packages. Follow the guide on ubuntuguide.org. Once after you add the extra repositiries, updagrade all the libraries. Since many software depends on libraries, upgrading a one library may increase the performance of many software that you are using.

Step 3 : Install some cool software

There are thousands of cool free applications in the open source world. Just look at the applications list on add/remove programs in ubuntu. However, there are some software, such as Adobe Photoshop, Macromedia Dreamweaver and there is no doubt that those are best software on those fields; and unfortunately most of those don’t have a linux version. But there is an incredible piece of software called wine which allows you to run windows applications on the linux environment. Both Photoshop and Dreamweaver works prefectly on wine. One more thing, if you are worring about the games, the answer is don’t worry :D, smile dude… most of the games works in wine but with a little of configuring.

Step 4 : Install the codecs

Since the computer became a toy to the people, the most people used it for listening songs. MP3s became so much so popular and now people are having thousands of mp3s on their hard disks. But if you tried to play a mp3 file, just after installed ubuntu, you’ll be disapointed. It can’t play mp3 files, and it also doesn’t support many other formates. The reason behind this is that most of those formates are not open source neither free, so it violates the ubuntu open source licence. But again, don’t worry, you can simply install those stuff just using one command :
sudo apt-get install gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs

Step 5 : Make it look nice

In every culture, there are some myths; so do in linux. I heard that lot of people says that linux is not user friendly and you have to do everything in that small black window, typing green letters all over here and there. But the truth is that you can do almost everything in terminal, but it’s not the only choice. You’ll see that yourself, even while when you are installing ubuntu - Just see how user friendly it is. So, however, after you logged into the system, it’s default human theme, which doesn’t look so nice to me ;). The solution is that you have to install a composite manager(beryl/compiz). If you don’t want a composite manager, you can just install someother stuffs like gdesklets, etc. Those will add some fancy effects your desktop.

That’s all about it and you are ready to go………..

SCIM - Installing Wijesekara Sinhala Input in Ubuntu Edgy

Monday, February 26th, 2007

Guys at the LKLUG has done a great job regarding the sinhala support for linux. Not only they designed a new open source font, they have also coded the rendering engine and an input method. To enable sinhala support just follow the guidelines in http://sinhala.linux.lk/.

However, the default input method is a phonetic based one which is really good if you have no experience in sinhala typing. But since I’m pretty much familiar with the wijesekara keyboard, I wanted to go for it. The SCIM itself doesn’t have a wijesekara input driver. First thing I had to do was installing m17n. I just apt-get the package and it worked. Then, I re logged into linux, there were plenty of languages in SCIM. So, I choose m17n-si-wijesekara. It’s fine but there were quite a lot of errors. So, I downloaded the development version of the keyboard from http://cvs.m17n.org/viewc…..b/si-wijesekera-preedit.mim. Then I copied that file to /usr/share/m17n/ and restarting the Xorg got me the nice wijesekara keyboard.

Here are some screenshots :

Chat with Nuwan

Chat with Chathu.. lol..

Another eye candy gadget to my linux box - Installing Cairo-Dock/Gnome-Dock in Ubuntu Edgy 6.10

Wednesday, February 21st, 2007

After install all those eye candy stuff, beryl, gdesklets and everything else, it looked quite nice. Amazingly, there weren’t any memory killers or frequent crashing apps. However, there is no doubt that apple Mac OS was/is the best eye candy OS ever. I don’t have to tell you that one of the most appealing applets is the icon doc at the bottom of the screen. So, since lot of people have their eyes on this, those are ported to many platforms (rather recoded not ported).

Now, It’s time for me to go for something instead of modeling the gnome panel itself. cairo-dock, it’s my choice. Installing cairo-dock quite easy if you have all the development libraries. There is no need for me to explain all the steps there - Just follow this link : http://ubuntuforums.org/showthread.php?t=302570. He has explained it step by step. The installation/compilation will go smoothly.

However even after you compiled the application, unfortunately there will be some errors. The first one is icons. Probably, what you’ll get will be some blank icons. The SVG files inside the tar ball doesn’t show up correctly. You might be already knowing that SVG files are text files. So, what you have to do is open the icons in ‘vi’ or ‘gedit’ or whatever, then just look at the source of the image. Most probably around the bottom of the file, there will be a link to a PNG file. Actually there will be two links linking to the same file. Just change the link to a valid path for a PNG image. Then you are ready to go.Recompile the application, then just run it. Then with any luck you’ll see the icons ;-)

Ah! I forgot to tell you about changing the icons/launchers. You have to change the g_aIcons array. It’s at the beginning of the file. The first parameter is the image, then the Text displayed, and finally the command. Make the display text as short as possible, otherwise those will overlap with each other and it’ll look kinda fuzzy or more to the point ugly.

After all things you have a working cairo-dock. Then the next step is to add it to the startup. I used the gnome session control panel, but however since I’m also loading beryl at the startup, cairo-dock used to crash. So, I removed this from the startup, and changed the beryl loading script(Look at my beryl installation post). So, the final script looks like this.


#!/bin/sh
beryl-manager
sleep 7
beryl&
sleep 7
/media/sda5/Software/cairo/cairo-dock/start-cairo-dock.sh

Now try restarting the Xorg, it’ll work like a pro. Even, it works as it should be, there are few problems regarding this. I usually use Alt + F4 to quit applications. So, when I keep quiting applications, if I pressed one more additional Alt + F4, damn… the cairo-dock will get closed and also if you pressed the “Show Desktop” button the cairo-dock will get minimized.

So, what do we do now? Don’t worry I have a small(small as in very small) hack to get rid of that problem. Open cairo-dock.c in vi(or whatever). Search for “gtk_window_new”(There is only one instance. It’ll be around the line 1180-1190). Change the second parameter of the function to “GTK_WINDOW_POPUP”. So, the line should look like this :


pWindow = gtk_window_new (GTK_WINDOW_POPUP);

Then, recompile the code and restart the dock. And finally you have another cool gadget to impress the people :D.

Enhance Apt-Get downloading using an external download accelerator(axel/prozilla/aget)

Wednesday, February 14th, 2007

The Apt-Get in debian systems use their own downloading system to download packages from the internet. It supports file resuming and pipelining. However, it doesn’t support downloading using multiple threads, and it won’t allow you to external applications to download.

However, the http downloader is a separate application(/usr/lib/apt/methods/http) from apt-get, and the apt-get spawns the executable to download the files. Those two programs communicate via stdin and stdout. I have written a new downloading application which can communicate with the apt-get. So, I just copied the executable to /usr/lib/apt/methods/http. The new application spawns another program(In my case a shell script) with two arguments; the url and the local file.

So, after all my shell script calls a python script. My program doesn’t call the python script directly because when the python scripts gives some output to stdout/stderr the apt-get program crashes. So, my shell script redirects the all output to /dev/null. Then, the python script will get the url, do a HEAD request, get the file size. If the file size is less than 100K, it’ll execute wget, if not it’ll execute axel. So, the files will get downloaded and apt-get will install the software.

The apt-get update command fetches many small files from the same server. Since the original downloader uses pipelining, it’s much faster. I have to modify my code to do something about pipelining.

Files :

scripts.tar.gz

apt.tar.gz

Netbeans 5.5 with Beryl

Saturday, February 10th, 2007

A solution emerged while doing little bit of browsing. Just have to export a variable :

export AWT_TOOLKIT=MToolkit

Get things working under beryl

Thursday, February 8th, 2007

Beryl is working, nice interface, another way to impress people who are saying/thinking that linux is only a black terminal(small white letters in a black screen in their words). But a small problem, some of the useful programs are not working properly.

VLC - The videos are not played properly. Change your video output redering from Default to X11 Video output. oh! You have to enable Advanced options.

Window Focusing - One annoying thing about beryl was when i started a new application/window, it didn’t get focus. In the beryl settings, General settings change the focus mode to ‘none’.

Netbeans 5.5 - Disable beryl just for now ;-). Haven’t tried anything yet.

AiGLX, XGL and Beryl

Wednesday, February 7th, 2007

The eye candy Linux desktops, of course way better than windows. I have seen many you tube clips on both compiz and beryl working, do I have to tell you.. those are awsome. So, however inspired by those I decided to give it a try(It was several months ago).

My Linux distribution was ubuntu 6.06. First I installed XGL and change the gdm.conf-custom file to load the XGL with gdm. Then I installed compiz. Nothing to bother at all, only few simple apt-gets and just two or three lines of config files, I have compiz running with XGL. However, since my graphic card is Intel 945GM, I’m using i915(i810) drivers. XGL is bit slow with that. However, this worked nicely without any bugs.

Then, the next thing any person would do is try to optimiz compiz, so you can get a better speed. But how? “Using Google”. Most of the sites said that the best option for my graphics card is AiGLX and Beryl. So, I installed AiGLX first, then beryl. For some reason it didn’t work and more annoyingly my sound card went out. Everytime I start the GDM with AiGLX, it crashes. So, I decided to uninstall that. Oppsss… a small problem. I can’t find the AiGLX package. Oppsss.. a big problem, AiGLX is inside the core of Xorg, it’s not a seperate module as XGL. Now, what do I do? Either I have to reinstall Xorg from the old repositories or disable AiGLX. So, I disabled AiGLX and activated XGL again. Damn.. XGL is not working either now. So, what else? I disabled the both turned back to the old ubuntu human theme.

After all those sort of stuffs, very recently(about three days ago) I formated the old ubuntu 6.06 and installed 6.10. Then I decided to give it a try again. Since, I have some bad experience with AiGLX, I tried to run Beryl with XGL. So, I installed XGL. Installed Beryl. This time, I created a seperate session for XGL, and created a small script ‘/usr/local/bin/startberyl.sh’. The content is :
#!/bin/bash
beryl-manager
sleep 5
beryl

This is not the normal procedure. I just did that on my own to get things easier. So, I logged out, then logged into the XGL session. Then went to the terminal and typed ’startberyl.sh’ and wow finally Beryl is running under XGL. However, It doesn’t sloved my problem completely. It’s still slow. However, I didn’t want to install AiGLX again, I have to statisfy with what I have. I put the script as a startup program. After working few minutes, I restarted the computer. When I rebooted the computer, wow…. It’s working really smoothly. I can’t believe XGL is running this fast. Then, I realized the secret. I forgot to set the XGL as the default session, so what I have done is booted the default gnome session, but how does the beryl is working? It needs either XGL or AiGLX. oh! Ubuntu edgy comes with AiGLX built-in support. wow!! it’s cool. Everything is working perfectly now. Beryl with AiGLX - After all It’s just matter of installing beryl and emerald-themes(for a ubuntu(6.10) edgy user).

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.