Tuesday, October 19, 2010

kernel panic - unable to mount root fs

I have a Ubuntu 10.04 desktop and one day it just refuses booting up. Here are my steps to get it going again. Please drop a comment if it helped you.

- press escape when grub is load. Choose "recovery mode" to see where in the boot process it failed. In this case it is trying to mount root and failed.
- rebooted the computer from the bootable CDrom. Chose "fix a harddisk"
- once the initial setup is completed, try to mount the harddisk as root. For me it worked.

At this point I have 3 suspects:
- grub is corrupt. I tried reinstalling grub from the CDrom and that didn't help. Moreover I have been able to change options, tried older kernels, so not likely.
- blkid or device id somehow changed. I double checked the blkid values and devices with both the grub menu and /etc/fstab and they haven't changed.
- it took a while for me but I finally did a ls -l on /boot. All the files except one was dated one day before the failure. It was also odd that there was no backup (.bak) of the file. The file was initrd-xxx. I couldn't find the documentation on how to roll back the file, so I grabbed the same file from another Ubuntu box, copied it over. Rebooted and it started working again.

I googled a lot during this process and there was nothing really helpful. My suspicion is that there was a kernel update and somewhere in the middle of the process it failed.

Thursday, October 14, 2010

Powershell set-ClusterParameter

Powershell is wonderful. That being said there are still dark corners you have to traverse through.

I need to create a Powershell script to create a MSMQ resource on a failover cluster. One of the things I need is to set the IP address using DHCP. Using the UI interface is simple, select the network, click DHCP enabled, click apply. You would think you can do the same thing in Powershell, but it has to work like this:

$clusterGroup = Add-ClusterGroup -InputObject $cluster -Name "MsmqCluster"

# create cluster IP address
$IPClusterResource = add-ClusterResource -InputObject $ClusterGroup -Name "${clusterGroup}-IP" -ResourceType "IP Address"

# find the network name
$ClusterParam = get-ClusterResource "Cluster IP Address"|get-ClusterParameter Network
$NetworkName = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,Network,$ClusterParam.Value
# have to fake an ipaddress and subnet mask
$address = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,address,""
$subnetmask = new-object Microsoft.FailoverClusters.Powershell.ClusterParameter $IPClusterResource,subnetmask,""

# have to bundle the parameters together and set the parameters in one shot
$setParams = $NetworkName,$address,$subnetmask

# now you have to enable NetBIOS before you can Enable Dhcp
set-ClusterParameter -inputObject $IPClusterResource -Name EnableNetBIOS -Value 1
set-ClusterParameter -inputObject $IPClusterResource -Name EnableDhcp -Value 1

Tuesday, September 21, 2010

longest run up

My friend is doing this crazy thing. Please support him.

Monday, September 13, 2010

Nokia 5800 settings

I called Fido and they gave all these info. I have to figure out how to put the information properly in the phone because I did not buy the phone from them.

Add a new access point under Network destinations. Do this twice (one for internet and one for wap)

Connection Name: fido wap (it can be anything I think)
Data bearer: packet data
Access Point Name (APN): wap.fido.ca
user name: fido
promopt password: no
password: fido
authentication: normal
homepage: http://fido.mobi (i need it because I use prepaid)
use access point: after confirmation (again because I use prepaid)

now go to options|advance settings

network type: ipv4
phone ip address: automatic
DNS addresses: automatic
Proxy server address:
proxy port number: 0 (8080 for internet settings)

I also find it curious that nobody talks about their $1 a day nor their $3 for a week (unlimited) data plans.

Tuesday, August 17, 2010

Hong Kong - sports part 1

I went back to Hong Kong for a few weeks. Here is a recap of the activities I have participated in.

I remembered trying water skiing when I was a teenager but do not recall any success in it. It is fashionable to do wakeboarding and we were fortunate enough to book a boat. When you have a couple of noobs trying to learn this it is truly an expensive exercise. Everything from wearing the boots that are attached to the board, setting the boarder and the boat in position, resetting after the boarder has fallen in the water. Every round takes a good few minutes for the noob to try to hang up to a few seconds of board time. Throw in a couple of noobs and the time flies by pretty quickly without any interesting action.

To make things more interesting the guy who has the most experience was not on the boat when I was. I was left with little instructions and pure speculation based on how I've seen noob snowboarders do. And I have to share my thoughts with my daughter too.

I got 4 tries on the board. I was happy to stand up on the first try. By the third try I can turn the board so I was kind of surfing. On the fourth try I was able to hang on for about 10-15 seconds which seems like an eternity.

