Recent Posts
Rolling the Dice
Last night my eldest daughter had a math homework where she needed to find a couple of dice. After thinking for a minute and not knowing where a couple of dice might be, I did what all good developer Dads do and we created a dice simulator using JavaScript. Here's what we came up with. Note the gratituous use of CSS3, and okay, I confess, I put a little more work into after she had gone to bed.
Here's why I like Javascripts truthy and falsly support.
Take an anonymous object couldBeTrue that could be null or it could be boolean true/false and you want to know if it is true.
Compare Javascript:
if (couldBeTrue) {
// do something
}
To C#:
if (couldBeTrue as bool? ?? false) {
// do something
}
// or maybe
if (couldBeTrue is bool && (bool)couldBeTrue) {
// do something
}
// or how about
if (((bool?)couldBeTrue).GetValueOrDefault()) {
// do something
}
Sometimes you're hungry and sometimes your mouth is bored. Know the difference.
Hello World
Like all good introductions to something new!
public void Main(string[] args) {
Website.Write("Hello World");
}
Starting this new site reminds me of the puppet show I watched this weekend with my kids. The writing was terrible, the puppetry was awful, it certainly didn't have the polish of say, Sesame Street, but it looked like they were having fun and I imagine someone was getting something out of it.