2008-04-17

History in Zsh

Since I use Zsh with shared history, the normal history command doesn't work properly. Instead I came up with this ugly hack using cat and cut:
cm@tyst> cat ~/.zshhistory | cut -c16-40 |awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
550 ls
496 cd
322 make
224 vim
168 su
151 screen
105 ssh
91 bitbake
76 rm
58 mtn
and for root:
root@tyst> cat ~/.zshhistory | cut -c16-40 |awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
713 emerge
312 vim
247 ls
165 cd
120 screen
108 iptables
83 etc-update
60 top
59 dmesg
53 cp
Guess it's quite obvious what distro I use on my computer at home and what I spend time doing...

2008-03-09

Lies

For some strange reason studies of liars seem to pop up all over the net right now. NYmag has a long and very interesting article about why kids lie and how they learn it from their parents. Kids start as early as age 2 or 3, and the smarter the kid the earlier they start lying. Telling the truth is easy, but making a believable lie takes a lot more effort.

The always excellent Radiolab had a show last week about lies where they presented the results from several studies on the subject. They interviewed the famous psychologist Paul Ekman about facial expressions and how to tell if people are lying. The whole concept of microexpressions is fascinating. And Ekman's vow he took when his daughter was born to never lie again seems incredibly difficult to keep.

Another part of the program discusses a study Yaling Yang did on pathological liars. Brain scans of them showed that they had a lot more white brain matter in their prefrontal cortex compared to the control group, but less gray matter. The researchers believed that the huge increase in connections in the brain made lying practically effortless for these individuals and they could reply instantly with a plausible lie.

The radio show continues with a segment about a con-woman called Hope and how she used unsuspicious people by constantly lying.

People who are good at lying are generally more happy and have greater success in life. People with serious depressions are "too realistic" and seem unable to twist the truth into a brighter version. Being able to lie to yourself as well as others have many advantages even when you don't abuse it to the fullest.

I spend a lot of time thinking about how to interact with people and even more observing what people do and how they react. If I had no moral or empathy there's no limit to how much I could take advantage of peoples good will. Most people want to help and trust other peoples "good nature", but I'm afraid there's too many who don't have that in them. I'll be sure to keep my eyes open for the slightest "leakage", be it a microexpression or an inconsistency in the story. Just never let people know you caught them lying, that just makes them more careful next time and harder to catch.

This cynical post is written while listening to Billy Talent - Lies

2008-01-28

Schwartz and gllin

For some reason Andrzej "balrog-kun" Zaborowski is still missing from PlanetOpenMoko, so I'll just link to some of his recent posts instead.

Andrzej have written an ELF-loader called Schwartz that can translate OABI to EABI and his latest post shows how to use it with gllin instead of a chroot.

Very impressive! I haven't tried it myself yet, but I definitely will soon.

2007-12-19

OpenMoko Debug Board

I've had a problem with my u-boot_env since ever since I flashed a bad u-boot version in early august. The first time I tried to flash a new kernel it wrote right over the environment partition and since then I've been unable to boot without holding in AUX and use Factory Reset. Also, since the u-boot_env was overwritten I had no way to redirect the u-boot serial terminal output to USB because the limited default boot menu only includes Boot and Factory Reset.

Fortunately I managed to get my hands on a debug board. (Thanks abraxa_!) Following the instructions in the wiki I installed libftdi and started looking for an openocd ebuild. Wasn't until later that I realized I didn't need to install openocd in Gentoo at all, since it was a lot easier to use the one built by the Moko Makefile.

Next I connected the debug board to the pc but it just wouldn't show up correctly. Taking a closer look at the debug board page in the wiki I noticed I was missing kernel module. Recompile the kernel to include Device Drivers -> USB -> USB Serial Converter Support -> USB FTDI Single Port Serial Driver as a module, and after a modprobe ftdi_sio vendor=0x1457 product=0x5118 the device was detected the way it should:
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 2-1.1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT2232C
usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB0
ftdi_sio 2-1.1:1.1: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT2232C
usb 2-1.1: FTDI USB Serial Device converter now attached to ttyUSB1
usbcore: registered new interface driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver
I updated the openocd.conf according to the wiki and it started without complaints. Did a telnet localhost 4444 and was greeted by the openocd prompt. The only problem now was that I had no real clue how to proceed. I typed help in the prompt and then tried some of the commands. After a mix of a halt and reset commands the Neo1973 went black. Trying to restart from scratch I closed openocd and unplugged the debug board. That turned out to be a bad idea. After reconnecting the USB cable and restarting openocd I constantly got the error:
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Info: configuration.c:50 configuration_output_handler(): Command ft2232_vid_pid not found
Info: configuration.c:50 configuration_output_handler(): Command ft2232_layout not found
Error: jtag.c:1461 jtag_init(): No valid jtag interface found (ft2232)
Error: jtag.c:1462 jtag_init(): compiled-in jtag interfaces:
Error: jtag.c:1465 jtag_init(): 0: parport
The reason it failed was probably that the Neo was still on, but halted, and I guess that caused some trouble for the debug board. After disconnecting both devices and taking the battery out of the Neo, then starting over again it worked better.

