January 28th, 2004
Perhaps you’d have noticed the new colors and a slightly changed layout.
Is pink too effeminate? Think the color palette is garishly eye-blinding? Do your eyes bleed from the white background?
January 25th, 2004
… short-circuit evaluation is how the logical human brain works when confronted with chained boolean conditionals in real life
Having to pick up VB.NET for a Human Computer Interaction course this semester, I’ve been spending some time getting acquainted with the language through a couple of books. Every now and then I get somewhat bemused by how “different” VB syntax is - not that it’s a bad thing, pray. Syntax, as almost everyone agrees, is secondary to semantics.
Anyway, here’s a particularly bemusing bit of trivia you can use to taunt/jibe/provoke your VB.NET/VB programmer friends.
Did you know that VB.NET’s default boolean operators And and Or do not take advantage of short-circuit evaluation? Take for example this snippet of conditional code below:
Dim x as Integer 1
If (x < 5) Or (x > 10) Then
Now, you’d expect your run-of-the-mill compiler/interpreter to optimize by short-circuiting the 2nd boolean expression, since the 1st expression is already true (and so whether the 2nd boolean expression is true or false doesn’t really matter). For some reason, probably one steeped in history, VB.NET, or rather the JIT compiler, doesn’t short-circuit. It happily goes ahead and evaluates the 2nd boolean expression.
This is logically ludicrous - short-circuit evaluation is how the logical human brain works when confronted with chained boolean conditionals in real life. If the university says I can only get a First Class Honours degree if my CAP is greater than 4.5 AND get a minimum of A- for my thesis, I won’t really fret about not getting an A- for my thesis (and subsequently missing out on a yummy First Class Honours) when my CAP can never hit 4.5.
Now to be fair, there is an alternative OrElse operator which does perform short-circuit evaluation. It is not fair though to expect such an unorthodox operator to be something your common on-the-street (read: non-VB) programmer will expect to exist (unless he reads a VB.NET book and bothers to flip to the introductory chapters).
Come to think of it, it could be an intended design issue. Evaluating the 2nd boolean expression could be always warranted when it produces a side effect. That must be the reason why Microsoft introduced the OrElse and AndAlso operators and leaving the standard And and Or operators as non-short-circuiting to prevent confusing converting VB programmers.
So this then is actually an issue with VB. Hence, we can conclude that they deserve to be taunted/jibed/provoked. Spare the VB.NET programmers. For now.
January 25th, 2004
Teach Yourself Programming in Ten Years is more realistic. That just about sums up why I was never bought by the enticing promises of “Teach Yourself X in Y days” and “Learn X in Y hours” books.
January 22nd, 2004
Check out the 1st post in this discussion forum thread. It’s in Chinese but the pictures speak for themselves. 20 hours was how long it took, but check out the hair on the girl and the fur on the dog. Unbelievable.
January 22nd, 2004
Pure CSS tooltips by SantaKlauss shows you how to display tooltips using purely CSS. The idea is not unlike Nice Titles, though the execution is very different - Nice Titles uses the DOM to extract the nicetitles, the tooltips use only CSS.
The smart part is when printing: the tooltips are “inlined” and bracketed appropriately so that they show up in the normal flow of the document when printing.
Still, I consider the execution to be semantically incorrect since the tooltip requires the anchor tag <a> to work - the text that is “tooltipped” is not an anchor. A better way would have been to use a standard <span> tag. Of course, this then breaks in IE because IE only supports the :hover pseudo-class on the <a> tag. Thanks to whatever:hover, however, this can easily be fixed. Also, there seems to be no need for the z-index fix as mentioned (tested on IE/Win 5, 5.5 and 6). The CSS is below:
body {
behavior:url(/htc/csshover.htc);
}
span.info{
position:relative;
background-color:#ecc;
color:#000;
text-decoration:none
}
span.info:hover { background-color:#e96 }
span.info span.tooltip { display: none }
span.info:hover span.tooltip {
display:block;
position:absolute;
top:2em; left:2em; width:15em;
border:1px solid #0cf;
background-color:#cff;
color:#000;
text-align: center
}
Here’s an example.