Thursday, May 31, 2007

Offline GMail?

With today's announcement of Google Gears - "an open source browser extension that lets developers create web applications that can run offline" - I'd like to make a somewhat obvious prediction that GMail will feature a disconnected mode within, say, 2 years.

It looks like Google is seriously entering the desktop space.

Tuesday, May 01, 2007

Linux pids wrapping

I have this old "ps waux" textdump:


Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux
23:29:59 up 9:35, 22 users, load average: 3.47, 1.13, 0.44
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
[...]
clarence 32522 0.0 0.7 4516 1616 pts/18 Ss 22:33 0:00 /bin/bash
clarence 32544 0.0 1.3 9100 2992 pts/18 T 22:34 0:01 vim test2.cc
clarence 729 0.9 6.0 36360 13516 ? S 23:27 0:01 konsole [kdeinit]
clarence 730 0.0 0.6 4516 1508 pts/19 Ss 23:27 0:00 /bin/bash


I still cannot figure out how I managed to do that. As far as I can see, I was only using OpenOffice.org Writer, viewing webpages and had compiled KDE4 earlier in the day. The machine had not even been up for 10hrs.

Mimetypes not working for you in KDE4?

If KDE4 mimetypes aren't working, type "kbuildsycoca4" instead of "kbuildsycoca". I believe this change allows for KDE3 and KDE4 apps to coexist. I thought I'd share this since it took me an embarrassingly long amount of time to figure it out :)

I also recall someone saying that the "shared-mime-info" package had to be a certain version. So I found a Fedora RPM for 0.17 and upgraded to that (I know that RPM is old but it was the only one I could find quickly). Not sure if it was required though.

Monday, April 23, 2007

Using a HP PSC 1315 as a scanner under Fedora Core 4

Update (2007-04-24): I've been told (see the comments) that the Linux support works out-of-the-box these days with newer distros. Also, I've got nothing against hplip - it's just that hpoj was the first one I got working with such an old distro. I ran into numerous difficulties setting up this scanner because of conflicting information on the internet and also instructions that just didn't seem to work for my setup.

The HP PSC 1315 stands for "Hewlett-Packard (all-in-one) Printer-Scanner-(photo)Copier". It's a USB colour inkjet and was dirt cheap considering all the functionality - less than $100, years ago. I do not recommend this hardware (see bottom of post).

Now I was interested in getting scanning to work under my old Fedora Core 4 system. The scanner supports 600 DPI and this is more than I need. After much googling and conflicting information, a search string of hp psc fedora got me to these working instructions. This uses the obsolete "hpoj" driver, instead of hplip's "hpaio" driver, but I don't mind since kooka and xsane both work now. Thanks very much to "zparihar" on linuxquestions.org for that useful post.

I can think of only 2 things that I have found harder to install under Linux: support for the Aetheros WPA wireless and an analog joystick. I won't even attempt to set up the printing for the time being since I don't need that capability.

By the way, I initially found this HOWTO Install a USB Scanner guide on the Gentoo wiki, which looks like it could be useful for other scanner models. I gave up on it since it looked too complicated by the time it asked me to add a 03f0:3f11 line (printer USB ID given by lsusb) to /etc/hotplug/usb/libsane.usermap.

I strongly recommend against buying this printer given that Linux support was not out-of-the-box and also given that HP's driver for Windows is horrendous. Regarding the latter, sometimes print jobs go nowhere and deleting them from the print queue does nothing, blocking all future print jobs. Unplugging the USB cable is another sure way of preventing one from deleting print jobs even after reattaching the cable. Some combination of rebooting, reinstalling the printer under a different USB port etc. (I still haven't found a reliable way) is required to delete the stuck print jobs. To make things worse, the "HP Director" application would quit silently after the IE7 upgrade and after applying a patch from HP, it now starts but the buttons don't work.

Wednesday, April 11, 2007

Sydney meeting

As Seb Ruiz writes, we met up with Brad Hards last night in the city. See Seb's blog for photos.

Some interesting KDE trivia that was shared around was that:

* Kopete is apparently pronounced cop-it-tay, not co-pete

* Krita can be read as kri-ta instead of krit-a

Thursday, March 08, 2007

Going to the ACM programming contest in Tokyo

Update: We came equal 44th out of 88. While it's generally invalid to draw certain comparisons in such competitions (since you can jump a large of number of rankings by debugging just an extra problem), I'll draw one anyway: we equalled CMU and beat Harvard :) However, pretty much all of the other unis I listed below beat us easily. The University of Auckland is a deserving South Pacific Champion with a Bronze Medal.

