Creating a Domain Specific Language for Parsing

, , , , 1 Comment »

It’s with some trepidation that I start on what is sure to be the most geeky post I’ve created to date. First a little background. I thought it would be a worth-while exercise to create a view engine for the Asp.Net Mvc framework. This is a result of a series of comments I took part in on Haack’s blog post about using lambdas from aspx.

The specific comment I made was in response to a green-field question about what an ideal view engine would look like in your mind. For me, based on my experience with NVelocity and the MVC pattern in MonoRail, the less you put in the view the better and a simplistic view language is actually a strength because it encourages that.

I’ve also had some difficulty working with aspx as text because what you have are two formats, csharp and xml, both of which have a natural flow and indentation which can’t coexist peacefully. Angles, percents, and curly braces become a disordered chaos where nothing lines up rationally. (Readability is vital to maintainability.)

So I proposed something like the following.

<var i="0"/>
<var css="new string[] {'row', 'row-alt'}"/>
<table>
  <for each="var hobby in Hobbies" i="i+1">
    <tr class="$css[i%2];">
      <td>$i;</td>
      <td>$hobby.Title;</td>
      <td>$Html.Function("arg","arg");</td>
    </tr>
  </for>
</table>

See, the theory is you use the same syntactical conventions for both markup and code and they’ll no longer fight each to dominate the file format. It’s very zen. And the editor’s normal assistance with colorization and indentation of xml helps you close loops, represent scope, etc. Since I’m the sort of person who feels he should put his brain where his mouth is, e.g. a fool or a masochist, I set out to implement exactly such a view engine.

Read the rest of this entry »

Using Nginx on Slicehost to save money

, , , , , , 8 Comments »


A little bit ago I had set up Trac on http://dev.dejardin.org, which is a python application, and Subversion which is it’s own Apache dav module, and that’s running on the same slicehost instance as Where’s Lou which is of course a WordPress php application.

Unfortunately the net result of this was to bloat each instance of the Apache process to 21 megs and about ten of them would be running at any given time. I believe I was also experiencing a condition where apache process were not correctly terminating on a reset. In any case my slice with 256 meg ram and 512 meg swap space was running with all ram used up and over 260 megs swaped at any given time.

I’m not concerned about the use of virtual memory in general, that’s what it’s there for, but at this point there were some noticable request delays appearing. This was the point where I decided something needed to be done because there’s no point driving people away from your web site because of water-torture-esqe inconsistent response delays.

Read the rest of this entry »

Plastic editor for Asp.Net Mvc ready to beta

, , , , , , , 3 Comments »

Anyone out there with Visual Studio 2008 installed is welcome to try out an open source utility I’ve put together. If you have feedback or bug reports those would be greatly appreciated.

Mvc Plastic Editor

It’s called MvcPlastic.

  • Capturing view context and view data as it occurs
  • Reviewing rendered screens as you would a slide deck
  • In-place editing of the views and content files
  • Tweak repeatedly without re-submitting forms or re-executing controller actions

It’s a single dll you can drop into a bin directory of an asp.net mvc (4/16) web app and activate with a line added to the web.config.

Read the rest of this entry »

Design by j david macor.com.Original WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in