Five-Dollar Words for Programmers, Part Two: Orthogonal

In geometry, “orthogonal” basically means the same thing as “perpendicular”, or “at right angles”.  The walls are orthogonal to the floor. But algebraists extend the meaning of “orthogonal” beyond mere perpendicularity; to an algebraist, two aspects of a system are orthogonal if one can be varied without changing the value of the other.  Imagine for…


Five-Dollar Words for Programmers, Part One: Idempotence

Programmers, particularly those with a mathematical background, often use words from mathematics when describing their systems. Unfortunately, they also often do so without consideration of the non-mathematical background of their colleagues. I thought I might talk today a bit about the word “idempotent”. This is a very easy concept but lots of people don’t know…


Do not use string hashes for security purposes

A recent question I got about the .NET CLR’s hashing algorithm for strings is apropos of our discussion from January on using salted hashes for security purposes. The question was basically “my database of password hashes doesn’t seem to work with .NET v2.0, what’s up with that?” To make a long story short, the answer…


FYI, C# 2.0 Has A Breaking Change in Enum Subtraction

A customer brought to my attention the other day that the C# 2.0 beta release has a breaking change from the previous release. Namely, this code enum E : byte {  A = 1,  B = 2}; // . . . E a = E.A;E b = E.B;int j = a – b; sets j…


Another C#/LINQ chat, Thursday 1300h Pacific Time

The last chat we had just after PDC was a virtual mob scene. We had hundreds of questions, way more than we could handle in the short time that everyone was available. Now that you’ve all had some time to absorb some of the new stuff coming up, we thought that we’d have another opportunity for you…


Resolving ambiguity in C# param passing

Here’s a question I got recently about parameter arrays in C#. Suppose you are designing a method and you know that it is going to take some small number of values, but you’re not sure how many.  For example, consider what I call the “madlib” formatting functions: Console.WriteLine(“{0} love my big sphinx of {1}”, bird, rock);…


Checking For Script Syntax Errors, This Time With Code

A number of people asked me to clarify yesterday’s entry. Rather than try to talk you through it, I think the code is straightforward enough to speak for itself. Here’s a little skeleton that I just whipped up. #include <stdio.h>#include <activscp.h>#include <new> const GUID CLSID_VBScript = {0xb54f3741, 0x5b07, 0x11cf, {0xa4, 0xb0, 0x00, 0xaa, 0x00, 0x4a, 0x55, 0xe8}};const…


Checking For Script Syntax Errors

A reader asked me recently whether there was a way to check a chunk of JScript or VBScript for syntax errors without actually running the code. I’m sure that there are many third-party tools which you could find that do this. If you have your own script host, you can do it yourself quite easily….


Local variables considered not very harmful

Like I said, that code from last time was just test code, not real production code. Though clearly it works, I’d never write code like that in a million years. I’m not thrilled with the way it uses the answer variable of the outer scope as an accumulator, and it is profoundly weird that the “do…