programming

C#, VB and LINQ

Friday, September 30th, 2005 | Development | No Comments

I went to a colloquium on LINQ (I guess this link might die in the future when the future is no longer the future, so to speak) presented by Erik Meijer who is a technical lead in the WebData group (whatever they do). Meijer is a very charismatic speaker and it was a very good presentation he did (although Virtual PC on his laptop couldn’t entirely keep up). For the uninitiated LINQ stands for Language INtegrated Query and it brings set relational functionality to .NET. VB9 and C#3 will have syntactic sugar for it, other languages can consume it using the assemblies.

LINQ correspond to Haskell’s monad comprehensions, in case you know what those are, and I think it will be interesting to see how people put it to use, but I could fear that it will create a tendency to put even more data-layer specific code into the business aspects of application. The added expressitivity, however, seems like a great thing and I look forward to play with it.

Meijer also presented a couple of the new things coming in VB9, among these is late-late binding, which allows you to try to access fields on a type Object regardless of whether you know they exist at compile-time or not, so in some sense VB9 is now a complete bastardisation between statically and dynamically typed languages and you get to be able to do some truly nasty things:

  Dim z As Object = {Name := "Test", ID := 20}
  Console.WriteLine(z.(Console.ReadLine()))

This allows you to specify the field in the anonymous struct to access at runtime, no more static typing, there be monsters here! What does this mean for Visual Basic programmers? I would guess that the group of programmers that are currently programming Visual Basic aren’t exactly, in general, those who know what type erasure, type inference and monad comprehensions mean. I wonder whether Microsoft may be letting their developer base walk the plank in some sense, but only time can tell.

Erik Meijer has been teaching as an assistant professor at the University of Utrecht prior to being with Microsoft and one of the most refreshing things in the presentation was to see a theoretical person using all his theory and knowledge of paradigms, semantics and whatnot to improve (I hope) production environments. All in all a great presentation, I’m still spaced-out about being able to access a lot of my functional programming things in C#.

Finally the fun anecdote Meijer gave during his presentation: Originally LINQ was called LIQ, but marketing changed it to LINQ as Language Integrated Query Object Relations would’ve become LIQOR otherwise. Can’t have that, nope.

Tags: , ,

Zooming the editor

Monday, March 7th, 2005 | Development, Personal | No Comments

A while back Sara Ford offered up “I love Visual Studio Core” t-shirts for people who wanted to contribute a bit of code for the Visual Studio 2005 PowerToys. Not passing up the chance for a t-shirt, I contributed code to a zoom control. Now the add-in is stored on gotdotnet, so good luck finding a time when it isn’t crashed in some way.

For the interested parties, there’s a photo of the shirt on my floor, here…

Shirt

Tags: ,

Atomic Cellular Dysfunction

Thursday, February 17th, 2005 | Development, Personal | 2 Comments

It isn’t that my organism is self-destructing (much) that I’ve picked this rather funky topic for today’s post, nay, it is far more sinister and dark – it is the topic of a contest that I participated in, together with Noah Adler last month, a contest that was about creating a game in 48 hours to the theme: Atomic Cellular Dysfunction.

We managed to create, within the 48 hours, a lovely game in style with the games of the 80s that we have both grown up on and loved, so without further ado, we bring Atomic Cellular Dysfunction to the world. We hope you will enjoy it as much as we enjoyed PacMan and the other great games of our time.

Tags:

Zoom zoom zoom

Tuesday, February 15th, 2005 | Development | No Comments

I was featured on Sara Ford’s blog and the VS 2005 News blog for my involvement with writing the VS Editor Zoom Add-In, which is an add-in bringing Word’s zoom control to Visual Studio .NET 2003 and Visual Studio 2005 December CTP so far.

I hope some of you may find a need for some zooming.

Tags: ,

UrlHistory and Internet Explorer

Wednesday, January 26th, 2005 | Development | No Comments

Back in 1997 I started a humble MFC project to manage my URL history in IE so I could keep track of when I had been to which pages, etc. Like it so frequently happens with spare-time projects, something else came up and it’s been lying in an unsuspecting corner of my harddisk’s sector 27724 collecting dust ever since… well, not literally, I hope.

As I was cleaning out a bit of miscellaneous projects on my disk and trying to work out which projects I wanted to finish sometime, I came across the MFC project and thought… hmm, IE has this stuff in it nowadays, so why not just right write up a wrapper around it for .NET and provide it so tools are a bit easier to write to do custom things. For instance take a snapshot of newly visited pages since yesterday and create a graph of your browsing activity, or what have you of projects one can think of.

Tags:

Integrating Source Safe and Mantis

Wednesday, June 16th, 2004 | Development | No Comments

