Planeta Gnome
Planet GNOME: David Siegel: One Hundred Paper Cuts for Lucid, Round 10

Time flies like an arrow! This week marks the final round of paper cuts for Ubuntu 10.04 LTS “Lucid Lynx.” We’ve done an outstanding job so far but we still have work ahead of us. Here are some paper cuts that need attention this round:

“Create Document” Templates difficult to use
Right-clicking on the Desktop and choosing “Create Document” still shows a menu with only “No templates installed” and “Empty File.” Let’s at least put some OpenOffice Document templates in there.
Shutdown/restart dialogs make it unclear whether people should wait
Users often mistakenly believe they have to wait through the 60-second countdown on Shut Down and Restart dialogs.
Opening a deleted ‘recent document’ results in a new file.
Deleted files shouldn’t be displayed in the Recent Documents menu.
Default setting for remembering password should be remember until logout
“When accessing a windows file share (or other network resource) that requires a password, the radiobutton defaults to “Forget password immediately”. While this is understandable for security reasons, it is a usability “paper cut” because one will typically be confronted with the same password prompt again in very short order (without even closing the nautilus window). Just yesterday this got a smirk out of a Windows user looking over my shoulder that I had to enter the password “again.” This has also been an annoyance for me for quite a few years.”
Context menu for an USB pendrive shows “Unmount”, “Eject” and “Safely Remove Drive”
Which one do I choose?!
OpenOffice menus still have icons which should be removed
‘nough said.
In the file operation dialog, the file count and the size count change in opposite direction.
File count decreases while copy size increases, causing users to go cross-eyed.
In Help, Table of Contents switches from left to right when user selects topic
Eww.
Unfriendly message upon typing incorrect password (Policykit-GNOME)
AUTHENTICATION FAILURE” is a severe message to confront users with, especially users who sometimes make mistakes when typing into password fields. When a user makes a mistake while typing his password, we should be understanding, supportive, and encouraging rather than alarming, accusatory, or even perfunctory.
Posted on permalink
Planet GNOME: Florian Boor: MeeGo or Maemo grown up

Wee..! Big news – Intel and Nokia joining their open source software platforms Maemo and Moblin into a single one: Meego

So what does this mean for developers and device manufacturers? One thing is for sure: The new platform will become the “grown up” version of Maemo and Moblin. Especially for the Maemo part this means that the focus will change from targeting a very few devices and a quite well-defined software stack to a more generic way to support multiple hard- and software environments. And this is good – only a portable and easy to support platform is attractive for the device makers while the availability of multiple devices is important for its attractively among software developers.

It looks like we have interesting times ahead…

Posted on permalink
Planet GNOME: Tomeu Vizoso: Free love
A fan of free software sent this greeting yesterday to me, addressed to the Sugar community and to other free software projects:
free software foundation suggests people send valentine's greetings to free software developers. i could be wrong, but i think it's a great idea. i don't get many excuses to bother devs with thank yous.

i'm not only a huge fan of sugar. i have sugar to thank for helping introduce me to all of these: linux-libre (via trisquel-con-sugar) trisquel, python, gnewsense. i tried trisquel because it included sugar, i learned python because of pippy. after 25 years of coding in basic, python is probably my favorite language.

i know sugar is developed for kids and that's great. i learned basic as a kid, and i believe very strongly in pippy and i think turtleart is absolutely ingenious.

i know i have (a) team(s) to thank, but in the interest of not making spam filters angry and retributive i'm just sending this valentine to you. maybe you'll share it? thanks everyone.
Posted on permalink
Planet GNOME: Andre Klapper: A blast from the (German) past

Spend a day at my parents’ place this weekend and cleaned up a bit. Found this old application for Western German citizens to enter East Germany. Interesting to see all the stuff that was asked for. Also wondering why it’s also in English and French, but not Russian…

Application for entering the GDRApplication for entering the GDR

Posted on permalink
Planet GNOME: Pascal Terjan: Accessing French taxes account

Today I tried accessing my account which had worked fine for years, and at the point where it requests the certificate, Firefox was failing with "The page you are trying to view can not be shown because the authenticity of the received data could not be verified." and Chrome with "Erreur 107 (net::ERR_SSL_PROTOCOL_ERROR) : Unknown Error".

