Search Results: "ghe"

17 May 2008

Simon Richter: OLPC and Windows

There is an article on TechCrunch on Windows on the OLPC. This article started out as a comment below lots of comments that were missing the point, but eventually grew too large. The entire discussion circles around the question whether it would be beneficial to give the users the same view and behaviour that is on 90% of machines worldwide, so they can start out prospective jobs with a minimum of training. Learning your way around the UI is only a significant part of training if that actual work you will do is trivial — so this argument basically boils down to "I don't expect the African kids to do anything but grunt work during their lifetime anyway, so we better start training them early", which is the wrong approach not only to education. To make a bad car analogy, roads are usually made of several layers, from the foundation providing the stability up to the paint defining lanes. Operating systems are similarly layered, with a core that applications (cars) never touch directly, and several other layers on top of that that are not really required for basic functionality, but that add safety (process separation) or comfort (standard functions). The minimum standard of things is a "platform definition", which all car (or application) makers can expect — all roads have a minimum width and there are no dangerous spikes (if that is not true, you can get a steamroller or respectively format your harddisk). Railways use the same kind of foundation (operating system), but the platform (heh) is quite different. You cannot drive a car on a railway, or a train on a road, just as you cannot run a Windows application on a Linux system or vice versa (there are special wagons you can place your car on, and special trucks with rails on them if you feel like it, but these are heavier and need more energy to pull). Now in this discussion, people have been comparing Windows (the platform) to Linux (the operating system). That doesn't work. On Linux, there are several platforms available, the most prominent being GNOME and KDE for the desktop and POSIX utilities on the command line, but there are lots of others as well. Part of most platform definitions is an user interface, which abstracts what is really happening to something comprehensible to the user, using analogies (a tachometer displays our speed as an angle usually, but other representations are possible). The "desktop" idiom happened to be the first graphical UI some thirty years back, and was perpetuated into today's computers (just like the width of roads hasn't changed from the days of the Roman empire, where it was "two horses and then some"), however this doesn't mean it is the best choice available — it's just what we are used to. If you look at the screen contents on the day traders' computers (lots of that on the TV right now thanks to the market crisis), you will notice the vast majority does not use overlapping windows or standardized "rising-edge" buttons to click on, but rather, they have a tightly-packed grid layout with high-contrast information displays that also color-code certain messages. I think that is the most important point here: to achieve optimal results, the presentation idiom needs to be chosen in a task specific way. With children as the target audience, we lose one of the key requirements behind the adoption of the windowed view: the need for side-by-side presentation of data from multiple unrelated sources (which is also a problem given the lack of screen space). With the introduction of ad-hoc mesh networking and collaborative applications, the "desktop" analogy begins to break down. The project's mission also defines requirements on the platform. If we want to keep the requirement "users should be able to build and share their own stuff", then we want a framework where it is hard to make mistakes, especially those that can be spotted only after an interesting failure, and more importantly impossible to write code that makes unrelated components fail, because these components might be your way back out of the situation. Windows has an excellent event model with fairly good isolation of components (to the point where a problem in an event handler can be handled by the event loop rather than terminating the program, so for example Internet Explorer can shut down broken plugins rather than crashing), but the detail knowledge required to really work with the API (how to build a message loop that also runs queued I/O completion handlers correctly) leads to a fairly steep learning curve, and would teach implementation details rather than concepts. The normal "linuxy" approach of going low level whenever higher-level approaches fail is not the answer either as we want to truly empower people rather than just training them to be a cheap replacement for the tech support Indians (no offence), so it is vital that the "real" applications use the same framework that people implementing new things would use, and thus all the complexity that we want in our "official" applications needs to be taken care of by the platform, with all the safety features in place too. So no existing platform provides what we want. — hence Sugar. And that is the problem for Windows advocates: Sugar replaces those bits that make Windows a platform and not just a kernel, so porting Sugar to Windows doesn't make sense from a technical point of view, since we already replaced the bits that we didn't have free software for before. Other than that, the "Linux vs. Windows" kernel choice is secondary; in fact both kernels are very similar in design and function, the various advantages and disadvantages of either aren't that relevant really. The only technical reason in favour of Linux is the virtual memory management — the Windows VMM behaves erratically in the absence of a swap device, but I believe that is not something that cannot be fixed. The reason why I believe Linux is the better choice here is long-term support. Since these devices will be used in basic education (which hasn't changed that much in the past years as 1 plus 1 still equals 2), there is hardly any need for radical changes after the initial rollout — why add instability when you don't have to? With Microsoft as a for-profit company, there needs to be a business model sustaining that behind it, and I believe it will be very hard to find one. "Subscription" falls down in that it is a long-term recurring expense, which governments tend to be pretty wary of. The alternative is to upgrade several million computers' OS every few years. Lots of companies are skipping entire Windows releases because of the migration cost, and even with the "console bonus" (all hardware is the same) and bootloader support for software upgrades over a mesh network, this is still a massive endeavour. That each machine would have to reserve enough memory for the entire "upgrade pack" so it can transition "in one go" also makes this model unworkable. To summarize, using Windows on the OLPC does not make sense at all. If you use just the kernel, you don't gain anything over Linux, and if you use the entire platform (and by extension, the UI), you add unnecessary complexity that is not only not required for the actual task, but also distracting. If you add restrictions and extensions to make it work, you invent a new platform, which is precisely what Sugar did. The argument that it is important for pupils to use the same thing that the rest of the world is using to ease their entry into the workforce is bogus at best, and racist at worst.

Uwe Hermann: Green energy from Lichtblick getting... cheaper!

You might remember that I wrote a blog entry about my switch to the green electric utility "Lichblick" (Germany) a while ago. I did that purely out of environmental reasons, I didn't want to continue to waste money on polluting and/or dangerous crap such as fossil or nuclear power. Yes, even if that meant a slightly higher price (but I really didn't compare prices much before switching — I was after an environmentally clean solution, not the cheapest solution). Quick status update: the switch went really nice and easy, no downtimes, no hassle. I've been a happy customer for more than 8 months now. Today in my snail mail inbox: a letter from Lichtblick that they're going to reduce the price per kWh from 20.25 to 19.99 (Euro) cents starting July 1st and they give you a guarantee that there won't be any price raises before the end of 2009 (more details also here). Now, that's a positive surprise there. Compare that to 98% of all other energy providers in Germany who have lately increased prices quite a lot for very obscure or non-existant reasons. Yes, I do realize that the reduced costs are not that dramatic, and Lichtblick is using this as a means to impress people and gain new customers. But I fully support them in doing so, the more people are switching to a green energy provider the better, if you ask me. I encourage everyone to consider switching, either to Lichtblick, or some of their competitors (in Germany) e.g. Greenpeace energy, Elektrizit tswerke Sch nau, or Naturstrom AG. There are various alternatives in other countries too, of course.

14 May 2008

MJ Ray: Strategy on Strategies

[SNR Event Welcome Slide]
Anyone seen this before? Today, I went to an event about the Sub-National Review Consultation (as a substitute for someone else AIUI). I'd not heard about this before, but if you're in England and you've any interest in our regional planning system (which I think you should, if you have your main home here or run a business here), you have six weeks left to comment on the UK Government's suggested changes. As I understand it, it will move the second-highest tier of planning control from democratically-accountable regional bodies to the business-led Regional Development Agencies, with some oversight by MPs and the very- indirectly-accountable council leaders. I've posted more detail on Co-opNet. When I asked about local involvement and cooperatives, I was directed towards Local Strategic Partnerships, but I'm pessimistic about how easy it will be to influence regional planning through those: a few weeks ago, I was at the launch of the North Somerset Partnership Sustainable Community Strategy for 2008-2026. It's a 72-page A4 glossy book which I've still not found time to read properly. I think the size says something about its sustainability. I've posted a little more detail on WsMForum. I'll try to answer questions about either of them on this blog or those forums...

10 May 2008

Martin F. Krafft: America does not exist, they never found it

From Berne, the Swiss capital, hails a band I really like by the name of Z ri West. The name itself is a pun: the folks from Berne love their city (rightfully so!) and join the rest of Switzerland in looking down a bit upon Zurich, which is metropolitan and hip and has often been considered the real capital of Switzerland. Located west of Zurich, Berne is thus Z ri West , and by using this name, the Bernese band ridicules the Zurich folks a bit. Well, that s my interpretation anyway and I make no claim over its correctness, and I surely don t want to get mixed up in local politics! Where was I? Oh yeah: Z ri West (Flash-using homepage] make rock music, and they re good with their instruments. The result are groovy and melodic sounds, which everyone in Switzerland knows. What I find particularly amazing about this band are their lyrics. Kuno, the singer, sings almost all songs in the Bernese dialect, which I ve learnt to the point of understanding it, though I can t speak it yet. It s a beautiful dialect, and Kuno displays magnificent control over it. When I say beautiful, I do not only mean its sound, but also the way it allows one to express thoughts, situations, feelings, etc.. It s very lyrical, often poetic, but always very much to the point. It sounds natural, yet not at all blunt. In addition, Z ri West s songs display no haste. Again, this is a bit ironic since the Bernese are said to be slow, but what I mean is that the band is unafraid to take their time to recount what they have to say. Forget 4/4 beats and verse-chorus-bridge-verse-chorus, it s a lot more as if the band shaped the music around the story they re telling. (Of course I have no reason to claim that the Bernese are actually slow. According to my dear (Bernese) friend Isabel, they are just considerate to give the rest of the world enough time to parse and understand their sophisticated verbal and non-verbal output). I won t be able to convey all of the lyrical beauties of their music to you, but what I want to do is translate my favourite of their songs, which is based on a story by Peter Bichsel and it s called America does not exist . Keep in mind that their version rhymes, which I won t be able to achieve in the translation. I ll try to keep the flow though. Imagine a jazzy, slightly Latin groove to it. And it s sung, not spoken.
This is the story of Colombo
not the one from the TV show
but of a guy who once lived in Spain
and who was a bit of a freak
capable of nothing
and always telling weird stuff
without giving it much thought
until one day someone told him: you ve got to learn a trade
you have to live your life
nobody takes you for real like this
and most just laugh about you
what are the options
he asked - what do you do
I m an explorer - the other guy said
I sail my ship out to the sea
through the various parts of the globe
that sounds very interesting - I d like that too
and so Colombo said - I ll become a famous explorer And he told it to everyone
and everyone just started laughing
and he said: just wait and see
and the people didn t believe him
and he got sulky
and the people almost died laughing
and he left the town
and hid somewhere in the forest
where he remained for 13 weeks - 13 weeks in the shrubs
and the people searched and felt ashamed
and noone knew where he might be
and noone laughed anymore when suddenly on a wonderful morning he was back
then everyone rejoiced
and when he said: i told you so
I discovered a new land
it s out there somewhere in the sea
then everyone listened
and was kind to him
and tried hard to make some dreadfully serious faces The explorer from the first verse
Amerigo Vespucci is his name
just happened to be in town
and said: good for you, but I won t believe you until I see it myself
and went off to set sail immediately
and after exactly 13 weeks and a day and a night he was finally back
and the people all went down to the port
and Colombo was nervous, almost ill because he had lied
and he was horribly frightened
and pale
and looked noone in the eyes But Vespucci smiled and stood in front of the people
and blinked at Colombo and told that he had found it
and Colombo was so glad that he didn t tell on him
and called out Amerigo Amerigo and the people joined in And Colombo became famous and until the end of his days
he was never actually sure and never dared to ask
whether America really existed
over time, more people went there and when they came back
they told stories and they tell the same stories until today
and noone knows anything more than he knew before
and everyone saw exactly the same
and that sounds very dodgy
and tastes a bit like screenplay and Hollywood America doesn t exist
they never found it
America doesn t exist
it s all just a tale
America doesn t exist
it s all lies and made up
America doesn t exist
America is just a rumour
NP: Z ri West: Z ri West

8 May 2008

Matthew Garrett

Modern CPUs are great. They have all sorts of advanced power saving features, which is one of those nice cases where everyone can save money, gain performance and claim environmental credentials at the same time. Everyone's a winner.

Well. Everyone's a winner as long as your software doesn't suck.

I've talked about the benefits of the tickless kernels and reducing wakeups and spending longer in deep C states before, so if you don't know about them then go and read that first. This time I'm going to focus on a different level of hardware, and a different level of suck.

For a long time, laptops supported changing the speed of processors when switching between AC and battery. CPU power consumption is proportional to frequency, so dropping the frequency meant a longer battery life. Of course, it also meant that it took longer to get anything done - the reason this was still a win was because CPUs in those days consumed just as much power when idle as when running. Transmeta introduced a technology called Longrun with their Crusoe processors, bringing the ability to drop both the frequency and the voltage of the CPU simultaneously. With power consumption being proportional to the square of the voltage, even a small drop resulted in worthwhile power savings. As the only really worthwhile thing Transmeta brought to the x86 world[1], this was unsurprisingly ripped off by everyone else. Intel introduced their Enhanced Speedstep, AMD gave people PowerNow and VIA have Longhaul.

Obviously, reducing the frequency of the CPU increased battery life. Everyone's happy?

No[2].

The problem is that nowadays, processors don't consume as much energy when they're idle as when they're running. The aforementioned C states mean that an idle processor consumes a tiny percentage of a loaded one - an ultra-low voltage Intel part will draw on the order of a watt. Executing code, even at the lowest voltage and frequency, will draw far more power. Obviously, we want to keep the processor idle for as long as possible. The easiest way to do this would be to never run anything, but that's not a real option. The alternative is to run when we have to, but make sure that we get it over with as quickly as possible so we can return to the idle state. Counterintuitively, that means switching to the highest voltage and frequency, executing the code and then dropping back into the idle state. By going faster, we save power[3].

In summary, the only sensible way to use a CPU is to run it as fast as possible in order to let it idle as much as possible, and drop the frequency and voltage when it's not doing anything. The. Only. Sensible. Way.

Some people write software that lets you choose different power profiles depending on whether you're on AC or battery. Typically, one of the choices lets you reduce the speed of your processor when you're on battery. This is bad. It is wrong. The people who implement these programs are dangerous. Do not listen to them. Do not endorse their product and/or newsletter. Do not allow your eldest child to engage in conjugal acts with them. Doing this will reduce your battery life. It will heat up your home. It will kill baby seals. The sea will rise and your car will float away. If you are already running it, make sure that it always sets your cpufreq governor to ondemand and does not limit the frequencies in use. Failure to do so will result in me setting you on fire[4].

The only legitimate reasons for limiting the speed of your CPU are to avoid overheating (which should be fixed in the kernel, really - having userspace in charge of ensuring the continued functioning of the machine is madness) or to make the machine quieter. And if you want your machine to be quieter, there should be a tickbox marked "Reduce performance in order to reduce noise" or something, which would take into account all the sources of heat in your machine rather than just your CPU. Encouraging the managing of acoustic levels by asking users to restrict the functionality of their CPU is just another way of saying "Look! We suck!". Letting the user choose a specific CPU governor or a specific frequency is not a useful thing to do. Don't do it unless you want to see dead kittens. Delivered by UPS.

[1] And, presumably, whatever else Intel and everyone else ended up licensing off them which resulted in their reinvention as an IP company rather than a CPU one, but that's just not interesting to me.

[2] Even ignoring the people that are unhappy for entirely unrelated reasons, such as injured toenails or the brutal murder of their family

[3] There's a corner case here, which is a system that is always entirely CPU bound. Say we halve the CPU's speed. Along with the voltage drop, that gets us down to about 20% of the original power consumption. Of course, it now takes twice as long to do anything and your screen, RAM, hard drive, chipset and so on are still drawing power, so will end up costing you twice as much power as they would have done if you'd run at full speed. If you do the maths, it works out that you save power if your processor's full-speed power consumption is more than 1.7 times that of the rest of the platform. In the real world, things are made more complicated by the rest of your platform consuming more power if you're working over a longer period of time - your hard drive is going to end up spending more time spun up, your memory bus is going to be active for longer and so on. You're basically not going to hit this case.

[4] While the burning of your body will result in carbon emissions, the reduction in power usage should offset this in the long run

7 May 2008

Jon Dowland: Nine Inch Nails - The Slip

I would not blame the people I speak to regularly for getting some kind of fatigue regarding Nine Inch Nails. It seems like a week hasn't gone by this year without something happening: a single, an album, or tour dates. It didn't come as much of a suprise that a new album was released in it's entirety this monday gone. ID3 tags in previously-released singles said "watch nin.com on 5th of may". It wasn't even that suprising that the whole album was free, either. What was a suprise, to me at least, was that this album is fantastic. I'd heard two tracks prior to the album being released (although one only by a few days). Whilst I enjoyed them, they were pretty safe, lyrically and musically. They didn't push any boundaries. They also did not forshadow the album at all. This album is the best Nine Inch Nails release this century. It's too early to tell whether it stands higher in my estimation than 1999's The Fragile. If so, it's the best release since 1994. I had not even considered this a possibility. I also think it's the best album to present to someone who isn't familiar with their work to see if they'd like to look for more. It has a good range of tracks covering loud, aggressive, introspective, instrumental, dancable, dark and delicate. I'm now starting a self-imposed ban on listening to the album, so as to not overdo it too much so early on. Regardless, I can still hear The four of us are dead playing over and over again in my head. This is a strong candidate for my favourite NIN song ever. It made me think of what the Cure should be writing. Each track in this release (like each of the 36 tracks in the last album) have their own unique embedded picture in them. There is scant software in Debian that can handle these, unfortunately. I think "tagtool" can add and remove art. Amarok copes admirably. Rhythmbox doesn't, unless you apply this patch, which is stagnating in gnome's BTS, unfortunately. For the lazy (with 32bit x86), here's a tarball of a recent-ish rhythmbox rebuilt with this patch. I'd supply a Debian package but I didn't feel like building the documentation at the time. I haven't found a single program for the n800 that can handle the artwork.

6 May 2008

Biella Coleman: Summer Reading: Dominican nerdiness

It is the end of the semester as well as the end of my first year of full time teaching. It has been quite a handful, mouthful, and especially mindful but I am happy to say that I like a lot more than I dislike it, which bodes well for the future. I would like to spend some time writing about teaching and what I enjoyed to teach (and what the students like) but for now I want to note what was my favorite book of the academic year, which unsurprisingly, was fiction (and thus nothing I taught). The book is The Brief Wondrous Life of Oscar Wao by MIT professor, Junot D az and I read it over my winter break. It is a heart breaking but deeply humorous story that I could barely put down and I can’t wait till his next novel and will gladly wait the 10 years it took him to write this one after his amazing book Drown. It is about the life, trials, and tribulations of an unlikely character, a Dominican SUPER NERD by the name of Oscar Wao who has more than a lot of trouble scoring with the ladies (a “lovesick ghetto nerd” in the words of the author. Or to put in Dominican speak, he is no “tigre”). In the process of his many failures and attempt at love and lust, you learn about the experiences of Dominican immigrants in the tri-state area, the brutal history of the Trujillo dictatorship in the Dominican Republic as well as a good dose of odd culture folklore (both geek and Dominican, if you can believe it!) and all of this is told in a style that manages to combine the rhythm and passion of a poetry slam with classic issues of tragedy common in Greek literature. It is books like these which make me a little down on purely academic ones which tend to lack the style, pizazz, rhythm, flow, narrative, and heart needed to make you fall in love with words on a page.

2 May 2008

Alastair McKinstry: CO2 reconsidered

Just up on arxiv.org this week appeared Warming the early Earth - CO2 considered, by von Paris et al. Just a preprint, and i'm working through its 53 pages now, put its likely to put the cat among the pidgeons:
Abstract: Despite a fainter Sun, the surface of the early Earth was mostly ice-free. Proposed solutions to this so-called "faint young Sun problem" have usually involved higher amounts of greenhouse gases than present in the modern-day atmosphere. However, geological evidence seemed to indicate that the atmospheric CO2 concentrations during the Archaean and Proterozoic were far too low to keep the surface from freezing. With a radiative-convective model including new, updated thermal absorption coefficients, we found that the amount of CO2 necessary to obtain 273 K at the surface is reduced up to an order of magnitude compared to previous studies. For the late Archaean and early Proterozoic period of the Earth, we calculate that CO2 partial pressures of only about 2.9 mb are required to keep its surface from freezing which is compatible with the amount inferred from sediment studies. This conclusion was not significantly changed when we varied model parameters such as relative humidity or surface albedo, obtaining CO2 partial pressures for the late Archaean between 1.5 and 5.5 mb. Thus, the contradiction between sediment data and model results disappears.
The suspected composition of the eary Earth (the Archean, when life is believed to have started, 3.8 to 2.5 billion years ago), has alternated between CO2 and other reducing gases, such as methane. Originally CO2 was thought to be the main greenhouse gas, making life possible. However the high CO2 levels required were a problem; high CO2 levels would have created siderite (FeCO3) in the top layers of soil as iron interacted with CO2 in the oxygen-free air. Since then methane has top billing as the greenhouse gas responsible, with significant hydrogen levels a possibility. Over time, methane has come out on top. And thats what I wrote when I did my literature review for my PhD. Now I'm tidying it up a bit, and that section may be in for a rewrite. But what does it mean for our Climate change models of today? Tags , ,

29 April 2008

John Goerzen: A Smart Gas Tax

The recent announcements by McCain and Clinton of their support for a temporary repeal of the Federal gas tax make me sick. More on why later, but first, I want to put forth my idea. I think both Republicans and Democrats would like it -- as it's based on market principles and achieves a reduction in costs to the average household, while simultaneously helping the environment and reducing our dependency on foreign oil. But of course, it's courageous, and we don't have many politicians of that type anymore.

What we need is a large, revenue-neutral, gas tax increase. Now, before people go nuts, let's explore what this means.

Revenue-neutral means that it doesn't result in a net increase of monies going to the government. The increase in the gas tax rate is offset by a decrease in the income tax, tied to the cost of direct and indirect taxable gasoline each family or business consumes. So on day 1, if you cost of filling up at the tank goes up by $10 in a week, if you are an average family, your total paychecks also go up by $10. Your cost for receiving a package might go up by $1, and your paycheck goes up by the same amount. So you're no worse off than before -- if you're average.

Let's look at the pros and cons of this sort of plan:



If we think more long-term, we see even more positive effects:



As for the cons:



Now, for the McCain/Clinton plan: it's a farce. Reducing the gas taxes means more efficient gas, which means more consumption of gas, which in turn leads to -- yes -- higher gas prices. Its real effect will be minimal, and is a terrible long-term policy. It charges tens of billions of dollars to the national credit card (which we, and our children, will have to repay) while achieving almost no benefit now. It's a gimmick through and through, and something that says loud and clear that neither candidate is on track for the "Straight Talk Express".

Update 4/29/2008: One potential solution for the problem of declining revenues over time is to periodically re-index the averages to mirror current usage. Assuming this does really lead to the expected drop in consumption, there is no sense in 2020 of paying people for how much gas they would have used in 2008.

26 April 2008

Jeff Bailey: Update; Video; Chain Letter; Hacking

Hey'all! Another update of the moment:

Physio is going amazingly well. I feel like my neck / shoulder mobility is close to what it was pre-surgery. My strength is still lagging behind, and I'm doing hefty 3 pound bicep curls! Woohoo! Not so much for my arms, but for my back, which still has to support my arms doing this. I'm also doing 45 pound dips, and some exercises with a yellow theraband. Walking is really tiring me out at all anymore, no matter what distance I walk. As I'm reducing my pain meds, I am starting to get sore, though. Hopefully in the next week that will stabilise. Next Monday I get an ultrasound of some internal organs (I can't remember which, sorry) that will see if I have a non-drug related cause for the ongoing nausea. But so far a pill every day or two seems to be keeping it at bay.

