Entries Tagged 'General' ↓

Shameless Plug (of a Memory Leak)

Superswitcher version 0.5 is out.

  • Plugged a memory leak. Previously, we were not destroying cairo contexts.
  • First draft of a D-Bus interface.
  • New add and remove workspace buttons.
  • Respects #define MAX_REASONABLE_WORKSPACES 36 as per metacity.
  • –trigger-on-caps-lock split into –also-trigger… and –only-trigger…

The memory leak turned out to be that I wrote gdk_cairo_create without having a corresponding cairo_destroy. You’d think compilers these days should be able to pick up an error like that. C++ has ’smart pointers’ and destructors, but hot damn is it ugly. Garbage collected languages take away the problem of explicit memory management, but can be sluggish (yeah, yeah, it’s debatable), which might be quite important if you’re on limited resources.

I like C. I get it, and as far as software goes, it’s small and simple enough that I think I get all of it. I can read C, and I can understand what’s happening. Compare this to C++, where overloading and operators and multiple inheritance and references instead of pointers means that when you get an obscure bug, it hurts. Even when you have a simple bug, the compiler error messages are horrendous to get your head around. Apparently there’s a new C++ standard (”C++0x”, due Real Not-Soon Now) brewing that will ‘fix’ some of these problems, but I expect it to suck because they’re adding more things rather than taking stuff out. To mix metaphors, you can’t polish a backwards compatibility crutch.

Java and Python are (relatively) easy to write in, but for serious stuff, you have to “learn the architecture of the machine”, so says Samba guru Jeremy Allison. You gotta understand pointers, and that something is slow because you’re copying lots of char arrays in a dumb way. Having read what I just wrote, I am turning into such an old fart, but then again, I’m like 48 in computer years.

What I really want is a programming language that reads like Python and runs like C. That should be its mission statement: reads like Python, runs like C. Maybe I should enrol in a research degree, spend a few years inventing Yet Another Best Programming Language Ever, and whinge that nobody uses it even though it is the Best Programming Language Ever. If I do, you’ll surely hear about it. In the meantime, enjoy a less leaky window switcher.

Closing thought: what’s the biggest memory leak anyone’s ever seen? This fuzzy screenshot shows Firefox clocking over 1.5GB…

OMG I AM TEH FAMOS!!!!!!!

To be precise, I’m on the Slashdot, which means I now have +1 Nerd Cred. Admittedly, it popped up on Easter Friday, which would probably be in the top 3 slowest news days of the year. And you have to dive in to the numerous links (no, not from a comment, from the actual ‘article’) to find my name in one tiny corner. And the blog post it linked to is over two weeks old. And it’s not as outrageously remarkable as Bonsai Kittens. But I’m there, dammit.

The blog post it linked to is from my work blog, which is more product announcy than personal diary-y, but, yeah, for the last few months I (with help from my colleagues, especially David) have been working on getting GeoRSS and KML to show on Google Maps and also through the Google Maps API.

There were a lot more linkbacks to that post than I was expecting, and it was a little odd, when just surfing around, to follow the trail from Jeremy Zawodny’s linkblog (one of my occasional internet timewasters) to Sam Ruby’s Which Way Is Up, which opens with, whoa, my name. It also made the O’Reilly Radar.

Which Way Is Up also mentions that GeoRSS isn’t officially standardized - it’s a partially undefined specification, with respect to boring details like what’s the XML namespace, are lat/lng co-ordinates separated by commas or whitespace, blah blah blah. That’s not to say that KML is perfect either - a personal boring detail peeve is how it’s sometimes child elements rather than attributes: <LineStyle> <width> 3 </width> </LineStyle> rather than <LineStyle width=”3″/>. But really, that’s a boring detail I ought to save until around the 50 hour mark when we’re stuck in a borked elevator together and have totally run out of other conversation.

Backtracking a bit, the thing with GeoRSS being somewhat loose means that the example that I chose to demonstrate GeoRSS-on-Maps could be held up as exemplary, or “officially blessed by Google”, even though it’s imperfect wrt this loose standard, or so the discussion went at Which Way Is Up. But really, it was just an arbitrary decision by me made in like 3 seconds when I needed a reasonable looking GeoRSS example and SlashGeo was the first one I saw on my Tomboy note full of these things. It made me wonder (briefly) about what other standards have been ensconced somewhat accidentally…

Sigi Says That I Should Blog More Often

Sometimes happiness is simply a new pair of shoelaces.

Does He Say "Math" or "Maths"?

I was going to stick an Update on my previous post (on Terry in the New York Times) but it’s sort of evolved into a full post. It turns out that my 大哥 has a shiny new WordPress. For example in his response to the NYT story, there’s a discussion about math education, and Terry says

