Regular Expressions From Scratch, Part One: Defining Terms

Over the years that I’ve been writing this blog some of the most positive feedback I’ve received has been for those entries where I’ve explored fundamental concepts in computer science. I thought that I might take that to its logical extreme, and do a series on what exactly a “regular expression” is. Most script developers…

18

Why are base class calls from anonymous delegates nonverifiable?

I’m still learning my way around the C# codebase – heck, I’m still learning my way around the Jscript codebase and I’ve been working on it for nine years, not nine weeks. Here’s something I stumbled across while refactoring the anonymous method binding code last week that I thought might be interesting to you folks….

18

Why Can’t I Access A Protected Member From A Derived Class?

A question I got recently was about access to protected methods from a derived class. Clearly that’s what “protected” means – that you can access it from a derived class. In that case, why doesn’t this work? class Ungulate {  protected void Eat() { /* whatever */ }} class Giraffe : Ungulate {  public static…

9

How to make little girls scream like… well, like little girls

[No technology today, so if you’re only here for the witty banter about programming languages, skip this one.] Leah and I spent the week before Halloween volunteering at Nightmare At Beaver Lake, a haunted-house-style attraction that runs along the trails in Beaver Lake Park, just on the other side of Lake Sammamish from Microsoft’s main…

7

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…

21

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…

20

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…

11

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…

16

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);…