I've posted two more videos of Leif up on YouTube. I have a bunch to sift through, but hopefully there's at least one more good one in the set. I haven't uploaded the pictures yet because I hate f-spot so much. (Ask my sometime why I think it was called f-spot)

I got a fun chain letter from someone asking everyone to boycott Esso and Shell for the rest of the year to force gas prices to come back down the sub dollar-per-litre. This was my reply:


I like high gas prices, though. I want the prices to go much higher.

Every time the prices go up, there are more cyclists on the road, and
the air gets a bit clearer.

If it were $10/litre, then almost noone would drive. We'd all be on
bicycles. Then it we be so much safer to be on a bike.

I can't wait for the day.


What do y'all think?

And on the hacking front, I actually dusted off CVS and fixed some autotools bits in GNU Sysutils so that David could fix a compile bug. I don't know if this round of activity will spur us into doing more. But it's possible. So maybe in another.. Oh, I dunno. decade or so we'll have a full GNU replacement for util-linux that's portable and everything. =)

I might get off my ass and hack on my reimplementation of Galactic Bloodshed through the month of May. I miss that game in a strange pathetic way.

Heading into my last month of off-work recovery time, I'm surprised at how good I feel. I haven't replied to alot of emails I've gotten from folks, even from before the surgery. I'm starting to make headway on the emails, though. Thanks for your patience!

