So I’ve Got A Summer Project…

This is an old post from my previous Joomla!-powered site; sorry for the retread.


I’m not really much of a blogger. I’m pretty wordy when I write, but for me at least there’s this unshakable stigma attached to blogs, the kind of thing that makes you question if you really want to be the kind of guy who writes about what he had for breakfast that morning.

So, despite having a new, blog-ready site up for about three months, I haven’t posted. Guess it’s time to change that a bit.

If the really large banner at the top of the page wasn’t enough of a hint, my name is Ed. I’m a computer programmer and a student at the University of Maine. I’m working for Google this summer as a part of their Summer of Code program; I did it last year, too, and it’s a boatload of fun. One of the mentors for my organization, the Mono Project, suggested that we keep some sort of blog. Seeing as how we’re three weeks into the project and I haven’t, this would probably be a good time to start. My project, a set of tools for Visual Studio that I’ve taken to calling Cloverleaf (note the shiny happy logo to the left of this paragraph and drool at its sheer awesomeness), is designed to facilitate the porting of CLR code from .NET to Mono by providing useful tools to ease the transition. If you’d like to read about it, you can do so here. Anyway, Cloverleaf is ticking along nicely. Developers can choose to run a .NET application under Mono (without a debugger, as the debugger engine isn’t finished), run Gendarme, a totally cool code analysis tool, on assemblies of their choice, or run an ASP.NET website under the Mono ASP.NET web server, XSP2. All of these bits and pieces are useful, but today I’m going to brag about my favorite feature to date: remote invocation of applications and displaying them near-seamlessly on the user’s desktop.

I feared this feature. I was sure it was going to be a huge pain to actually do and that I was going to somehow screw it up along the way. But thanks to a guru friend of mine, I lucked onto a solution that was doable in much, much less time. By using Xming and Simon Tatham’s fine Windows-based SSH and SCP tools, PSCP and Plink, I was able to do it in a day of fairly steady programming. Read on for entirely overblown and self-congratulatory screenshots.


Witness–the dialog box!

Main dialog for the Cloverleaf application. (Click to view full size.)

Main dialog for the Cloverleaf application.

Yeah, yeah, I haven’t finished the thing yet–I have to puzzle out the horribly documented Mono.Zeroconf, for one thing, and then come back and bolt it on. (The remote application system only needs Zeroconf to find servers; it doesn’t actually use the published services. Those are used by the remote web server, which I’ll briefly mention in a bit.) It’d also be nice if I could figure out a way to make the “select local IP address” bit a little more intelligent, but as a guy who’s got four NICs active on two different networks (one physical, one virtual), I couldn’t figure out a very good way. So I punt the question to the user.

The remote deployment is awfully simple as it is. First it fires up the Xming Win32 X server, which has the nice trait of not duplicating itself if a copy’s already running (a boon to me, for I am constructively lazy). Then it zips up the application to remotely deploy, writes a brief shell script, and uploads both to the server via SCP, then invokes the script via SSH (EDIT: originally via Plink and PSCP, but now using SharpSSH and the Mentalis library it requires). Thanks to X forwarding, they pop up on the developer’s desktop without a hitch–well, after a couple of embarrassing bugs. (Believe it or not, you have to wait for a file transfer to finish before you try to use those files! Who knew?) Thanks to sometimes less-than-minor differences between Microsoft’s System.Windows.Forms and Mono’s implementation, called MWF, there are some weird graphical differences between the windows, but nothing game-breaking. Here’s a side-by-side (well, top-on-bottom) view of my quick little Hello World test app:

The application running natively, using .NET 2.0 and the Microsoft implementation of System.Windows.Forms.

The application running natively, using .NET 2.0 and the Microsoft implementation of System.Windows.Forms.

The same program running on Mono on a remote machine, being forwarded to my local machine and displayed via Xming.

The same program running on Mono on a remote machine, being forwarded to my local machine and displayed via Xming.

You might notice that both windows have the normal Win32 sort of window decorations. This is apparently something Xming does when running in “internalwm” or “rootless” mode; since it’s providing its own window manager with its own window decorations, you lose the KDE/GNOME/whatever window decorations and get the Win32 ones. (You can see this sometimes on Linux, too–if you ever switch window managers on the fly, the applications stay the same but the window decorations change.)

The biggest thing I like about this remote testing feature is that, while it doesn’t replace a dedicated test box on a developer’s desk for everything (it doesn’t do services and probably never will, trying to do console input currently locks it up, and I still need to wedge a tee command into the uploaded script so I can get a copy of the log file back down from the remote machine), it helps. You can just throw one box in the corner, put the Cloverleaf daemon and its (few) dependencies on the machine, and everyone can test off it without needing to run VMs or any such nonsense.

That’s about all there is to it at the moment. Apparently I’ve excited at least one of the other Google Summer of Code developers for Mono; George Giolfan seems to think this could be very useful to him as he works on better theming for Mono’s WinForms implementation. (I wish him luck. He’ll need it. That thing’s ugly.)

Next on the chopping block is a remote ASP.NET web server. For production purposes, generally you have one web server on which your applications run. That doesn’t work so well for development purposes, especially with a very stateful framework like ASP.NET, which relies on a lot of postbacks. Say Bob and Jim have two web apps started on Apache running mod_mono. Jack comes along and wants to start his own web app up for testing, so he restarts Apache after editing httpd.conf. Bob and Jim just lost any stateful information they had, and Jack had better watch his back. So what Cloverleaf is going to do is have a service sitting on the communal development test machine (or virtual machine, or whatever). This is where Zeroconf comes into play–they should be able to just click a development machine and be off to the races, one would hope. But instead of using one monolithic server running mod_mono, the Cloverleaf service will instantiate individual web servers for every user, running on very much nonstandard ports, and will just kill them when the developer says “when.” It’ll be able to handle both XSP2 and Apache (I hope–Apache may be difficult to set up, though XSP2 is a breeze) and do the same for developer testing of web apps that the app deployment testing does for desktop apps.

If you’re interested in Cloverleaf or any of the Mono Project’s other GSoC projects, the development trunk can be checked out from our Mono Project GSoC 2008 page on Google Code. You can also see our development discussions and weekly reports on our Google Groups page. Eventually, Cloverleaf will probably find a place to live here on my website, but that’s a ways off at least.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
This entry was posted in Mono Project, Open Source and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  1. [...] mentioned in my original post on the topic, my Google Summer of Code project was Cloverleaf–a package of semi-related tools to [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*