The workaround that allowed me to access it was export NSS_SSL_ENABLE_RENEGOTIATION=1 (found in a Debian bug report).

Posted on permalink
Planet GNOME: Quim Gil: Maemo + Moblin = MeeGo –> Join us!

BIG NEWS TODAY meego.com + video from MeeGo Steering Group + video from Nokia & Intel

This is a move that many had desired. On the paper it just made so much sense. However, not too many had really thought it would happen. Big companies have quite often big egos and it’s not easy for them to be humble and come together. I’m happy to work in a company that has been able to push and concede together with another company that has been also able to push and concede. 1 + 1 in this case will bring three and more. If these two megacorps could drop some of their priorities in order to reach a common ground, other players can do that too. Including you? (yes, you).

As a Nokia contact with the Maemo community and as an active community member myself, I expect this announcement to be big news for the maemo.org membership. Software freedom and more diversified devices have been two loud and consistent claims since the Maemo project was born in 2005. MeeGo brings that, and a lot more. In fact I think today is an historic day for the Linux and free software communities. Not only for seeing these two companies shaking hands in a Linux Foundation hosted project, but for the rest of handshakes expected to come after today’s launch. Now, where is your hand?  :)

Intel and Nokia are two major investors and contributors in free software development. Both have big teams in house and collaborate with a wide variety of open source companies, projects and rock stars. Now they are combining strategies and resources in order to kickstart a free Linux mobile platform. Real code will come soon although plenty of it is already available in code repositories from Moblin, Maemo, Qt

MeeGo is just like you would expect a free Linux OS to be: based on the standard Linux and Free Desktop technologies and developed publicly in a project open to all contributors. As a huge fan of the free software community at large, I’m just amazed by the huge amount of passionate ideas and work it pushes. Every time time someone attempts to encapsulate part of that energy and bring it aside for a mobile platform I think “Nah, you really want to be part of that storm, fuel that powerful entropy and be clever canalizing the energy to your platform and products.” You don’t know how happy I was the day I knew Nokia and Intel wanted to do just that with MeeGo.

Answers in the new community

You can find more details at meego.com . However, don’t look for all answers since there are so many missing. The reason is obvious: many of these answers rely today in the Maemo and Moblin communities. Also in the open source upstream projects feeding the MeeGo architecture. Also in the application developers that ultimately will make this platform successful. Also in the chipset vendors, device manufacturers and other users and stakeholders of this platform called to spin the whole mobile industry.

All these answers are somewhere: we just must find them. It will require the best of our brains. It will be deep, it will be fun. I just couldn’t wait today’s launch in order to start the bootstrapping of MeeGo. The whole thing is actually big and digesting it takes some time. If you want to be part of this I recommend you to go through the website, subscribe to the mailing list and decide the task or area you want to push first. In other words: choose your mission in the MeeGo project.

My preferred mission here and now is to contribute in the evolution of maemo.org and the Maemo community in the new MeeGo context. I have some ideas but, to be honest, I’m biting my tongue in order to let you go first. But still I couldn’t sit just quiet waiting for the launch, so I decided to start a wiki page describing and comparing the most interesting assets of the Maemo and Moblin communities. Please help improving it. It will be useful to figure out all what we could have if we are clever integrating and merging.

And now the personal anecdote

In Autumn 2006 I was a 770 user applying for a job at Nokia. There was this interview with Valtteri Halla (now MeeGo’s Technical Steering Group member) and Ari Jaaksi (now VP and head of Maemo Devices). I was explaining them how great it was working as self-employed or in small cooperatives and living in a lovely house in Andalusia. Ari asked me what were my motivations to leave all that, move to Helsinki and join a big corporation. Well, by that time my second child was born and I really needed a source of income. :)   But the reason not to hesitate taking such a chance was my explicit agenda of bringing Linux and free software to the real mainstream.

Today, three years after getting that job, I feel this agenda (pushed together with many others in the World: I love you all) is about half the way. Working at Nokia you really learn the meaning of the word “mainstream” and yes it includes your cousin, your neighbor and many people you don’t even think of. MeeGo is a platform to reach them and offer them something useful and exciting for their lives. Software freedom lovers: you know what I mean.