Hugs all!

24 April 2008

Joachim Breitner: Pausable IO actions for better GUI responsiveness

For a university seminar I m currently writing a GUI program to view fractals based on simple iterated function systems (only similaritudes allowed). It supports three different drawing algorithms and you can edit the IFS by dragging squares around on the screen. But this post is not about this program (I might present it later), but how Haskell allowed me to solve a problem very nicely:The first instances of the code had a problem that a lot of GUI programmers know: The drawing of the fractal took quite some time, and during that time the gtk main loop is blocked and the program becomes unresponsive. At first I avoided this problem by manually splitting the drawing function (e.g. by repeatedly increasing the resolution) and kept re-drawing it at higher resolutions in an idle handler, so at least I could interact whenever one resolution has finished drawing. It worked somewhat but it was not easily done for the other, not pixel based, algorithms and it was ugly.So I wanted a way to (a) pause the drawing at any convenient point, to resume it later, and (b) safely abort the drawing if what I m drawing has changed and I need to restart.A common solution to this would be to do the drawing in a separate thread, so (a) is actually not needed, but I did not know if I can safely do (b), and I have heard that threads cause problems with gtk.So I tried to dig deeper for the hidden treasures of advanced haskell programming: I need a monad transformer! I expected the infamous ContT monad transformer to help, but I couldn t figure out how, and I started to create my own monad transformer, called CoroutineT.I tried to figure out what an action of type (CoroutineT IO a) should do, and I came up with this type signature:
pausingAction :: IO (Either (CoroutineT IO a) a)
which means that after the pausingAction is done, it is Either paused (and I get back another pausingAction to run when I want it), or it is done (and I get the result). Note that I m writing IO here, but it can be any monad.The definition of the datatype and the monad instance came mostly from trying to make this type work (yay to haskell s type system, less thinking required), and looks like this:
data CoroutineT m a = CoroutineT  unCoroutineT :: (m (Either (CoroutineT m a) a))  

