Bob the Giant Slayer

30 03 2013

One of the nice things about living in Israel is that you get to see many of the places mentioned in the bible. When taking youth movements on hikes it’s customary to say stuff like “On this rock Jacob sat down to tie his laces while running from Esau” or “Saul peed behind this tree”.

We live about 20 minutes from the Valley of Elah and one time while driving through I remembered that the kids have been watching some biblical cartoons so I told #1 (about four years old at the time)

You know, this is where David fought Goliath 

Was David real? He immediately asked

Yes replied both his parents.

He then mulled it over for a bit and asked “Is Bob the Builder real too?”





Extending the family metaphor

27 02 2013

The metaphor of family is everywhere in programming. We have parent and child processes, HTML has parent nodes whose child nodes are all siblings. The fact that in all these cases there is only one parent who apparently produced its offspring by some sort of asexual[1] reproduction fits nicely with the common conception of programmers’ social skills.

The metaphor of family is often extended, if a process’s parent process terminates before its child you get an orphan process (not to be confused with zombie processes), a process can inherit handles from its parent and so on.

I recently run across a family relationship which was new to me. When traversing the windows of IE10 I found a window whose parent had no children. Here is the window hierarchy of an alert dialog in IE10:

Window hierarchy of IE10 alert window

We can see that the alert dialog is a top level window with a parent which is also its sibling (said parent has no children).
I don’t usually muck around with HWNDs so I don’t know how rare this kind of thing is and I’m not sure how it fits into the family metaphor. On the one hand this window is a sibling of its parent so perhaps it’s an incestuous window (I’m not sure exactly how this would work in the context of asexual reproduction), on the other hand its parent disowns it so I think perhaps the best name for this window is a bastard window.


[1] I hadn’t realized there were so many different kinds of asexual reproduction.





The Carpet Rule

26 01 2013

I spent my professional life working in only two places, in both of these companies a Carpet Rule was available to protect people’s coffee breaks. Simply put the carpet rule states that:

Work may be discussed only in carpeted locations.

The rule is based on the fact that work areas tend to be carpeted while kitchenettes, cafeterias and, not to put too fine a point on it, toilets are typically not carpeted.

The way the carpet rule is invoked usually goes like this.

Alice and Bob are on a coffee break when Charlie approaches.

Charlie: Hey Bob, what’s the status of the bug I assigned you?

Bob: I’m sorry, do you see a carpet here?

The Carpet Rule has many sub clauses and exceptions (one can discuss programming as long as it’s not directly related to work and one can opt-in to a work discussion) but it is there if you need it.

I became aware that this rule is not universal and tried to add it to the font of all human knowledge but the deletionists would not have it[1].

Now the fact that 100% of the places I worked had this rule cannot be used as an indication to the fact that it is indeed ubiquitous especially due to the fact that the two people most responsible for enforcing this rule are myself and the rule’s inventor whom I head-hunted from our previous employer…

Your mission Internet, should you choose to accept it is to adopt the Carpet Rule in your own place of employment for the greater good of coffee beaks everywhere!