Tagged: community, development, freedesktop.org, GNU/Linux, Intel, maemo, MeeGo, Moblin, Nokia, open source
Posted on permalink
Planet GNOME: Mukund Sivaraman: Website ads

I'm thinking of running Google ads on banu.com, this website, etc. Hosting a server costs $69/month which I paid for the last 3 years from my pocket.

We want an automated build system now for Tinyproxy as it is used on several different platforms, but the current server is incapable to host even a buildbot let alone centrally accessible VMs for it and a capable one costs quite a bit more.

We can't sell this software, or offer consulting services (embedded device manufacturers prefer to hire someone in-house who can customize various other software for the device too). If such free software projects are difficult to sell, surely there must be other tolerable ways of generating revenue to pay for hosting it.

I'm going to try it, at least as an exercise.

Posted on permalink
Planet GNOME: Jaap A. Haitsma: Nexus One could be more Environment Friendly

In order to reduce strain on the environment the European Union decided with the top 10 mobile phone manufactures to use a common charger (Press Release). Basically they decided to use a micro-USB for charging. Mobile phones only last 2-3 years on average however the chargers last much longer. By having a standard way of recharging you reuse your old charger.

However I have not seen mobile phone yet which doesn’t come with a charger. So actually we are still producing electronic waste which is not needed and we end up with loads of unused chargers.

When you buy the Nexus One it comes with a US charger and a USB cable. The charger has a fixed cable. If it would have a USB connector the charger one could have saved a cable. Further the charger could be more easily reused to charge devices with a mini USB connection.

When you buy a Nexus One from the UK Google automatically adds a UK charger for which pay an additional $19.95. So you even end up with two chargers in the end.

In my opinion Google should just ship a USB cable with the phone and make a charger optional. I’d prefer if Google in that case would offer an optional dual charger like depicted here on the left, because I would be able to use it charge two devices at once.

What’s your opinion should all devices that are charged by USB come without a charger by default?

Posted on permalink
Planet GNOME: Robert Ancell: gdm2setup
Tired of not being able to configure many settings for GDM in Karmic? Two community members; Garth Johnson and Nick Glynn have developed a great tool called gdm2setup which gives you a lot more control:


Try it out from their PPA!
Posted on permalink
planet.freedesktop.org: Keith Packard: TeleMetrum v0.2 testing

Test Flying TeleMetrum v0.2

Bdale and I got a chance to test fly the new version (0.2) of our TeleMetrum flight computers. Bdale flew with the Albuquerque Rocket Society down in New Mexico while I flew near home with Oregon Rocketry during our February model launch.

I flew my Dynastar Grappler which I have modified to create a large payload bay out of a foot of the original body tube:

I cut a sled out of plywood and mounted the TeleMetrum on one side, and a small 110mAh battery on the back:

The field we use for model launches is surrounded by tall fir trees, so we tend to stick to reasonably small motors. This time, I loaded up an Aerotech 24mm E18 motor and trimmed the delay down to about 5 seconds as this rocket uses simple motor ejection. This flight didn’t exercise the new ejection circuitry. In any case, the flight was perfect, telemetry worked all the way down to the ground using just a 1/4 wave whip antenna on the receiver.

Here’s the data recorded in the on-board eeprom:

The maximum reported altitude was 186m, velocity was 49m/s and acceleration was 53m/s².

As expected, the GPS loses tracking during boost, but rapidly re-acquires near apogee and tracks the rocket all the way back to the ground. The flight track can be viewed in Google Earth.

Needless to say, both Bdale and I are extremely pleased with the performance of the new hardware.

Posted on permalink
Planet GNOME: Seif Lotfy: Algorithms for learning association rules in Zeitgeist

With the framework being in a stable form now and Siegfrieds work on a “dataprovider register” (he will blog about it soon i hope) I decided to take a stab at something new that has not really been used on the desktop before except in GNOME-Do.
However what we are doing is a bit more complicated.
With Zeitgeist knowing about your activities and events i tried to apply the classic “A Priori” Algorithm to detect associated files based on usage.
Unlike our current implementation of finding files related to other explicit given files. This one looks at a whole timerange and creates sets of files used together. It is kind of like detecting usage patterns.