instance (Monad m) => Monad (CoroutineT m) where
return v = CoroutineT (return (Right v))
a >>= b = CoroutineT $ do
r <- unCoroutineT a
case r of
Left paused -> return $ Left (paused >>= b)
Right unpaused -> unCoroutineT (b unpaused)
This translates to english like this: A call to return is not paused. When an action is already paused, further actions should be run after the paused action is resumed. When an action is not paused, further actions can happen now.Like every well behaving monad transfomer, I also need a "runCoroutineT" function to start the coroutine. I probably could have used unCoroutineT directly, but for my use case (GUI drawing) I did not need a return value, so this function is more handy:
runCoroutineT :: Monad m => CoroutineT m () -> m (Maybe (CoroutineT m ()))
runCoroutineT a = either (Just) (const Nothing) liftM unCoroutineT a
Nothing surprising here, basically just turning the Either into a Maybe. So it becomes clear how to do (b): We can just throw away the resume action returned by runCoroutineT (if any). The more interesting thing is how we do (a): We need a pause action of type (Coroutine m ()). But how should it work? I did not really try to understand why it works, but by looking at the types, I came up with this:
pause :: Monad m => CoroutineT m ()
pause = CoroutineT (return (Left (CoroutineT (return (Right ())))))
Yes, it sounds like some dance step instructions (read the second line out aloud!), but it works somehow.So here is some example code: I have a pausable IO action that counts from one to ten, pausing after each number. I also have function that resumes an pausable action up to n times:
example n = keepGoingFor n $ do
        liftIO $ putStrLn "This is the coroutine"
        forM_ [1..10] $ \i -> do
            liftIO $ putStrLn $ "Counting to "++ show i ++" while you keep calling it"
            pause
  where --keepGoing :: Monad m => CoroutineT m () -> m ()
      keepGoingFor 0 _   = putStrLn "Here I just abort the run"
      keepGoingFor n cor = do
        resume <- runCoroutineT cor
        case resume of
            Just runAgain -> keepGoingFor (n-1) runAgain
            Nothing       -> putStrLn "Finally stopped"
