About Joe Wein

Software developer and anti-spam activist

RCA Airnergy looks like a hoax

Gizmodo reported about a Gadget shown at CES 2010 that supposedly harvests energy from a wireless hotspot. The “RCA Airnergy WiFi Hotspot Power Harvester” consists of a small battery, a USB connector and some circuitry that is supposed to convert wireless signals into DC power to top up the battery. The gadget can then be used to recharge or power any device that can draw power from a USB port, such as a cell phone or iPod.

A claim was made in a Youtube video on the Gizmodo site that the gadget will charge a Blackberry mobile phone from 30% to fully charged in 90 minutes. That may well be true, if the internal battery of the gadget starts off fully charged and is big enough. The big question is, how much energy can this wireless harvester actually draw out of thin air to replenish its internal battery, if any?

The whole thing reminds me of the hoax of the Japanese “car that runs on water” demonstrated in June 2008 by now apparently defunct company Genepax Co. Ltd. (their website went offline the following year). That car turned out to have a set of lead-acid batteries that — fully charged — could have powered the car some distance even if the proprietary fuel cell announced by Genepax was completely dysfunctional. In any case, the quoted power output of the fuel cell of only 300W was completely inadequate to power a car, meaning the batteries (the real power source) would have had to be recharged from a wall socket before too long.

Likewise, the amount of power available from a WiFi hotspot is nowhere near enough to run a computer or mobile phone. Take my cheap Samsung mobile phone with a 880 mAh 3.7 V Li ion battery (a battery capacity of 3.2 Wh) that I normally need to charge every other day or so. 3.2 Wh over 48 h works out as about 67 mW, which is not that much. However, the maximum power at which a wireless access point may transmit under FCC regulations without needing a broadcast license is a mere 100 mW. Even if the “Hotspot Harvester” could convert 2/3 of the radio energy into usable DC power, it would have to suck up 100% of all energy radiated by the access point, which would have to broadcast at full blast all the time instead of just when there is traffic, just to keep my cell phone charged.

In reality, there is no way the harvester can grab 100% or 10% or even 1% of the energy from the hotspot, which radiates wireless signals in all directions. The gadget can only harvest the small fraction of the airwaves that cross its antenna, which is only a few centimetres by a few centimetres in size, while the hotspot may be metres or tens of metres away. The numbers simply don’t add up.

What that device is then is just a glorified spare battery that will need to be recharged by plugging it into a wall socket or the USB port of a mains-powered computer. The “energy harvesting” function can make no meaningful contribution to the battery charge – unless maybe you happen to put it inside a microwave oven and radiate it with 1000W of power (boys, don’t try this at home! šŸ˜‰ ).

The sad thing is how many websites and blogs have given free publicity to these claims, without doing the math to check if they make any sense at all.

Afghanistan 30 years after the Soviet invasion

I spent Christmas of 1979 with friends of mine in Czechoslovakia, then behind the “iron curtain”. It was there that I heard about a massive Soviet invasion of Afghanistan that started on Christmas eve, 24 December 1979. It was the beginning of a war that cost 15,000 Russian lives and countless Afghan ones, driving millions abroad as refugees.

When my friends heard the official report on Czech TV news, that the USSR had been asked for “brotherly assistance” by the Afghan government under a Peace and Friendship Treaty between Afghanistan and Russia, they immediately felt reminded of a similar announcement during the 1968 invasion of Czechoslovakia. The fact that Afghan president Hafizullah Amin was killed three days later did not exactly help to make it look like the Soviet army did come with an invitation.

The invasion was a watershed event for the Soviet Union, which it demoralized and effectively bankrupted. It has often been called “Russia’s Vietnam” and there were indeed many similarities. Each war was costly to the respective superpower which lost out against insurgents supported by the opposing superpower. Like the US client regime in South Vietnam that survived for another two years after the withdrawal of US troops following the 1973 Paris Peace Accords, the pro-Soviet regime in Kabul under Najibullah managed to hang on to power for another three years, until post-Soviet Russia dropped support for it. Civilian casualties in both wars were huge and vastly outnumbered military casualties by the superpower. About 3,500,000 North and South Vietnamese (about two thirds of them civilians) and between 700,000 and 2,000,000 Afghan civilians were killed.

The pro-Soviet government in Kabul that was overthrown by US-sponsored mujahideen did have a poor human rights record, but at least, unlike the later Taliban regime, it worked to support the rights of women, who could go to work and weren’t forced to go veiled then. Under the Taliban girls could not go to school nor could women see a doctor.

While in 1979 the Soviet invasion was portrayed as an unprovoked aggressive move, as the first invasion outside the direct Soviet sphere of influence since 1945, the picture that has since emerged looks quite different. In an interview with “Le Nouvel Observateur” (Paris), 15-21 January 1998, President Jimmy Carter’s national security adviser Zbigniew Brzezinski revealed that Carter authorized support for Afghan insurgents almost six months before the Soviet invasion, which came as a response to the US-sponsored insurgency:

According to the official version of history, CIA aid to the Mujahadeen began during 1980, that is to say, after the Soviet army invaded Afghanistan, 24 Dec 1979. But the reality, secretly guarded until now, is completely otherwise Indeed, it was July 3, 1979 that President Carter signed the first directive for secret aid to the opponents of the pro-Soviet regime in Kabul. And that very day, I wrote a note to the president in which I explained to him that in my opinion this aid was going to induce a Soviet military intervention.

In an Interview with Mother Jones (23 July 2009), US journalists Elizabeth Gould and Paul Fitzgerald explain that stepped up US aid to militant Islamic insurgents had the opposite effect of the declared intention: Instead of driving out the Russians from Afghanistan, it kept them trapped there:

Gould: [Texas congressman] Charlie Wilson came online around 1984 with the idea that the Soviets were never going to leave Afghanistan, so Congress had to increase the supply of arms to insurgents to drive them out. In 1983, a little more than two years after the Soviets had invaded, we took Roger Fisher of the Harvard Negotiation Project to Afghanistan for Nightline to assess the possibility of negotiating the Soviets out of the country. We came back with the story that the Soviets were actually desperate to get out and really wanted to save face, effectively.

MJ: Why was that?

Gould: The big issue really was the insurgency. The Soviets were in Afghanistan primarily because of the insurgency that was flowing from Pakistan and was basically burning schools and burning down power lines and disrupting the ability of the Afghan government to function. When Charlie Wilson actually did in fact get his budget going, and increase the insurgency, it actually held the Soviets there as opposed to driving them out. Charlie Wilson kept the Soviets in Afghanistan for another six years. He didnā€™t drive them out.

MJ: So if the U.S. hadn’t funneled arms to the insurgency, the Marxist government that was in power in Afghanistan would continue and at that point the Soviets wouldn’t need to be there?

Fitzgerald: The Soviets even prior to their invasion had been trying to convince the Marxists that they should step down from running the country. They told them point blank, you are not capable, you are not diverse enough, your party isn’t broad enough to run the country. And they were letting the United States know. In the summer of 1979, through their emissaries, the Soviet Union let the US know that they wanted the Marxist government of Hafizullah Amin and Nur Mohammed Taraki, to step down. According to the declassified cables the U.S was fully aware of the Sovietā€™s desire for a political solution. The Soviets expected that they would get cooperation from the United States in setting up a coalition government.

It becomes clear then that liberating Afghanistan was not the primary objective, but hurting the Soviet Union. Zbigniew Brzezinski appeared to have no regrets about having lured the Soviets into the conflict, which not only wrecked the Soviet empire but also left Afghanistan into the hands of the Taliban:

What is most important to the history of the world? The Taliban or the collapse of the Soviet empire? Some stirred-up Moslems or the liberation of Central Europe and the end of the cold war?

Now the US is sending tens of thousands of its sons and daughters, with billions of dollars for funding this war, to counter some of these “stirred-up Moslems” mentioned by Brzezinski.

The Frankenstein’s monster created by the US to bring down the Soviet Union is now going after its own creator, except of course that the men and women dispatched to fight and die in Afghanistan today are not the same individuals who conspired to launch this never ending war some 30 years ago.

Wars are rarely ever by necessity, despite what politicians may say at the time and what may first seem like an effective solution to a political problem often comes back to haunt those who chose the path of violence even though there were better alternatives.

The most robust router I ever used – WHR-HP-G54 (DD-WRT)

It’s been 15 months since I set up a Buffalo WHR-HP-G54 with open source Linux-based DD-WRT firmware as my main broadband router (see “DD-WRT on Buffalo WHR-HP-G54”, 2008-09-06). I’m happy to report that this US$70 router it is the most robust router I have ever used. Its performance has been solid as a rock.

I’ve owned other routers that would occasionally need resetting because of connection problems, or that would spontaneously reboot themselves, but not the WHR-HP-G54. It never misses a beat.

Currently, its uptime count is at 157 days, that is since a family member accidentally pulled its power cord out of the wall socket five months ago. This box will stay up and running forever, no matter how hard you push it. It works better than any other router I’ve owned at any price.

In five months my router has handled a total of 1080 GB (1.08 TB) of data that either came from or went out to the cable modem, or over 6 GB per day (I process a lot of spam data and have 4 hard disks of 1 TB or larger).

On top of all the regular functions of a home / small office router it handles IPv6 tunneling over IPv4 and offers many features. The user interface is straightforward, yet very powerful.

A friend of mine who used to have chronic problems with two different routers, which he uses with about 10 different computers in his home, on my recommendation bought the same model several months ago. He thanked me again today because he hasn’t had any problems since šŸ™‚

Afghanistan — a missed chance for Obama

President Barack Obama will over time come to regret his decision to send another 30,000 men and women into war in Afghanistan, announced in a speech at West Point on 1 December 2009. More non-Afghan boots on the ground in Afghanistan will do nothing to make Americans more secure. To the contrary, the escalation will only help the Taliban recruit more men. And the more Western troops are stationed in Afghanistan, Iraq and other Islamic-majority countries, the easier it will be for Al Qaeda to portray the US and its allies as “crusaders” coming to invade.

As Canadian columnist Gwynne Dyer reasoned in an article on the Afghan presidential election in early November, the blatantly rigged election that secured Afghan president Hamid Karzai another term in office could well have provided the political cover to abandon the doomed Afghan intervention: “…now is his best-ever chance to pull out, because the political train-wreck in Kabul gives him an ideal opportunity to renege on his foolish promises to pursue the war in Afghanistan until victory.” Obama did not use this chance to cut his losses.

What kind of “victory” is Obama hoping for by staying? The signs are not encouraging. For years, President Karzai’s power has barely extended beyond the capital, which is why he’s often nicknamed the “mayor of Kabul”. The provinces are ruled by powerful warlords, whose abuses of power and lawlessness back in the 1990s paved the way to power for the Taliban. Karzai’s administration and police force are one of the most corrupt in the world — the country was ranked 179 out of 180 countries evaluated by Transparency International in 2009 (only Somalia is worse). Hamid Karzai’s own brother, Ahmed Wali Karzai, who lives in the Southern city of Kandahar, is reputed to be a major player in the opium trade as well as being on the CIA payroll, writes the New York Times. US troops are propping up an unpopular, corrupt regime, just as they did in South Vietnam in the 1960s. Even Afghans who side with the government know that sooner or later the US will withdraw its troops, while the enemies of the present government will still be there and they will have to live with them somehow.

