Monday, October 18, 2010

Mono.CSharp

Back in April, I read this post by Miguel de Icaza about the C# REPL (read-eval-print-loop) feature coming to MS.NET framework (previously it had only run on the Mono framework, for reasons detailed in the blog post). I was pretty excited. The feature looked really awesome when Miguel first blogged about it back in 2008 and I was pretty bummed that it was only available for Mono. 

I hadn't had an opportunity to play with it as I had been pretty busy doing other stuff at work and really didn't want to touch the application that I wanted to add it to because it's pretty touchy for some reason. It's a very multithreaded application with networking, database and a bunch of other stuff, so trying to touch it can cause rippling effects. It's something I've really wanted to rewrite for a while anyway. I finally decided to implement a couple new features in the application and brave the problems that would come.

I implemented the features and it seemed like everything was working fine until the day before I went on vacation. Everything went to pot. Right down the drain. I patched up the app as best I could before I left and received some frantic pages from a colleague before I actually hit the road.

Once I got back from my vacation I set about to correct the application correctly. You know, actually implement mutual exclusion and so forth so that it wouldn't die a horrible death every couple days. I switched some of the threadpool stuff over to the new TPL (Task Parallel) that was released in .NET 4.0 and that has had a great improvement in speed, but I still wanted a way to break in and debug stuff at runtime. Enter the Mono.CSharp library.

I wrote a very simple network interface that received commands from a raw connection, would evaluate them and then print back the results to the client machine. I still have a few kinks to work out, but all-in-all the solution is AWESOME. I can now remotely login and run commands to see what is happening internally in the application. I used some of the code from the example csharp.exe that Miguel released in order to have some pretty-printing and other similar features, but nothing real intense.

If you haven't checked out the Mono.Csharp library, I highly recommend you do. It has some potential to be very powerful. MS has promised a similar feature for the next revision of C#, but you can have it now, and very easily by just using the Mono.CSharp library.

If you'd like more information about Mono, check out http://go-mono.com.

Wednesday, October 6, 2010

The Widow's Mite

This is a booklet that my sister wrote. She is an extremely talented woman and I look up to her. Buy lots of these, it is really good!



This is her blog. http://myamateuradventures.blogspot.com/

Monday, October 4, 2010

Boost.Spirit

I've been looking at replacing an application at work that was original written in C. The application has it's own little language for defining hardware register sets and also takes care of managing slight differences between register sets for different products. I would normally write this application using C#, but it needs to be able to run  on systems that may or may not have .NET, and it is not an installed utility, but something that is checked into our source control system.

I thought originally about just updating the application to be C++ because it really is a good candidate for inheritance and polymorphism for the different register types, and having the STL is always a nice bonus for string manipulation. So, I need to write a parser. I've looked at Boost previously for other applications, but never at the Spirit library.

The library sounds really nice in theory, but I the examples for the latest version don't seem to follow the need that I have, or I am not understanding the examples very well.

Has anyone used the Qi library for writing a complete parser for a real life language? I'd like to see something like that.