I’m currently doing my masters thesis, and as part of it I needed to implement a simple compiler for the .NET runtime, the CLR. I just recently started playing around with the Boo language, which is a statically typed .NET language with very similar syntax to Python and many of its features, while still being statically typed and offering some nice extra features such as regular expression literals and string interpolation. I wanted to try the language out on a small project so I decided to use it to write my little compiler. The only problem was that as far as I could tell there were no available parser generators for Boo. (There might well be some, I must admit I didn’t really look very hard). The only parser generator I’m used to using is Coco/R, which is nice and simple to use, and available for many languages, although not for Boo. It is however available for C# so I decided to modify it myself to make it output Boo code.
I recently started playing around with ASP.NET MVC to build a small website. I’m pretty impressed, I like working with MVC a lot better than the web forms model. One thing that ASP.NET MVC offers is to have “pretty urls” similar to frameworks like Ruby on Rails or Django, that is, instead of urls that look like http://example.com/index.aspx?car=Ford&year=1990 you get urls like http://example.com/cars/Ford/1990. This works flawlessly in Visual Studio using the development webserver but there can be some complications when deploying to IIS. The new IIS 7 has support for this built in when using integrated mode, however my webhost is still on IIS 6 and there are problems there. Essentially there are two ways that can be used with IIS 6. The first way is to map all requests to the ASP.NET engine, even ones for images, css etc. That works but has some performance implications. The other way is to use a file extension in all urls, so our example url might have to be something like http://example.com/cars.aspx/Ford/1990/. That’s not horrible but not the way I want it either. So, I came up with another way. (more…)
For those that just want to play the game already, go here to play it
The last few weeks my hobby project has been creating a cardgame in Javascript. I’ve always wanted to create a cardgame and I decided to use simple Javascript so I could make it available online since no-one wants to bother to download small games. I figured there were thousands of blackjacks and solitaires out there so I decided to create my favorite cardgame, Idiot. (more…)
I was watching a movie on my computer the other day and I had gotten the subtitles for it off the internet, I think from http://opensubtitles.com or something like that. The only problem was that they were a bit out of sync with the picture, about 2 seconds too late. Using a good media player, such as VLC you can add an offset to the subtitles every time you watch the movie but I figured I could probably whip up a small script to do it for me so I could just do it once and then have the subtitles correct every time I watched the movie. (more…)
I have an old ASP.NET 1.1 application that I have to maintain and which for reasons beyond my control can’t be updated to a later .net version. I hadn’t touched it in a few months but recently I had to make some small changes and realized I didn’t even have Visual Studio 2003 anymore. I got a new computer a few months ago and I have Visual Studio 2008 and IIS 7 on it but no VS 2003. I didn’t really want to install it, it’s pretty old at this point and not very well supported in Vista, and like most programmers I like to play with the shiny new toys, not the old obsolete ones. So I decided to try to maintain this application in Visual Studio 2008. Now, VS 2008 can target different versions of the .NET framework, but only 2.0, 3.0 and 3.5 so I was out of luck. But, thanks to a nice article I found by Jomo Fisher on compiling .NET 1.1 in VS2005 and some extra hacking I got it working pretty well. My setup was IIS 7 on Windows Vista, IIS 6 on Windows XP is pretty much the same although some of the options I point to may be located in different places. So, here’s what you need to do to develop ASP.NET 1.1 in Visual Studio 2008:
(more…)
Recently I had a school project where we needed to parse a certain grammar into a syntax tree and do some analysis on the code. Everytime I’ve had to work with trees (which has only been for school projects actually) I’ve been frustrated because it can be hard to visualize the tree, especially when it starts getting large. I’ve pretty much done two things in that situation, either draw the tree on a piece of paper, which takes a lot of time and is very boring, or try to look through the structure in the debugger, which gives you some idea but is not really very convenient. So, when I was working on this new project I figured I could probably come up with some simple way of displaying the tree while I was working on it. I wanted the solution to be re-usable so I could pull it out again the next time I have to work with binary trees without having to change it to match the new project. So, here’s what I came up with.
(more…)
If you’re developing Mozilla Extensions it can be quite annoying to keep packaging your extension after every change, installing it and restarting Firefox/Thunderbird to test your changes. Fortunately there’s an easier way.
(more…)
Visual Studio and the .NET framework make it really easy to create Windows Services. All you have to do is create a new project, select ‘Windows Service’ as your project type and you’re all set. However, debugging Windows Services in Visual Studio can be a big pain. The recommended way is to use InstallUtil to install them, and then restart the service and attach the debugger everytime you want to debug it. I wanted Windows Live! Bot to be available as a Windows Service, but I also wanted to be able to debug it without the hassle, so here’s what I came up with: (more…)
A few weeks ago I was helping my sister change her blog. She has a Blogger account but uses Haloscan for comments, since when she started blogging Blogger didn’t offer comments as a part of their service. That has changed now, so I thought it would be much more convenient to have the comments and blog all at the same place. I just needed a way to export her Haloscan comments and import them into Blogger. So I wrote a small Python script to do the exporting for me. (more…)
Updated 05.09.2007: Minor changes to work with the new MSN protocol
My wife showed me a website the other day where you could type in your email address and password for MSN Windows Live! Messenger, and it would show you which of your contacts didn’t have you in their contact lists, either because they’d never added you, or because they’d deleted you at some point. It’s a cool idea and a good way to prune some of the contacts that you never speak to from your contact list. But I don’t really wanna give up my user / pass to some third-party site, even though they promise not to log it anywhere, and most of these sites (at least the ones I saw) tried to make some money by sending advertisements to your contacts while they were checking them, which I definitely didn’t want. So, since I already have a project that uses the MSN protocol I figured I could probably whip something up myself. (more…)