F#: Detecting the CPU architecture

If you google for methods of detecting the cpu architecture, you’ll find lots of pages about how to use WMI and ManagementObjectSearcher. This is an immensely slow operation which takes more than a second to complete (at least when I’ve timed it on a 2.8 GHz 4 core machine), so don’t use it. A quicker method is to use PInvoke to call the GetNativeSystemInfo function of the Windows API directly.

Read more

Compatibility between 32-bit, 64-bit and “Any CPU” .NET assemblies

I couldn’t find any decent .NET platform target compatibility chart, so I made one:

.NET platform compatibility charts

Read more

Now it’s confirmed – Attachmate really did axe Mono

A rumour that Attachmate fired the Mono team has circulated around the net the last two weeks, but there has been some uncertainty as Miguel de Icaza’s blog remained silent on the subject. To add to the confusion, a few tweets here and there from Miguel and others, suggested that things weren’t as bad as they were rumoured to be. Alas, things are just that bad, as was to be expected. Miguel wrote about it in his blog yesterday.

Read more

.NET RSAParameters endianness

Ever had to access or set the RSAParameters structure’s fields? Well, if you do, you will find that the MSDN documentation on them doesn’t specify their endianness (byte order). Googling isn’t too helpful either, as I found different sources claiming different endianness. So, I wrote a little test in F# that shows that the RSAParameters fields are indeed big-endian.

Read more

F# values, functions and a little bit of both

Judging from a few questions on stackoverflow and hubFS, programmers new to F# sometimes confuse value assignments with functions that don’t take arguments. This confusion is easily straightened out. In fact, it’s so easily straightened out, that it’s not really enough for a blog post. Thus, we spice things up a bit by letting the value assignment assign a function value, and throw in closures and something about the practical differences between stack and heap values for good measure.

Read more

F# ASCII85 module

Sometimes, you need to store binary data in places where only text data is welcome, such as XML files. The quick & dirty solution is to code your data into hexadecimal strings, which you can easily get away with when storing a few bytes. However, sometimes you want better space efficiency and this is where ASCII85 comes to the rescue.

Read more