May 4, 2015

Book review: The boy who harnessed the wind

I like to watch TED talks. One of my favorite TED talks is about a young man named William Kamkwamba where he's describing how he built a windmill by using only scrap. Here it is:

A few days ago I found out that he had written a book called The boy who harnessed the wind - Creating currents of electricity & hope. The book will not only tell you the story of the windmill, but also how he grew up and other technical projects he had. So the windmill is just a small part of the book.
William Kamkwamba grew up in Malawi, which is a small country in southeast Africa. He grew up in a poor family and he lived in a small hut made of clay. They didn't have electricity, so he had to go to bed at 7 PM when the sun had gone down. The only option they had was to save money and pay the electricity company to install electricity, but they couldn't really afford it. Neither did they want to save the money because the electricity company in Malawi was know for its frequent blackouts.  So what's the point of first save money and then not have any electricity anyway?
When I say that William Kamkwamba grew up in a poor family, were are talking really poor. Like most families in the country, they had to grow corn so they could feed themselves. But when a harvest failed due to bad weather the entire country began to starve.
It fell upon us like the great plagues of Egypt I'd read about, swiftly and without rest. As if overnight, people's bodies began changing into horrible shapes. They were now scattered across the land by the thousands, scavenging the soil like animals. Far from home and away from their families, they began to die.
His family had saved some money, but they had to spend their last savings on food. The school system in Malawi is not entirely funded by taxes, so William Kamkwamba was forced to drop out of school. Because of the famine, only 20 out of 70 students could remain in school. Even the teachers were forced to spend their day searching for food.
Luckily, William Kamkwamba and his family survived the famine. But they couldn't afford his student fees because of a series of unfortunate circumstances, so while his classmates could return to school, William Kamkwamba was forced to remain home. 
But William Kamkwamba wanted to learn what his classmates were learning, so he decided to visit a small library. In the library he found the books Explaining Physics, Using Energy, and Integrated Science, which interested him. He had earlier wanted to learn how car engines worked, but no-one in the village knew, and he had taught himself how to repair radios. As he read the books, he learned more and more and one day he decided to build a windmill. This is how it looked like: 

Source: Moving Windmills

If he could build the windmill, it could rotate a pump for water and irrigation. This could mean that his family would never have to starve again, and he could get electricity for his home. But everything didn't go smooth. At one point, and because of the country's low education level, his neighbors wanted to tear down his windmill. The reason was that they thought it blew away the rain clouds. To not upset anyone, he had to stop the blades during the day.

May 2, 2015

Book review: So, Anyway... by John Cleese

One of my favorite comedians is John Cleese. I don't know how many times I've watched and laughed at Fawlty Towers or Life of Brian. But I haven't really known anything more about him, so I decided to read his biography called So, Anyway... written by himself.
It turns out that John Cleese grew up as the only child in a family with a mother who was a little bit crazy and the family constantly moved around in England. He explained in the book that constant relocation in childhood is often associated with creativity. Your mind will become more flexible and capable of combining thoughts and ideas in new and fresh ways. Another proof that this theory might be the truth is the entrepreneur Elon Musk. His parents divorced when he was young and he moved around the country of South Africa, and is now considered a creative genius. If you want to read more about Elon Musk, you should read my biography book on him called The Engineer - Follow Elon Musk on a journey from South Africa to Mars
But back to John Cleese. If you have watched his movies, it might be difficult to accept that John Cleese was an introvert. He was also a good student who studied at Cambridge and he was also a teacher in science, English, geography, history and Latin. He was smart and got one of the best grades in criminology after just reading the book two days before the exam. 
It was at Cambridge he started practicing comedy. After the exam he decided to pursue a career in comedy instead of law. He said that "very, very few people have any idea what they are talking about," a reference to those who said that he should work with practicing law instead of comedy. In hindsight, it turned out that it was a good decision to not listen to other people.
But the road to fame wasn't always straight. Like other skills, writing and performing comedy is not easy. What John Cleese learned was that when acquiring some skill, we don't improve gradually, like some ascending straight line on a graph; the improvements take place suddenly. After a period of not appearing to get better at all, if we just keep patiently practicing, there will be an unexpected jump up to the next level:

Plateau... jump!
Plateau... jump!

Plateau... jump!

Because writing comedy is difficult, John Cleese delivers several blows aimed at mostly British journalist who tended to sometimes write bad reviews of his shows. He explained that 
British journalists tend to believe that people who become good at something do so because they seek fame and fortune. This is because these are the sole motives of people who become British journalists.
Also, some journalists tend to write bad reviews just to get noticed. This happened after a show in Canada. The audience in Boston liked it, but when John Cleese performed it in Canada, the reviews dismissed it as a dreadful, talent-free disaster. But then someone told him that "the Canadian critics are always like that."
If you happen to be an aspiring comedian, John Cleese's best advice is to steal the idea that you know is good, and try to reproduce it in a setting that you know and understand. 
Comics steal and then conceal their loot. The fact is that it is exceedingly difficult to write really good comedy. Those who can do it possess a very rare talent.
What you also should do is to always try to improve and learn something from each performance. If you are performing the same piece night after night then you can carry out a series of little experiments, discovering what works and what doesn't. Every single night you will learn something new about the psychology of your audience. 
It will always be difficult to learn the psychology of your audience. John Cleese noticed that sometimes his audience started laughing at things no one had ever previously laughed at. Laughter is also infectious, so people tend to laugh together, but when they view the same production separately their opinions will vary more widely. It may also take time before a sketch becomes a classic. It took about five years before the "Dead Parrot" mysteriously morphed into a classic. 
Neither should a comedian try to be a perfectionist. John Cleese learned that when you stop concentrating on avoiding mistakes, you relax a bit, and consequently you will actually make fewer mistakes. The more anxious you feel, the less creative you are.