“For instance, while teaching undergraduate linear algebra here in the U.S., I’ve found that students respond well to the story of how two Stanford graduate students in mathematics and computer science managed to exploit the theory of singular value decompositions of large sparse matrices to create a rather well-known multi-billion dollar web search company :-) .”

For the non (linear algebraists) amongst us (not to be confused with the (non-linear) algebraists), he’s talking about PageRank and the Google. I’d also add computer graphics and games as another reason for the kids to wanna learn linear algebra. I can hardly remember what dull rag my MATH1001 professor waved to try and motivate us, but it was, by definition, forgettable.

He also has a rather interesting riff (this time for armchair physicists) on Lara Croft as an analogy for Quantum Mechanics. I always thought that her body defied the classical laws of physics. :-)

Twitbar 2.0

With the youth of today’s attention spans halving every 18 months, it is good to know that Deskbar’s triple-extreme ease of extensibility (that’s XXXEoE™) meant that, for Phil Wilson, "it took longer to write [his] blog post than [a Post-to-Twitter Deskbar extension]"

Python rocks. \m/

Calling All Szemerédi Fans

One of the reason’s why Terry Tao’s wig is so big in the math world is the Green-Tao theorem, which states that the sequence of prime numbers contains arbitrarily long arithmetic progressions.
If that means anything to you, you might be interested in his forthcoming article in the Bulletin of the American Mathematical Society, entitled “What is Good Mathematics” (PDF). He’s also in a
New York Times article
from last week, and his little brothers gets a mention. Yay me - I’m in the NYT. :-)

Election, Shmelection

Having nothing new to say about technology at the moment, here is a brief interlude…

A state election is coming up, which for all practical purposes means that I am supposed to bless one of the two major political parties. The trouble is that I find both prospects are utterly uninspiring (yes, even more uninspiring than the usual parade of political hacks), and the polls show that I am not alone. The incumbent is corrupt and incompetent, but is predicted to lurch home in front of a totally forgettable and farcical opposition.

Actually, there are politicians that I admire (!), but they don’t happen to be in my electorate. In fact, I’ve always lived in “safe” (rather than marginal) seats, so I feel like my vote doesn’t matter anyway, and I’m being taken for granted. Marginal seats get the pork barrels, boundaries are gerrymandered, and geographically dispersed interests are under-represented. So I got to thinking… what if we had a democracy without electorates? Or, to be precise, a single electorate - the whole country.

Here’s how it would work. I would go to the ballot box, and put one X next to the name of who I wanted to represent me in the nation’s Parliament, and that’s that. Those who mustered a minimum number of votes (say, 0.01% of the voting population) would become Members of Parliament. But not all MPs would be equal, their vote in Parliament would be weighted by how many votes they garnered at the election. A majority would be still needed to pass laws. Not a majority of MPs (or a majority of seats), but a weighted majority, representing the population. Corporations work somewhat like this. Some shareholders have a greater share than others, and thus have greater say in how the corporation is run. I wonder if there’s any lessons from the corporate experience (or elsewhere) as to how this alternative universe would pan out.

Ah, but what if a tremendously charismatic evil genius takes 55% of the vote at election time, then the system becomes a one-person dictatorship, no? One countermeasure would be to have rolling elections, so that each MP was elected for a four year term, but we had elections every two years, so that only half of the Parliamentary weight would be up for grabs at each election - each citizen is represented twice. No one MP could represent a majority weight solely by himself (or herself).

Would this work? Am I a naïve engineer trying to imagine an mathematical fix for a messy human problem? Would this reduce elections to a popularity contest, or beauty over brains? Would this lead to only extremist politicians backed by vocal, passionate interest groups? Would this lead to weak and unstable (and ineffective?) government, if there was no clear majority party (as you get in the two-party system)? Would it lead to opportunist, independent politicians selling off their critical (weighted) vote if a proposal is hovering around the 50% mark? Would it destroy the concept of a political party entirely (why vote for a follower when you could vote for the leader)? Would that ruin the Westminster notion of the executive (Ministers) being drawn from, practically speaking, MPs of the majority party? Is it even logistically possible?

All I really want is a reason to vote for (rather than against) somebody next week. (Sigh)…

Been There, Done That, Got Loads of Free T-Shirts

Linux.conf.au was pretty cool - there were OLPCs to play with, faces put with names (and nicks), an awesome Open Day full of shiny demos, and a luncheon pilgrimage to the Red Hat Noodle Bar.

