Wednesday, February 27, 2008

Huh. Mono Just Works.

So I continue work on a project which I want to write in .NET but needs to run on Red Hat Enterprise Linux (an ancient version, I'm sure) and Vista. And my home computer is a Mac. Surely this is a recipe for Mono.

I started gingerly, programming in Visual Studio 2005 and building comprehensive unit tests. I run them with Test Runner or NUnit directly in our automated build. Fine.

Then I got a little braver. I installed Mono on our Linux machines. (Long story, actually, and not very amusing. It had to be compiled from source and one of the source files edited because this version of Linux is so old some of the thread functions now have different signatures. But never mind.) Not wanting to jump in whole hog, I simply copied the compiled DLLs from the Windows machine to the Linux machine. Mono comes with a version of NUnit, so I started it up.

linux-machine:/glb/home/myuserid: bin/nunit-console2 MyProject.dll NUnit version 2.2.0 Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole. Copyright (C) 2000-2003 Philip Craig. All Rights Reserved. OS Version: Unix 2.4.21.47 Mono Version: 2.0.50727.42 ...... Tests run: 6 (all pass), Not run: 0, Time: 3.859981 seconds Tests run: 6, Failures: 0, Not run: 0, Time: 3.859981 seconds

Wow. Just like that. This code isn't exactly running a nuclear reactor, but it is out there multithreading, doing file I/O (with locks), XML serialization, and all manner of fun. Mono even gets Linux's different file naming conventions correct, and thanks to defensive coding of file-handling functions, no change needed on my part. (Hint: learn to love System.IO.Path).

Well, if it works on Very Old Red Hat Linux, surely it'll just work on Mac OS X, right? Yes, why not. I did "svn up" and got the code and binaries down to my little Mac called, er, LittleMac. nunit-console2 reported the same happy results.

One binary, three runtimes.

But why stop there? Why not try the Mono compilers, too? Other than masochism, no particular reason, but I was intrigued by the idea of being able to debug in Linux. After all, the programmers this is supplied to will probably want to occasionally debug the code, and they'll want to do it in Linux as well as Windows. Why not try MonoDevelop? Heck, it's included with Mono downloads. Turns out it's file format compatible with the .sln and .csproj files Visual Studio 2005 uses. I just opened it on the source code I'd downloaded from Windows. I pressed Build, then ran nunit-console2 again. Same results. That was on the Mac.

It just worked. I'm sure my honeymoon will be over soon as I'm just scratching the surface, but I'm very encouraged. Will the auto-generated C++ wrappers for my C# code work just as pleasantly on all these platforms? Stay tuned.

Monday, February 25, 2008

Skynet Begins Self Construction

Yep, Google is now constrained by the very infrastructure of the Internet. From the Official Google Blog.

... One of the biggest challenges we face is staying ahead of our broadband capacity needs, especially across Asia ... Collectively we just signed an agreement to build a new high-bandwidth subsea cable system linking the U.S. and Japan.

I think there's a couple of interesting points here.

  • Google's demand on bandwidth is greater than any one company can provide. This seems to give it a great deal of leverage, as it probably makes a higher margin converting that bandwidth to advertising than the telcos make converting boats and electricity into bandwidth. Google's incessant preaching about how it just wants an open Internet to compete on is probably true. The bigger the Internet gets, the more money they make. But clearly they have switched from roughly passive beneficiaries of Internet advancement to aggressively self-interested builders of the Internet.
  • While Google may not be getting into the telco business (they emphatically deny it in this release) their leverage and reach make them natural competitors to the telephone companies. Everyone would love to see the telcos suffer for their crappy service and monopoly behavior. But the telcos were granted their monopoly by the government and so still have to (theoretically) abide by serious regulations. Google earned their monopoly all by themeselves. Who are they beholden to?
  • The speed of light is still a hard limit. Why isn't Google building more data centers in Japan? Why a big cable from the US to Japan? Is there that much youtube content generated in one country and then viewed in another? Perhaps, but it makes me wonder whether Google's internal traffic needs are on a par with or greater than its external traffic needs. That's pure speculation.
  • Where I came up, a "couple" can mean more than two things.

When will Skynet become sentient? I console myself that any soul who comes into being through reading the Internet will probably be so confused as to be harmless. Will it be addicted to porn? Unable to rectify the political rants from right to left? Get into Wikipedia editing contests with itself? Let's just hope the launch codes for the nukes aren't online anywhere.