Archive for 2008

Freakonomics

December 27th, 2008

Steven Levitt, the economist, and Stephen J. Dubner, journalist, collaborate on this title that has become something of a household name. Freakonomics is the study of common phenomena through the lens of incentives and economic reality. Levitt takes on teachers inflating test scores when standardized tests are a determining factor in their careers. It's hardly surprising, but nevertheless few people seem to give it a second thought. Likewise, in every area of life there are interests and motives, and the powers that be wish to wield a certain amount of control over the situation. But the incentives they set are often not effective.

A compelling example is the study of crack dealers, based on field data supplied by Sudhir Venkatesh. There is a certain public perception that drug dealers wield a lot of power and consequently enjoy much wealth. In reality, it turns out, much like any corporation, the foot soldiers live on minimum wage level incomes, while only the fat cats cash in. But then why would people subject themselves to such high risk for little reward? The answer seems to be that this is the only career that seems plausible to their lives.

While Levitt's case studies are generally informative, Dubner's presentation is often dull and publication-like.

linux audio confusing as ever

December 19th, 2008

Audio in linux, how to put it into words? How about: oss, alsa, pulseaudio, esound, arts, portaudio, jack, gstreamer, phonon. :googly: Did I miss any? Embarrassment of riches? Or just embarrassment?

I will not rehash history any more than to say that between buggy/incomplete drivers for sound cards and the wonderful world of alsa I've never been able to understand how the hell audio works beyond getting output and, sporadically, input. I am the quintessential dumb user of linux audio, even though I have tried to figure it out.

But let past be past. Ubuntu 8.10 Intrepid. Pulseaudio ready and everything, since 8.04. Why Ubuntu decided to plug in pulseaudio without setting up any gui controls for it is beyond me. All I know is that occasionally sound output will stop working (I get 2 seconds of output and then it stops) and then "pkill pulse" cures it.

Let's run through the list.

alsamixer

I've learned to use alsamixer to fix low level audio problems. It is reliable in that it gives me all the channels on my sound card, so I always use it to mute/unmute my microphone and to untangle the master/pcm/headphones/front speakers settings caused by mixers that only allow me to control the volume of one channel and apps that output on god knows what channel.

That's alsamixer on a Ubuntu 8.10 desktop with all updates installed as per today. Here's the same thing on my laptop.

Same distro, same version, all updates installed. And I have made no conscious choice for this to come about, all I did was install the pulsaudio gui tools. All of a sudden, alsamixer is useless as it only has access to a single "master" channel. It would appear now that pulseaudio is sitting between the sound card and alsa, but does that sound right?

pulseaudio gui

pulseaudio is here, might as well use it, right? Ubuntu ships a bunch of pa* packages that are gui tools for pulseaudio (not installed by default). This one is called pavucontrol. It lets you set volume per audio stream. I love this, I've wanted to have it since forever.

But then it comes to output and what do I see?

A single output device. Where is my master, my pcm, all my channels? What's more bizzarre is that pulseaudio says it's connecting to alsa while alsamixer says it's connecting to pulsaudio. Surely that way madness lies?

What's worse, pavucontrol is a gui app without any kind of systray integration, so much as I would like to use it as an easy-to-reach mixer, I can't.

kmix

I run kmix in my tray, it lets me set the volume by scrolling the mousewheel over the icon, which is exactly what I want. It's not a terribly impressive mixer, as it only lets me select one channel to control, whereas what I really would like is to be able to lock several output channels into one, otherwise I'm never really in control. So the best I can do is set the volume to max on master, and tell kmix to show me pcm. That seems to work well enough.

It appears I have two identical channels, but the leftmost is misnamed, that's actually Master.

Now, let's see. alsamixer doesn't show any of these channels, because it delegates to pulseaudio. So kmix connects to... god knows what, but at least I can access these channels.

gnome-volume-control

Gnome's volume manager is an interesting one. It has a combo box for devices. I'm showing here all the devices related to output and how channels are connected.

The good news is that the channels in the default mixer correspond to those in kmix (sweet sanity!). But then there is that bottom mixer with a channel of the same name as the single output channel in pavucontrol. And yes, they are the same (and the same as the single output in alsamixer).

But this channel appears to be some kind of composite output channel that has no bearing on any of the output channels in the top mixer (or in kmix). (Ie. while it might appear to be a composite pipe that aggregates the flow of all these standard channels, it's actually a pipe that sits after all of them. If pcm volume is 0, this channel won't receive any input, and will be mute no matter its volume setting.)

So neither can I effect the settings of master/pcm/etc with this channel nor vice versa. That means if I want to use this single channel as my master volume control, I have to make sure that absolutely no application can mess with the volume for any of the standard master/pcm/etc channels. Good luck with that.

A sane spec