On the never-ending quest for improved development support I have managed to tie Microsoft Visual Source Safe together with the open source bug tracking system, Mantis, so that checkin comments will be reflected in bugnotes in the bug tracking system.

This helps make it easier for developers to see what changes influenced a certain bug, what it took to fix it and so on and so forth, all in all a pretty nifty tool. The first part of the road was etched in clear marble, I’d have to use the VSS 6.0 Automation library using COM Interop from .NET (of course I’m implementing this in C#). Fetching version info is fairly trivial, actually, so kudos to whomever implemented the automation model.

Of course as any developer reading this has come to understand, things just aren’t going to be this easy all the way. So how do we make sure this automation code is triggered when we have a checkin? Well, we make a SourceSafe add-in, right? Sure, if I want to force all developers using it to use the SourceSafe Client rather than do the source control work directly from Visual Studio.NET. So away goes the idea of a SourceSafe add-in. Right, well, a VS.NET add-in must be just what the doctor ordered, right? Well, this is where I, much to my disappointment, wasn’t able to find anyplace inside the VS.NET automation model that allows you to hook up to source control events (please correct me if I am wrong).

So what is a desperate developer trying to please people by integrating their systems to do? Well, how about writing a Windows Service running the integration every 30 minutes, it’s not as if the checkins are that critical to see in real time anyway, is it? An hour later and the entire system is nicely converted to a Windows Service, complete with application configuration bindings that allows you to configure the frequency the integration is run, the MySQL server hosting the mantis tables, the source safe server and user credentials for the same. And as the nice guy I am, here is all the lovely source code for it:

The Service
The Automaton Library

At some point of time I will probably brush this thing up a bit and make sure that it adheres all the technical details of Mantis, and hey, I might even submit it to the Mantis project, although they probably won’t be overly thrilled with seeing Windows-specific code. They are like that them pesky open source people. :o)

Hope you find some use for it. Feel free to drop a line.

Tags: , ,

A DIME for your Country – the continued story

Friday, June 11th, 2004 | .NET, Development | No Comments

I have previously discussed Microsoft’s DIME implementation in their Web Service Enhancements 1.0 library for .NET. Namely the part where they manage to break any and all support for non-ASCII SOAP transfers. It seems as if they’ve rectified this grivious mistake in version 2.0 of WSE, so now we can have international messages, yay!

Of course we have to rebind our solutions, re-test and all, but hey, what don’t we do to get them internation characters delivered to our doorstep?

Tags:

A DIME for your Country

Monday, April 5th, 2004 | .NET, Development | No Comments

Lately at work I have been on a project where we needed to implement a web service client. A part of this client is accepting a series of files passed as DIME attachments. Since .NET doesn’t implement this on its own we had to dig forth the Microsoft WSE 1.0 library, which features a series of extensions to the normal web service programming support.

To understand the full conundrum let us back up a bit. Part of the receival of the documents is an enum with the name of the document type. Since we’re in Denmark and the web service is by another Danish company we do, of course, have some localised names with æ, ø and å in them — e.g. Lånebevilling. Now this is all great as long as we just remember to use utf-8 or iso-8859-1 as the charset type… or is it?

Using the DIME classes is fairly straightforward and not overly difficult so we were taken slightly aback when our web service client notified us that it had caught a Deserialization exception from the SOAP message — namely System.InvalidOperationException: ‘??’ is not a valid value for ResponseType.. With this extremely obvious error message I went spelunking in the badlands of the WSE1.0 implementation. After fruitless hours of looking through the disassembled code of the Microsoft.Web.Services.Dime namespace I sought help with the SOAP 3.0 toolkit and inserted a trace listener to see what actually went across the wire.

After about a days’ work pondering why it just didn’t work I came across an unsuspecting Encoding.ASCII.GetString call in the backlands of the Soap Deserializer. As the client very kindly tells me then å isn’t an ASCII character. Disappointed we were faced with two options: write our own DIME implementation or get our external partner to stop using locale specific characters. Neither a truly pleasing solution.

So to round all of this off then in this case the implementation doesn’t give a DIME about your country or its letters. Just keep to ASCII and everyone will be happy. Pity.

Tags:

XFRE

Tuesday, February 3rd, 2004 | Development | No Comments

From the while we wait department comes XFRE, or XML-XHTML Forms Roundtrip Engine. XFRE provides a simple and crude version of the recent, as of time of writing, W3C recommendation, xforms. Its sole responsibility is to, using xslt, be able to generate a user interface in XHTML Forms based on an XML document and then regenerate this XML document from the user’s input. So until we get a real server-side .NET XForms implementation this will have to make do. Notice the issues and caveats on the project page.

Tags: