Showing posts from June, 2008

It's Raganwald's fault this time...

I just spent a day trying to write a program to solve Raganwald's puzzle (at the end of the article). Until now I thought I was a very intelligent guy. Tough :P

At least I added a few more extension methods to my tools class :)


As far as I know, I've always been a proponent of "worse is better" - I favor "cheap and bad" over "expensive and good". I don't wear brand clothing, I don't use brand appliances and I definitely hate brand computers.

The price/performance ratio is one reason.

Case A. One $100,000 computer with a guaranteed up-time of 99.9999% - that's less than an hour of downtime in a year. (I sincerely believe that any actual computer with such a guarantee would cost a lot more than that.)

Case B. Several computers with a guaranteed up-time of 90% - that's one day of downtime in ten, or more than a month of downtime in a year.

How many computers are needed to obtain the same reliability as the first system?

Well... the chance of one such system failing is 1 - 90% = 10%. The chance of two of them failing at the same time is 10% x 10% = 1% (therefore, the up-time of two cheap systems has increased from 90% to 99%). Adding a third computer will increase tha…

I used to hate the site because it doesn't have a "save the whole story" button. Which is annoying, because I want to use my ebookwise reader to read the whole book while sitting in bed, not on a chair looking at the screen.

So... at some point I got pissed bad enough that I felt like writing an application to do it. Since I don't actually have any readers for this blog :P I won't bother with documentation or anything. I've included both the source files and the executable in the archive here. (Yes, I know, I should get a domain, it's not that expensive. I'll do that if I ever decide to actually keep blogging.) [Edit] Of course, that link is no longer valid. I'll write an article about writing that app at some point.


I watched Zeitgeist the movie yesterday. Nice movie, I recommended it to a few friends for the 2nd and 3rd parts :) (Nice = it fits in with my previous beliefs, of course :P)

As for the first one... well, the whole Horus/Jesus thing is a hoax. This thread is a request by someone for actual evidence... now, the thread is huge, reading it all will take more time than seeing the movie :D, but the thing is, even Acharya's attempt at one point to substantiate her claims fails flat on its face. The conclusion - even by some atheists commenting on the thread - is that the whole thing is Massey's invention, which Acharya parrots because it sells books. (Who knew Dan Brown will practically spawn a new industry, huh?)

So... still a nice movie, and I did learn a lot even from the first part. (Yes, I have long known that the Catholic Church took over a lot of pagan holidays to make Christianity easier to swallow.)

A few helper methods in C#

Just a few methods I find myself using in a lot of projects...

publicstaticint ConvertToInt(thisstring value, int def)  {  int result;  return Int32.TryParse(value, out result) ? result : def;  }  publicstaticint ConvertToInt(thisstring value)  {  return ConvertToInt(value, -1);  }  


string s = "123";  Console.WriteLine(s.ConvertToInt());  

publicstaticvoid ForEach<T>(this IEnumerable<T> set, Action<T> action)  {    Debug.Assert(set != null, "set");    Debug.Assert(action != null, "action");  foreach (var item inset)      action(item);  }  publicstaticvoid ForEach(this IEnumerable set, Action<object> action)  {    Debug.Assert(set != null, "set");    Debug.Assert(action != null, "action");  foreach (var item inset)      action(item);  }  

I find it much more expressive to use this ForEach extension method instead of a foreach loop:

list.ForEach(item => { ... do something with item ... });  

rather than