Taken from wikipedia here is a little example:

A large supermarket tracks sales data by SKU (item), and thus is able to know what items are typically purchased together. Apriori is a moderately efficient way to build a list of frequent purchased item pairs from this data. Let the database of transactions consist of the sets {1,2,3,4}, {2,3,4}, {2,3}, {1,2,4}, {1,2,3,4}, and {2,4}. Each number corresponds to a product such as “butter” or “water”. The first step of Apriori to count up the frequencies, called the supports, of each member item separately:
Item Support
1 | 3
2 | 6
3 | 4
4 | 5
We can define a minimum support level to qualify as “frequent,” which depends on the context. For this case, let min support = 3. Therefore, all are frequent. The next step is to generate a list of all 2-pairs of the frequent items. Had any of the above items not been frequent, they wouldn’t have been included as a possible member of possible 2-item pairs. In this way, Apriori prunes the tree of all possible sets..
Item Support
{1,2} | 3
{1,3} | 2
{1,4} | 3
{2,3} | 4
{2,4} | 5
{3,4} | 3
This is counting up the occurrences of each of those pairs in the database. Since minsup=3, we don’t need to generate 3-sets involving {1,3}. This is due to the fact that since they’re not frequent, no supersets of them can possibly be frequent. Keep going:
Item Support
{1,2,4} | 3
{2,3,4} | 3

In much larger datasets, especially those with huge numbers of items present in low quantities and small numbers of items present in large quantities, the gains made by pruning the possible pairs tree like this can be very large
.

Now imagine the supermarket being all files on ur computer and the transactions being sets of events happening to the files per 30 minutes.

Using this we will be able to determine alot of cool associations between files and with some Tracker magic we could do this on a metadata level.

Now i pushed the implementation with this test case and another into a branch waiting for the team to review it and expose it properly over D-Bus. The test cases work though which kinda gets me excited to work on new algorithms and generate adaptive transaction since right now i assume every 30 minutes is a transaction. I have a lot of ideas and also I will be applying two other algorithms Winepi and Minepi to compare results.

Expect some cool stuff to come up soon…
Releases of the engine and GAJ are being prepared…
Cheers

Posted on permalink
Planet GNOME: Matthew Barnes: Using GStreamer to sample arcade music
Recently I discovered the online Arcade History database has added music samples for some games.  For example, they now have music for the mid-80's racing game Out Run.

I thought it would be cool to integrate that into my MAME front-end, GNOME Video Arcade, and wound up blowing the whole weekend on it. I'm happy to say it's finished already, and works great!

My foray into basic GStreamer programming was suprisingly pleasant. The API is nicely designed and well-documented, and simple use cases like mine are made easy. The "playbin" plugin pretty much did all the work. I just fed it Arcade History URIs and wired up a simple user interface to follow state transitions from the audio stream.

GStreamer is an example of the kind of high-quality software engineering that I strive to emulate in my own work.


 
Posted on permalink
Planet GNOME: Jesse van den Kieboom: gedit gobby collaboration

After some more hacking we have most of the functionality ready for real collaborative editing in gedit. Here is me and Armin collaborating (me with gedit and Armin with gobby, sorry, interface in Dutch):

In contrast to my previous post, this version now properly handles its sessions, does error handling etc. The only thing that is really missing right now is undo/redo, which is tightly coupled to GtkSourceView at the moment in gedit. We would need to make the undo handling less specific to use infinote undo/redo for shared documents.

When all of this more or less works, the next step will be to use telepathy tubes to allow sharing documents directly with one or more of your contacts. The idea is that you can offer a collaboration session to your contacts. gedit will then internally run an infinote daemon, offering a virtual document store made up of the open documents in the gedit window. All the necessary components are there, so it should be fairly straightforward to do.

To finish, a little teaser screencast: (youtube, ogv)

<object height="344" width="425"><param name="movie" value="http://www.youtube.com/v/rXzI2dInXKI&amp;hl=en&amp;fs=1"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed allowfullscreen="true" allowscriptaccess="always" height="344" src="http://www.youtube.com/v/rXzI2dInXKI&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" width="425"></embed></object>