[1] This isn’t the only time I was thwarted by Wikipedia, when another cow-orker and I started the  Jews in Space wiki page it was quickly renamed to be List of Jewish Astronauts  :(





Time capsule for 2112

12 12 2012

On 12/12/1912 Abraham Alfons Lanzkron sent his 9 year old son Lazarus a postcard.

Front of the postcard from 1912

Front of Postkarte

Back of postcard from 1912

Back of Postkarte

One hundred years later, Lazarus’s son Abraham (AKA Romy) Lanzkron emailed the scanned postcard (or postkarte it you prefer) to his son (that’s me).

In a hundred years my children will be over a century old and my grandchildren will probably be grandparents (if the next mass extinction event doesn’t get them first) so I’m depending on you – my future great-grandchild – to do the correct thing on 12/12/2112.

I don’t know what the preferred method of communication will be in the 22nd century but I’m pretty sure it won’t be Facebook (look it up if you don’t know what Facebook is). Hopefully the internet will survive in some way or form and this message will reach its mark.

Good luck from 2012, your ancestor.


For those of us who don’t speak German here’s a translation, thanks Oskar.

A postal –curiosity

For   the
12-12-1912
———

Oh people look at this card

And read on this place

The 12- 12 has arrived today

One could call it a Postal – Curiosity

Because a 100 years is a long time

And no one will live so long

But take this card with you

Because it will be desired by all

,
Copyright Ernst Katzenstein, Hamburg 36.Caffamacherreihe29

Postcard

Mr.

Lassar Lanzkron

Here (Hamburg)

Rutschbahn 26/2


Full disclosure: This post pre-dated a couple of days to appear to have been posted on 12/12/12.





A Protocol for Communication with Aliens

5 11 2012

A few months ago some of my cow-orkers tried to send a distress signal to the outside world:

Pac-Man rendered with Post-it notes

Before long we got a reply from the building across the street:

Space Invaders

This was proof positive that there is intelligent life out there, the only question was how to communicate with it. The best minds[1] were put aside to build a communication protocol and the result didn’t disappoint.


[1] While lesser minds like my own were reserved for the more tedious task of doing some[2] actual work.
[2] For infinitesimal values of some.





Life the Blogosphere and Everything

27 10 2012

Today is the third anniversary of my first blog post. I must admit I’m a bit surprised that I managed to last so long. Not letting the lack of anything to say get in my way was a big help (case in point, this post).

I also see that I managed to pass the one or two posts goal I set myself, if fact according to WordPress I’ve reached a very significant number of posts. In honour of this occasion I would like to tell you a little story.

Back when my first born was almost four I was searching the internet for a colour-in picture of a horse for him (this was his horsey stage). He suddenly recognized an alef (א) which is the first letter in his name. So I opened up vi notepad and let him type in a few alefs. I then remembered that he’s picking up the numbers too and asked him which numbers he knows, well the digit he knows best for some reason is four so he typed that in. I then I asked him what else looks familiar and he typed in a two too.

<DrumRoll>
The first number my son ever typed was 42 !!
</DrumRoll>

The inner geek in me was soooo proud.





Use of dynamic causes trust issues between developer and compiler according to anonymous blogger

22 10 2012

I do most of my work in C++ and have a bit of an abusive relationship with my compiler. It yells long error messages at me at the slightest  provocation and I do my best to placate it. In return I gain a sense of security that “If it compiles it’ll (probably) work”[1].

I used to have the same sort of relationship with my C# compiler (only with less error messages) but lately I’m beginning to have some trust issues.

It all started one day when I was refactoring some code to use regular expressions (the types have been changed to protect the guilty).

string pattern = "needle";
/* Snip N lines */
System.Console.WriteLine(haystack.Contains(pattern));

This code needlessly matches “needlessly”, well that’s simple enough to solve, I’ll just replace pattern with a regular expression including word boundaries:

Regex pattern = new Regex("\bneedle\b");
/* Snip N lines */
System.Console.WriteLine(pattern.IsMatch(haystack));

It compiles, ship it!

After all the buildup it should not be awfully surprising that the code in question is not shipping quality. At runtime it throws an exception saying it can’t cast a string to a Regex.

When expanding the N lines in the above code I see this:

if (someCondition)
{
    dynamic obj = GetDynamicObject();
    pattern = string.Format("{0}:{1}", obj.value, pattern);
}

Why the hell does this compile[2]? It’s obvious that String.Format always returns string which is incompatible with Regex!

Well actually it isn’t, String.Format doesn’t always return string. dynamic is contagious, any function that is called with at least one dynamic argument will return dynamic, thus dramatically lowering the value the compiler has as an error detector.

In fact if you’re in the habit of using var whenever possible you may be helping to spread this contagion. Previously we thought that writing type names is redundant and the following lines are equivalent:

string s1 = Path.Combine(directory, file);
var s2 = Path.Combine(directory, file);

Some would even prefer the second line saying it’s redundant to tell the compiler something it already knows, but if one of the variables you send to this (or any other) function is of type dynamic it will infect s2 with its type and so on transitively.


[1] This is hyperbole of course, what I mean is that I expect the compiler to catch all type errors.
[2] In real life it was worse, the string.Format had several arguments only one of which was dynamic and this declared many lines above the offending line.








Follow

Get every new post delivered to your Inbox.