Saturday, February 21, 2009

Crude canine saves another planet

Some time back, I started off a planet for NGOs at ngoplanet.org based on rawdog, not long after planetkde's switch to rawdog. NGO Planet does rss, opml and blogs listing, just like planetkde, but takes a different route to do all that (and opinion is divided on whether that's for better or for worse :D).

Instead of using jriddel's rss plugin that powers planetkde (unfortunately, I could not install libxml2 on my hosting provider, which is needed by the rss plugin), it dumps each form of output just by using a different template for each. So, with a minor tweak to rawdog code, rss is dumped using a rawdog template like this and an itemtemplate like this.

For the blog listing, it takes in an additional config parameter called feeditemtemplate that specifies the template for generating the list of feeds. The same infrastructure is thereby used to dump both the blog listing and the opml output, using separate set of templates for opml and bloglist. The complete set of code changes is in this github repo.

I do feel that hacking on the templates is an easier and more powerful way to extend rawdog (though I do realize that the creator of rawdog thinks otherwise). On the downside, this requires rawdog to be run multiple times, once for each type of output, unlike how it's done with planetkde - that's probably fixable, though.
PS: A secondary purpose for this post is also to shamelessly bump NGO Planet itself :D, so if you know of any blogs about NGOs anywhere in the world, please tell them about NGO Planet.

Friday, December 19, 2008

The Hyves Photo Uploader

A new desktop client for Hyves, the top social networker in The Netherlands, was out yesterday as beta (paid members only, for now). It's a chat client, blog/media/event notifier and photo uploader all rolled into one. Girish and self have been working on the photo uploader part of it for over a month now (half of that time in a cold, wet and absolutely charming place called Amsterdam), with oodles of help from Arend and Boud, and it's looking all neat and slick now. Works on Windows, Mac and Linux. Written using Qt/C++, Javascript and the public hyves api .
On the same topic: Boud's blog , Official blog (in english)

(Are we anti-social or what? Hyves is the first social networking site I joined, and only when we started working on this (same case with Girish, I bet), and I have a grand total of 5 friends (one of them being myself with another username). Another case Boris in the making? :D)

Tuesday, October 21, 2008

Tata Wimax keepalive

My tata wimax connection works well most of the time but it has a supremely annoying feature that to get connected, one is redirected to login in their login site (pretty much how the internet connection works in many hotels). If you are idle for sometime, it will auto logoff. Since my internet connection is not so fast, I usually download over the night and open a keepalive window.

This worked well up until a couple of months back. Now they seem to have decided to disconnect users at random times regardless of internet activity. Not to be deterred by the challenge, I started thinking of how to work around this. The login screen looks like this:



I needed something that keeps logging me in automatically. Qt/WebKit was the obvious choice. It would have been trivial had the post URL of the above form not been dynamic (i.e it has a magic session number in the POST url).

So, here's what I had to do:
1. Keep loading some website at periodic intervals. Check if I get redirected to their login page. It was a bit tricky to use Qt/WebKit to detect a redirect (in fact, there are two redirects); one has to resort to using timers and check if all the redirection has been done and the pages have been completely loaded.

2. Once the page is loaded I need to get the "dynamic" post URL of the form. I could do a grep in the html but that would be too simple :-) So, I tried evaluateJavaScript that will look in the DOM and return me the post url. Unfortunately, the QVariant returned by evaluateJavaScript() is always null. So, the next strategy was to fill the form details and submit the form entirely using JavaScript. And that worked like a charm :-)

You can find the git repo here (btw, Assembla rocks!).

It struck me later that I probably didn't need Qt WebKit at all. I think a html/js loading a website periodically in a separate frame and trying to logon if necessary could have worked as well.

Monday, October 6, 2008

KWord: ODF Lists

It's been a long busy month. With the impending 2.0 release, I have been hacking away polishing up ODF list support for KWord.

Here's a list of improvements coming up

  • Support for saving and loading ODF text:list. This was a lot of work. ODF lists are complex beasts. It was major help that Thomas Zander had done a lot of work in supporting lists and numbering of lists in the layout. We now support the important ODF 1.1 list attributes like space-after, min-label-distance, text-align, min-label-width
  • Support for editing lists and sublists, similar to OOo and MS Word. Press tab to increase the indentation level. Press Backtab to decrease the level
  • Support for loading and saving lists as numbered-paragarph. This means that documents written with KWord 1.x can be loaded up with 2.0. However, KWord does not save as numbered-paragraph because neither OOo nor KWord 1.x can load it correctly (KWord 1.x seems to use the optional text:number tag to determine numbering).
  • Support for list headers
  • Support for unnumbered paragraphs. In ODF, a list-item can contain multiple paragraphs. As a result, the first backspace that you press at the beginning of a list-item makes the paragraph an "unnumbered paragraph". The second backspace ends the list.
  • Quirks to make lists behave the save just like OOo. OOo seems to make a few assumptions that are not stated in the spec - Two disjoint text:lists that follow the same list style are considered to be one list (this affects numbering and that changing the style of one list changes the other). For better or worse, we go out of the way to mimic OOo here.


Here's a screenshot:



Non-list changes
  • Fixed whitespace normalization. See 853298 for details.
  • Switched the default template to odt!
  • Lots of refactoring, cleanup and redesign.

Thursday, August 21, 2008

N810 is awesome

I have been using the N810 for a week now. It's plain awesome - its decently fast and most importantly things just work. The feel of the device is so good compared to my pricy 6110 S60 crap. I am really hoping Nokia will release a maemo based image for 6110 someday.

My previous experience with Nokia (device) development was with S60/Symbian which was just plain depressing. The Carbide would keep crapping out at the most inappropriate moments, the final product behaves differently than the simulator, the... Ah, I should stop here, I love bitching about S60 and Symbian. And I can do it forever :-)

So with some trepidation, yesterday I decided to get my N810 setup for development. It was so simple that I was sure I was missing something. Qt Hello World was up and running in short time. I wrote a small tutorial on how to get Qt installed on maemo.

Immediate thoughts: Maemo looks like a very hacker friendly platform. A big thing for me is that compared to the S60, I actually want to write apps for the N810.

Next Stop - Getting KOffice running.

Wednesday, August 6, 2008

Akademy


BESCOM willing, I hope to finish the slides for my talk by tomorrow night.

Tuesday, August 5, 2008

Looking for a maintainer for KDocker

Standard excuse - I have no time. I am looking for maintainer(s) for KDocker. Unlike it's name suggests, it's not a KDE application, it's plain Qt 3.

Over the years (literally), I have just ignored bugs, feature requests, patches from many (~100) people. Today, I got a mail from Peter Toushkov with updated bulgarian translations. IIRC, there are two new language translations archived somewhere in my gmail account. I feel very bad about all the effort put in by these people go waste. I should have written this maybe a year back, but better late than never.

Why would you want to work on it?
- You get to learn a lot of Qt and X11 . In fact, this knowledge is what helped me write QSystemTrayIcon at TT :). Some of the code in there is quite hard to get right on all WM.
- Actually, there is no maintanence work. The first task would probably be to rewrite everything in Qt4 using QSystemTrayIcon and still call the new code kdocker.
- Many people have mailed me with lots of innovative ideas which would be nice to implement.

Contact me, if you are interested.