Archive for the ‘Hacks’ Category

Gnome Online Desktop

Sunday, April 13th, 2008

Few years ago, the internet is mostly used for information and emails. Over the fast few years, it has changed a lot. Recently(around last two years), the desktop applications started to consume the power of web. Since then, some platforms yet not much popular emerged, like Mozilla Prims, Adobe AIR.

But as for today, generally, the online applications and desktop are separated. Gnome Online Desktop tries to bridge the gap between those two.

This weekend, I gave it a trail run. Here it goes :

Installation

I installed the system on Ubuntu Gusty, which doesn’t have online desktop is repositories (I think only fedora have them). So, I had to build from the sources. I followed the building guide they have given on using jhbuild.

Then, I installed gnome dependencies for ubuntu. There were problems with the installation. “gtk-doc” was not there. So, I just ignored it and installed other packages. Then, there was a conflict between “libxul-dev” and “xulrunner-1.9-dev“. “apt-cache show libxul-dev” indicated that version is “1.8.x.x”, so I only installed “xulrunner-1.9-dev“.

First, I installed jhbuild from repositories(sudo apt-get install jhbuild). Then, created the .jhbuildrc file as it says, and tried the command. But it started to complain about a “lib_packages” variable. I googled for it, and the first hit was from the same page. Apparently, the wiki page have been updated very recently, and the script has been changed(to non-working version). So, I edited “.jhbuildrc” file, and removed “addpath(’PYTHONPATH’, os.path.join(lib_packages, ‘gtk-2.0′))” line. Now, jhbuld is working fine, but for the obvious reasons, apt-getting from ubuntu, doesn’t install the “online-desktop” module. So, I removed it, and got the jhbuild from gnome SVN.

Now, it started to build 101 packages. Normally, if I was emerging in gentoo, I would go for a tea, have a nap and come back later. But since I ignored “gtk-doc” and “libxul-dev“, I knew those two would fire back later. After going through many packages, it complained about the gtk doc. By analyzing the error message, I managed to install “gtk-doc-tool“, and it continued. Then again, some xul errors popped up. It was complaining that some “idl” files are missing. Going through “/usr/share/idl” revealed that both “unstable” and “stable” are installed, thus those are in sub directories. Once I moved to “/usr/share/idl/xulrunner/unstable” to “/usr/share/idl/xulrunner/“, and done same with the “/usr/includes/xulrunner/unstalbe“, it worked fine and compiled all packages. Then, I followed the rest of the guide, and logged out(I created the session “.desktop” on “/usr/share/xsessions/” instead of “/etc/X11sessions“).

Login In

I crossed my fingers, and logged into the gnome online desktop session. Gnome startup splash was followed by the bug-buddy saying mugshot crashed. I just ignored it, and continued. The sidebar said I’m “nobody” and firefox started with the session. Then, I clicked “enable online desktop”, and it took me to “online.gnome.org” which I successfully logged in. But the desktop still says, I’m “nobody”.

I suspected this might be related to mugshot, so I ran mugshot from terminal again. This time, it ran without any problems. Then, I close firefox, and went through the login process again, but it’s the same results. After going through some files, I found there is a firefox extension, and that was not installed. There was a shell script called “firefox-update.sh”, but running it didn’t help, instead it created some broken symlinks. Then, I created a symlink manually to “od/lib/mozilla/extensions/ {longstring}/firefox@mugshot.org” in “/usr/lib/firefox/plugins“. Then, the extension loaded, but still it’s the same results.

Then, I killed few hours with mugshot-client and bigboard source code, but didn’t come up with anything. The last chance was thinking that something is wrong with gconf settings. So, I logged out, created a new user, and logged back in.

Playing Around

Mugshot crashed as usual at the startup, but then I ran it again it gave a black and white tray icon. It was a long shot, but I was lucky! Online authentication worked. The problem with my used account must be either mozilla settings or dbus settings.

However, mugshot icon turned into purple and suddenly it crashed(Just after I logged in from web interface). So, I saved the bug report, and started to play around a little bit. The sidebar downloaded my information(name,photo,online services) from the gnome online account and displayed those, but I already know those :) Of course those are useful as much as bookmarks. Then, the “recent documents” from places menu is moved to sidebar. That’s a good choice, quick access.