Asked for some help in #openmoko for how to get that u-boot_env repaired and NineX suggested using the Devirginator since it had worked well for him. At that time the buildhost was down, so I tried to configure it to use my local repository instead. After about an hour or so fighting with the config file, only getting useless error messages, I got tired and gave up for the day.

At the same time as NineX mentioned the devirginator, Mike Montour put together a short list of steps in a pastebin explaining how to do it manually and my plan was to try that next time. While I was away during the weekend, moving to Stockholm, he wrote an awesome wiki page on how to do that manual Unbricking. Thanks a lot for the clear and helpful wiki page Mr Montour!

I followed the steps on that page straight through, using a mix of openocd, dfu-util and cu, I now have a Neo1973 that boots correctly. Rebuilding my Bad Block Table showed that I had a bad block at 0x00004000, the default u-boot_env address. Maybe that, in combination with an early August version of u-boot was the reason I got this problem in the first place.

The Debug Board itself is not so easy to use at first, especially when you're not really familiar with embedded things like JTAG and serial consoles. Despite that it is still very nice to have one around when you experiment with your Neo1973. If I knew this low level stuff was so much fun I would have bought the Advanced Kit from the start.

2007-11-24

OpenMoko is growing

I just took a quick look at the statistics for the OpenMoko project and it made me happy.

Currently there is 3500 revisions in the svn repository and bugzilla has reached 1022 bugs, 241 of them are still open. The wiki has 3685 pages and 6090 registered users, and maybe more impressively, projects has 1507 developers and 81 projects registered.

The IRC channel on freenode has stayed at around 320 people for the last six months and there's a lot of interesting discussions going on. It's a friendly atmosphere and people interested in the project are encouraged to drop by. Usually, they get pointed to the right place in the wiki, where most questions have already been answered. A good page to read if you want to know what is going on in the project is the Community Updates page. Right now it has not been updated in over a week, but I'm sure it will be soon.

Unfortunately, a hardware bug in power management with GTA02v4 has required a fifth revision of the hardware for GTA02. It's a bit of a shame that the release will be delayed even further, but I'd rather have good hardware later, than something broken right now.

The most interesting code changes in OpenMoko recently involves gsmd, PhoneKit(pdf) and the dbus interface to it. The dialer and sms handling is also being worked at in a furious pace by the OpenedHand guys. Since about a week, calling has worked without any problems for me. Power management has been improved and the phone should last at least a day now.

Also, some guys from Ixonos have been working on an alternative to gsmd, gsmd2. I haven't looked at the code, but they have some very nice documentation and a detailed specification. Still, lots to be discussed it seems.

The GPS binary driver is still not available for download. OpenMoko have been promised by Global Locate that they will be able to distribute it, but the legal terms are not yet set. Hopefully this will be solved soon.

All in all, a lot is going on and the software will be in pretty good shape for when the GTA02 is released.

2007-11-21

Our future climate concerns me

A few days ago IPCC (United Nations Intergovernmental Panel on Climate Change) released a document they "succinctly" call Policymakers' Summary of the Synthesis Report of the United Nations Intergovernmental Panel on Climate Change (IPCC) Fourth Assessment. It's a complete summary of all the data on climate change, densely packed into 23 fact filled pages. (The full reports are much longer.)

The summary quickly showed up everywhere in the news, even at my favorite Ars. Reading through the document does make you think about the future of our climate. 11 of the last 12 years rank among the 12 warmest years ever measured since they started in 1850. For me personally, it has been some great warm and long summers and not a negative thing. For people living in northern Europe like I do, global warming will mostly make things better. The forests and crops will grow better, warmer summers, less freezing winters. The only downside for us will be an increase in precipitation. Most places will not be this lucky.

