Archive for the ‘Tech’ Category

CruiseControl.NET and other open source stuff

12:49 PM

Recently I’ve spent some time setting up a CruiseControl.NET instance for our internal projects. Using this project, we have an automatic and immediate feedback whether our checkins work without having to waste developer time waiting on the full unit test suite.

To improve response times of the server running CC.Net while integrating, I’ve applied the ProcessPriority patch from CCNET-504 and now run all processes at BelowNormal. Now there is no noticeable impact on other services on the server while a build is running. Since the patch didn’t apply cleanly to the newest CC.Net version, I updated the patch to current HEAD and posted it in the bugtracker. Thanks to Craig Sutherland the patch is now applied in the HEAD and will be released with 1.5. Having already wet my feet, I proposed a refactoring for the Tasks to move all common properties to the BaseExecutableTask class, thereby removing ~300 lines of code and unifying the diverse set of properties currently in the wild. This will have to wait for the next release in order to not interfere with a timely 1.5 release.

Currently CC.Net builds the projects from subversion, runs all unit tests with NUnit and checks code quality with Gendarme.

While integrating Gendarme in our build process, I found and reported two bugs in the rules, which triggered false positives on our code. Thanks to Sebastien Pouliot both appear to be already fixed and slated for release with the next Gendarme (2.8).

MSSQL doesn’t (completely) support IEEE754 floating points

12:00 PM

After looking for quite a while (it is unbelievable, no?) I have to accept that Microsoft’s SQL Server 2000, 2005 and 2008 do not fully support IEEE-754 floating point numbers. Specifically NaN (Not-a-Number) and +/- Infinity are not allowed. While the 2000 Server seemingly allows such values to be inserted, but breaks badly afterwards, the newer versions disallow inserting such values. Here is the MS Connect article requesting the feature. There is also the documentation about float data and a read-between-the-lines hint in the documentation for XPath numbers. The article describing floats is very circumspect about this:

The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.

[emphasis mine]

The XPath article states it clearly:

However, float(53) is not exactly IEEE 754. For example, neither NaN (Not-a-Number) nor infinity is used.

.

For completeness, here’s a little review about other DMBS’ support for NaNs and Infinity:

Android development FAIL

04:25 PM

After installing the Android 1.5r3 SDK and Eclipse 3.4 with the matching ADT plugin, I soon encountered this error message:

[2009-10-16 15:02:09 - ddms]Failed to reopen debug port for Selected Client to: 8700
[2009-10-16 15:02:09 - ddms]Address family not supported by protocol family: bind
java.net.SocketException: Address family not supported by protocol family: bind
	at sun.nio.ch.Net.bind(Native Method)
	at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
	at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
	at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
	at com.android.ddmlib.MonitorThread.reopenDebugSelectedPort(Unknown Source)
	at com.android.ddmlib.MonitorThread.run(Unknown Source)

[2009-10-16 16:29:40 - ddms]Can't bind to local 8600 for debugger
[2009-10-16 16:30:14 - ddms]Can't bind to local 8601 for debugger
[2009-10-16 16:30:14 - ddms]Can't bind to local 8602 for debugger
[2009-10-16 16:30:15 - ddms]Can't bind to local 8603 for debugger
[2009-10-16 16:30:25 - ddms]Can't bind to local 8602 for debugger
[2009-10-16 16:30:25 - ddms]Can't bind to local 8606 for debugger
[2009-10-16 16:30:25 - ddms]Can't bind to local 8607 for debugger
[2009-10-16 16:30:25 - ddms]Can't bind to local 8610 for debugger

As it turns out, the debugger tries to connect to “localhost” which is resolved by Windows Vista via the Windows\System32\drivers\etc\hosts file, which contains the IPV6 address “::1″. Since Android’s IPv6 support is still under development, none of the development tools can cope with it, resulting in above error messages.

Substituting the IPv4 127.0.0.1 as localhost address made it work fine.

Floating point adventures

12:27 PM

Using == to compare floats and doubles is not only problematic when dealing with numerical precision, but also when dealing with NaNs: In C#, the equals-operator returns false when comparing NaNs. If NaNs shall compare equal (e.g. when suppressing PropertyChanged events, as I’m doing), use Double.CompareTo(double). The IComparable<> interface requires that A.CompareTo(A) always returns zero and therefore does correctly (for this case) work with NaNs and +/- infinity.

Minor note on ‘dd’ write performance

11:12 PM

Today I was cleaning out some old logical volumes. Since they resided on rented harddisks, I chose to overwrite them with zeroes to avoid leaving data tracks on someone else’s disks. The first thing that came to my mind was this:

dd if=/dev/zero of=/dev/vg/lv

(more…)

Virtual ethernet cable with OpenVPN

01:30 PM

Because it was so easy, here a little HOWTO describing the simplest OpenVPN setup: connect two servers with a virtual, encrypted ethernet cable:

/etc/openvpn/cable.conf:

local [IP1]
remote [IP2]
port 1194
proto udp
dev tap
secret cable.key
keepalive 10 120
comp-lzo
persist-key
persist-tun
status cable-status.log
verb 5

# openvpn –genkey –secret /etc/openvpn/cable.key
# /etc/init.d/openvpn start cable

Windows 7 x64 32 Bit ODBC

05:44 PM

[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

If you need to create a ODBC Datasource for 32 Bit Applications under Windows 7 x64 you have to use C:\Windows\SysWOW64\odbcad32.exe. More info can be found in this tutorial.

Windows 7 OpenVPN

05:21 PM

Successstory: OpenVPN Build 2.1_rc19, released on 16.07.2009, successfully installed on Windows 7 x64!

Mysterious data changes

04:36 PM

This error has cost me almost two days to debug:

Conditional Breakpoint

Its only symptoms where spurious but widespread changes to a single property. While this is “obviously” human error, these “easy” points would have mitigated the damage done:

  • strict type checking: the expression is of type string and not of type bool, the C# compiler would have known the difference and issued an error
  • in-band evaluation: The expression didn’t trigger breakpoints within the MethodName property. This would have pinpointed the cause of the data change immediately
  • constant vigilance!

Puppet Module Repository Beta

03:08 PM

Finally! Luke and I took out a minute and hashed up a scheme to get the ball rolling on a central one-stop-shop for puppet modules.

Let me quote the pertinent part from Luke’s mail:
(more…)