Monthly Archives: August 2006

Gone

I’ll be gone on vacation for two weeks starting today (yeah!). So don’t be surprised if I don’t respond to e-mail as fast as usual.

If you have any question or problem with Castle Generator, you can contact Peter, which is now part of Generator’s team.

Leave a comment

Filed under Misc

Generator vs burritos

If you want to join the fun, be sure to check my other post, on how to install this great piece of technology.

page_1.png

All images taken from Google with some random keyword search

1 Comment

Filed under Generator

Installing and using the Generator

A new script has been added to the generator. Now, to install, all you have to do is:

svn co http://svn.castleproject.org:8080/svn/castle/trunk/Tools/Generator
cd generator
nant install

and then you can type from your command line generate or monorail to get help and usage.

Have fun!

9 Comments

Filed under Generator

Python take 3

Unless you’ve been under a rock for some time, you’ve heard of the ruby-python war. I wasn’t sure in what side I was. Ruby is elegant, compact, flexible and full OO. I like python indentation rules and flexibility too, but dislike it’s lack of consistency in the core libs (part object, part procedural).

But now that I’ve watched this video of M. Python in which he admit he made some mistakes and conclude that a big incompatible new revision is necessary. New features will include, among other things, more verbosity. Read: no more statement! print 'something' will become print('something'). Why ? Because (the example he uses) if you want to redirect all your console output to a file or logger it will be easier like this then

replacing all the print statements in your code by hand

What ? Am I dreaming or he’s driving the language syntax from the technical limitations !?!

In ruby parenthesizes are optional so print 'something' is the same as print('something'). And if you want to redirect all the prints to somewhere else you simply override the Kernel print method.

That’s enough for me to move definitely to the ruby camp.

Leave a comment

Filed under python, ruby

Switching blog host

As you might have noticed, I switched from Blogger to WordPress. WordPress is one of the best blogging engine without a doubt. But some fundamental features are not included in the version hosted on wordpress.com like Markdown and Textile support.

Importing posts from Blogger to WordPress was a breeze. And setting up my new blog was equally delicious.

I now can blog from TextMate which make up a bit from the lack of markup support, plus I can add pages, widgets and stuff but not customize the templates… So I guess that when I’ll have enough time I’ll switch again to Typo on a free Rails host.

Leave a comment

Filed under Misc

Live coding with MonoRail

In my constant quest to bring Castle MonoRail closer to Ruby on Rails development style, one of the thing that kept me from choosing MonoRail over Rails for fun and pleasure was the code-compile-refresh process. Because we’re working in the static compiled world, a usual scenario looks like this.

  1. Add or remove some code
  2. Compile from the IDE or run NAnt
  3. Restart the web server (under *nix XSP needs to be restarted to load the new assembly)
  4. Refresh the browser (and wait for the app to restart AR and all other services)

This is painful! Why can’t we just code and refresh like with scripting languages?

While reading an article on reddit about Live coding, I had a idea…

# Rebuilds the project periodically and restarts the web server on success

 import System
 import System.IO
 import System.Threading
 import System.Diagnostics

 SERVER_CMD = 'xsp2'
 SERVER_ARGUMENTS = '--root public'
 NANT_ARGUMENTS = 'build -nologo -q'
 PROJECT_ASSEMBLY = 'public/bin/MyBlog.dll'
 REBUILD_DELAY = 1000 #ms

 serverProcess as Process
 lastWriteTime as DateTime

 print "Starting runner process, hit CTRL+C to stop"
 while (true):
  buildProcess = shellp('nant', NANT_ARGUMENTS)
  buildProcess.WaitForExit()

  if buildProcess.ExitCode == 0:
   if FileInfo(PROJECT_ASSEMBLY).LastWriteTime > lastWriteTime:
    print "Project recompiled, restarting the server"
    if serverProcess != null:
     try:
      # Stops the server
      serverProcess.Kill()
     except e:
      pass
     serverProcess.WaitForExit()
     serverProcess = null
    serverProcess = shellp(SERVER_CMD, SERVER_ARGUMENTS)
    lastWriteTime = FileInfo(PROJECT_ASSEMBLY).LastWriteTime
  else:
   print buildProcess.StandardOutput.ReadToEnd()

  # Waits a couple of seconds
  Thread.CurrentThread.Sleep(REBUILD_DELAY)

If you can’t see what this is about…

The other thing that keep me from dropping Rails for MonoRail is C# extra verbose and lack of fun and style. But I can’t do nothing about that, except use Boo whenever I can.

Note that this script will soon be integrated in the Generator so when you generate a new MonoRail project, the server script while run something like this.

3 Comments

Filed under Generator, Monorail