One odd thing about this boat trip is that the water inside the harbour is rougher. We got on the boat in Central and it was a rough 30 minute ride to get out of the harbour. Once we were able to turn the corner towards Pokfulam the waves die down. I haven't been on a cruise for many years and the busy traffic inside the harbour is to blame.

Monday, June 21, 2010

Tuesday, June 08, 2010

Did you notice?

That the hockey statisticians credited the loss to Brian Boucher for game 5?

If they used baseball rules it should have been Michael Leighton.

Friday, June 04, 2010

Network Load Balancing in Windows

I am using NLB on a prototype I am working on. I have a custom process that listens to custom port and I have two Windows 2008 boxes to act like a web farm. The quick gotcha is that if my process is down but the network on the machine is still up NLB will try to distribute the network load around the two nodes. I was hoping for something a little bit smarter (like figuring out the port has not listener) but that is not the case.

Monday, April 26, 2010


For the definitions of TSS, TSB and CTL read here.

This is my second year training with a powermeter. Last year it was mostly about getting the field experience of using it, matching up the perceived effort with the real power, managing efforts so the training is effective. This year the focus drifts into looking into TSS and CTL and how it relates to racing.

Firstly instead of using number of hours as a gauge of training effort, I am trying to use weekly total TSS as a gauge. So a big week needs to have say 600-700 TSS.

A rest week would be used to reset TSB to zero without losing CTL. The point is to keep building up CTL without going overboard. Last year I got sick right around Easter time trying to do too many big training rides and took more than one month to fully recover.

CTL is used as measure for race-readiness. If I were going into a 1.5 hour road race I need roughly 130 TSS. If my CTL were below 65 chances are I would crack before the end of the race. In comparison the one-day classic races the guys are racking up 300+ TSS in a day. Not only do you have to have the Watts per kilogram to stay with the guys, you need the CTL/TSS to stay with them for the duration of the race.

Lastly I counted the number of times a ride exceeds 150TSS last year and it is less than 10. So in terms of training regime 150 is a big ride. So if my "A" race is a 2 hour race worth about 180TSS, I will have to ride a couple of big rides to get use to that level. Either that or just stick to 30 minutes criteriums. :-(

Friday, April 09, 2010

how things have changed

Back in the days when I was learning piano, I often hear my teacher play the song once or twice in the beginning, rely on your memory and your reading skills and try to play the song. I was one of the luckier guys when I was in University and can use the record (vinyl) collection in the music library to hear the music while reading the score.
Last night my son told me that we were tasked to pick a new song (list C) for him to play and the recommended composer is Rachmaninov. So I opened up imslp and search what they have. We then look for the corresponding pieces on youtube and have these great pianists playing for us. We picked prelude op 23 no 5 - something I haven't played myself.

Monday, March 29, 2010

invalid license data. reinstall is required

I have Vista 64 SP2 and Visual Studio 2008 SP1. Monday morning I got this error message when I try to start Visual Studio. MSDN recommends reinstalling Visual Studio.

Luckily the technical support guy reminded to reboot the computer first. The problem goes away.

Monday, March 01, 2010


What did I do after watching the closing ceremonies? I re-read all the emails that were sent to me from the volunteer program manager. I baffles me that 7 years or planning and executed the plan in 2 weeks. Think designing, coding and testing a system for 7 years and run it for 2 weeks and throwing it away. Imagine hot-fixing it within the 2 week period as well. Amazing.

Next thing I would do: re-read the training manual. :-)

Tuesday, January 05, 2010

GroupBy with XElement

I am working on a new project and experimenting with Linq. It is very powerful and useful however it is a paradigm change for us old geezers.

The problem at hand was an XML string that needs to be sorted by a the value of an inner node:


I want to grab a list of "b" sorted by "c".

So I tried:
var xmldoc = XElement.Load("file.xml");
var grouplist1 = xmldoc.Elements("b").GroupBy(x => x.Elements("c").Select(y => y.Value);

When I do that the key is not the value1 but some sort of IEnumerable.
Then I tried:

var grouplist1 = xmldoc.Elements("b").GroupBy(x => x.Elements("c").Select(y => y.Value);

Then the compiler complained that I cannot cast an IEnumerable to string.

The issue is that within XElement you can have multiple "c"s although we know it could not. So this finally works:

var grouplist1 = xmldoc.Elements("b").GroupBy(x => x.Elements("c").Select(y => y.Value).ElementAt(0);

Of course it assumes there is at leaat one "c" node inside or else it would not work.

Lesson learned:
(1) types are still your friend. Declaring them make things easier.
(2) Break up Linq queries into smaller function calls. You will get the right result faster. At least it works for me.
Listed on BlogShares