In deciding to stay the course and trying a “surge” (just like his predecessor in office), Obama will have pleased some generals and the political establishment in Washington, D.C., but failed his test as a new kind of politician. To his credit, Obama took his time to carefully consider his options and listen to advice from different sides. He was very deliberate about it. Somehow I can’t quite image John McCain taking this much time to come to a conclusion, had he won the election a year ago… Yet, the outcome was still a bad choice and the reasons given for it are utterly unconvincing to me and many others.

In his speech Obama kept lumping together the Taliban and Al Qaeda, Afghanistan and Pakistan, knowing like his predecessor that the memory of 9/11 is still powerful and that some political mileage can be gained from it. The problem with that line of argument though is that Al Qaeda did not really need any bases in Afghanistan to stage that attack on the US: 9/11 appears to have been planned mostly in Hamburg/Germany and in Florida.

Occupying the mountains and deserts of Afghanistan will be costly in blood and treasure, but looked at it rationally, it will do almost nothing to prevent future terrorist attacks in the US or Europe. If anything, it will help recruit for future attacks, just as the US military presence on bases inside Saudi Arabia after the 1990-1991 Gulf War became the main recruiting tool for 9/11 (which is one reason why 15 of the 19 hijackers were Saudis).

Gwynne Dyer in his article “Last Exit from Afghanistan”:

It was always nonsense: terrorists donā€™t need ā€œbasesā€ to plan their attacks. Regular armies need bases, but all terrorists need is a couple of safe houses somewhere. Controlling Afghanistan is almost entirely irrelevant to Western security, and that reality is also beginning to seep out into the public discussion in the United States.

Al Qaeda does not depend on Afghanistan. Most experts assume both Osama Bin Ladin and Mullah Omar, the leader of the Taliban to be living in relative safety in next-door Pakistan, perhaps protected by the ISI, the powerful secret service of Pakistan that was allied to the Taliban when they first came to power in the 1990s. Remember that Pakistan was one of only three countries worldwide that diplomatically recognized the Taliban regime (the other two were fellow US allies Saudi Arabia and the UAE).

Even if the Pakistani government and its organs were to fully cooperate with the US, the tribal regions along the frontier between Afghanistan and Pakistan have always only nominally been under control of the central government. This goes all the way back to the days of the British Empire in India, when the British could only pacify these regions by paying them not to attack.

Middle East expert Fawaz A. Gerges estimates in a CNN opinion piece (“Afghanistan is mission impossible”, 2 December 2009) that there are three times more Al Qaeda operatives in US-allied Pakistan than inside Afghanistan.

It was foolish for President George W. Bush to invade Iraq after 9/11 when the Al Qaeda camps were based elsewhere. It is foolish of Obama too to send more troops into harm’s way in Afghanistan, a graveyard of foreign invaders (from Alexander the Great and the Mongols to the Soviet Army). Yet it wouldn’t make any more sense to try to send those troops to Pakistan, the real hornet’s nest, whose large population would be deeply hostile to any such adventure.

The problem is not really that the US keeps sending troops to the wrong country, or maybe sending too few troops to get the job done, it is that military invasions are not the right tool for this job: You can not defeat Al Qaeda with conventional armies any more than you can do surgery with a hammer. Al Qaeda is not fighting a conventional war and it can not be defeated with conventional military means.

There are political reasons for terrorism. As long as the US remains allied with corrupt, unpopular regimes across the Middle East and Central/South Asia, domestic hostility against these regimes will always spill over into Anti-Americanism and the local presence of US troops will fan the Anti-Americanism. Defeating terrorism will have to start with better governments in countries that currently act as a breeding ground for terrorism and insurgency, with weeding out corruption, injustice and lack of development.

Isn’t it ironic that, compared to its image in other countries in the region, America as a country is surprisingly popular amongst ordinary people in Iran, maybe because for the last 30 years they have lived under a government that is not allied with and not bribed by the US, unlike say Egypt, Jordan or Pakistan, where corrupt and incompetent elites are seen as in the pocket of Washington.

Instead of primarily seeking military cooperation from political elites in client countries through funding and military pressure, the US would be better off nurturing projects to build civil society and to encourage those governments to invest in education, health care and a working judiciary. Based on the experience of the last eight years, Karzai is the wrong man to deliver such goods to his fellow citizens in Afghanistan.

When Obama will finally start to withdraw US troops from Afghanistan maybe 18 months from now or later, the US will have squandered hundreds of billions of dollars while hundreds and thousands will have got killed, without having fixed any of the problems that plague the country today.

At that point, the Afghan people will still have to solve their problems amongst themselves.

Fix Windows as default boot on Ubuntu with Grub2 loader

If you install Ubuntu on a machine that came with Windows pre-installed you have the choice of preserving Windows and chose each time you boot which operating system to run. By default, the boot menu will list the current Linux kernel, followed by any older Linux kernel versions, followed by a memory test and finally the original Windows version. By changing a GRUB boot loader configuration file you can chose which one is the default that gets booted when you just wait and don’t touch the keyboard.

(NOTE: The following instructions assume the Grub2 loader used in Ubuntu 9.10 – earlier versions are different)

For example, the menu might look like this:

Ubuntu, Linux 2.6.31-14-generic
Ubuntu, Linux 2.6.31-14-generic (recovery mode)
memory test (memtest86+)
memory test (memtest86+, serial console 115200)
Windows Vista (loader) (on /dev/sda1)

You can configure Linux to — unless you tell it otherwise — always boot Vista by setting GRUB_DEFAULT in /etc/default/grub to the number of lines above the entry you want to boot (4 in this case), instead of 0 (zero) for the top entry. After any change to /etc/default/grub you need to also run sudo update-grub:

joe@ubuntu910:~$ gksudo gedit /etc/default/grub

GRUB_DEFAULT=4

joe@ubuntu910:~$ sudo update-grub