Posted on permalink
Planet GNOME: Andy Wingo: sidelong glimpses

Evening, tubes. I don't usually post about works-in-progress, but this one has been on my mind for two or three weeks, really paralyzing my mojo, so perhaps getting it out in textual form will help me move on a bit.

operation delimited continuation

So yes, to my non-programmer audience, let this be a pleasantly written but unintelligible lullaby, a word-train rocking you to sleep; but to the nerds out there, I'm quite fascinated with this topic, and I hope I'm able to convey some of that fascination to you.

Consider the following C program:

#include <stdlib.h>

int main ()
{
  abort ();
  return 0;
}

Let's assume we have it in foo.c, and compile it. We'll do so from tcsh, for reasons to be explained later.

$ tcsh
% limit coredumpsize unlimited
% gcc foo.c

OK, we should have a binary in a.out. Now, we run it, with predictable effects:

% ./a.out
Abort (core dumped)
% ls -l core
-rw------- 1 wingo wingo 151552 2010-02-14 21:37 core

So, what happened was that the program ran, then it got to the abort, which caused it to unexpectedly exit. Where did it exit to? In this case, back to the prompt.

That program is no longer running, but when it exited, it left behind a copy of its state -- of its continuation. A continuation is what's left of a computation. In this case, what's left is for abort to return, then main returns 0, then probably some system-specific code, then we'd be back at the prompt again. Aborting just brought us back to the prompt a little faster.

Anyway, the core dump has all of the data that would be necessary to complete the process' computation. With a debugger you can get in and see what that data was, but you can't run the program again from that point -- you'd need some extra OS-level support for that.

why are you talking about this stuff

Glad you asked! Core dumps are really a specific instance of control features in programming languages. Control features are what allow you to skip around in your program. In this case, we skipped back to the prompt.

Scheme includes support for a very low-level control feature known as continuations. With continuations, you can implement all kinds of things, like exceptions, coroutines, generators, and short-cut operators. You can make up new control operators in a Scheme library and add them to an innocent, unsuspecting program.

Many people are aware of this, but fewer know that continuations have a problem, a big problem. The origin of the problem is that a continuation captures the whole future of a computation, not just a part of it. So if you implemented exceptions with continuations, imagine dumping core every time you threw an exception. Not very efficient, no?

Well the truth is more complicated of course. If you have access to the entirety of a program, the compiler can transform your code into what is known as continuation-passing style (which the laity may recognize by the weaker names of single-static-assignment or A-normal form) and in that case invoking a continuation is just like calling a function. But for the rest of us, we have to play tricks with dynamic extents, incrementally dumping parts of the core as the program enters different dynamic extents.