And here is the output of two different runs:
*CouroutineT> example 5
This is the coroutine
Counting to 1 while you keep calling it
Counting to 2 while you keep calling it
Counting to 3 while you keep calling it
Counting to 4 while you keep calling it
Counting to 5 while you keep calling it
Here I just abort the run
*CouroutineT> example 14
This is the coroutine
Counting to 1 while you keep calling it
Counting to 2 while you keep calling it
Counting to 3 while you keep calling it
Counting to 4 while you keep calling it
Counting to 5 while you keep calling it
Counting to 6 while you keep calling it
Counting to 7 while you keep calling it
Counting to 8 while you keep calling it
Counting to 9 while you keep calling it
Counting to 10 while you keep calling it
Finally stopped
So it does really works fine, and it proved very useful in my GUI drawing problem. For that, I created this nice control structure which works like mapM_, but calls pause every n iterations, and therefore hides the pausing stuff almost completely:
pausingForM_ :: Monad m => Int -> [a] -> (a -> CoroutineT m ()) -> CoroutineT m ()
pausingForM_ period list action = pausing' 0 list
where pausing' _ [] = return ()
pausing' n (x:xs) = do action x
if n==period then pause >> pausing' 0 xs
else pausing' (n+1) xs
I have put the complete module (including instances omitted here) in the darcs repository that might later also contain the fractal drawing program.