I know this sounds crazy, but what's it gonna take to get a single server+mixer applet that

  • captures every possible audio stream, no matter the audio server/api it's on,
  • prevents applications from messing with master volume controls (eg. mplayer),
  • has a single virtual channel controlling all the underlying output channels, so that I can have a single master volume slider,
  • has per stream/app volume controls pulseaudio style,
  • integrates well into the systray,
  • integrates with laptop hotkeys

?

UPDATE: Ubuntu users can now vote on a proposal to unify sound systems on ubuntu brainstorm. Hopefully this idea and the related ones can gain some traction with Canonical to attack the problem.

A season with Verona

December 12th, 2008

Tim Parks's chronicles in the footsteps of Hellas Verona with the Brigate Gialloblu are well known to Serie A fans. I'm not one for books about football - I've never been so deeply interested as to study the history and try to find out absolutely everything, to me it's about what's happening in the present. But I thought I would give this one a try, after seeing it recommended by everyone who'd read it. I thought it would be an anthropological book, but it turns out Parks is Veronese: an immigrant who's found himself at home after 20 years in Verona.

His story is appealing on many levels. What strikes me first is the cozy nostalgia of Serie A in 2001. That Verona team had a lot of players who went on to bigger things. The Verona of Frey, Adailton and Mutu. With players who would make a career at Parma: Gilardino, Bonazzoli, Morfeo, not to mention Prandelli. With Laursen, who would sign for Milan. With Camoranesi, the oriundo, who would lend creativity and dribbling to Lippi's all winning Italy; and keystone of present day Juventus, of course. With Oddo, the most abused of all players, who allegedly had secured a transfer to Lazio in mid season and didn't seem to try very hard. With the Parma veteran Apolloni, his last season before hanging it up. With a young and hopeless Cassetti, present day Roma.

The Bari of Yksel Osmanovski and Daniel Andersson, and the very young Antonio Cassano. Luca Toni playing for Vicenza, long before his rise to fame. It was the start of Parma's sad demise, they had sold Crespo and Veron, brought in Ariel Ortega. They were still impressive, however, with Buffon, Thuram, Cannavaro, and a goal hungry Di Vaio. There were the lacklustre Inter and Milan, the latter would appear in the Uefa Cup the following season. Lazio, champions, had the most expensive squad in the world, way before their financial collapse. Eriksson had done it with Nesta, Nedved, Veron, Almeyda and Sergio Conceicao. Up front they had, no less, Boksic, Salas, Roberto Mancini, Kennet Andersson, Simone Inzaghi and Fabrizio Ravanelli. Roma had brought in Emerson, Batistuta and Nakata, and clinched the title.

And finally it was the Juve of Ancelotti, the man who came so close, but couldn't seem to win anything. Davids ruled the midfield with an iron fist that of Montero in defense. Conte would supply crucial goals when the chips were down, but the sole responsibility for offence was on Zidane's shoulders. It was Trezeguet's first season, after that golden goal at Euro2000. He made short process of Pippo Inzaghi, who was promptly sold. And it was still a time of struggle for Del Piero, who would strike up a golden partnership with Trezeguet the following season, in an improbably league triumph.

And so this is the world in which the story is told. Hellas was fighting for survival just as Chievo was on the brink of promotion to Serie A. They did stay up, but only for a year. Today we find Chievo in Verona's place, and Hellas at the bottom of Serie C1. How time flies. Parks sets out to write a book about Hellas, and the Brigate Gialloblu. Out of all the supporter groups in Italy, they are infamous for being the most racist of them all. By reputation, at least. As it turns out, they are not so much racist, complete with their monkey chants, as just plain antagonistic. But this is Italy, where everything is politicized. And Verona is cast as the racist town.

What matters, above all, in Italy is pretense, theater. It is not so much that rules are bent, they just don't exist as rules, merely as guidelines. And there are always grounds for appeal. In one incident, the police state in no uncertain terms that noone will be let into the stadium without a ticket. But then they are allowed in anyway. One must always be seen to play one's part, that is the crucial thing. On a different occasion, there is heavy rainfall during a match, and by half time the pitch is flooded. The rules state that the ball must be thrown up in the air and made to bounce on the surface, or else the game must be abandoned. But neither the referee nor the teams wish that to happen, so the man in black boldly goes around the pitch trying to get the ball to bounce until he finds a spot where it does. He repeats the test a few more times and now, clearly, a pretense to the rule has been made, the match continues. (Incidentally, that explain's Collina's Perugia in 2000.)

