Tuesday, April 29, 2008

Why reinvent the wheel again and again?

Reading this post "Get that job at Google" on Stevey blog's made me wonder why we always reinvent the wheel in the software industry.

At one point he says the interviewers usually ask to implement a well known basic algorithm (tree, sorting, ...). Why?

Do they expect that rooting learning existing algorithms makes a good programmer?

Said differently: Do you really ask a Chief how to build pans, knifes or an oven? Wouldn't it be better to test if he is able to select appropriate ingredients or use bad ingredients to make tasty dishes?

As most of us I studied how sorting, hashtable, trees and other statistics methods where implemented. And I quickly realised that only very few mathematical genius would be able to ameliorate them hence I forgot how to code them as soon as possible to leave place for useful stuff.

Such as which of the available implementations (Boost::graph, Poco, std,...) is the best in a cross-platform implementation, which one is thread-safe, which one is fastest, etc.

Anyway very informative post.
I wonder how much time he uses to write those rants :)

PS: If I made interviews one of my question would be to use so-called "advanced" statistical methods to prove a relationship among data then change the chosen method parameters to disprove it!

Cpu usage going to 100% when pc idle

Since months each time I let my pc idle it would go in idle mode. Nothing special here.

However some process was doing something in the background when my pc should have been idle. This didn't bothered me because each time I used my pc again this process would stop. Hence I thought it was a "normal" Windows process doing some small maintenance.

Recently I began to have doubts.

To pinpoint the problem I used the excellent free must-have tool ProcessExplorer. (At least grab it before Macro$ begins to charge for it ;)

After lauching ProcessExplorer I waited until my pc got idle and this mysterious process began (= gone taking a cup of coffee). When I cam back it was running so I looked at ProcessExplorer and saw that it was a SVCHOST.exe running at 80-100% cpu!! Ouch!

That's much badder than I thought but strangely the pc didn't seem to heat so much - hence the fan didn't turn like mad and the reason it didn't realise the problem sooner.

ProcessExplorer told me numerous services are associated with this SVCHOST and my suspicion quickly turned to the "System Restore Service".

Some browsing helped me found this trick which indicate that some infinite loop was happening:


  • Open a dos shell window. By clicking “Start/Run”, type in “cmd.exe” and hit enter.
  • Stop the Windows Management service: "net stop winmgmt"
  • Delete the Repository folder: "rd /s /q c:\windows\system32\wbem\Repository\"
  • Restart the Windows Management service: "net start winmgmt"
  • Recompile all the "Managed Object Format" files (*.mof,*.mfl):
  • a - "cd /d c:\windows\system32\wbem\"
  • b - "for %i in (*.mof,*.mfl) do Mofcomp.exe %i"
  • Verify the folder "c:\windows\system32\wbem\Repository\" has been recreated. If not, restore your system and try again or look for another solution. :-)

This trick worked for me.
I should have done this a long time ago.

I didn't need to try this other trick: "Problem with High CPU Usage with SVCHost.EXE : cpu, usage, high".

If none work for you you will probably need to use ProcessExplorer and stop one-by-one the programs linked to the SVCHOST.exe to find the culprit and decide either to leave it stopped or correct it by reinstalling it.

Also don't forget to update you anti-virus, spyware etc as it could be a corrupt service.

Good luck

Tuesday, April 8, 2008

Open source 3D printer !

Rahh... this is such a cool project I can't resist making some publicity for it.

RepRap is short for Replicating Rapid-prototyper. It is the practical self-copying 3D printer shown on the right - a self-replicating machine.

I hope I find time to build it with my children :D