23 April 2008

Neil Williams: filetype highlighting annoyances

anjuta is my favourite IDE for C work - the configurable symbol browser/highlighter, the ability to right click on a function name or typedef and go straight to that part of the relevant source file somewhere else in the project (or outside), the debug support, mostly sane syntax highlighting (i.e. when it works it is perfect, when it doesn't work it doesn't try and make things worse). geany is very competent too, although possibly better suited to small tasks. (The compile and build menu options in geany don't always use the existing Makefile.)

Recently anjuta has developed an annoying habit of complaining about filetypes it claims not to understand (e.g. configure.in ac, Makefile.am - quite important files in the general C workload), geany (my favourite text editor, especially for perl) does those well but doesn't seem to support highlighting ChangeLog or debian/changelog - a task left to gedit but I can't use gedit for source code because the highlighting and general support of normal source code is truly awful, especially for perl.

(I got comments last time I rated geany higher than gedit - it's a question of focus. gedit cannot do everything - at least not well - but it tries anyway and therefore fails badly. Geany has far, far superior source code highlighting and an incredibly useful symbol browser because it has a more "source code" focus. I'm not going to go scrabbling around in gedit to create a customised highlighting scheme and only have two or three colours for perl is completely unacceptable in gedit (and changing colour scheme as no effect), as is the lack of a symbol browser.) Besides, geany loads and runs much faster than gedit.

Compare for yourself: Geany:
geany.png>

or gedit:
gedit.png

(inlined images removed - originals behind the links are quite large)

I mean, WTF? No separate colour to distinguish interpreter keywords or function names from plain text strings in gedit?? Duh? Badly broken regexp highlighting that highlights only the $ at the end? The entire file is like that - there are three colours in all. 99.9% is puce, variable names are olive and characters like line endings or tab markers are blue. Yes, I can change those colours but what's the point of changing everything that is now in puce into blue when what I need is some parts to be blue, some parts to be light blue, some parts to be red and some parts to be yellow. The gedit perl highlighting has to be the worst I've seen in any editor. It's almost easier in monochrome. Perl is by far the worst but gedit C highlighting isn't much better.

Compare with geany where keywords are always identifiable, regexps are marked up clearly, no silly marking of line ending characters inside a string, sane marking up of pod content and HERE documents and variable highlighting - and it never gets confused.

Needless to say, vi (or more precisely vim) does all the highlighting with aplomb, even though asking for a symbol browser in vim is a bit excessive, even for me.

vi.png

Why can't I have a single GUI that does highlighting as well as vim ? Geany is the closest of the three - lacking only ChangeLog and debian/changelog (and debian/control) highlighting, anjuta is almost there (once that annoying bug is fixed - already filed by someone else) but gedit? What? Has groundhog day been changed to 1st April somewhere? They're having a laugh, must be.

22 April 2008

Matthew Garrett

...

Leaving aside the obvious failure (asking women to classify themselves into those who are happy to have their breasts groped and those who aren't - and yes, that is the effective choice, since refusing to participate will result in people making conclusions about which of those categories you fit into), there's the whole "open-source breast" thing.

Creating copyrightable works is a choice. Having breasts is not[1]. Attempting to equate the two is not reasonable. Applying "open-source" to things that are not directly comparable to copyrightable works is like applying "Darwinism" to things that are not directly comparable to natural selection operating upon living things. Discussing Darwinistic politics is likely to result in people concluding that you're either a libertarian fuckloon or blame atheists for the death of your cat. Discussing open-source breasts is likely to result in me stabbing you in the fucking eye. Don't make the baby Jesus cry when he sees your horribly mutilated face. Just accept that open source is a useful licensing model, not an entire way of life.

Or: get your hands off my adjective or you'll find my hands on things you really don't want groping, whether you're wearing a badge or not.

(And yes, I realise that this is not the offensive aspect of things. This says it better than I could)

(Previously)

(Previously previously)

[1] There's a set of basically uninteresting exceptions. And by "uninteresting" I mean "If you are trying to argue over this, then you are missing the fucking point"

Christine Spang: Summer Plans

Last week, eight pounds of Perl books arrived at my doorstep, courtesy of deciding to work for Best Practical this upcoming summer. They’re cool people, very free software friendly, and conveniently located in Davis Square. They are also the makers of RT among other things, which Debian uses for a variety of purposes. It should be a good time. (No, I probably won’t actually be hacking on RT, but exactly what I’ll be working on is as yet undetermined.) Speaking of the summer, I have a vague plan to make a West-coast visit for a week or so at some point. I’ll be hitting at least Seattle and San Francisco; if you’re around either of these areas or possibly even somewhere in between and would like to hang out, drop me a line in comments or via email.

Martin F. Krafft: netconf and the GSoC

I am very excited to announce that Jonathan Roes has successfully applied to the Google Summer of Code 2008 and will be working on netconf over this summer. With his help, I am confident that netconf 1.0 in Debian lenny is no longer a dream. Jonathan is a soon-to-be computer science graduate from the University of North Carolina at Charlotte, and his application was (by far) the most convincing of the ten I received. He has several years of programming and Linux experience and it s quite obvious that he has understood the philosophy of netconf. I am looking forward to working with Jonathan! NP: Underworld: Second Toughest of the Infants

18 April 2008

Gintautas Miliauskas: Calibrating the keyboard autorepeat setting

The default keyboard autorepeat setting on most systems is boringly slow. Even worse, the delay before autorepeat kicks in is so long. This is great for novice users, but we programmers deserve better. Here's a calibration procedure that I use: For me an autorepeat delay of ~250ms and 80 char/s rate works well. To get your numbers, you can use the command xset q grep 'repeat rate' . This tweak make the standard direction keys (and particularly the backspace & delete keys) much more useful: you can frequently get away without using special editor commands or, say, having to select things to delete them and thus resetting the X buffer. It makes things a little faster and more responsive. Try reverting to the standard setting after a few weeks of fast repeat to feel the difference.

14 April 2008

Evan Prodromou: 25 Germinal CCXVI

I got my FON router delivered to my house about 2-3 months ago, but I didn't realize what it was until I was cleaning up my office to leave for Buenos Aires. Glad to have a project, I set it up on my home network while I was waiting for the taxi to the airport. I've only really started playing with it since we got back. FON is an international effort, originally based in Spain, to share extra network capacity with roaming wireless users. You set up a router in your home (or wherever), and any other FON user can connect to the Internet through your network. Conversely, you can connect on any other FON network. There is a lot of grass-rootsiness to FON, but it's a commercial project, which turns some people off. I originally heard of FON at Wikimania 2007, where FON provided wireless routers for each attendee's room. It was a nice service, although the doubled-up ESSIDs were kind of confusing at the time. They make a lot more sense for home use. I was impressed by how many FON spots there are on the Montreal/Plateau (see http://maps.fon.com/ for details); about one ever 2-6 blocks in any direction. I think there's an opportunity here to see a higher concentration, though. I'd love to see co peration between FON and, say, le Sans Fil, possibly involving the Ville de Montr al. Apparently there are already FON cities in different parts of Europe, so it's not impossible. I think FON is an interested development for WiFi -- a hybrid between community-based initiatives and a commercial venture. I'm not sure if it will be successful, but I think it's a step in the right direction. tags:

13 April 2008

Rob Taylor: PackageKit Stop Energy

This should be a reply on Hughsies blog, but I don’t want to create a livejournal account. Richard, please move to blogs.gnome.org! In response to Jason’s comments: Hey. I’m a Debian/Ubuntu kinda guy and I think PackageKit is a hell of a lot better than Ubuntu making ubuntu-only solutions like gnome-app-install. It’s DEFINITELY not a NIH, there was nothing that gave us this kind of capability at all before PackageKit started. Everyone knew what was needed to be written and Richard was the guy that jumped in and got it started. Also Richard wasn’t working at Red Hat when he started PackageKit and has worked with every distro he can on this. Jason, stop the Stop Energy. Update:
I though I might jump in and say a bit more on this problem: It really comes down to the question of whether a backend should ask questions of the user. Richard thinks that they shouldn’t, mainly because every time he’s seen backends ask questions they aren’t ones he knows the answer to and so, by inference, most people don’t know the answer to. These questions shouldn’t be asked in a user-friendly system.
However ‘These questions’ are actually multiple classes of problems and simplistically dismissing these is really just asking for failure in solving the problems correctly. Before I go any further, let me note that debconf has multiple levels of verbosity that it can ask questions at. Most Debian based distros just ask the highest priority questions. It should be noted that a PackageKit backend should allow a central administrator to set default values for any of these setting however. Lets break down some of the kind of questions asked though debconf: Some packages also use stdin/out to really make sure you know what the hell you’re doing, like kernel packages, but i think that’s somewhat outside of this scope of this problem. Those kind of things should just fail unless you’re doing leet-super-admin work ;) So the question really comes down to asking the user sensible questions that they a) know how to answer and b) care about. The point I made to Richard on IRC is that this is actually a difficult and multi-faceted problem and just hiding these problems won’t help in solving them well, so my take is that PackageKit should allow asking of questions, probably via a dbus interface, have a debconf frontend that channels questions by this channel, and then let the Ubuntu and Debian guys get on the case of forming projects and policy to help fix the problem at source. Update 2:Richard pointed me to this FAQ entry which explains why even handling debconf questions is hard.

