The Best Domain-Specific Language for Manipulating Data is SQL

Motivation I’m not a fan of Microsoft’s Language Integrated Query (LINQ). But ranting about a language feature is an ineffective way to convince programmers of the merits of other techniques. So decided to construct a detailed example that illustrates how LINQ solves a certain problem, contrast it with a different technique, then highlight the deficiencies of LINQ and extol the virtues of my preferred technique. I happily set about creating a relational database and C# object model, then hit an impasse. When the time came to determine how to write LINQ code that maps the relational data into the C# […]

AES, A Stronger Cipher Than XOR

The Problem In a previous post, Encrypting and Decrypting Text, I discussed how the shared key derived from a Diffie-Hellman Key Exchange can be used with a simple cipher (XOR) to encrypt and decrypt text. I wrote a demonstration program that sends encrypted messages between a client and server, with the server knowing how to respond to funny lines from the classic comedy, Airplane! I concluded with a mysterious statement, “There’s a weakness in our simple XOR cipher that’s exposed by sending a message not recognized as a line from Airplane!” Let’s pick up there by sending a simple phrase […]

Encrypting and Decrypting Text

In a previous post, The Math That Enables Asymmetric Key Cryptography, I discussed how your web browser and a web server can establish an encrypted communication channel without requiring you and the web administrator to meet beforehand to exchange secret keys. I explained how your web browser and a web server exchange public keys, then perform math operations on their private keys and the exchanged public keys to derive the same shared key. And I emphasized the security of this technique (Diffie-Hellman Key Exchange) is guaranteed by the computational difficulty of determining the shared key from the partial information transmitted […]

Iterating over a Generic Dictionary

It can be tedious to iterate over a generic Dictionary in C#, especially if the Dictionary contains complex types. The values you’re interested in are properties of the iteration variable. I never know what to name the iteration variable (here I name it “pair”), which is an indicator this code is clumsy. Make it easier on yourself by using C#’s Tuple Deconstruction language feature. First, write an extension method for the generic KeyValuePair class. Or, instead of writing the extension method, you can add a reference to my ErikTheCoder.ServiceContract package and add a using ErikTheCoder.ServiceContract; statement. Then rewrite your foreach […]

Modifying This Blog’s WordPress Theme

I decided to host my blog using WordPress for a few reasons. Mainly because it’s mature (read “debugged”) and feature-rich. However, the most important reason may be because it’s written in PHP and I hate PHP. It’s such an unstructured, inconsistent mess. Because I hate PHP, I won’t be tempted to tinker with the code that runs my blog. I’ll focus more on the content I write for my blog, which is the entire point of blogging. That, and to focus on the thought process necessary to conceive of and produce interesting, clearly-written content. Most everything I want to customize […]