April 27, 2015

Book review: Thunder Run

I've read the book Thunder Run - Three days in the battle for Baghdad by David Zucchino. It tells the story of the first part in the battle of Baghdad during the 2003 Iraq War. The beginning of that war is a day I remember. In Sweden we used to have a mandatory military service and I was inside of a combat vehicle the night our officers told us that mainly US forces had invaded Iraq. Everyone in our unit was now worried because there was a rumor that our graduation day would be delayed because no-one knew if that conflict would spread. Luckily, that didn't happen.
What I also remember from that time was a newspaper article that tried to describe how the coalition would attack Baghdad. We had practiced urban fighting so we all knew how difficult it would be to attack a large city like Baghdad with a population of 5 million. But as time passed no-one read any more articles about the battle of Baghdad. What had really happened?
A few days ago I found the book Thunder Run and it will explain why no more articles about the battle was produced. The reason is that the mainly US forces decided to use a new strategy to invade Baghdad. The strategy was a series of so-called thunder runs.
A thunder run is a lighting armored strike and the American army has been conducting thunder runs since the Vietnam War. To protect the roads in Vietnam from ambushes, the American commanders dispatched columns of tanks and other armored vehicles up and down the roads. The vehicles moved at high speeds and fired at everything they could see.
Before the American commanders in Iraq decided to use thunder runs as the main strategy, they had the idea to clear Baghdad block-by-block with mainly soldiers while the tanks guarded the outer parts of the city. Before that strategy was called into action the commanders decided to send out a few tanks in a thunder run through the city and to the airport to test the defenses. That thunder run was successful and they just lost one tank. What if they could make another thunder run into the heart of Baghdad? So with just 970 soldiers inside various tanks and other armored vehicles, they decided to seize a city of 5 million people. The tanks made it to the center, but then all hell broke out and that is the story of the book.
The book tells the story with a high level of detail, down to the single mortar round. Moreover, you might also learn a few new things. The art of crater analysis is a technique to determine from where a mortar is fired by analyzing the crater where other mortar rounds have impacted with the ground.
It also tells the background of each solider and what the individual experienced, including a few soldiers on the Iraq side, and the psychology of war. One peculiar story is when a soldier was hit in the chest. What do you think his first thought was? The answer is that he was thinking about how difficult it would be to clean his own tank from the blood. He had been told that they would be required to turn the tank in as clean as they had been when they got them.
One downside with the book is that it only tells the story of the thunder runs in Baghdad. I believe the book should also have told the story of the previous two weeks after the invasion of Iraq. Those battles were not as intense as the battle of Baghdad but it would have been interesting to learn what happened.  

April 19, 2015

Tutorial: How to load and modify a saved animation in Blender

This will be a super-short tutorial on how to load and modify a saved animation in Blender. Let's say you are going to make an animation for Unity. You have a character and maybe two animations, one where the character is doing nothing except moving its head, and one where the character is walking. You did the "doing-nothing-animation" first and then you did the walk animation.

What if you came up with the brilliant idea that the "doing-nothing-animation" should also include an animation where the character is moving its arm. So you want to make a simple modification to that animation. You select the animation, or action which is the name of a saved animation, in the Dope Sheet window. But you will now discover to your horrors that the character is still walking, which is the latest animation you made.

What you need to do is to first select all bones and then open the animation.

April 2, 2015

Unity Tutorial: How to create a seamless audio loop without a clicking sound

Today I decided to add audio to my Tesla Simulator. The cars by Tesla Motors are powered by electricity so I couldn't find a classic engine sound I could download from somewhere on the Internet. So I had to look through YouTube videos to find someone who drove a Model S and at the same time didn't talk. That wasn't and easy task! But I found about 3 seconds of electric car engine sound, which is actually mostly sound from the air and the tires.

I imported this mp3 file into Unity and added it to the cars. But, to my horrors, the sound wasn't looping correctly and it made a clicking sound each time it looped. I made a Google search to find a solution and noticed that a lot of other people had the same problems in Unity with "Audio "click" at loop point" and "Clicking wav loops." But no-one had a good solution. 

After a few trial and errors I found a good and easy solution. What you need to do is to make your audio file "seamless", like those seamless textures. This is how it is done:
  1. Download Audacity, which is a free, open source, cross-platform software for recording and editing sounds.
  2. Open your sound file in Audacity.
  3. With the left-mouse pressed, mark the part of the audio file that will make up the entire loop. The end and the beginning audio-lines should end close to the "zero" line, which is the black line in Audacity.
  4. Copy it and paste it into a new file.
  5. Now we need to make it seamless. Mark a small part of the beginning of the audio (with the left-mouse pressed), go to Effects and pick Fade In. Then mark a small part of the end of the audio, go to Effects and pick Fade out.
  6. Go to File and pick Export Audio.
  7. Drag the exported audio into Unity and you will hopefully not hear a clicking sound each time the audio file loops!