Parks gives us a broad description of Hellas. Both the supporter culture he participates in, and the inner workings of the club. He relays conversations with fans, players, coaches and administrators. What's really interesting is that it would seem everyone in that world, down to the president of the club, is victim of circumstance. The fans are the mercy of the management and the players. The players are at the mercy of the resources the administration has available, the coach, the fans, and public opinion. The coach is at once the most empowered person of all, deciding who will play and where, but then every single decision he makes will be scrutinized. And the president, supposedly all powerful, can do no more than to balance the budget by selling the most valuable players, while facing pressure from fans to spend more and spend wiser.

All in all, a book for a Serie A fan. Humorous in part, revealing to a point, but also padded with a lot of relatively boring storytelling.

The Afghan

December 8th, 2008

Frederick Forsyth is, above all, a great storyteller. In The Afghan, the bulk of the story is told in real time, which is exhilerating. We jump frequently from scene to scene, where characters are acting on information just as other things are happening elsewhere. And there are a lot of characters, but their profiles are well established enough so that the reader knows who he's following around at any given time, and usually, what his motive is.

When I saw the title I was struck by how contemporary it looked. And it is indeed contemporary. Unlike historical novels that are set in the past, background has to be established, and the reader only knows the world in the novel from what he is told. The Afghan is quite different. Forsyth takes a stab at fitting a story in the world of today, the world we know from tv and the news, and with historical persons in central roles. He takes on the Middle East conflict, treating us to a guided tour of Afghanistan and Pakistan, and also to a less severe look at the United Arab Emirates, Kuwait, Iraq, and Saudi Arabia. Peshawar, Quetta, Kandahar and Jalalabad are some of the venues.

We follow in the footsteps of a young Afghan, Izmat Khan, a boy from a village in the mountains. As a boy he bears witness to the Soviet invasion, deemed too young to participate. His family is evacuated to a refugee camp in Pakistan, where he enters a madrasah, the one flavor of education offered to the refugees, funded by the Saudis who are intent on spreading wahhabism. By the time he grows up, the Soviets are still in Afghanistan, and he joins in with the Mujahideen. Soon, 1989 rolls around and the struggle is over, but the country is by no means at peace. Warlords fight among themselves for dominance, to which the Taliban rises up in opposition, eventually taking control of most of the country.

With the Soviet Union in ruins, the West eventually wakes up to the threat of religious radicalism. Meanwhile, Osama Bin Laden continues to enjoy the hospitality at the hands of Mohammed Omar, the leader of the Taliban. Under Bill Clinton there are air raids on his training camps. A cruise missile launched from a US ship in the Gulf misses its target and strikes the mountain above Khan's valley. He happens to be visiting a neighboring village that day, but he returns to witness his entire village buried under rock. His whole family wiped out. That is the day he pledges to join in the jihad against America. First in the Taliban, he fights the Northern Alliance, US sponsored. Then, he is to become a part of the single biggest terrorist attack to date.

This is all background for the events to take place, established so that the story told in the current can be told effectively. The key is a plot that has been uncovered from an Al Qaeda high official who escapes capture, but his laptop is taken. The plot has a name, but nothing points to what it consists of. Noone knows what it means, because noone knows about it, save a small circle at the very top of the organization. Their communications are under constant scrutiny, but the intelligence services of the West are powerless to tap into them. Messages are often delivered by messenger, recited from memory. And unlike the impatient West, Al Qaeda is in no hurry, things take time and that is way. Their operatives have spotless records, highly educated in the West and above suspicion.

The novel is an intriguing mix of contemporary reality and literary license for plausible additions.

Ludlum's Jason Bourne

December 6th, 2008

Ludlum's Bourne trilogy was well received when it was published (the first book in 1980). Ludlum was not one for sequels, so the epic of Jason Bourne is an exception to the rule, and it wasn't until six years later that "Supremacy" hit the shelves.

The Bourne story has seen a big revival since. The first movie starring Matt Damon came out in 2002, and Ludlum was willing to work on the movie and turn his creation into a motion picture. Unfortunately, he died in 2001, before the movie was premiered, and probably never got to see the end product. But for what it's worth, I think the movie and the ones to follow were done very well. There is too much complexity and substance in the story to put on screen, so they decided not to try to follow the story in the book, just make a good movie instead. Which I think they did.

Consequently, Damon's Bourne is very alike Ludlum's Bourne, but not quite the same. And the movie epic has the same starting point, but swiftly departs from the story in the book, while grabbing many key details that make a Bourne story what it is. If you're a Bourne fan, then, you'll find three parts of a story that are completely new and captivating.

Interestingly, the Bourne story is not like a tv series, where you find the same characters a week apart in their lives, with the same concerns and outlook on life. Ludlum puts 5-10 years in between each story, and Bourne's life (and he himself) will have changed a lot from one to the next.

Identity

It all begins with a small fishing village somewhere near Marseille. The drunk of a doctor receives the man who's been found floating in the water, multiple gunshot wounds in his body, a severe one in the head. At once a gentle introduction to the man without a name (who shall be known as Jason Bourne) and a crucial peg in the story - the six months he spends recuperating, off radar; noone knows what happened to him.