The next stock in sidebar is “Applications“. It showed some applications like “Firefox”, “Terminal”. It also showed “Thunderbird” as not installed, which is actually installed and used exclusively :-/ So, I wanted to change the list of applications showed there. The Application Main panel is quite attractive and nicely build. It’s very easy to find applications. However, only very limited set of applications can be added to the sidebar. I can understand everything else, but this? I’ve no clue.

Then the “people” stock was there, but unfortunately I don’t have any friends on my mugshot account. It only showed some generic user called “Gnome Online”(or something similar). I accidentally added another email address to “Gnome Online”, then I found out there is no way to remove that. The only option was to just remove that user(There is no point of keeping a bot with wrong addresses associated with it). Once I logged into gtalk via pidgin, the people stock got filled with my gtalk contacts list. But it’s just some photos+names, nothing else.

I added the “Google Mail” account, and it worked without giving out any problems. After a complete swap of the sidebar, It felt like nothing is new in online desktop. So, my next guess was there must be something amazing in mugshot client.

Mugshot Adventure

I googled for a little bit about what mugshot client do, but didn’t find any useful information. Then, I checked mugshot bugzilla to see whether anyone else has got these problems. But I was alone. So, I fired up Xchat, joined #gnome-hackers on GimpNet. However, I didn’t get any replies(that’s my bad timing, the channel was very quite when I was dropping there - probably most of the people are sleeping).

The Online Desktop getting started said something about mugshot-client should be bootstraped. I had no idea what that means, so I logged back into my normal *perfect* gnome desktop(By the way, I’m a big gnome fan :) ), and ran “jhbuild bootstrap“. Then, it installed 14 more packages. So, I cleared the built file from mugshot-client checkout directory using “make clean” and executed the mugshot-client build command(”jhbuild build meta-online-desktop -t mugshot-client“).

Here comes the trouble again - it gave me weird error saying “hippo canvas python module not found” - which the files/headers are there. Then, I rebuild several other modules like “hippo-canvas, desktop-data-model, gnome-settings-daemon, online-desktop” and tried building “mugshot-client” but nothing worked. Then, it must be something I did with the bootstrap command - I’m not even a little bit familiar with jhbuild, so I decided the best thing to do is rebuild everything from scratch.

First, I removed the install directory. Then, cleared the build files in the checkout directory. The “bash” saved me from lot of trouble. I didn’t have to worry too much about going into each directory and running “make clear“. If you are interested, following are the two commands,

for x in `ls *.tar.gz *.tar.bz2`; do rm -rf `echo $x | sed 's/.tar.gz$//;s/.tar.bz2$//'`; done
for x in `find | grep Makefile$`; do make -C `echo $x | sed 's/\/[^\/]*$//’` clean; rm $x; done

After clearing everything, I ran the full build command along with the “time” command. After 1 hour, 59 minutes and 49 seconds, it finished(2.4Ghz dual-core 2GB RAM).

Then, I re login to online desktop and now it’s worst; both bigboard(sidebar) and mugshot-client crashed. They must have just committed a non-working version on bigboard around that time :( However, bigboard bug was simple, they were trying to integrate google docs(good news!!) - and gdata.gdocs package was not there. I simply removed “import gdata.docs as gdocs” line from “bigboard/google.py“, and sidebar is back in business.

The bug-buddy was a real rescue buddy on musgshot-client. I changed few lines of code, and it’s started working again. (I didn’t exactly fix it - Just changed some lines that it wouldn’t crash, just work barely). However, the result was not what I expected, it’s just getting the updates from mugshot site, and displays the notifications.

Speaking of mugshot site, it let users integrate many services into one feed, which seems to be a great idea, but since I don’t have any friends on mugshot, I couldn’t really experience it. My idea is it would be a much easier to keep track with friends this way.

Programmers point of view aka “Thoughts of a coder”

From the users point of view, online desktop doesn’t have any killer features *yet*. Anyhow, reading of some of design documentation enlightened me :) The technology used is online desktop is XMPP, which means, it’s using push technology instead of pull; less bandwidth usage, less server load, quick response time.

Just like most of other opensource products, they also have core libs which helps other developers to tap into the system, and make use of that. This means a real integration between all desktop-online bridging applications.