Although the temperature will increase the most at the poles, it's the places that are already dry and hot that will get the most serious problems. Serious droughts will follow, an increase in wild fires and agriculture and livestock will suffer. That might eventually lead to malnutrition and on top of that, clean drinking water will become a problem. The number of cyclones and storms is likely to increase too, and in low coastal regions and river deltas, increased risk of flooding.

Global increase in temperature for 2099 compared to 1999

The study also expects that in the long term, if the warming continues, the ice caps on Greenland will melt completely and raise the sea level with about 7 meters. This will take some thousand years or so, but it will be a noticeable increase just in the next 100 years.



Fossil fuel is the pink fields in these graphs

The primal cause for the emission of green house gases (GHG) is the use of fossil fuels. The concentration of carbon dioxide and methane in the atmosphere is exceeding by far the natural range seen in the last 650,000 years. We need to cut down on the green house gas emissions on a global scale right now, and even using the most optimistic scenarios still points to an increase in global temperature.

A global increase of 1.5-2.5 degrees Centigrade would endanger 20-30% of the species assessed of global extinction. Most scenarios in the summary suggests a much higher increase in temperature...

If all future investments in infrastructure and energy plants are shifted to get the lowest possible CO2 emissions, the additional investment costs would be around 5-10% higher. That's not much at all, and simply increasing efficiency of energy supply and industrial processes would do a lot to stabilize GHG emissions on a global scale. It's good to see that UK is helping China to get started on this.

Maybe we have no choice in lowering our oil consumption. A recent article in Wired states that most likely we will be unable to maintain the current consumption because we just can't pump the oil up fast enough. Some says 10 years more is all we have.

My personal opinion is that oil based fuels are way too cheap. If prices were at least doubled, maybe driving around in a petrol car won't be the cheapest way to travel medium distances any more. Electric or hydrogen fuel cell cars, although still very expensive, would become a more viable option. Flying is also cheaper than it should be, and even though it's nice to be able to afford to fly away for vacation, I wish there was a less polluting option for long trips. I really do.

2007-11-10

Memory and learning

I've been thinking a lot about learning and memory lately and there's been no shortage of interesting articles to read or videos to watch.

Over at wondr.net Jamin has started his Memory Month. He posts a new article every day, teaching you useful tricks for remembering everything from shopping lists and numbers to names of people you've just met. These methods will probably work great, but I'm to lazy to really sit down and do it since there's so many other things distracting me right now.

I don't believe in the old myth that humans only use 10% of the brain, but I do believe that there's a lot about the brain we don't understand at all yet, and maybe we never will. At Google Video they have some very interesting documentaries regarding the brain, for instance this documentary from Channel 5 in 2005 about Daniel Tammet or this one about Kim Peek. These savants have enormous counting skills huge memory capacities, but the brain power comes at a price. From mild autistic tendencies like Asperger's to completely anti-social autistic behavior.

It's been noted that these types of disorders are getting more and more common, especially in academic families and it's even been called The Geek Syndrome by Wired. The latest studies says that something between 3 and 20 genes are involved in causing these disorders. Incidentally this also seems to affect maths and science skills in a positive way. Abnormalities in the cerebellum, the "little brain" responsible for motor control and filtering sensory input and passing it on to the right part of the brain, is common in autistic persons. Kim Peek for instance, has a damaged cerebellum and no corpus callosum, the connection between the two halves of the brain, at all.

The brain is a pattern matching machine and it seems to me like it's automatically filtering the continuous flow of information washing over us, but if it's not filtered enough the person might be classified as slightly autistic. If the brain filters too much, parts of it just doesn't get used enough and will dwindle away. Of course this is an overly simple way of looking at it, but I'm certain it's a part of the puzzle.

I'm also convinced that the brain is a lot more flexible than people used to believe, even in grown ups. New born babies have twice the number of nerve cells they need, but the ones that aren't used just dies off. Usually this happens in two periods, first at a young age, then again around puberty. But the brain is not "frozen" after that at all. A recent study on mice shows that the nerve cells move around and stretch "in a highly dynamic fashion".

It's never too late to learn something new, but I think it's harder to really focus on learning just one thing when you're grown up compared to when you're still a kid. There's just too many things to think about and too many distractions, and so much interesting to learn.