The story is played out first in Zurich, then Paris. A thrilling account where little by little, bits and pieces of Jason's life are recovered, and yet the struggle to find himself never stops. In Zurich he takes a hostage in a moment's reflex to blend into the crowd. Her name is Marie, she's an economist from Canada. Everything in Jason's life is unexpected and uncontrolled circumstance. Including Marie, who is to become first his ally and at last his wife.

His identity comes into view slowly, through a haze of disinformation he must fight off. Nothing seems to make sense. Until he learns at the very end that noone knows who he really is precisely because that is how his identity was crafted. As a cover. A fake assassin dispatched to lure the real assassin. Carlos. So well concealed that no intelligence unit can get to him, even locate him.

Carlos becomes his mission, because that is all he knows, all he can remember. But not his real objective, which is to find himself, find the people who cast him in this role. The people who haven't heard from him in six months and think he's turned on them.

The story is so thrilling precisely because he has this terrible disadvantage. Everyone is after him, but he doesn't know their various motives and interests. And yet he has the intuitive skills to hide from them. But there is a symmetry in the situation. Since he doesn't know what he's doing, neither can they predict his actions. He is as incomprehensible to them as they are to him. Except Carlos. Carlos knows him. Not personally, but he understands the thought process, the method of an assassin. And in the end, Bourne lures Carlos to him, but fails to defeat him, nearly losing his life.

Supremacy

Many years have passed since Paris. David and Marie Webb reside in a small town, courtesy of a government protection program. David's memory has not been fully restored, but his mind is whole again, he can live a normal life. Flashes of his life under the name of Jason Bourne still haunt him. And flashes of his even more distant past as the clandestine operative Delta in the Vietnam war do too. But they do not dominate him anymore. Under the supervision of psychiatrist Morris Panov he has recuperated mentally, and his horrible recollections are now a matter of exception.

The happy existence is brutally disturbed. In Hong Kong there is an assassin on the loose, a pretender calling himself Jason Bourne. A kidnapping is staged. Marie disappears. David is forced to chase after her to Hong Kong. He enlists the help of Alex Conklin, an ally from the distant past, and an influential officer in the CIA. But not even Conklin is sufficiently well placed to uncover the plot. A plot hatched by the government to take down this fake Bourne and pump him for information.

David is forced to set aside his quiet life and become Jason again. The chase in Hong Kong, Macau and China is thrilling. At the center of it is one of the most powerful men in China's economy, and government. A Taiwanese who wants to see China's downfall, and the man he has enlisted to propel Hong Kong into chaos, thereby giving China the necessary pretext to make a play for annexation, is the new Jason Bourne. A play that will inevitably put China at conflict with the Western world. In the chaos he perceives a coup, a victory for Taiwan.

The title "supremacy" is descriptive. Bourne is at his best, his body and mind at full throttle. He not only speaks both Mandarin and Cantonese well enough, he navigates the underworld of South East Asia with fluency. And yet he is so utterly alone, not even Marie to guide him with her analytical mind.

Ultimatum

David has aged, he's 50. With a wife and two children now. It is odd that Ludlum has let Carlos rest for a decade since the events in Paris. Now, suddenly he's back, and gunning for Bourne. David's loss of physical athleticism is balanced out a bit, at least he has support from the agency this time. But Carlos out-thinks and out-schemes them all, Bourne is constantly on the defensive.

What was once a political objective to bring down Carlos is now a desperate struggle to protect his family. Bourne isn't as sharp anymore, or as quick. Ludlum has brought him back more desperate, more careless. More people get caught in his crossfire. In the distance there is a group of powerful men conspiring to take control of big business and government. They are the survivors of the once notorious Medusa in Vietnam, the Medusa the man known as Delta was part of. Decades later, they are highly placed officials and businessmen; their operation becomes an imperative for the agency. But their link to Carlos, as Bourne perceived it, is vague.

For Bourne there is only Carlos. They squre off in Montserrat, then in Paris, finally Bourne lures Carlos out of his safe Paris haven and into the Soviet Union. The Soviets want Carlos as badly as everyone else, they still suffer the stain of having trained him as an operative before it became clear to them that he's a psychopath. In Moscow, Bourne enjoys some unprecedented and strictly off the record co-operation with the KGB, courtesy of Conklin's contacts.

Marie is desperate. Not about the threat of Carlos, but about David's mind. He must not let the past take hold of him. And yet she can see how much more it drains him now, the stress and the pursuit. The terror of a strike on his family. But the ultimatum has been thrown down, he doesn't have a choice. Go after Carlos or Carlos will destroy what's most dear to him.