Joey Hess: secret code

I'm still following The Lost Ring, but it got a little too intense today when someone who was not very familiar with what was going on was recruited to pick up an envolope hidden in an umbrella stand at a gallery in Hong Kong became disturbed by the contents and destroyed it. All we're left with is some fuzzy pictures. blur This fragment contains a code. If we can figure out enough of the code, it can be used to download a digital copy of the paper that got torn up. It's a kind of checksum, was written with a typewriter (that writes capital letters a bit higher than the rest of the line, and tends to fade bottoms of numbers), and will look something like "SS71/124P/84JH/HFGS/CEAS". After playing with the gimp, I'm fairly sure that the code starts out "C??L/T4GA/L". enhanced In the movies, this is easy, you just zoom in on the blurry picture until you can see fingerprints. In the "real" world, it's gonna be tricky.

Rob Taylor: PackageKit Stop Energy

This should be a reply on Hughsies blog, but I don’t want to create a livejournal account. Richard, please move to blogs.gnome.org! In response to Jason’s comments: Hey. I’m a Debian/Ubuntu kinda guy and I think PackageKit is a hell of a lot better than Ubuntu making ubuntu-only solutions like gnome-app-install. It’s DEFINITELY not a NIH, there was nothing that gave us this kind of capability at all before PackageKit started. Everyone knew what was needed to be written and Richard was the guy that jumped in and got it started. Also Richard wasn’t working at Red Hat when he started PackageKit and has worked with every distro he can on this. Jason, stop the Stop Energy. Update:
I though I might jump in and say a bit more on this problem: It really comes down to the question of whether a backend should ask questions of the user. Richard thinks that they shouldn’t, mainly because every time he’s seen backends ask questions they aren’t ones he knows the answer to and so, by inference, most people don’t know the answer to. These questions shouldn’t be asked in a user-friendly system.
However ‘These questions’ are actually multiple classes of problems and simplistically dismissing these is really just asking for failure in solving the problems correctly. Before I go any further, let me note that debconf has multiple levels of verbosity that it can ask questions at. Most Debian based distros just ask the highest priority questions. It should be noted that a PackageKit backend should allow a central administrator to set default values for any of these setting however. Lets break down some of the kind of questions asked though debconf: Some packages also use stdin/out to really make sure you know what the hell you’re doing, like kernel packages, but i think that’s somewhat outside of this scope of this problem. Those kind of things should just fail unless you’re doing leet-super-admin work ;) So the question really comes down to asking the user sensible questions that they a) know how to answer and b) care about. The point I made to Richard on IRC is that this is actually a difficult and multi-faceted problem and just hiding these problems won’t help in solving them well, so my take is that PackageKit should allow asking of questions, probably via a dbus interface, have a debconf frontend that channels questions by this channel, and then let the Ubuntu and Debian guys get on the case of forming projects and policy to help fix the problem at source. Update 2:Richard pointed me to this FAQ entry which explains why even handling debconf questions is hard.

Next.

Previous.