Wish I didn't have to sleep so much, but a completely unscientific experiment on myself made me notice that when I sleep less then 6 hours per night, my memory isn't as good as it usually is. Things just don't stick. Also, I've noticed that I remember things I read in the evening better than the things I read in the morning. I imagine that my brain is working through the input from the day while sleeping, trying to keep only the seemingly important memories.

It's getting late, I'll go read a book.

Update: Great article about memory in National Geographic

2007-10-18

OpenMoko progress

I have had my Neo1973 for three months now and the software is finally getting usable. There were a lot of changes during August, the totally new theme and a lot of updates to the kernel and low level libraries. I had the first successful "out of the box" call with OpenMoko using a build from ScaredyCat in September 3:rd, but after that things started to go bad. The daemon handling communication to the GSM modem was more or less broken for a month and calling did not work out of the box for quite a while. That was if you even managed to get the rootfs built. WebKitGtk failed to build almost every time, and so did many other programs too.

This happened for many reasons, mostly because the understaffed development team had to focus on the hardware for GTA02 to iron out all serious bugs, and also because some of them finally had some well deserved vacation.

Despite these issues, the first batch of Neo1973's sold out quickly. A second batch was produced during late September and more people got their hands on the GTA01 phones in early October.

Trolltech also published an image for the Neo1973 and it worked really well. Even managed to use up the rest of my prepaid sim card calling friends.

Since then things have really sped up again. OpenMoko hired XorA to manage OpenMoko in OpenEmbedded and take care of build issues and bitbake recipies. This quickly made a big difference when it comes to getting the complete OpenMoko distro to build. Also, WebKitGtk now compiles more often than not and the default build has seen a several additions. It now includes the openmoko-browser2 based on WebKitGTK. The browser is a bit unstable still and the design is awful since only about 50% of the screen is used to display the actual web page you're browsing.


Also the media player has gotten a face lift and is becomming usable, with the exception that the mp3 decoding library is not yet optimized for the Neo. There's some usability issues still, like that the volume slider is difficult to control with your fingers only, and how you add files to the playlists.


The manufacturing of the second hardware revision of the Neo1973 is just about to start and hopefully all eager developers can get hold of a GTA02 before Christmas. If I didn't have a GTA01 already I would probably wait for the GTA02. The WiFi and faster processor would surely be nice to have. Of course bigger flash disk, the accelerometers and the graphics accelerator are nice too. In addition to that, the AGPS chip has changed to U-blox. (For a comparison of the two revisions of the phone, look here.)

Talking about that, I really hope that Broadcom will release an EABI driver for the Global Locate chip in the GTA01. Since Broadcom bought Global Locate it's been awfully quite about the GPS and even if you can get the old driver working in a chroot, it's a shame it takes so much effort. There's also no applications what so ever for using the GPS either. Not beyond a few shell scripts at least.

2007-09-19

Science and Nature Writing

I just finished reading The best American Science and Nature writing 2006. This is the seventh version of this book series and I definitely wish I had found out about it earlier. Each book is made up of about 25 articles that a guest editor selects from about a hundred articles chosen by Tim Folger.

The 2006 edition is edited by Brian Greene who just happens to be one of my favorite physics writers. The articles span everything from bittorrent and blogs to animal psychology, anthropology and advanced physics. Coming from sources like Scientific American, The New York Times and Wired, most articles are easy to read and don't get detailed to the point of being boring. I had actually managed to read some of the articles already, but the others were a great way for me to be introduced to areas of science I knew very little about.

Some of my favorite articles are Dr Ecstasy about the chemist Alexander Shulgin, His brain, her brain about the differences between the male and female brain, and The coming death shortage describing how the increasing life expectancy of humans will affect us.

I encourage everyone interested in widening their scientific horizons to read this book. It's only 280 pages long and reading one chapter per night before falling asleep was perfect. 9 out of 10 points for this book from me.

2007-09-06

NerdTests.com

I remember doing this nerd test in 2005 and got the following result:

NerdTests.com says Supreme Nerd.  What's your score?  Click here!

Noticed on a blog that they had a new version of the test and of course I had to take it. The questions are funny and after answering them as honestly as I could I got:

NerdTests.com says I'm a Nerd God.  What are you?  Click here!

Hmm... Not sure what to say about the score, but at least I'm not a dumb awkward dork. :-)