I gave a talk about superswitcher at the GNOME miniconf. It wasn’t the sexiest topic, and I was a little nervous (I haven’t really done a lot of presenting before), but I don’t think it sucked. It was a better experience than one I had a few years ago, when it was really cold, and my hands were stiff and frozen just before I had to get up on stage, so I thought to run some warm water over my hands, only to turn the tap on far too fast, and the splash gave me a nice big wet patch right over my groin :-). Unfortunately, the video appears to be lost. There are OGGs of Davyd’s introduction and t-shirt handing out (trust me, it’s not that interesting) beforehand, and the Avahi talk afterwards, but not the one of me. So much for my 15 minutes of fame, but really, there wasn’t a lot to it (if you want to find out what superswitcher does, just download and try it). At least Davyd took a photo.

Anyway, I talked a little bit about the wnck library, and if you want to start playing around with that, then I have some wnck python example programs that are pretty short and simple. Another example I gave is how easy a (Python) D-Bus program can be. Here’s a 4-liner that tickles superswitcher (yeah, you will need a version after 0.4):

#!/usr/bin/env python
import dbus
dbus.SessionBus().get_object('superswitcher.SuperSwitcher',
                            '/superswitcher/SuperSwitcher').TogglePopup()

Finally, Enso was just released, albeit Windows-only and trial-ware (yeah, they gotta eat). From my biased viewpoint, it looks sort of Deskbarish (they mention Python plug-ins!), sort of Superswitcherish (they switch windows by find-as-you-type title search, and they trigger on Caps Lock!), sort of Quicksilverish (Santa is still yet to gift me a BlingBook Pro), sort of Google Desktop Ctrl-Ctrl-ish, surely sort of other things I haven’t seen yet, and heavily influenced by the late Jef Raskin’s The Humane Interface (certainly interesting reading for UI designer wannabes, especially those who want to get away from the “nothing’s changed since the 90s, overlapping windows, files and folders, icons on a desktop” rut). The Flash demos are all very flash :-), although I don’t really see the life-changing-ness of being able to calculate anywhere (maybe I just wasn’t cut out to be an accountant). The “learn as” feature seems nifty at first glance (although if it’s just files or URLs, you could simply just bookmark them in Nautilus or Epiphany and pick them up in the Deskbar).

Update (2007-01-29): Terry didn’t win, by the way, but he still made the news. Apparently he “is a true-blue Australian with a fondness for meat pies, football, cricket, and our easygoing, honest, and relaxed culture”, despite me being unable to remember the last time he ate a meat pie, watched the footy, or the cricket. He is, however, easygoing, honest and relaxed.

ICU@LCA?

Just a short note to say I’ll be at linux.con f.au in Sydney next week. Drop me a line if you wanna meet.

I don’t have much else to write about, so instead look at Drew Kerr’s Gimmie / panel menu musings.

CAPS LOCK, HOW I LOVE THEE

It’s nowhere near “release early, release often”, but superswitcher 0.4 is finally out. The project is now hosted on Google Code, which means a subversion repository, an issue (bug) tracker, an one-stop download shop and probably more to come.

You can now also download a i386.deb binary package directly, rather than just the source tarball. This is the first time that I’ve rolled a .deb, so feedback is most welcome.

One new feature I’d like to highlight is the ability to use the Caps Lock key to switch windows (WITHOUT HAVING TO TYPE LIKE THIS) instead of the Super key, which is most useful if, for example, your Thinkpad has no Super key, or something like compiz wants the Super key. This promotes the larger-than-average Caps Lock key from my most hated wart on the keyboard to one of the most cherished keys. Hooray for the poor neglected Caps Lock.

Changes since 0.3:

  • Can now drag-and-drop workspaces.
  • New -c, -v and -? command line options.
    -c or –trigger-on-caps-lock makes Caps Lock also switch windows.
    -v or –version shows the version number and exits.
    -? or –help shows a brief instruction guide.
  • Super-Shift-Control-Insert now moves *all* windows from this workspace to a new workspace, so as to be consistent with Shift = Move, Control = Move-All-Windows-in-this-Workspace and Insert = New-Workspace.
  • Now does window-frame geometry calculations “the right way”, via a window’s _NET_FRAME_EXTENTS X property, rather than presuming that its frame is the same as its parent X window.
  • Now warps the pointer to the activated window’s center, under focus-follows-mouse in metacity. This fixes the behavior where window activation would be ’stolen’ by whatever window was under where the pointer was at the time.
  • Now works when NumLock is on. Fixes bug #1.

Get it fresh from the superswitcher project page. Its gnomefiles.org page is still updated but is no longer definitive.

Thanks to Drew Kerr for his help.

OK, back to Kerry O’Keeffe calling the cricket…