Highlights

Subscribe

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 4.25
 

September 29, 2011

parallel ssh

[warning: technical wonkery]

pssh is a godsend when you're working with a number of servers. Pssh lets you run the same command on many different computers via ssh, collating the results for you.

The man page says pssh is "most useful for operating on clusters of homogenously-configured hosts.".

But to my mind, where it really shines is doing diagnostics over a number of machines.

I was recently called in to fix up a problem like this. A website had gone down, the sysadmin was missing, and nobody really new which of seventy-odd machines was responsible. So I was flailing around in the dark. All I had was the shared root password, and a client very keen for things to start working Real Soon Now.

My first tool out of the box was nmap. This lets me figure out which servers we have around::

  root@dv06x:/home/dan# nmap -sP 10.10.22.0/24

    Starting Nmap 4.20 ( http://insecure.org ) at 2011-05-29 15:03 PDT
    Host 10.10.22.1 appears to be up.
    MAC Address: 00:04:23:E1:F8:DF (Intel)
    Host 10.10.22.5 appears to be up.
    MAC Address: 00:04:23:E1:F8:DF (Intel)

Here I'm telling nmap to ping every machine with an IP address (internal to the data centre) of 10.10.22.XXX -- that is, which shares the first 24 bits of its IP address with 10.10.22. [why 10.10.22? because ifconfig showed me the IP for the firewall server I was first logged in to, and it began with 10.10.22.

Now, let's pull a list of IPs out of there. I couldn't find an option in nmap to just print the IP address, so let's do it with perl:

    root@dv06x:/home/dan# nmap -sP 10.10.22.0/24 | grep "appears to be up" | perl -pi -e 's/.*?((\d+\.){3}\d+).*/\1/' > servers.txt 2>/dev/null
    root@dv06x:/home/dan# cat servers.txt
    10.10.22.1
    10.10.22.5
    10.10.22.6
    ...

Now we have these servers, we can try ssh'ing into them. First, we need password-less ssh access. Here's an explanation. First we generate a keypair:

ssh-keygen -t rsa

This generates keys in ~/.ssh/idrsa (private) and ~/.ssh/idrsa.pub (public). Now we must copy the public key to every other server, appending it to the file ~/.ssh/authorized_keys.

scp doesn't support appending. One way would be to first scp to a temp file, then log in and append that file to ~/.ssh/authorized_keys.

But that's a lot of excess typing, if you're doing it seventy times. Instead we can use pipes with cat:

    cat ~/.ssh/id_rsa.pub | ssh root@10.10.22.6 "cat >> ~/.ssh/authorized_keys"

Now we need to do this for every machine. Let's do it the semi-manual way: pssh won't save much time, since we need to enter passwords and accept fingerprints anyway:

 
    root@dv06x:/home/dan# for server in `cat servers.txtc`
    > do
    cat ~/.ssh/id_rsa.pub | ssh root@$server "cat >> ~/.ssh/authorized_keys"
    > done

Now we should be able to connect to any of them without a password:

 
    root@dv06x:~# ssh root@10.10.22.23 
    Last login: Mon May 16 04:16:41 2011 from 10.10.22.5
    Linux xn03 2.6.18-xen #1 SMP Fri May 18 16:01:42 BST 2007 x86_64

Now is when pssh comes into its own. The man page explains basic usage:

 
       parallel-ssh [OPTIONS] -h hosts.txt prog [arg0...]

That is, you give it a list of hosts in a file, and a command to execute on hte command-line. It'll ssh into each host in parallel, and run the command everywhere. I'll also use the

-P
option, so that we can see the output directly on the terminal.

Let's start with the

uptime
command. This prints out how long the server has been up -- as well as, more interestingly, the current load:

 
    root@dv06x:/home/dan# pssh -P -h servers_all_ip uptime
    ...
    10.10.104.156:  16:03:42 up 53 days, 22:46,  0 users,  load average: 0.00, 0.02, 0.26
    [69] 16:21:56 [SUCCESS] 10.10.104.156
    10.10.22.101:  16:03:18 up 2 days,  3:47,  1 user,  load average: 69.52, 70.14, 70.21
    [70] 16:21:56 [SUCCESS] 10.10.22.101
    10.10.104.146:  16:03:12 up 33 days, 15:25,  0 users,  load average: 1.24, 1.22, 1.19
    [71] 16:21:56 [SUCCESS] 10.10.104.146
    10.10.104.156:  16:03:42 up 53 days, 22:46,  0 users,  load average: 0.00, 0.02, 0.26
    [69] 16:21:56 [SUCCESS] 10.10.104.156
    10.10.22.101:  16:03:18 up 2 days,  3:47,  1 user,  load average: 69.52, 70.14, 70.21
    [70] 16:21:56 [SUCCESS] 10.10.22.101
    10.10.104.146:  16:03:12 up 33 days, 15:25,  0 users,  load average: 1.24, 1.22, 1.19
    [71] 16:21:56 [SUCCESS] 10.10.104.146

It's slightly irritating not to have the output matched up with the results, but it's already tellig us something useufl. 10.10.22.101 has an immense load, and has been recently rebooted. That's probably somewhere to concentrate our attention

We can also gather some information about what operating systems we're dealing with.

lsb_release -a
will get us that:

 
    root@dv06x:/home/dan# pssh -P -h servers.txt "lsb_release -a"
    ...
    10.10.22.12: Distributor ID:    Ubuntu
    Description:    Ubuntu 7.10
    Release:        7.10
    Codename:       gutsy

Much more can be done along these lines, but I'll leave it there for now

 

July 28, 2011

If at first you don't succeed: make a wordle and call it a day.

Every data project goes through an embryonic Wordle stage. There's a point where you've spent a few hours futzing with code, are many more hours away from whatever you were trying to build, and feel aw, screw it, let's make some pictures.

In that spirit: headlines from the Guardian and the Mail, these past couple of days:

Guardian
Guardian headlines
Mail
Mail headlines

The somewhat less pointless use of the data will come When I Get Round To It™ -- which, given current circumstances, might not be for quite some time.

 

July 11, 2011

Just how insignificant are BP and ExxonMobil?

Multinational oil companies really have been eclipsed by their state-owned counterparts:


That's ExxonMobil coming in at number 17, as the first private company. It's 30 times smaller than Saudi Aramco by reserves, 20 times by production.

 

July 9, 2011

Dum-dum bullets and shoot to kill

The Metropolitan Police are armed with bullets that the army wouldn't be allowed to use.

Hollow-tipped bullets are designed to expand inside the body on impact, making them much more likely to kill whoever they hit. The generals of the 19th century decided that they were too lethal for war, despite British arguments that they were needed to stop 'fanatical barbarian[s]'.

So they were banned under the 1899 Hague Convention**, along with chemical weapons and bombs thrown from airships. NATO still keeps to that, though perhaps few other armies do.

The police, through, are unaffected. So the Met used these these bullets to kill Jean Charles de Menezes, and this year they started using them more generally.

Now, there's a decent argument that this isn't as bad as it sounds. If a bullet is busy mashing your victim's organs, it's less likely to pass through and hit whoever is behind them. I thoroughly approve of not killing bystanders, but a little confused how that works alongside the policy of giving machine guns to the transport police

Or, more fundamentally: the UK police already kill about 90 people per year -- let's not make it any easier?

[disclaimer: I know nothing about guns, would be happy to never see one again in my life, and wish the police agreed]

 

June 19, 2011

frobbing markets

Market volality provides information about a market. In just the same way as you learn what a gizmo does by applying different input to it, so you piece together the shape of a market by watching what happens under different circumstances. A market could seem utterly stable, until a little volatility reveals that it had always been at the edge of a precipice.

Tyler Cowen sees this in the fate of USian symphony orchestras after the financial crisis. The financial crisis pulled out much of their institutional support, thus showing how shallow was their backing. This caused secondary effects:

The initial negative shock of the crisis, among its other effects, caused donors and potential donors to see that support for these projects was weaker than they thought. Many of these donors are now less than keen to keep pouring money into losing endeavors. An unraveling process has set in. It's not just the negative wealth effect, but new information has been revealed about popularity and sustainability of the underlying venture. Neither monetary nor fiscal stimulus will prove any kind of easy cure for these institutions or, potentially, for these jobs.

There is a well-known literature in finance about how trading, combined with the possibility of sudden price dips, causes market participants to learn the shape of the market demand curve and thus revalue the appropriate overall level of prices. The mere act of trading can generate market volatility. This kind of insight is not yet sufficiently appreciated in macroeconomics. The financial crisis caused us to see that many market institutions were on shakier ground than we had thought.

This is analogous to the 'tipping-point' understanding of political protest. Marches aren't themselves important. But they show the strength of support, and so can win you the support of actors hedging their bets. So the time to march (leaving aside movement-building reasons) is when you believe that your support is greater than generally understood

 

June 18, 2011

UK parliamentary constituencies, with party currently in power there

[mainly for the benefit of google]

Something I was surprised not to be able to find online: a list of UK parliamentary constituencies, and the party currently in power there. Something I needed, and I imagine a lot of people have put together for themselves over the years.

Anyway, here's a CSV file, pulled from the They Work For You API today (18/6/2011).

code will go up on github soonish, along with a bunch of related things.

 

May 28, 2011

sorry, nobody believes you any more

Governments have got into the habit of offering massive amounts of foreign aid, then quietly abandoning their promises once public attention has moved on. It's nice to see them being called on it:

The Group of Eight (G8) countries will pledge $20bn in aid to post-autocratic Arab countries that have toppled heads of state and moved towards democracy, according to European officials. ... While the $20bn would add a strong boost to the countries' economies, Al Jazeera's Jackie Rowland pointed out that the G8 had failed in the past to fulfill aid commitments. She said that by the end of the conference, leaders were expected to publicly admit that neglect. "We're expecting them to admit that there's been a shortfall in the aid that was promised... and the aid that was actually delivered," our correspondent said.
 

May 20, 2011

The Libyan ambassador in Berlin has defected

The Libyan ambassador in Berlin has finally defected. Sort of.

This is months after many of his counterparts in other countries, and at the UN quit. It was the defecting Libyan ambassador who persuaded the UN to meet on Libya, and to pass UN Resolution 1970 to impose an arms embargo. The Security Council at the time wanted to postpone meeting on Libya, but the diplomatic defections forced their hand.

Meanwhile, in Berlin, the Libyan diplomats remained loyal. I remember one occasion where our protest at the embassy was even greeted by a counter-protest inside its gates, the staff feverishly waving pictures of their Brother Leader -- and, presumably trying to ignore the loathing of their countrymen opposite.

Anyway, better late than never. The ambassador, Jamal al-Barag, defends the delay:

Spiegel how could you have remained in your position?
Barag Because Schalgham [the Libyan UN ambassador, some kind of mentor/boss to the German ambassador] advised it. Since the UN passed Resolution 1973 [the no-fly zone resolution, on 17 March], I have done no more political work. I only come sporadically into the office. But we have more than 700 Libyan students in Germany. I ensure that they receive their €1800 each month, that their health insurance and tuition fees are paid.

Barag, who comes from Misrata, reports that he receives news of friends and acquaintances being killed on a daily basis. That he's spent 2 months watching this without criticising it is, to put it in the best line, testimony to the power of blind loyalty.

 

May 18, 2011

How do you describe a face?

How do you describe a face? Given my ability to forget almost everybody I meet, it's a question that bothers me on an almost daily basis. I'm always trying to figure out some procedure by which I can break a face down into its component parts, remember them methodically, and so be able to recognize somebody the next time I see them.

Oddly, I've not yet been able to find any systematic method for doing so. There are tantalizing hints that such systems exist, but they're never spelt out simply on the internet.

In Snow Crash, Stephenson imagines the value of a reliable synthetic face for living in a virtual world:

He was working on bodies, she was working on faces. She was the face department, because nobody thought that faces were all that important - they were just flesh-toned busts on top of the avatars. She was just in the process of proving them all desperately wrong. ... The Black Sun really took off. And once they got done counting their money, marketing the spinoffs, soaking up the adulation of others in the hacker community, they all came to the realization that what made this place a success was not the collision-avoidance algorithms or the bouncer daemons or any of that other stuff. It was Juanita's faces. Just ask the businessmen in the Nipponese Quadrant. They come here to talk turkey with suits from around the world, and they consider it just as good as a face-to-face. They more or less ignore what is being saida lot gets lost in translation, after all. They pay attention to the facial expressions and body language of the people they are talking to. And that's how they know what's going on inside a person's head - by condensing fact from the vapor of nuance.
That's the dream, then. As for the reality: there's probably something of that ilk in Second Life, but I've not yet hunted it down. The real action on the digital side is in computerised face recognition, which is alas of little use for people wanting themselves to describe faces. Early work was based, like old-fashioned anthropometry, on measuring the distance between 'anchor points' found in all faces. But as it's moved towards more statistical methods, which get results but can't be imitated by humans. Meanwhile the police have procedures to help witnesses identify the characteristics of a face:
most composites are put together by asking a witness to describe the parts of a face -- the eyes, nose, mouth or chin -- and then assembling those pieces to create a likeness. The popular FACES computer composite system, for instance, offers witnesses 63 head shapes, 361 types of hair, 514 eyes, 593 noses and 561 lips to choose from.

What are these part of the face? This paper contains a list, extracted from the Farkas System of facial recognition. The full list is apparently present in full only in Leslie Farkas' textboook Anthropometry of the head and face

The Visage Project seems to be an attempted online classification of faces through identifying features. The demonstration is hampered by too-small images, but the descriptions of characteristics are useful.

Another branch of work looks at the face in terms of emotions. This area was spearheaded by Paul Ekman, an anthropologist trying (with some success) to demonstrate the similarity of emotions across human cultures. His Facial Action Coding System is a means of describing facial emotion, muscle by muscle. He's spent the past decade training police, writing popular books, and even inspiring a TV series -- but nonettheless seems to be a serious and broadly respected academic. The effort required to use FACS, though, is considerable -- and it's concerned with changes in exprerssion, not with the permanent structure of the face.

Finally, there's a certain degree of scepticism about the idea of learning faces section by section. It isn't normal, you see:

Several brain studies have shown that we tend to see a face as a whole, and we pay more attention to the relationship among the parts of a face than we do to the parts themselves. "Every cognitive scientist who has studied faces has concluded that faces are processed holistically. In fact, we now know that at least as early as six months of age, babies are engaged in the holistic processing of faces, not individual features," Dr. Wells said. "You can take people who've been married 15 or 20 years and the husband or wife can be quite incapable of describing a single feature of the spouse's face accurately," added Christopher Solomon, technical director for a British composite company called VisionMetric Ltd.

Still, for now I'll take the facial-component approach over the alternative of recognizing friends by their hair and shoes, and becoming confused whenever anybody has a haircut.

 

May 16, 2011

python mode function

Oddly, there seems to be no mode function in the python standard library. It feels like something that should have an optimized C version squirreled away somewhere. 'Mode' is too ambiguous to be easily searchable, alas. Anyway, here's a will-have-to-do-for-now version:

from collections import defaultdict
def mode(iterable):
    counts = defaultdict(int)
    for item in iterable:
        counts[item] += 1
    return max(counts, key = counts.get)

Should be reasonably fast (for pure-python), though could eat up a lot of memory on an iterable contaning large items.

 

May 14, 2011

Still putting out

Voyou:

There's a strange way in which today's capitalism is repeating in reverse the early capitalism in which although workers are, in reality, wholly dependent on capitalism, they are formally - legally and ideologically - treated as independent contractors. This spurious reconfiguration of the worker as entrepreneur unites informal workers in the third world and precarious workers in the first

This is something that struck me very strongly when reading The Making of the English Working Classes. Industrialisation began with outsourcing. Or rather, with putting-out, which Weber describes like this:

The peasants came with their cloth, often (in the case of linen) principally or entirely made from raw material which the peasant himself had produced, to the town in which the putter-out lived, and after a careful, often official, appraisal of the quality, received the customary price for it. The putter-out's customers, for markets any appreciable distance away, were middlemen, who also came to him, generally not yet following samples, but seeking traditional qualities, and bought from his warehouse, or, long before delivery, placed orders which were probably in turn passed on to the peasants.

This is the system which was gradually absorbed into factory-based textile production -- and with it the destruction of previous social life, and the structuring of life around the working day.

Now, as with so much else, we've taken a loop around from centralised production, and are replaying the pre-industrial system at an octave's difference. That means opportunities to recreate social life, to escape the homogenous regimentation of the factory -- but also a return to the forms of exploitation most present just on the cusp of the industrial revolution.

Hence there's plenty of reason for politicised microserfs to turn back to history, explore how the peasants of the 18th century were -- and weren't -- able to assert themselves against the putters-out.

[crossposted to the art of thinking praxis]

 

May 10, 2011

ad-hoc webserver from the shell

Here is a neat trick to make the current directory hierarchy available online: $ cd /tmp $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...

 

April 27, 2011

Tatu and the IWW

Tatu are secretly Wobblies, aren't they? All About Us hinges on a personalization of the great IWW slogan An injury to one is an injury to all, transmuted into obsessive romance:

If. They. Hurt. You. They. Hurt. Me. Too
So we'll rise up won't stop
And it's all about
It's all about
It's all about us

It's not just me feeling the solidarity. This group review returns to the theme time and time again, albeit with a point-missing tendency to link it to the USSR:
You can imagine those pounding war drums soundtracking the Bolshevik revolution - there's certainly a similar sense of collective running through the lyrics, drawing strength from standing shoulder to shoulder with fellow revolutionaries. "If. They. Hurt. You. They. Hurt. ME. TOO.": spine-tinglingly magnificent pop moment of the year.

And more generally, you can make a case that the value of TATU is fitting their various high-pitched emotional states into a grand narrative of love and rebellion:

If you listen across their 'Best Of' album, you can see it unfold: forbidden love and ensuing confusion as the girls, through their transgression, are thrust beyond the bounds of the normative ("All The Things She Said"'); the forging of a new revolutionary ethics ("All About Us", "They're Not Gonna Get Us"); yet more confusion as one of the girls falls for a boy ("Loves Me Not"); a Thermidorian inquest into the motives and consequences of the betrayal ("Friend Or Foe"); then finally, the realisation that the only place this utopian society can exist is in space ("Cosmos")
 

April 4, 2011

Exporting surveillance

MENA net filtering uses Western technology:

At least nine Middle Eastern and North African state censors use Western-built technologies to impede access to online content. ISPs in Bahrain, UAE, Qatar, Oman, Saudi Arabia, Kuwait, Yemen, Sudan, and Tunisia use the Western-built automated filtering solutions to block mass content, such as websites that provide skeptical views of Islam, secular and atheist discourse, sex, GLBT, dating services, and proxy and anonymity tools. These lists of sites are maintained by the Western company vendors. The ISPs also use these tools to add their own selected URLs to the companies' black lists.

I'm interested here that no Chinese technology is mentioned as being used. This was something I'd been expecting -- as had Naomi Klein (kind of) -- but which hasn't come to pass.

As Erich Moechtel has pointed out, much of the European surveillance export industry is surprisingly open. This conference in Dubai in February was more concerned with bugging and individual surveillance, but the principle applies more broadly.

More on this from the TAZ:

Eines der bekannten europäischen Beispiele sei die Firma Nokia Siemens Networks, die beispielsweise Technik in den Iran geliefert habe. "Dort wird diese aktiv zur Repression der Bevölkerung genutzt", kritisiert Kubieziel. Mittlerweile setzten Länder wie China aber auf selbst entwickelte Software zur Zensur, die sie auch an anderen Staaten weiter verkaufe.
 

March 11, 2011

Saudi day of rage: some quick reading

It's entirely possible nothing will happen in Saudi Arabia today. A few hundred protesters on the streets, the ringleaders arrested, and the country will continue as before.

Until this afternoon, though, nobody knows. Demonstrations have been called, and now is as auspicious a time for them as we're likely to see. But one downside of banning political expression is that you can never tell how large demonstrations will be. That, in fact, is why they matter more than under democracy -- they're about the closest you get to a vox pop.

Here are a few guesses as to how things will pan out today.

Hugh Miles on the LRB blog expects something fairly large:

Both Sunni and Shia Saudi opposition groups say they are under intense pressure to make a move before 11 March, but are trying to hold the line so as to garner as much media exposure as possible and secure a large turnout. 'We didn't want to go quickly, but the people took the initiative and issued a date,' one of the organisers told me. 'Now the momentum is there and there is an avalanche of calls for revolt. The speed with which things are happening is beyond our ability to keep up.'

One reason to expect a noticeable protest is because of how strongly the Saudi authorities have reacted to the prospect. After all, they presumably know more than anybody about public opinion. Then again, a strong reaction could just mark paranoia or deliberate overkill. According to Mohammad Taqi in the Daily Times (Pakistan):

The Saudi state machinery has subsequently gone into overdrive to prevent any prominent demonstrations. The regime has resorted to both appeasement through a $ 37 billion 'aid package' to the Saudi people and a series of stern warnings. The Saudi interior ministry said last week that the "laws and regulations in the kingdom totally prohibit all kinds of demonstrations

There's also much more global attention than there has been previously:

The brutal crackdown by the security forces on the Saudi Shia pilgrims in Madinah in February 2009 had largely gone unnoticed by the world. Subsequently, when a Shia cleric Nimr al-Nimr in his March 13, 2009 Friday sermon in Awwamiyya called for the Shia to consider secession from Saudi Arabia if their rights were not respected, the state suppression was swift but did not make the headlines. But now, with the full glare of media turned on to the Middle East, the last thing the regime wants is an uprising that it may have to put down brutally.

And, as this article points out, there's a certain irony to protests in a major oil-exporting country:

the more violent the unrest, and the closer it is to the oil wells, the higher that it sends prices. As prices rise, so do the contested autocrats' paychecks. Meanwhile, their bank accounts swell and they are enabled to pacify their citizens by loosening the strings on public spending. It is like brainwashing citizens into oblivion by keeping their stomachs full and their minds numb.
 

July 28, 2011

If at first you don't succeed: make a wordle and call it a day.

Every data project goes through an embryonic Wordle stage. There's a point where you've spent a few hours futzing with code, are many more hours away from whatever you were trying to build, and feel aw, screw it, let's make some pictures.

In that spirit: headlines from the Guardian and the Mail, these past couple of days:

Guardian
Guardian headlines
Mail
Mail headlines

The somewhat less pointless use of the data will come When I Get Round To It™ -- which, given current circumstances, might not be for quite some time.

 

July 11, 2011

Just how insignificant are BP and ExxonMobil?

Multinational oil companies really have been eclipsed by their state-owned counterparts:


That's ExxonMobil coming in at number 17, as the first private company. It's 30 times smaller than Saudi Aramco by reserves, 20 times by production.

 

July 9, 2011

Dum-dum bullets and shoot to kill

The Metropolitan Police are armed with bullets that the army wouldn't be allowed to use.

Hollow-tipped bullets are designed to expand inside the body on impact, making them much more likely to kill whoever they hit. The generals of the 19th century decided that they were too lethal for war, despite British arguments that they were needed to stop 'fanatical barbarian[s]'.

So they were banned under the 1899 Hague Convention**, along with chemical weapons and bombs thrown from airships. NATO still keeps to that, though perhaps few other armies do.

The police, through, are unaffected. So the Met used these these bullets to kill Jean Charles de Menezes, and this year they started using them more generally.

Now, there's a decent argument that this isn't as bad as it sounds. If a bullet is busy mashing your victim's organs, it's less likely to pass through and hit whoever is behind them. I thoroughly approve of not killing bystanders, but a little confused how that works alongside the policy of giving machine guns to the transport police

Or, more fundamentally: the UK police already kill about 90 people per year -- let's not make it any easier?

[disclaimer: I know nothing about guns, would be happy to never see one again in my life, and wish the police agreed]

 

June 19, 2011

frobbing markets

Market volality provides information about a market. In just the same way as you learn what a gizmo does by applying different input to it, so you piece together the shape of a market by watching what happens under different circumstances. A market could seem utterly stable, until a little volatility reveals that it had always been at the edge of a precipice.

Tyler Cowen sees this in the fate of USian symphony orchestras after the financial crisis. The financial crisis pulled out much of their institutional support, thus showing how shallow was their backing. This caused secondary effects:

The initial negative shock of the crisis, among its other effects, caused donors and potential donors to see that support for these projects was weaker than they thought. Many of these donors are now less than keen to keep pouring money into losing endeavors. An unraveling process has set in. It's not just the negative wealth effect, but new information has been revealed about popularity and sustainability of the underlying venture. Neither monetary nor fiscal stimulus will prove any kind of easy cure for these institutions or, potentially, for these jobs.

There is a well-known literature in finance about how trading, combined with the possibility of sudden price dips, causes market participants to learn the shape of the market demand curve and thus revalue the appropriate overall level of prices. The mere act of trading can generate market volatility. This kind of insight is not yet sufficiently appreciated in macroeconomics. The financial crisis caused us to see that many market institutions were on shakier ground than we had thought.

This is analogous to the 'tipping-point' understanding of political protest. Marches aren't themselves important. But they show the strength of support, and so can win you the support of actors hedging their bets. So the time to march (leaving aside movement-building reasons) is when you believe that your support is greater than generally understood

 

June 18, 2011

UK parliamentary constituencies, with party currently in power there

[mainly for the benefit of google]

Something I was surprised not to be able to find online: a list of UK parliamentary constituencies, and the party currently in power there. Something I needed, and I imagine a lot of people have put together for themselves over the years.

Anyway, here's a CSV file, pulled from the They Work For You API today (18/6/2011).

code will go up on github soonish, along with a bunch of related things.

 

May 28, 2011

sorry, nobody believes you any more

Governments have got into the habit of offering massive amounts of foreign aid, then quietly abandoning their promises once public attention has moved on. It's nice to see them being called on it:

The Group of Eight (G8) countries will pledge $20bn in aid to post-autocratic Arab countries that have toppled heads of state and moved towards democracy, according to European officials. ... While the $20bn would add a strong boost to the countries' economies, Al Jazeera's Jackie Rowland pointed out that the G8 had failed in the past to fulfill aid commitments. She said that by the end of the conference, leaders were expected to publicly admit that neglect. "We're expecting them to admit that there's been a shortfall in the aid that was promised... and the aid that was actually delivered," our correspondent said.
 

May 20, 2011

The Libyan ambassador in Berlin has defected

The Libyan ambassador in Berlin has finally defected. Sort of.

This is months after many of his counterparts in other countries, and at the UN quit. It was the defecting Libyan ambassador who persuaded the UN to meet on Libya, and to pass UN Resolution 1970 to impose an arms embargo. The Security Council at the time wanted to postpone meeting on Libya, but the diplomatic defections forced their hand.

Meanwhile, in Berlin, the Libyan diplomats remained loyal. I remember one occasion where our protest at the embassy was even greeted by a counter-protest inside its gates, the staff feverishly waving pictures of their Brother Leader -- and, presumably trying to ignore the loathing of their countrymen opposite.

Anyway, better late than never. The ambassador, Jamal al-Barag, defends the delay:

Spiegel how could you have remained in your position?
Barag Because Schalgham [the Libyan UN ambassador, some kind of mentor/boss to the German ambassador] advised it. Since the UN passed Resolution 1973 [the no-fly zone resolution, on 17 March], I have done no more political work. I only come sporadically into the office. But we have more than 700 Libyan students in Germany. I ensure that they receive their €1800 each month, that their health insurance and tuition fees are paid.

Barag, who comes from Misrata, reports that he receives news of friends and acquaintances being killed on a daily basis. That he's spent 2 months watching this without criticising it is, to put it in the best line, testimony to the power of blind loyalty.

 

May 18, 2011

How do you describe a face?

How do you describe a face? Given my ability to forget almost everybody I meet, it's a question that bothers me on an almost daily basis. I'm always trying to figure out some procedure by which I can break a face down into its component parts, remember them methodically, and so be able to recognize somebody the next time I see them.

Oddly, I've not yet been able to find any systematic method for doing so. There are tantalizing hints that such systems exist, but they're never spelt out simply on the internet.

In Snow Crash, Stephenson imagines the value of a reliable synthetic face for living in a virtual world:

He was working on bodies, she was working on faces. She was the face department, because nobody thought that faces were all that important - they were just flesh-toned busts on top of the avatars. She was just in the process of proving them all desperately wrong. ... The Black Sun really took off. And once they got done counting their money, marketing the spinoffs, soaking up the adulation of others in the hacker community, they all came to the realization that what made this place a success was not the collision-avoidance algorithms or the bouncer daemons or any of that other stuff. It was Juanita's faces. Just ask the businessmen in the Nipponese Quadrant. They come here to talk turkey with suits from around the world, and they consider it just as good as a face-to-face. They more or less ignore what is being saida lot gets lost in translation, after all. They pay attention to the facial expressions and body language of the people they are talking to. And that's how they know what's going on inside a person's head - by condensing fact from the vapor of nuance.
That's the dream, then. As for the reality: there's probably something of that ilk in Second Life, but I've not yet hunted it down. The real action on the digital side is in computerised face recognition, which is alas of little use for people wanting themselves to describe faces. Early work was based, like old-fashioned anthropometry, on measuring the distance between 'anchor points' found in all faces. But as it's moved towards more statistical methods, which get results but can't be imitated by humans. Meanwhile the police have procedures to help witnesses identify the characteristics of a face:
most composites are put together by asking a witness to describe the parts of a face -- the eyes, nose, mouth or chin -- and then assembling those pieces to create a likeness. The popular FACES computer composite system, for instance, offers witnesses 63 head shapes, 361 types of hair, 514 eyes, 593 noses and 561 lips to choose from.

What are these part of the face? This paper contains a list, extracted from the Farkas System of facial recognition. The full list is apparently present in full only in Leslie Farkas' textboook Anthropometry of the head and face

The Visage Project seems to be an attempted online classification of faces through identifying features. The demonstration is hampered by too-small images, but the descriptions of characteristics are useful.

Another branch of work looks at the face in terms of emotions. This area was spearheaded by Paul Ekman, an anthropologist trying (with some success) to demonstrate the similarity of emotions across human cultures. His Facial Action Coding System is a means of describing facial emotion, muscle by muscle. He's spent the past decade training police, writing popular books, and even inspiring a TV series -- but nonettheless seems to be a serious and broadly respected academic. The effort required to use FACS, though, is considerable -- and it's concerned with changes in exprerssion, not with the permanent structure of the face.

Finally, there's a certain degree of scepticism about the idea of learning faces section by section. It isn't normal, you see:

Several brain studies have shown that we tend to see a face as a whole, and we pay more attention to the relationship among the parts of a face than we do to the parts themselves. "Every cognitive scientist who has studied faces has concluded that faces are processed holistically. In fact, we now know that at least as early as six months of age, babies are engaged in the holistic processing of faces, not individual features," Dr. Wells said. "You can take people who've been married 15 or 20 years and the husband or wife can be quite incapable of describing a single feature of the spouse's face accurately," added Christopher Solomon, technical director for a British composite company called VisionMetric Ltd.

Still, for now I'll take the facial-component approach over the alternative of recognizing friends by their hair and shoes, and becoming confused whenever anybody has a haircut.

 

May 16, 2011

python mode function

Oddly, there seems to be no mode function in the python standard library. It feels like something that should have an optimized C version squirreled away somewhere. 'Mode' is too ambiguous to be easily searchable, alas. Anyway, here's a will-have-to-do-for-now version:

from collections import defaultdict
def mode(iterable):
    counts = defaultdict(int)
    for item in iterable:
        counts[item] += 1
    return max(counts, key = counts.get)

Should be reasonably fast (for pure-python), though could eat up a lot of memory on an iterable contaning large items.

 

May 14, 2011

Still putting out

Voyou:

There's a strange way in which today's capitalism is repeating in reverse the early capitalism in which although workers are, in reality, wholly dependent on capitalism, they are formally - legally and ideologically - treated as independent contractors. This spurious reconfiguration of the worker as entrepreneur unites informal workers in the third world and precarious workers in the first

This is something that struck me very strongly when reading The Making of the English Working Classes. Industrialisation began with outsourcing. Or rather, with putting-out, which Weber describes like this:

The peasants came with their cloth, often (in the case of linen) principally or entirely made from raw material which the peasant himself had produced, to the town in which the putter-out lived, and after a careful, often official, appraisal of the quality, received the customary price for it. The putter-out's customers, for markets any appreciable distance away, were middlemen, who also came to him, generally not yet following samples, but seeking traditional qualities, and bought from his warehouse, or, long before delivery, placed orders which were probably in turn passed on to the peasants.

This is the system which was gradually absorbed into factory-based textile production -- and with it the destruction of previous social life, and the structuring of life around the working day.

Now, as with so much else, we've taken a loop around from centralised production, and are replaying the pre-industrial system at an octave's difference. That means opportunities to recreate social life, to escape the homogenous regimentation of the factory -- but also a return to the forms of exploitation most present just on the cusp of the industrial revolution.

Hence there's plenty of reason for politicised microserfs to turn back to history, explore how the peasants of the 18th century were -- and weren't -- able to assert themselves against the putters-out.

[crossposted to the art of thinking praxis]

 

May 10, 2011

ad-hoc webserver from the shell

Here is a neat trick to make the current directory hierarchy available online: $ cd /tmp $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...

 

April 27, 2011

Tatu and the IWW

Tatu are secretly Wobblies, aren't they? All About Us hinges on a personalization of the great IWW slogan An injury to one is an injury to all, transmuted into obsessive romance:

If. They. Hurt. You. They. Hurt. Me. Too
So we'll rise up won't stop
And it's all about
It's all about
It's all about us

It's not just me feeling the solidarity. This group review returns to the theme time and time again, albeit with a point-missing tendency to link it to the USSR:
You can imagine those pounding war drums soundtracking the Bolshevik revolution - there's certainly a similar sense of collective running through the lyrics, drawing strength from standing shoulder to shoulder with fellow revolutionaries. "If. They. Hurt. You. They. Hurt. ME. TOO.": spine-tinglingly magnificent pop moment of the year.

And more generally, you can make a case that the value of TATU is fitting their various high-pitched emotional states into a grand narrative of love and rebellion:

If you listen across their 'Best Of' album, you can see it unfold: forbidden love and ensuing confusion as the girls, through their transgression, are thrust beyond the bounds of the normative ("All The Things She Said"'); the forging of a new revolutionary ethics ("All About Us", "They're Not Gonna Get Us"); yet more confusion as one of the girls falls for a boy ("Loves Me Not"); a Thermidorian inquest into the motives and consequences of the betrayal ("Friend Or Foe"); then finally, the realisation that the only place this utopian society can exist is in space ("Cosmos")
 

April 4, 2011

Exporting surveillance

MENA net filtering uses Western technology:

At least nine Middle Eastern and North African state censors use Western-built technologies to impede access to online content. ISPs in Bahrain, UAE, Qatar, Oman, Saudi Arabia, Kuwait, Yemen, Sudan, and Tunisia use the Western-built automated filtering solutions to block mass content, such as websites that provide skeptical views of Islam, secular and atheist discourse, sex, GLBT, dating services, and proxy and anonymity tools. These lists of sites are maintained by the Western company vendors. The ISPs also use these tools to add their own selected URLs to the companies' black lists.

I'm interested here that no Chinese technology is mentioned as being used. This was something I'd been expecting -- as had Naomi Klein (kind of) -- but which hasn't come to pass.

As Erich Moechtel has pointed out, much of the European surveillance export industry is surprisingly open. This conference in Dubai in February was more concerned with bugging and individual surveillance, but the principle applies more broadly.

More on this from the TAZ:

Eines der bekannten europäischen Beispiele sei die Firma Nokia Siemens Networks, die beispielsweise Technik in den Iran geliefert habe. "Dort wird diese aktiv zur Repression der Bevölkerung genutzt", kritisiert Kubieziel. Mittlerweile setzten Länder wie China aber auf selbst entwickelte Software zur Zensur, die sie auch an anderen Staaten weiter verkaufe.
 

March 11, 2011

Saudi day of rage: some quick reading

It's entirely possible nothing will happen in Saudi Arabia today. A few hundred protesters on the streets, the ringleaders arrested, and the country will continue as before.

Until this afternoon, though, nobody knows. Demonstrations have been called, and now is as auspicious a time for them as we're likely to see. But one downside of banning political expression is that you can never tell how large demonstrations will be. That, in fact, is why they matter more than under democracy -- they're about the closest you get to a vox pop.

Here are a few guesses as to how things will pan out today.

Hugh Miles on the LRB blog expects something fairly large:

Both Sunni and Shia Saudi opposition groups say they are under intense pressure to make a move before 11 March, but are trying to hold the line so as to garner as much media exposure as possible and secure a large turnout. 'We didn't want to go quickly, but the people took the initiative and issued a date,' one of the organisers told me. 'Now the momentum is there and there is an avalanche of calls for revolt. The speed with which things are happening is beyond our ability to keep up.'

One reason to expect a noticeable protest is because of how strongly the Saudi authorities have reacted to the prospect. After all, they presumably know more than anybody about public opinion. Then again, a strong reaction could just mark paranoia or deliberate overkill. According to Mohammad Taqi in the Daily Times (Pakistan):

The Saudi state machinery has subsequently gone into overdrive to prevent any prominent demonstrations. The regime has resorted to both appeasement through a $ 37 billion 'aid package' to the Saudi people and a series of stern warnings. The Saudi interior ministry said last week that the "laws and regulations in the kingdom totally prohibit all kinds of demonstrations

There's also much more global attention than there has been previously:

The brutal crackdown by the security forces on the Saudi Shia pilgrims in Madinah in February 2009 had largely gone unnoticed by the world. Subsequently, when a Shia cleric Nimr al-Nimr in his March 13, 2009 Friday sermon in Awwamiyya called for the Shia to consider secession from Saudi Arabia if their rights were not respected, the state suppression was swift but did not make the headlines. But now, with the full glare of media turned on to the Middle East, the last thing the regime wants is an uprising that it may have to put down brutally.

And, as this article points out, there's a certain irony to protests in a major oil-exporting country:

the more violent the unrest, and the closer it is to the oil wells, the higher that it sends prices. As prices rise, so do the contested autocrats' paychecks. Meanwhile, their bank accounts swell and they are enabled to pacify their citizens by loosening the strings on public spending. It is like brainwashing citizens into oblivion by keeping their stomachs full and their minds numb.
subscribe to the RSS feed

Short Posts

(See all short posts)

Kildare Street: an Irish version of they work for you

Brazilians phreaking US military satellites

Arrest of Jersey State Senator. I know none of the background to this, but it sounds spectacularly hideous.

Rowenna Davis gets it right. Again. (This time, inheritance tax)

Cheekly: Russia is using the Georgian protests as an excuse to move more troops into Abkhazia [RFE/RL]

Scraps of Moscow on Moldova

Tyler Cowen: 'the United States is...a countercyclical asset'. Good article

Good: Rue89 pick up experimental chimp's investigation into AstraZeneca editing Wikipedia to pimp their drugs. Bad: they don't bother naming or linking to him.

Unsure what to make of the protests in Moldova. The communists won, in a fairish election, in line with earlier predictions? Sounds like the opposition ought to put up with it -- though I'd be pretty pissed off if I were one of them.

Helena Cobban on Waltz with Bashir

Shoe attack on Indian minister. The tactic is catching.

Tamil protest in London

What is a Weapon of Mass Destruction? In US law, apparently anything down to a grenade can be classed as WMD.

Is Pornography the New Tobacco? Nice analogy, hope it doesn't hold.

John Swenson-Wright on North Korean missile tests.

Brian Eno: "Pop music is like the daily paper". Word.

Sex offenders will be made to take lie detector tests as part of their probation conditions on release from prison, the Ministry of Justice said yesterday [IIndependent]. Do these things have any kind of accuracy?

Brilliantly over-enthusiastic Italian SF manifesto, further improved by passing it through Google Translate.

German police hassling a wikileaks volunteer.

Marx's Critique of the Gotha Programme. I always fall into the trap of imagining Marx as philosopher rather than journalist, so forget how wonderfully snarky he can be. This is great fun.

South Africa has denied the Dalai Lama a visa

Fallows again, claiming that China is thinking of going back to traditional characters. Is this really plausible?

James Fallows contrasts the architectural styles of Beijing and Shanghai.

Ross Anderson (i.a.) & friends claim that one in four of the major government databases is almost certainly illegal. Full Report

And here is the German atheist bus campaign itself

The BVG is refusing to carry the atheist bus campaign - despite a slogan that makes the UK original look forthright: "Es gibt (mit an Sicherheit grenzender Wahrscheinlichkeit) keinen Gott"

Nice list of consequences of the recession

has some useful additions to the great End of Newspapers debate. Nice exchange in the comments, too.

French students occupy Sciences-Po/a>: "On veut nous enfermer dans des facultés qui tombent en ruine, alors nous nous enfermons dans l'école la plus riche"

French minister Nadine Morano is attempting to legally extract from Dailymotion the IPs of users who have been defaming her. Evidence of a cross-channel partnership of Nadines to be bone-headed about the internet? [Although given British libel laws, Ms. Morano might well have an even easier time of it there]

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.