The problem with that is, when the next kernel update comes out, two lines will be inserted at the top and your default value now selects the wrong entry:

Ubuntu, Linux 2.6.31-15-generic
Ubuntu, Linux 2.6.31-15-generic (recovery mode)
Ubuntu, Linux 2.6.31-14-generic
Ubuntu, Linux 2.6.31-14-generic (recovery mode)
memory test (memtest86+)
memory test (memtest86+, serial console 115200)
Windows Vista (loader) (on /dev/sda1)

You would need to manually select the latest kernel and repeat the above steps with a new value of 6 in this case. This is clearly a problem. Fortunately, there’s a simple workaround: use a name instead of a number for selecting the default. Here is how it works:

1) List the bootable operating systems:

joe@ubuntu910:~$ fgrep menuentry /boot/grub/grub.cfg
menuentry “Ubuntu, Linux 2.6.31-15-generic” {
menuentry “Ubuntu, Linux 2.6.31-15-generic (recovery mode)” {
menuentry “Ubuntu, Linux 2.6.31-14-generic” {
menuentry “Ubuntu, Linux 2.6.31-14-generic (recovery mode)” {
menuentry “Memory test (memtest86+)” {
menuentry “Memory test (memtest86+, serial console 115200)” {
menuentry “Windows Vista (loader) (on /dev/sda1)” {

2) Mark and copy the entry you want to stay bootable, including double quotes, for example "Windows Vista (loader) (on /dev/sda1)".

3) Edit the Grub configuration and paste the new value after the GRUB_DEFAULT= (in place of 0 or 4 or whatever number):

joe@ubuntu910:~$ gksudo gedit /etc/default/grub
GRUB_DEFAULT=”Windows Vista (loader) (on /dev/sda1)”
joe@ubuntu910:~$ sudo update-grub

Note: Make sure to close the gedit window before doing sudo update-grub

That’s it, no more Grub configuration tinkering required! šŸ™‚

Revolution in Prague – 20 years of freedom

This week it will be twenty years since I had the privilege to become an eyewitness to the Velvet Revolution (Czech: sametovĆ” revoluce) in then Czechoslovakia. With close friends of mine I attended a mass demonstration at Letna Park in Prague to mobilize for a general strike the following day, which ended 4 decades of Communist Party rule.

The following is an account of these events that I wrote about 10 years later, with photographs taken on that cold winter day.

[Start of original article]

Revolution in Prague

I have long had friends in Czechoslovakia, some 100 km (60 miles) east of where I was born. In 1968 a massive invasion of Soviet, East German and other Warsaw pact armies ended “socialism with a human face”, a daring but short-lived experiment by liberal communist prime minister Alexander Dubcek. My friend later showed me underground leaflets distributed then, that he had secretly stashed away. I was only seven years old when that happened, but I still remember being frightened after hearing my father and uncles talking about whether the invasion could mean WW3.

Nine years later, a group of intellectuals formed a human rights organization called “Charta 77”. Its leaders were playwright Vaclav Havel and Jiri Dienstbier. Another prominent member was Petr Uhl. The opposition group was persecuted and its members spent many years in Czech prisons.

Following “perestroika” in Russia under Mikhail Gorbachev, political change built up momentum across Eastern Europe. Poland voted for a non-communist government. Hungary took down the barbed wire along its border to Austria, triggering a mass exodus of East Germans to the west. Mass demonstrations in Leipzig, Dresden and other east German cities followed. Then thousands of East Germans invaded the West German embassy in Prague, forcing the East German government to let them emigrate. Soon after, the Berlin wall and border checkpoints to West Germany were opened and millions of East Germans could travel west for the first time in four decades.

Infected by the bold spirit of their neighbours, Czech students publicly demonstrated near Vaclav square in the center of Prague, commemorating Czech students who had dared to demonstrate against Nazi occupation 50 years earlier. Despite the non-confrontational theme, police violently broke up the demonstration, brutally beating the students. Photos of the events emerged and public outrage followed. The national television eventually had to show pictures of the clubbing. This triggered growing mass demonstrations on Vaclav Square in central Prague, which got so big that they had to be moved to Letna Park, the usual site of the annual Mayday parade of the Communist Party (KSC). Two big rallies were to be held on Letna Park over the weekend, to spread the call for a general strike, to demonstrate to the Communist Party that it was isolated and that the people wanted it to resign.

When I saw the reports on the TV news, I decided to leave for the Czech border the very next morning. East of the Bohemian Forest the snow was about 30 cm (1 ft) deep. Bohemia was covered in white and the infamous “Bohemian Wind” was blowing. I experienced no particular problems at the border and found relatively little traffic on the wintery roads. My 4wd Audi took me to Teplice, in northern Bohemia, some 60 km (40 mls) south of Dresden, without any problems due to ice or snowdrifts.

My friends were surprised to see me, of course. Throughout the afternoon we watched television. All regular programming had been canceled and there were only interviews, live reports and speeches. All censorship had been dropped. Journalists reported about anything, said anything, gave a forum to anybody. I was probably watching the most free television in all of Europa at that moment. Finally it was announced that Vaclav Havel would speak. I was utterly amazed. The man who had all his plays banned, had been jailed, made to earn his living shoveling coal, probably the most stubborn oppositional in this country could speak freely to his compatriots. And speak he did, I don’t remember if it was for 30 minutes or an hour. The camera was his, and the audience too. That same afternoon there were a million people on Letna park, at a demonstration of the Obcanske Forum (civic forum, the largest organization within which was Charta 77).

I talked to my friend about going to Prague on Sunday together. His wife was worried what might happen. What if they had their pictures taken, got arrested and lost their jobs? But a million people had demonstrated already and Havel had been on TV. The Berlin Wall had been broken too. This was not Prague 1968 any more. This time it would work. Well, if he was going then so was she.

The roads were icy as we headed down to Prague the next day, but it was a pleasure to drive in the Audi. Letna Square is on one of the hills high above the centre of Prague, which makes it cold and windswept in the winter. We parked in the suburbs within walking distance and followed the crowds.

The first thing that surprised us was that there was no police. Usually, they were all over the place. Now, not one. I was going to witness an event with anywhere upwards of 500,000 people and would not see a single policeman all afternoon, in what until days ago could only have been described as a police state. Instead we saw students with white armbands, or civic forum badges, who took care of everything. The government must have decided that violence was too risky.

This ice-hockey stadium at the edge of the square was used by the speakers, amongst them Havel, Dienstbier and Petr Uhl, who had just been released from jail were he had been taken for spreading the (luckily mistaken) rumour that a student had been killed during the demonstration the previous weekend.

The crowd was so huge, it was difficult to see how big its was from anywhere in the middle. So I passed up my camera to one of these guys and they were kind enough to take some pictures in various directions. No one was paranoid about having their pictures taken any more. People had shaken off fear.

This is the view towards the stage. Many people were wearing ski hats or jackets in the colours of the Czechoslovakian flag. This was not just an anti-communist or anti-Stalinist event, since it had been a foreign invasion that suppressed freedom 21 years earlier. This was very much a nationalist event too. The revolution of 1989 was as much about reclaiming national sovereignty lost in 1968 as it was about restoring democracy lost in 1948.

That’s the view towards the right hand side of the square. I was told Letna park can hold one million people. It had been full on Saturday. Looks pretty full to me on that Sunday too!

The slogans on three of the banners read: “Step down!”, “Civic Forum” and “Free Elections!”

The Victory sign became popular over night, as a sign of confidence in the effectiveness of the general strike the following Monday.

“Free newspapers, radio and television” (my Czech is pretty rudimentary…) — a message against censorship

On the left (in red): “End one party elections!” Below: Valtr Komarek was a renowned economist who came out against the government.

Two of the young people who organized security, directing traffic and handing out information. Yes, it was cold and windy too.

A Skoda car (Prague license plate) with “I love civic forum” in the rear window.

A revolutionary family effort. The child in the middle holds a banner with “Svoboda” (Freedom) written on it

Stalinism hit its dead end. All shop windows were plastered with political messages, as were the underground (subway) stations that are the arteries of public transport in Prague.

Photographs of the violently crushed students demonstration that caused the outrage triggering the mass demonstrations.

Pictures of Alexander Dubcek, father of the “Prague Spring” of 1968 and of Mikhail Gorbachov whose hands-off policy discouraged the Czech communists from resorting to violence in the way the Chinese leadership had done at Tien-An-Men square earlier that year.

View towards the top end of Vaclav Square, with the National Army Museum in the back. In front of the museum is the Vaclav Monument, which most of us remember from pictures showing it surrounded by Russian tanks in August 1968.

A field of candles lit for the victims of the government.

Cheerful pedestrians were waving the V-sign at passing motorists who honked their horns in solidarity.

V-signs and flags every where — as along the street between Vaclav Monument and the museum.

People had been waiting for this day for at least 21 years. Until a few years aerlier the National Army Museum in the background still bore the bullet holes were it had been hit by Soviet tank artillery.

Ladas, Skodas, Trabants and Wartburgs in a freedom parade.

The following day was scheduled to be a general strike. The opposition groups were headed by well known intellectuals. The big demonstrations had all been in Prague. People still were not sure what the outcome would be in the smaller towns, away from the capital and how effective the strike call would be amongst industrial workers, such as the Skoda factories.

The right to go on strike

The right to go on strike
(See here for an English Translation of this flyer)

But Czechs have long held intellectuals in high respect, like to read and to watch plays. Famous actors, whole theaters and even national football (soccer) players publicly came out in support of the strike call. By Monday afternoon, when I was back in Germany, the figures were in: The strike was a great success, the government had lost every pretense of being in control and there was nothing else left but to withdraw in an as orderly way as possible. Within days, a transitional cabinet was established and former oppositionals took control of public institutions. An election later confirmed that communist majority had always been a carefully constructed fiction.

Vaclav Havel (president of the Czech Republic until February 2003) is one of the politicians who I respect most, for his courage, his non-violent struggle, his sense of humour and his humane values.

[End of original article]

Twenty years later

I went back to the Czech Republic about ten years later, with my wife and kids. We visited Prague as tourists. I was amazed how much everything had changed. I heard English spoken everywhere, where before most tourists were from East Germany or other parts of the Eastern Block. Prague had become a magnet for young people from all over the world.

Things have not been easy for people, as not all have materially benefited equally from the changes. The old planned economy suffered from low productivity and horrendous ecological problems (especially acid rain in the lignite mining areas in Northern Bohemia), but everybody had been guaranteed a job of some sort. Hopes had been so high after 40 years of repression and mismanagement that people were bound to be disappointed by reality (just as Americans were bound to be somewhat disappointed after voting for change in the 2008 US Presidential Election, I might add).

Rule by a repressive one party bureaucracy was a dead end for Czechoslovakia. Now the Czech Republic is a free country again. Its citizens need not fear being arrested or losing their jobs or be denied education for speaking their minds. They are free to travel and to trade and to seek opportunities.

The events of twenty years ago gave me hope in the human spirit. They showed me what people can achieve when they dare to dream, to follow their moral convictions and to reach out to their fellow human beings instead of being bowed by fear.

NTFS disk corruption on frequent file creates and deletes

I recently upgraded a secondary hard disk in a Windows machine from a Seagate Barracuda 7200.11 1 TB drive to a Western Digital Caviar Green WD15EADS 1.5 TB drive. Mirror imaging the data off the old drive to the new drive using the Linux dd utility from an Ubuntu live CD went very smoothly and completed in a little over three hours, but I subsequently hit a snag when I tried to resize the partition on the larger drive.

The image copy of the 1 TB NTFS partition resulted in a 1 TB partition followed by 500 GB of unallocated space, which I wanted to add to the free space of the NTFS partition. That should be no problem for Linux gparted, but only if the partition to be resized is internally consistent. If it is not, one will have to use CHKDSK /F under Windows to fix it first.

C:\>chkdsk m: /f
CHKDSK is verifying files (stage 1 of 3)...
0 percent complete. (0 of 21942736 file records processed)
Deleted corrupt attribute list entry
with type code 144 in file 2300.
Deleted corrupt attribute list entry
with type code 176 in file 2300.
Deleting corrupt attribute record (144, $I30)
from file record segment 2300.
Deleting corrupt attribute record (176, $I30)
from file record segment 2300.
Deleted corrupt attribute list entry
with type code 144 in file 2332.
Deleted corrupt attribute list entry
with type code 176 in file 2332.
Deleting corrupt attribute record (144, $I30)
from file record segment 2332.
Deleting corrupt attribute record (176, $I30)
from file record segment 2332.
Deleted corrupt attribute list entry
with type code 144 in file 2342.
Deleted corrupt attribute list entry
with type code 176 in file 2342.
Deleting corrupt attribute record (144, $I30)
from file record segment 2342.
Deleting corrupt attribute record (176, $I30)
from file record segment 2342.
21942736 file records processed.
File verification completed.
41475 large file records processed.
0 bad file records processed.
1552 EA records processed.
0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
10 percent complete. (4118 of 81648013 index entries processed)
Correcting error in index $I30 for file 2300.
10 percent complete. (5149 of 81648013 index entries processed)
Correcting error in index $I30 for file 2332.
Correcting error in index $I30 for file 2342.
34 percent complete. (23316097 of 81648013 index entries processed)
Correcting a minor error in file 2300.
Correcting a minor error in file 2332.
Correcting a minor error in file 2342.
81648013 index entries processed.
Index verification completed.
CHKDSK is recovering lost files.
997 unindexed files processed.
997 unindexed files processed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
21942736 security descriptors processed.
Security descriptor verification completed.
Inserting data attribute into file 2300.
99 percent complete. (1 of 939015 data files processed)
Inserting data attribute into file 2332.
Inserting data attribute into file 2342.
939015 data files processed.
Correcting errors in the master file table's (MFT) BITMAP attribute.
Correcting errors in the Volume Bitmap.
Windows has made corrections to the file system.

1465135996 KB total disk space.
871385828 KB in 18183533 files.
7651336 KB in 939018 indexes.
0 KB in bad sectors.
22057856 KB in use by the system.
65536 KB occupied by the log file.
564040976 KB available on disk.

4096 bytes in each allocation unit.
366283999 total allocation units on disk.
141010244 allocation units available on disk.

Googling for these error messages, I found a Knowledgebase article by Microsoft about disk corruption on Windows NT that could occur with frequent file creates and deletes (for which they had a fix) and a posting by a Windows XP user who also frequently creates and deletes files.

The three files reported by CHKDSK were three folders on my hard disk. CHKDSK converted them into zero length files. After recognizing this, I deleted these files and recreated the original directories. Since then my application has been working again.

As it so happens, these three directories are three places on my computer where the largest number of files is created and deleted in rapid and random succession (there’s one process each creating them and one process each asynchronously consuming them), just like in the articles that I googled.

If anyone else comes across a similar problem with NTFS with similar symptoms, I would be glad to hear from them.

Update 2009-11-20:
The three corrupted folders that were turned into zero length files by ChkDsk did not actually disappear completely. Instead their contents was moved to a hidden folder tree. Note the above lines:

CHKDSK is recovering lost files.
997 unindexed files processed.

I looked on the hard disk for hidden files or folder from the command prompt:

M:\> dir /ah m:\found.*
 Volume in drive M is wd15
 Volume Serial Number is E861-DD52

 Directory of m:\

2009-11-18  17:39    <DIR>          found.000
               0 File(s)              0 bytes
               1 Dir(s)  576,809,738,240 bytes free

This hidden folder contains the three lost directories:

M:\>dir m:\found.000
 Volume in drive M is wd15
 Volume Serial Number is E861-DD52

 Directory of m:\found.000

2009-11-20  12:06    <DIR>          dir0000.chk
2009-11-18  17:39    <DIR>          dir0001.chk
2009-11-18  17:39    <DIR>          dir0002.chk
               0 File(s)              0 bytes
               3 Dir(s)  576,804,810,752 bytes free

Looking at the contents of each of these folders I could soon tell which was which and move those files back to the original path.

Marvell MC85 with NdisWrapper on Ubuntu 9.10

Last week I updated my Gateway M-6750 from Ubuntu 9.04 to Ubuntu 9.10 (“Karmic Koala”) and managed to get myself into a right mess, as I lost access to both my wired and wireless internet connections. I then burnt an Ubuntu 9.10 live CD from an ISO image dowloaded with uTorrent and reinstalled from there. That got the wired connection working, but the wireless was still gone. Before I fixed that problem I upgraded my notebook hard disk drive, complete with dual-boot Vista and Ubuntu partitions, to a new 500 GB drive (see yesterday’s blog post).

The Marvell MC85 doesn’t have a native Ubuntu driver yet. Therefore you have to use a Windows XP driver for it as described here. You can download the Netgear wn311t_setup_4_1.exe driver set and extract its content on either XP or Wine. You’ll end up with NetMW14x.inf, netmw143.sys and netmw145.sys. Only NetMW14x.inf and netmw145.sys are actually needed.

See my instructions in my earlier blog post for the initial steps (look for a section labeled “Update, 2008-03-18”).

Installing the driver with ndiswrapper does almost everything. The magic ingredient that was missing when I tried to get it working this time was to ensure that ndiswrapper loads every time, before using the Network Manager or when booting up. Without ndiswrapper the Windows driver won’t be loaded and Ubuntu simply won’t see the wireless adapter. It will show up as unclaimed on this command:

lshw -C network

*-network UNCLAIMED
description: Ethernet controller
product: Marvell Technology Group Ltd.
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:02:00.0
version: 03
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: latency=0
resources: memory:f6000000-f600ffff memory:f4000000-f400ffff
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
logical name: eth0
version: 01
serial: 00:e0:b8:XX:XX:XX
size: 10MB/s
capacity: 100MB/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi pciexpress bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10MB/s
resources: irq:28 ioport:4000(size=256) memory:fa200000-fa200fff memory:c0000000-c001ffff(prefetchable)

Ubuntu uses file /etc/modules to enumerate extra drivers and kernel modules that need to be loaded at boot time. Therefore I needed to add a line in /etc/modules using gedit:

gksudo gedit /etc/modules

Add

ndiswrapper

in a line of its own at the bottom of the file and save it, then restart your machine. After the reboot you should be able to use the Network Manager to manage wireless connections, including looking for available networks and configuring security parameters (for WPA, WPA2 / RSN) to be able to connect.

I found many other threads and blog postings that discussed manually editing configuration files and configuring wpa_supplicant, but none of that is required if you just configure Ndiswrapper for NetMW14x.inf, tell NDiswrapper about the device ID and then ensure that Ndiswrapper is always laoded. Here is the lshw output with Ndiswrapper having claimed the wireless adapter:

*-network
description: Wireless interface
product: Marvell Technology Group Ltd.
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
version: 03
serial: 00:16:44:XX:XX:XX
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ndiswrapper+netmw14x driverversion=1.55+NETGEAR,10/04/2006, 2.1.4.3 ip=192.168.42.122 latency=0 link=yes multicast=yes wireless=IEEE 802.11g
resources: irq:16 memory:f6000000-f600ffff memory:f4000000-f400ffff
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
logical name: eth0
version: 01
serial: 00:e0:b8:XX:XX:XX
size: 10MB/s
capacity: 100MB/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi pciexpress bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10MB/s
resources: irq:28 ioport:4000(size=256) memory:fa200000-fa200fff memory:c0000000-c001ffff(prefetchable)

Notice the driver=ndiswrapper+netmw14x after configuration:. If you get that you should be in business! šŸ™‚

Backing up / migrating your hard disk data with a Ubuntu live CD

Recently two hard disks died in my household, both of which were Windows boot disks, just as if I needed a reminder how quickly one can lose important data. This and some troubles while upgrading my Gateway M-6750 notebook from Ubuntu 9.04 to Ubuntu 9.10 (“Karmic Koala”) prompted me to get some spare hard disks and do a complete backup / upgrade.

I upgraded my notebook from 250 GB to 500 GB, and I can now keep my old drive as a safe snapshot to go back to if anything should ever go wrong with the new drive.

The most important tools needed for this were an Ubuntu 9.10 live CD from an ISO image (downloaded with uTorrent) and the NewerTech Universal USB 2.0 Adapter, which lets you hook up just about any IDE or SATA drive to a USB-equipped computer.

My notebook has Windows Vista on it, for which Gateway did not ship an install DVD – theres’s only a recovery partition. For installing Ubuntu I had originally shrunk the Vista NTFS partition on the 250 GB drive to make space for a 60 GB Linux partition, which provides a dual-boot feature via the GRUB loader.

I ordered some WD Scorpio Blue 500 GB notebook hard disks (WD5000BEVT) from Amazon and they arrived the next day. These are good work horse drives. I hooked one up to the NewerTech Universal USB 2.0 Adapter and booted into the Ubuntu Live CD.

From there I started a terminal window and used the “dd” command to make an image copy of the drive, see below. Be very careful with the source and destination specification. Use fdisk -l to verify which drive is which and in some cases the USB drive will appear as /dev/sdc instead or /dev/sdb. For IDE (PATA) drives the names could be /dev/hda, /dev/hdb, etc. If you specify the wrong drive as the destination you could wipe out all your data!

sudo dd if=/dev/sda of=/dev/sdb

This will copy every single byte from the first SATA hard disk to the second SATA (or USB 2.0) hard disk on the machine. You won’t have to worry about what partitions there are and which one is bootable, because it will simply copy all of them.

I started it last thing before I went to bed. It took about 2 hours to copy the entire 250 GB of the existing to the existing WD2500BEVS to the new drive. In the morning I shut down Ubuntu, opened the bottom of the case and transplanted the new drive inside, which took a small screw driver and about 10 minutes. Then I fired up the machine again and it successfully booted both Windows Vista and Ubuntu 9.10 off the new drive.

Since the new drive had more space, I wanted to resize the partitions so that each could take 250 GB instead them having to share that space. GNU utility gparted lets you do that. It can shrink, grow and move partitions pretty any way you like. You can tell it the new size of a partition and how much space to leave before and after it.

I first did not know that gparted can move partitions as well as resizing them, so I decided to remove the Ubuntu partitions, grow the NTFS (Windows) partitions and the reinstall Ubuntu into the remaining space. Be careful when removing an Ubuntu partition in a dual-boot system, because the active loaded and its menu file will be in the Ubuntu partition. Thus if you shoot it without first making the Windows partition the active boot partition you won’t be able to boot off that hard disk any more! Either boot of your operating system install CD/DVD or off an operating system recovery partition (if available) and select the command prompt. From there use fixldr /mbr (2000/XP/2003) or bootrec /FixMbr (Vista / 7) to rewrite the Master Boot Record. This will disable the Ubunto bootstrap loader. Make sure Windows will boot without the Ubuntu boot menu coming up. No you can remove the Ubuntu
partitions.

With sudo gparted on the Ubuntu Live CD you can resize the NTFS partition for Windows to any sensible value. In my case I got an error because some NTFS data structures were in an inconsistent state. To fix that I had to boot Windows and run chkdsk /f from a command prompt and then restart. Windows fixed the problem and one restart later I was back in Ubuntu live and gparted was able to resize the partition

After that I installed Ubuntu into the free space that I’d left for it on the 500 GB drive.

Given the low cost of SATA and USB 2.0 drives versus the time and data lost when something goes wrong with your hard disk, I do recommend a full image backup like mine. The dd command also lets you copy drives or partitions to files, so you can back up multiple machines to one large drive.

Electricty in Japan

Our household of four uses about 500 kWh of electricity per month on average, a considerable portion of which is consumed by the computers I run my business on. The total tends to be more in July and August, when we also run air conditioners to take the edge of 35+ centigrade heat, whereas in the winter our municipal gas bill tends to go up a lot because of heating. All year round we use gas for cooking and hot water.

TEPCO (Tokyo Electric Power Company), the local utility for the Kanto area, charges us about 25 yen per kWh on average (the exact rate varies a bit month by month, as the company tries to even out charges for its customers against seasonal consumption patterns). That’s about US$0.28 / EUR 0.18 per kWh at current exchange rates.

While electricity in Japan tends to be expensive by US standards, its supply is also extremely reliable. Until a few years ago uninterruptable power supplies (UPS) for domestic use used to be almost unheard of here, because we’d expect maybe one brief blackout per year. The Japanese power grid tends to be a lot more redundantly laid out and with more spare capacity than in the US, where cost is the top priority.

The voltage of A/C power in Japan is 100 V compared to 230 V in Europe and 110V in the US. Western Japan (Nagoya, Osaka and further west) uses a mains frequency of 60 Hz like the US whereas Eastern Japan (including Tokyo) uses 50 Hz like Europe. Equipment sold in Japan works with either frequency, but often the Wattage rating is slightly different depending on the frequency. Japan uses two pin plugs like ungrounded US plugs and usually they’re not polarized. If equipment has a ground wire it is attached separately, not via a plug pin.

Electrical appliances purchased in the US will usually work OK at the slightly lower voltage of Japan, but the reverse is more risky. I once managed to fry a power brick for a USB hard disk which I took to the US and used without a step-down transformer (110 V to 100 V). Moving between Europe and Japan, a transformer is almost always required, with the exception of consumer electronics items that use a 100-240 V universal switched mode power supply. These days the latter category includes almost all notebook computers, digital cameras, video cameras and many desktop computers, flat screen monitors, etc.

Japan generates about 30% of its electricity from nuclear power, 7% from hydroelectric dams and the rest from fossil fuels including coal, natural gas (imported as LNG) and oil.

In recent years the electric utility companies have been aggressively promoting “orudenka” (all electric power) homes, i.e. new homes that use electricity for cooking, cooling, heating and hot water, with no propane, natural gas or heating oil usage in the house.

So called “EcoCute” heat pumps produce hot water using ambient heat and electricity. Even if they manage to provide two extra units of heat for every unit of electricity, they are unlikely to save much CO2 output compared to burning gas, as fossil fueled power plants only produce one unit of electricity for every three units of heat from burning fuel. Yes, it may be better to use a heat pump to make hot water from electricity than a simple heater element, but at the power station you’re still wasting 60-70 percent of the primary energy from coal, oil or LNG, which goes as waste heat into a river or ocean or up a cooling tower. It would make more sense to burn gas at home to heat water, instead of two conversions (from heat to electricity to heat) and transmission losses. With the current power infrastructure EcoCute is hardly the way of the future.

EcoCute would make sense only with plenty of wind, geothermal or hydro power to supply electricity without pumping out CO2 or piling up toxic radioactive waste. In reality Japan is generating almost two thirds of its power from fossil fuels. Its utility companies are sitting on piles of nuclear waste that has nowhere to go. Japan is lagging far behind other developed countries in wind power or other renewable energy sources while confidence in its nuclear industry has been shaken by several high profile accidents since the 1990s.

If you’re going to burn anything at all to make electricity (as we’ll probably have to for a few more decades), a much more promising concept is the “Ene Farm” combined heat and power (CHP) generator promoted by several gas utilities and oil companies, launched in Japan in June 2009. It’s a residential fuel cell producing electricity from hydrogen and oxygen while heating water with the waste heat. Like in prototype automative fuel cells (e.g. Honda), the hydrogen is extracted from natural gas through a process called steam reformation. A fuel cell CHP system located where heat can be used directly is about the most economical way imaginable of using fossil fuel, if you’re going to use it at all.

The biggest current drawback of Ene Farm is the high cost of the system: 3,255,000 yen ($US36,000) for a system that puts out 250 to 700 W of power and a multiple of that in heat that goes into a 200 l storage tank. A 1,400,000 yen subsidy by government does make it a bit more affordable, but still its cost needs to come way down to make it popular enough to make a big dent in CO2 emissions from Japanese homes. Its proponents are hoping to reduce the equipment cost by as much as 90% over the next decade. I hope they succeed – at a lower price it could be a killer product.

A very similar idea, but taking a different route is the Linear Free Piston Stirling Engine (LFPSE) cogeneration unit jointly developed by Infinia, Enatec, Bosch and Rinnai (a Japanese maker of gas appliances). Instead of a fuel cell it uses a Stirling engine to convert heat into mechanical motion, which via a moving coil generates electricity. The waste heat produces hot water or heats a home. First generation prototypes are being tested in Europe from 2008 to 2010, with mass production by Rinnai in Japan scheduled for 2011.