Overall, I'm happy that we made it this far and I'm happy with this year's performance against an elite set of world class competitors. On the non-technical side of things, we had a great time in Tokyo and at the Disney Sea theme park, paid for by IBM. It is on this high note and after nearly 10 years of contests, that I'm retiring from programming competitions.



I've been a bit quiet these last few months as I've been practising for this contest. Two teams are representing Australia this year - one from the University of Adelaide (the defending South Pacific Champion) and the other, the University of New South Wales (one of the members being yours truly).

It will be interesting to see how we'll fare against the Chinese, Russians and MIT, CMU, Harvard, Waterloo etc. considering that their teams were presumably picked from a multi-tiered qualification process (and reportedly, the Chinese education system also has high schools - not just universities - dedicated to programming!), while the qualification process for the South Pacific consists of a single competition :) In any case, we hope to improve on the performance of recent South Pacific teams.

Anyway, after all this craziness / intense competition is over, I hope to finally, finally, finally get back to opensource programming (although, consistently, every year, I seem to find a different distraction). So in a sense, I wish the competition was over more quickly :)

Sayoonara!

Monday, December 25, 2006

Another script: revision controlled OpenOffice.org documents

I mentioned that I used OpenOffice.org for my thesis.

However, a problem is that binary files, like .ODT, don't work well with revision control systems.

Firstly, they aren't diff-able so you have to also keep a .TXT file, in the repository, in sync with the .ODT. This is error-prone and the .TXT diffs don't reflect formatting changes.

Secondly, because OpenOffice.org files are compressed (.ZIP format), the binary deltas that revision control systems (e.g. SVN) use to save space fall apart for even the tiniest of changes to documents, due to the characteristics of compression.

But thanks to the second anonymous commenter on that blog post, I came up with a new way of revision-controlling OpenOffice.org documents:

What I now do is keep the unzipped OpenOffice.org document in revision control, not the binary .ODT file. This means that I can diff the content.xml between revisions, not bother keeping a .TXT file in sync and avoid SVN's space-inefficient binary deltas since I'm really only keeping text files in the repository (more on this later).

If you checkout such an unzipped OpenOffice.org document from SVN, you can use my magic Makefile to reconstruct the .ODT from these unzipped contents by typing make. It's just like adding water to milk powder.

And every time you make a change to the .ODT file, the same make command works the other way and updates the unzipped contents to match the changed .ODT. Then you can svn commit a new revision.

Caveats:

* Warning: svn status will not report changes to the .ODT, until you type make. Be careful or you might think that your checkout has no local changes and you decide to delete the checkout to "save space"! A "foolproof" way to get around this problem is to skip the svn propedit svn:ignore . [and type kolourpaint-developer-guide.odt] step.

* It actually does store a binary file in revision control, namely Thumbnails/thumbnail.png. I haven't dared try to work around this though, for fear that OpenOffice.org won't like me playing with it.

* Some files such as layout-cache and settings.xml, while not binary unlike Thumbnails/thumbnail.png, change on every save and probably shouldn't be revision controlled either.

* You can't have 2 people working on the same document as merging two content.xml files is asking for trouble. But at least you can diff between revisions.

* A lot of lines in content.xml may change in response to even a small layout change due to lots of tags changing control numbers.

If you try this scheme, please let me know how it goes.

BTW, in the end, my thesis turned out to be 192 pages (probably, about 100 pages too long :)). It was on porting the L4 microkernel to processors without virtual memory, specifically the Blackfin processor. It was written in a rush so apologies for the awful number of spelling and grammatical errors!

A few scripts that could be useful

I just uploaded some scripts I've had lying around for months. Hope they're useful:

1. kbus: starts the DBUS server since it's not done automatically. Sure beats typing eval `dbus-launch --auto-syntax` and copying environment variables all the time.

Update: It looks like DBUS has an auto-starting feature now, via --ensure, so this script is no longer needed).

2. svnupfast: an "svn up" that takes half the bandwidth.

3. svn-import-changes: a poor person's distributed revision control system.

Full details and "sort of" docs here.

Re: We’ve got a couple of feet in our sights

Regarding a few things Boudewijn Rempt wrote about the look of KDE:

1. I actually thought Keramik was stunning during the early builds of KDE 3.1 - it was the perfect balance between good eye candy and not being so noticeable that it got in the way. Unfortunately, I believe it changed in the final KDE 3.1 (please correct me if I'm wrong) and the gradients became too striking.

I liked it in combination with KDE 3.1's bluish icon set, which was sadly replaced in KDE 3.2.

I still use Keramik with the KDE 2 colour scheme and I like it better than Plastik (which is still a very good theme).

2. The window colour changing on focus switches in KDE 4 is a feature of the style, I believe. It is really slow indeed on my old graphics cards as well and for a while I thought it was a palette bug, until I realised that it was supposed to be highlighting the focused window.

I'm sure this will be fixed eventually but I'd still expect KDE 4 to be a tad slower than KDE 3 because of Qt4's automatic double buffering. But I think this is a reasonable price to pay for less flicker.

On a side note, for those of you who are wondering, that automatic double buffering is actually done per top-level window, rather than per widget (I looked inside the Qt code for this and it's actually quite clever).

Thursday, December 14, 2006

Why UI messages must be carefully worded

I got this email from the university today:


Your overall [average mark]: 87.0

There were no outstanding results at the time of this calculation.


Apparently, none of my results are any good ("outstanding"). I feel insulted...

... but obviously, that's not what they meant. They should have used "unfinalised" instead of "outstanding" to be unambiguous.

And no, 87.0 is not my real mark. I'm not going to post the real mark here because there are some fellow students running around uni trying to find out my marks, for god knows what reason, so no need to make it easy for them :)

Saturday, December 02, 2006

A fix for Radeon Xpress lockups under X.org

I'm writing this article so that people googling can find the fix.

I just helped some fellow UNSW students fix Linux hanging when performing a graphical login (no, even the magic sysrq keys I enabled did not help). They were running X.org 6.8.2 (Fedora Core 4) with an ATI X600 graphics card (Dell Optiplex GX620).

I solved this by switching from the buggy opensource radeon driver to the generic VESA driver i.e. in /etc/X11/xorg.conf under Section "Device", I changed:

Driver "radeon"

to

Driver "vesa"

There are also 2 other solutions that apparently work:

1. Richard Zach suggests using the binary ATI driver.

2. Those students found that the opensource radeon driver worked if they updated to X.org X11R7 (Fedora Core 5) [*]. Unfortunately, they need to run some closed-source software that only supports Fedora Core 4. Furthermore, this upgrade does not seem to help with an ATI X200, which experiences similar lockups.

[*] Does anyone know the exact version X.org number?

Tuesday, October 31, 2006

JoJo - Too Little Too Late

I want to avoid sounding like a derganed teenage JoJo fan but I have to admit that JoJo's new single Too Little Too Late is pretty catchy pop and sounds remarkably similar to her original single, Leave (Get Out).

You can watch the video as linked off her website. Will buy the track once it comes out here.

On the other hand, I dislike all her other songs as they have too much of an R&B feel to them. So no, I'm not one of those diehard fans :)

Rent movies, don't buy them

In Sydney, a movie DVD costs about $US15 to $US22. A rental for a week costs about $US3 to $US5.

Therefore, unless you intend to watch the same movie on, at least, 3 separate occasions - each spaced at least 1 week apart - it makes no sense to buy that movie. But who actually watches a movie that many times?

Therefore, it makes no sense to buy movies instead of renting them.

Wednesday, October 18, 2006

A way to reduce stress

Assumptions:
1. You carry a mobile phone in your pocket.
2. You spend too much time checking your watch to see if you have to be at your next appointment, and this causes anxiety.

Method:
1. Do not wear a watch.
2. Set alarms on your mobile phone to warn you of appointments.

Justification:
1. As reaching into your pocket to check the time on your phone is highly inconvenient, you will check the time less often, compared to wearing a watch.
2. You no longer poll for appointments - your mobile phone alarm generates interrupts instead. This is far more efficient and no polling (i.e. no checking of the time) reduces stress.

Auxiliary Benefits:
* You do not have to buy a watch!

Notes:
If there is something else in the room that displays the current time (e.g. wall clock or computer's taskbar applet), the effectiveness of this method is reduced. However, you still get the benefit of being more relaxed as you have the knowledge that the phone alarm will always warn you about your next appointment, in time.

Sunday, October 15, 2006

KDE's 10th birthday

The Dot story tells all.

KDE's certainly changed my life in more ways than one:

A. I get a highly-configurable desktop that - apart from hardware integration and software installation issues - absolutely kicks Windows or Mac OS X in the face:


Konqueror is an incredible web-browser that loads, responds and renders far faster than Firefox/Linux and actually integrates with the desktop. In fairness, I do still use Firefox/IE for those more stubborn websites.

KMail is my email client of choice - friendly and does threading correctly, which I cannot say about Outlook.

KWrite is the model of how UNIX text editors should be - easy-to-use, while still having power features like syntax highlighting. None of the ESC, beep, colon, w, oops I left caps lock on, behaviour of ViM. And none of the Emacs operating system's crazy shortcuts, nor games (yes, literally; I used to spend far too much time talking to psychiatrist app they had in there :)). My favourite productivity boosting feature has got to be "View / New Window".

Konsole and its tabs and convenient Shift + {Left, Right} for switching tabs and Shift + {Up, Down} for scrolling by one line go well with the UNIX terminal's Shift + {PgUp, PgDn} for scrolling. The power of the UNIX command line is the perfect complement to the ease-of-use of the KDE GUI.

But my favourite app would have to be KTimeMon, the only clear and concise system-monitoring taskbar applet in existence.

And, Amarok, a media player that actually cares about playlists and gives context about the current song or artist. Having said that, it is a bit unstable at times and I wished it played video (else it's not a "_multi_media" player).

And of course, KMix.


Most importantly, it's all opensource and free (in terms of speech and beer) so it will always be around.

B. On the developer side of things, hacking on KDE over the last 5 years has taught me more about developing software - heavier C++ than I was used to, revision control, listening to users, UI design bug management, organisation, release processes, highly collaborative and distributed development, support, effective email communication, team management, the list goes on - than I have learnt anywhere else, even university. I still see closed-source companies that do not understand any of the above.

KDE is wonderful because it brings together the best software development practices and the most passionate people to create a kick-arse, opensource desktop environment that users love and a community where people meet, learn from each other and develop all kinds of skills.

It's a bit scary that I've been hanging around for half of KDE's existence. I started with KOffice filters and remember how friendly people like David Faure and Nicolas Goutte were in helping to get me up to speed. I moved on to write KolourPaint, touched other bits and pieces in KDE but became relatively inactive due to university commitments. But every minute I've been there, KDE's been one of the most rewarding things I've ever been involved in. As bonus, next year I'll be graduating and only working part-time after that, so I should have plenty of time to work on KDE.

Finally, congrats to everyone who has contributed to KDE's success and I'm sure KDE will only get bigger and better. Cheers!

OpenOffice.org for documents

I'm writing my thesis in OpenOffice.org. I vowed a few years ago never to learn LaTeX because the whole idea of spending time writing formatting commands, rather than document content, is so last decade (or maybe the one before that?). Yes \{to_you_too.

For a while, I had used LyX which, apart from having been started by KDE founder, Matthias Ettrich, is a WYSIWYM ('M' means "mean" i.e. document structure not formatting) document editor, that importantly generates LaTeX. The great thing is you can have your cake and eat it too - have the benefits of interactive WYSIWYG editing but also produce nice-looking LaTeX.

I found the interface to be a bit clumsy (e.g. "Edit / Paste External Selection" and the overly fast scrollbar) so resorted to writing all the text in KWrite before dumping it into LyX for formatting. But after a while, things just got too irritating - like the lack of a key shortcut for the "type of text" (e.g. "Standard" or "Section" or "Subsection") or when it generates uncompilable LaTeX (when I tried to force blank lines or add images). And if I changed the text in LyX, I'd have to synchronise the .TXT too.

So I retreated back to OpenOffice.org Writer. LaTeX people scoff at such WYSIWYG editors but with paragraph, character and page styles (Format / Styles and Formatting (F11)) available with just a double click (or none at all, if you've setup "Next Style" correctly), I don't see why. You also get the benefits of WYSIWYM, a reasonable user interface and importantly, an easy way to override the formatting if necessary (use RMB / Default Formatting to revert an override). It doesn't generate LaTeX but the output is good enough for me.

Another really handy feature, if you use headings, is the document outline viewer (Edit / Navigator (F5)).

Of course, the binary .ODT is no good for meaningful SVN or CVS diffs. Unzipping it won't help since the XML for the whole document is on, like, 2 lines. So what I do before I commit is I always save a .TXT version for diff'ing purposes. Works great except that the diff won't show formatting changes. Also, it's important after saving to .TXT to immediately resave back to .ODT before you forget and lose your next set of changes.

Yes, it's slow. Yes, it crashes at the most importune times. But it's opensource, its feature set is sufficient for all of my document editing and the .DOC filters are pretty good. And I just submitted my 106 page thesis draft on Friday. Saves me from learning LaTeX, thanks :)

The fastest way to quit acroread under Linux is...

... killall -9 acroread OR Ctrl+Alt+Esc. It's instant.

On the other hand, File / Exit, when a large document is open, takes forever and drives the disk light nuts for maybe a minute - like most laptops, this one has a really slow hard disk. I don't know the exact amount of time but given that Linux performs extremely badly when the disk is being accessed, it's too slow for me to want to try to reproduce it again.

As far as I can tell, no data is lost this way (maybe config settings but I don't mind) so it brings into question the purpose of writing teardown code if it performs so badly.

Friday, October 06, 2006

Page Styles in OpenOffice.org Writer

I'm writing this while waiting for my document to print...

Changing the current page's Page Style by double clicking the style name in the "Styles and Formatting" window (F11) does not work. It stubbornly insists on using the previous page's style's "Next Style" (RMB / Modify... in the F11 Window).

A solution is to force a page break (you think they'd call it a "Page Style Break") i.e. the "Insert / Manual Break..." menu item. Set the "Type" to "Page break" and the "Style" to the one you want. Then manually delete the blank page it creates (after all, it is a page break).

Saturday, September 23, 2006

Review of Kate Alexa - Broken & Beautiful

Australian pop singer, Kate Alexa's debut album, Broken & Beautiful, was released today in Australia.

Hooked by her radio hits "All I Hear" and "Somebody Out There" (which sound like Avril Lavigne "Under My Skin" tracks but more feminine) and misleadingly good iTunes clips of the other tracks, I bought the 14 track CD from a (physical) music store.

The video for "Somebody Out There" can be found here or on YouTube. The "All I Hear" video is available at Yahoo Launch if you have IE and Windows.

I felt the album was like listening to a Britney album (minus the porn): A few strong tracks that are singles or later become singles but the rest, disappointing fillers. It's similar to Ashlee Simpson's and Delta Goodrem's second albums.

To her credit, apart from her radio hits, "Under the Influence of You" (what a name) is absolutely infectious. Her fame-making single "Always There" is also not bad.

Ironically, the track named after the album (or maybe it was the other way round) "Broken & Beautiful" was the most painful of all to listen to due to the unnecessary screaming of the melody-less chorus.

So in summary: Buy her singles, which are very good teeny bopper/pop/rock, but don't bother with the $A20 ($US15) album.

Thursday, September 21, 2006

Fine resignation speeches

I just got elected unopposed [*] as both the Chair of the IEEE UNSW Student Chapter and 2007 Board Member of the UNSW Engineering Faculty. Unlike typical student representatives and executives, I pledge to actually do something rather than use it for resume points.

But anyway, for a bit of fun, I've been studying the 2003 resignation speeches of two prominent politicans. Guess my next degree will be Arts, majoring in Politics. Politics is a great sport if only it were productive. Now, on with the goods:

1. Robin Cook


The British Leader of the House resigns over the government's handling of the 2nd Iraqi War. Great speech overall with the piece-by-piece deconstruction of the "Weapons of Mass Destruction" argument but this bit is truly exceptional:

I intend to join those tomorrow night who will vote against military action now. It is for that reason, and for that reason alone, and with a heavy heart, that I resign from the government.

If you watch the above link's video, albeit lo-res, it's how he says the last bit so simply and unemotionally, that his betrayal is even more shocking. If I were reading the speech, I would have said it far more forcefully.

He got a standing ovation BTW. A politician willing to stand up for what s/he really believes in deserves one. As a rule of thumb (but doesn't apply in this case), such politicians with the brains and big ideas are generally the ones that don't survive in politics for long due to the party machine men. Think Mark Latham.

Too bad the Prime Minister wasn't in the chamber at the time. I'm surprised the government didn't try to gag this rather damaging speech (as such motions, at least in Australian Federal Parliament, are voted on immediately according to the Standing Orders).


2. Simon Crean


The Australian Leader of the Opposition takes a number of subtle and funny stabs at the people who destabilised his leadership:

Don't let your personal ambition cripple the Labor Party as it puts its case for a fairer and better Australia.

[...]

This ballot next Tuesday, is not only about leadership, it's about Labor standards, Labor values and how we conduct ourselves as a party.

[...]

I especially want to thank my senior front bench colleagues who have served the Parliamentary Party well and have remained loyal to me

In hindsight, the most ironic comment of all would have to be this:

Don't put a revolving door on the entrance of the Opposition Leader's office. That door only leads to permanent opposition.

The Opposition Leaders have been Kim Beazley, Simon Crean (the one in question), Mark Latham and guess what, Kim Beazley again. Full circle, huh?

Time will heal, in my view any personal hurt, thus hurt that comes from events like today.

No video this time but from memory, Crean gets real emotional here. I love his choice of words in true political style. He could have said the more straightforward:

You bastards for stealing my prime ministership!

but being a politician, he didn't. Pity.


[*] In case you missed it (and I wouldn't blame you if you did), the font is satirising the old biography pages for a particular political party. In reality, if you are elected unopposed, this simply reflects the sad state of democracy: it doesn't mean no one wanted to vote against you - it just means there were no other candidates.