Conclusion

Simple conclusion, it’s not ready yet. Of course, it should be - I built it from the trunk. Anyhow, considering the large number of gnome developers, and super cool gnome desktop, I feel like online desktop is not upto it’s full potential. A lot of simple yet effective improvements can be done, like improving the “Applcation” stock, or “Workspace Switcher”. I’m not sure why they are only adding people from “Gtalk/XMPP/..” connections to people stock(probably something with the design). Most of my friends are using MSN(may be I’ll check whether I can create a plugin for emesene to throw out some dbus signals).

The good news is, once the basic core framework of online desktop is much stable, developers will create some stunning integration apps.

Precisely, this is something you should checkout, but I’m not exactly sure how soon.

Improve jhbuild downloading

Friday, April 11th, 2008

Yesterday, I tried to install Gnome Online Desktop. Since, this is fairly new, it has to be build from the source. Gnome Online Desktop is a complete branch of gnome desktop, which will of course have many dependencies. It’ll take years to download each and compile manually. That’s why they have jhbuild (it works like gentoo emerge).

This is April, which is supposed to be the best month of Sri Lanka with festivals/celebration. But there is a price to pay, thundering (Last year, lighting took my laptop :( ). My connection goes down for each 10 minutes.

So, while jhbuild downloading a module, the connection goes down, and when I restart jhbuild, download doesn’t continue from where I left off. It downloads the whole file again. So, here is a very simple one line hack to prevent that from happening to you.

In jhbuild/versioncontrol/tarball.py, line 171, add a command line option “-c” to wget command. If you are not happy with “wget”, you can change it to whatever you want(prozilla,aget,d4x).

I’m still building online desktop (101 packages :-/ ), can’t wait to see what it can do.

Say Cheese

Tuesday, January 1st, 2008

It’s new year, 2008. Time to smile :)

Few days ago, I’ve been playing around with a pretty old USB webcam. I just plugged in it, and v4l(Video for Linux) drivers detected that fine (”dmesg | tail” would do the trick for checking what has been going in the system).

Since I don’t any specific webcam capture apps, I just used VLC to do some little testing. By running “vlc v4l:/dev/video0″, the green light on the top of the webcam turned on (turning on a small smile on my face :) ) and the video showed up. But it was about 60×60 size (and the smile faded away). So, I experimented with several sizes, and the best worked so seemed to be “320×240″.

Now, assuming that it’s enough for my needs (I don’t really need this anyway), I decided to install a webcam app. The “Cheese” from gnome foundation looked promising, So, I downloaded the code, compiled and installed it. bham, there is nothing, just the gtk widget background with a gnome hand imprinted.

I guessed that the both problem and solution should lie in the gstreamer settings. So, I downloaded and installed the newest stable version of gstreamer(0.10.15), plugins-base(0.10.15), plugins-good(0.10.6) and plugins-ugly(0.10.6). But as a matter of fact, it didn’t have any effect on “Cheese”, but to break my mp3 playing capabilities of totem. Later on I found out it’s due to some plugins aren’t not compiled to properly, so compiling them fixed the mp3, but not the webcam app.

However, after going through the Cheese FAQ, I found out that I have to set some properties from the gstreamer-properties dialog and just blaming myself for not thinking of checking FAQ before going to all the hassle of compiling gstreamer, I changed the settings as it said (ximagesink something - I can’t remember now), then fired up Cheese.

Whoa, the webcam is blinking and suddenly the video appeared. But their seems to be small problem with the video, 3/4 of the image is blank. Only top 1/4 is displayed properly. First, I though it’s a temporarily problem, so I did a “rmmod and modprobe” to reset the device, but it didn’t help. So, I fired up cheese from the command line to see what’s going on. First it was detecting the webcam, then the sizes it can support (in other words the available “modes”). Then, it’s selecting so called the best mode, which is the largest.

For my webcam that was a weird size something with 288 x XXX (Sorry I can’t remember that either now). So, I tried that size with the VLC, and it’s the same results. As you can guess it’s not a problem with gstreamer but the V4L drivers. I looked for any cheese configuration file to set the preferred “mode” of the webcam, but unfortunately the product is still very young.