(I'm simplifying here, to continue the core-dump metaphor, in the knowledge that the clergy will correct this doctrine in the comments.)

But in the general case, capturing and reinstating continuations can be quite expensive, because in the absence of sophisticated analysis, one simply dumps the whole core. It's a terrible but common implementation strategy.

There are other, deeper problems with continuations as present in Scheme, notably the lack of composability. Though I do understand that this problem is deeper, I don't understand its depths, so I'm going to forgo a discussion of that here.

the solution: more power

So, continuations are great, but they can be expensive to implement. OK. In this context it's amusing that the solution to this problem is actually to give continuations more power.

The problem is that in Scheme you have control over where you dump core, but not how far you dump core. While it's true that continuations logically capture the whole future of a computation, in practice that continuation has a limit: the process boundary. Our a.out was spawned at the tcsh prompt, but it has no access to the implementation of the shell itself, not to mention the kernel.

So, more power, as we were saying: let's allow programs to delimit the range of computation captured by a continuation. Instead of capturing continuations up to the process boundary, a program can capture a continuation only up to a certain point in a program.

Pleasantly, that point is known as a %, pronounced "prompt". (Dorai Sitaram notes that he would have preferred >, but it was taken by greater-than. Also, this comes from back in 1993, so perhaps he can be forgiven the tcsh-style prompt.)

It's as if you were implementing a shell in your program, as if your program were an operating system for other programs.

Here's a translation of foo.c into a Scheme that supports prompts:

(define (foo)
  (abort)
  0)

And now we run it, in a prompt:

(% (foo)
   (lambda (core . args)
     (format #t "Abort (core dumped): ~a\n" core)
     (format #t "Arguments to abort: ~a\n" args)
     1))
;; =| Abort (core dumped): #<continuation ... >
;; =| Arguments to abort: 
;; => 1

The second argument to % is the "handler". When abort is called, control returns to the handler, and the continuation -- the "core dump" -- is passed as the first argument. Unlike in UNIX, abort in Scheme can take any number of arguments. Those arguments are passed to the handler.

Also unlike UNIX, the core dump may be revived; but normal Scheme continuations do have a UNIX similarity in that reviving them is like invoking exec(3) -- they replace the current process image with a new one. This might be the right thing for user space to do, but if you're implementing a kernel, scheduling a process shouldn't give that process control over the whole system.

Instead, delimited continuations are more like functions, in that you can call them for a value. Like this:

(% (foo)
   (lambda (core . args)
     (format #t "Abort (core dumped, but continuing): ~a\n" core)
     (format #t "Arguments to abort: ~a\n" args)
     (core))) ;; revivify the core, letting the program finish
;; =| Abort (core dumped, but continuing): #<continuation ...>
;; =| Arguments to abort: 
;; => 0

gloves off

If you didn't know about continuations before, and you've gotten this far, then drinks all around! If not, then, um, drinks all around? In any case, we're going more hard-core now, so you'll need it.

Delimited continuations are not quite a new topic. The first reference that I'm aware of that begins to understand the problem is The theory and practice of first-class prompts, by Matthias Felleisen, in 1988.

Unfortunately that document is only available behind a paywall, because the ACM is a pack of scrooge mcducks. So instead you'll probably have to deal with Sitaram and Felleisen's 1990 contribution, Control delimiters and their hierarchies.

But don't read that one first. First, read Sitaram's beautifully clear 1993 paper, Handling control, which is a lovely exposition of the offerings that delimited continuations have to the working Scheme programmer.

An obvious extension of Sitaram's work is in the implementation of abstractions that look like operating systems. Back in those days it wasn't quite possible to imagine, but the current example would be the web server, where each session is a different process. So we return HTML and wait for the user to come back, and in the meantime schedule other processes; and when they do come back, we resume their session via resuming their computational process.

It's typically said that with continuations you can implement any control feature, but that's not true if your target language also has continuations. For example, you can implement exceptions with continuations plus mutable state, but if the program you are running also uses continuations in their standard Scheme form, the program's use can conflict with the implementation of exceptions, producing incorrect programs.

feature on top of feature

This is why it's 2010 now and no major programming language includes delimited continuations in its specification -- because it's tough to see how they interact with other primitive elements of the language. There has been a lot of research on this recently, with some promising results.

But before I move onto the shining light, I should mention a pit of darkness, which is the profusion of delimited control operators in the literature.

Sitaram in his papers proposes prompt (or %) and control (similar to abort) as his primary delimited continuation operators. But there are others. The ones that are seen most often in the literature are shift and reset, and also there is cupto. It was only in 2007 that Dybvig, Peyton-Jones, and Sabry were able to tease out their relationship; if you are interested, I highly recommend the first third of A monadic framework for delimited continuations, despite the title.

This result was mentioned by Matthew Flatt's 2007 paper, co-written by Yu, Findler, and Felleisen, Adding Delimited and Composable Control to a Production Programming Environment. All this article has really been a prelude to mentioning this paper, and I think it merits a section of its own.

the flatt contribution

Go ahead and open up the Flatt paper, and skim through it.

I'll wait.

OK! First impressions?

Mine were, "what is the deal with all those pictures?". They seemed to be an affectation of friendliness, but appeasing neither the uninitiates nor the academics. But reading the paper in more depth, I was really impressed by their ability to convey information to the Scheme practitioner.

Because let's face it, there are piles and piles of terrible papers out there; and, what's worse, piles and piles of potentially good papers that simply aren't intelligible to the practicing programmer. OK, I dig on the lambda calculus; but what is your supposedly-proven result from your toy grammar going to do to help me make programs?

So I've always been skeptical, perhaps overly skeptical, of the desire to prove properties about programs, of the need to justify with symbology what you already know to be right. I still haven't seen the light. But at least now I know it exists, thanks to Flatt et al's paper.

The practical problem that I had was that Guile's catch and throw still weren't quite integrated with its new virtual machine; they caused the virtual machine to recurse, calling itself reentrantly. Besides being inelegant, this forced the catch expression and handler to be allocated as closures, and restricted potential optimizations.

So I started to look at how I could express catch and throw in Guile's intermediate language. It was not clear that I could add them in an orthogonal way, until I remembered something I read about delimited continuations; but it wasn't until the Flatt paper that I really understood how to implement catch and throw in terms of these lower-level primitives.

But again, it seems I'm writing into the night, so I'll try to wrap up briefly. The form of catch is like this:

catch key thunk handler [pre-unwind-handler]

Then on the other side, you have throw:

throw key arg ...

I'm not trying to argue these are the best control operators, not by a long shot; but they are what we have now, so we need to support them.

So, following Flatt, imagine we have a fluid (dynamically-bound) variable, %eh, the exception handler. Then throw is easy:

throw key arg ... =
  (fluid-ref %eh) key arg ...

Yay psuedocode. catch is trickier, though:

catch key thunk handler =
  let prompt-tag = (fresh-tag)
    % prompt-tag
      with-fluids %eh = (throw-handler prompt-tag key)
        (thunk)
      λ (cont thrown-key arg ...)
       handler thrown-key arg ...

Aside from the pseudo-code being obtuse, perhaps you're confused that the % there has three arguments -- a tag, then an expression, then the handler (a lambda). Well the tag is useful to identify a particular prompt, so that an abort can jump back to a particular location, not just the most recent prompt.

Also you're probably underwhelmed, that most of the interesting work was pushed off into throw-handler, which takes the given handler and does some magic to it. Well indeed, there is some magic:

throw-handler prompt-tag catch-key =
  let prev-eh == (fluid-ref %eh)
    λ (thrown-key arg ...)
     if thrown-key is catch-key or catch-key is true
       abort prompt-tag thrown-key arg ...
     else
       prev-eh thrown-key arg ...

So the resulting throw-handler would run in the context of the throw invocation, and if the key matches, or we are catching all throws (catch-key is true), we'll jump back to the prompt.

Note that in our definition of catch, the first argument is the captured continuation, but that argument is never referenced. This simple observation allows us to note at compile-time that the continuation does not need to be reified -- there's no need to dump core, it's just a longjmp().

Guile also supports pre-unwind handlers: handlers that run in the context of the throw instead of the context of the catch. Since Flatt breezed over this in his paper, I'll mention an implementation of that here:

catch key thunk handler pre-unwind-handler =
  let prompt-tag = (fresh-tag)
    % prompt-tag
      with-fluids
          %eh = (custom-throw-handler prompt-tag key pre-unwind-handler)
        (thunk)
      λ (cont thrown-key arg ...)
       handler thrown-key arg ...

So, all the same, except the handler is made by custom-throw-handler.

custom-throw-handler prompt-tag key f =
  let prev = fluid-ref %eh,
      running = make-fluid false
    λ (thrown-key arg ...)
     if thrown-key is key or key is true
       let was-running = fluid-ref running
         with-fluids running = true
           if not was-running
             f thrown-key arg ...
           # fall through in any case
           if prompt-tag
             abort prompt-tag thrown-key arg ...
           else
             prev thrown-key arg ...
     else
       prev thrown-key arg ...

what

I know your eyes are glazing over by now. Mine are too, and it's not just the wine. But there's something important here.

The important thing is that small sigil, =; those definitions really are it. If you can prove anything about the behavior of catch now, you should be able to prove it about the new implementation above -- even though it works completely differently.

That's power! Power to refactor, knowing that your refactorings are correct. Because I was lost in a morass, paralyzed in front of my keyboard, wondering about the ghosts awaiting me if I poked code. Now I know. I need an efficient with-fluids, some pieces of prompt and abort, and to add that all to the bootstrap language of Guile, and I have it. It's right. And I know it is because Flatt et al have already done all of the calculations for me :)

the sound of mandolins

I realize it's something of a fizzleout ending, but I think it has to remain that way before I get it all into git. Inshallah we'll be rolling like this to Guile 1.9.8, though it could very well be 1.9.9. But either way, I didn't imagine myself saying this, but thank you, Flatt & crew: your formal work has led me to see the way out of my practical problem. Cheers!

Posted on permalink
Planet GNOME: Mirco Müller: Housekeeping finally done

I finally managed to motivate myself to update OpenGL examples with cairo with the current/new links to the hosting spots, where interested people can grab the example-sources. Over the last couple of weeks I got numerous requests regarding the stale links to the different examples listed on that page.

All examples have been migrated from git to bzr and put on launchpad. You can check out their sources from there. While doing that I also moved the repository of lowfat to launchpad. For lowfat’s code I also got a couple of “Where to grab the code?”-questions in my inbox. So now everybody should be happy and be able to easily get hold of the sources.

Here’s the quick list for the impatient readers:

Since glitz has been deprecated and completely removed from cairo’s source tree I also updated some of the examples, which used glitz-related code. So far I’ve not been able to add support for the new shiny cairo-gl backend, which the new coolness. I started on it, but stuff only segfaults around.

All that took so long because I can hardly force myself to do any spare-time hacking. It’s just not fun anymore, when you sit in front of the computer day in and day out. There are certainly tons of interesting things to do or try, but motivation is just zero.

Posted on permalink
Planet GNOME: Miguel de Icaza: Valentine's Day Call to Action

Everyone knows that in this day an age a software product is not complete until it offers a Desktop UI, a Web UI, and a front-end on the Appstore.

We access beautiful web sites, we purchase 0.99 apps on our phones and install gorgeous native software on our desktops.

The sysadmin community, once the backbone of Linux adoption, keeps asking "but what about me?". Indeed. What about them?

What are we doing about these heroes? The heroes that ssh in the middle of the night to a remote server to fix a database; The heroes that remove a chubby log file clogging the web server arteries; The very same heroes that restore a backup after we drag and dropped the /bin directory into the trashcan?

They are a rare breed in danger of extinction, unable to transition into a GUI/web world. Trapped in a vt100 where they are forced to by conditions to a small 80x24 window (or 474 by 188 with 6 pixel fonts on a 21 inch flat screen display).

These fragile creatures need our attention.

Today I am doing my part, my 25 cents to help improve their lives.

I am releasing Mono Curses 0.4 a toolkit to create text-based applications using C# or your favorite CLR language.

The combination of C#'s high-level features, Mono's libraries, Mono/.NET third party library ecosystem and the beautifully designed gui.cs, we can bring both hope and change to this community. Hope and change in the form of innovative text-based applications that run comfortably in 80x24 columns.

What is gui.cs

We know that hardcore sysadmins will want full control over what gets placed on the screen, so at the core of mono-curses we expose a C# curses binding.

On top of this, we provide a widget set called "gui.cs". gui.cs was introduced in 2007 enjoying unprecedented public acclaim among a circle of five friends of mine. Eight months after its introduction, it experienced an outstanding 50% growth when a second application was written using it.

Today, gui.cs is the cornerstone of great work-in-progress applications that any decade now will see the light of day. Including a new and riveting version of the Midnight Commander:

With only 3% of features implemented progress is clearly unstoppable!

I believe in dogfooding my own software before I unleash it to the world:

On a typical 21" sysadmin setup: 474x188 with the "Sysadmin Choice" award winning 6 pixel font.

Valentine's Day

So in this Valentine's Day, after you are tired of spending quality time with your grandmother, making out with your significant other or a stranger you just met at the checkout line in Costco, consider donating. Donate some of your time towards building some nice applications for your favorite sysadmin. God knows that he spent the whole day monitoring the dmesg output, looking for a SATA controller failure and keeping an eye on /var/log/secure, waiting for your ex to deface your wordpress installation.

And you have a choice, you can use Boo, IronRuby, IronPython, F# for building your app. VB.NET is also available if you want to teach your sysadmin a lesson in humility.

Get inspired today with some of the old screenshots.

Posted on permalink