I didn’t want to mess with the V4L drivers, so I had a look at the Cheese source code. There is an universal truth about everything, it’s always easier to break things rather than fix them. So, I just break the webcam mode detection code which leads into my hardcoded preferred webcam settings. Changes are done in cheese-webcam.c, and here is the diff file - just in case.

Cheese Screenshot

Now, It’s time to say Cheese, and Happy New Year!

How to convert your live CD iso into a live USB

Monday, July 2nd, 2007

Two days ago I downloaded the latest Ubuntu Gusty Tribe 2 (What a pathetic name?). I only had one blank CD left, and the burning process was interrupt by some unknown force. There is no point going to town to get a new CD, so, I started messing around my USB drive.

First what I tried was writing entire CD iso image into the usb drive. As far as I know, there is no easier way to do that in windows. So, I used another real live CD, and used “dd”. What I thought was by writing the iso image, it would behave like a CD and it will work, but It didn’t.

After going through some tutorials in the internet, I came to know that the best solution is syslinux. That’s pretty easy to install also. If you are in windows, download the syslinux, and extract it. Open the command prompt, go to the syslinux folder(if it’s “c:\syslinux\” then type “cd c:\syslinux”) and execute “syslinux X:” where X is your usb drive letter.

Then, to test whether it was executed properly, you can go to the usb drive and do a “dir /a”. It should have a file called “ldlinux.sys”. If it’s there, try booting from the usb drive. Then, it’ll complain the kernel image “linux” is not there. That means it’s installed. If it says, “Boot Error”, there is a HP disk format utility, you can download that and format the disk. If you are in linux, you can use “fdisk” and “mkfs.vfat”. Make sure you mark the partition as boot.

Then simply extract all the files from the ISO into the usb drive. Actually, after this step you have to configure the boot options, move some files here and there, but since I’m not going to keep Ubuntu on my usb forever, I just didn’t do any configuring. To boot up linux, just coping is enough.

So, again restart, and since we haven’t done any configuration, it will surely ask for the kernel again. The kernel is casper/vmlinuz. You also have to mention some kernel parameters. Here is my command.


/casper/vmlinuz boot=casper initrd=/casper/initrd.gz root=/dev/ram rw

However, If you are going to try Ubuntu Gusty Tribe II, it’s not stable yet. So, if you don’t want your linux to crash time to time, install feisty fawn. Since, my modem still doesn’t work in linux, I didn’t install it.

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

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

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.

Live.com, Google and Sinhala

Monday, March 20th, 2006
Since the beginning of this year, the most prestigious IT companies in the world focused their attention to one profitable large business, SEARCHING. A lot of companies were trying to be the best, but there was no clue, Google was the best. Few years ago, Microsoft was trying to overcome Google by their MSN searching but wasn’t able to make it success. Live.com

So, now they are trying to start over using the popular AJAX technology. Around two weeks ago Microsoft launched their AJAX based search engine, live.com which is a bit of threaten to google. Live.com isn’t only doing searching, but a web portal such as MSN and the most important thing is that you can customize your interface, and everything is AJAX based which means it’s really fast. Even though, it’s a portal, the interface is not overloaded with too much of information as in MSN. With the power of AJAX they have made it really descent and professional. The most amazing thing is that it is not only for IE, it is working fine in firefox under linux :-)

But when we look at the search content and the quality of the search, Google is still ahead. As most people think, the search content might be a matter of time, but we have to remember that Microsoft is a large IT company which mainly focuses at their software, not in search, but the heart of google is searching and they are the first guys who launched a popular AJAX based service, GMAIL. So, their experience is, of course better than Microsoft. Even though most of the people don’t use, Google itself support customizable interface(Google News, etc).

Google Sinhala As Sri Lankans, we saw a big step in google, they launched google.lk and their interface using Unicode. Earlier it was using English letters.But still google doesn’t support searching inside sinhala Unicode range. When we look at the live.com, there is no sinhala interface but the important thing is you can search using the sinhala Unicode characters.

I wonder why google doesn’t support sinhala Unicode characters, whenever it is not hard to implement. They are supporting almost every other Unicode character sets.

But still, no one of those giants don’t support ASCII sinhala searching using Unicode, so, still sinhalasearch.com rocks!!!