<$BlogRSDURL$>
Philip's Files

My Web Site

Wednesday, April 14, 2004
 
Currently thinking about:
Physics
Entanglement, GHZ entanglement.
Visualizing the geometry of special relativity.
Entanglement and what it implies about our picture of spacetime (hence the above).

Mathematics
Surreal Numbers.
Category Theory.

Code
Templates and automatic code generation.

Security
The use of obfuscation or the virtual machine idea applied to a source program to defeat toolchain perversion attacks. (letting rice's theorem work for you).

 
The direction of this blog
I was considering switching from Blogger to Livejournal.

(I'm clearly spending too much time creating web accounts.
Wiki's blogs, etc.)

Blog decision
Everyone and their dog seems to have a blog specifying their mood, the music they are listening to, who they met yesterday, etc.. There is value in that...

So here is my plan:
My livejournal will be that. Arbitrary stuff.

Stuff that seems like content will go to by blogger account.

That is the plan for now.


 
The direction of this blog
I was considering switching from Blogger to Livejournal.

(I'm clearly spending too much time creating web accounts.
Wiki's blogs, etc.)

Blog decision
Everyone and their dog seems to have a blog specifying their mood, the music they are listening to, who they met yesterday, etc.. There is value in that...

So here is my plan:
My livejournal will be that. Arbitrary stuff.

Stuff that seems like content will go to by blogger account.

That is the plan for now.


 
Saw Shattered Glass tonight. I really enjoyed it. I did not know it was a true story until the end and even then (in light of the subject matter), I had my doubts. Enough to make a conspiracy theorist out of anyone.


Tuesday, April 13, 2004
 
Back after some time off.
Back developing after taking some off time.
Slept a lot. Saw a lot of friends. Watched some movies.

Saw Cat in the Hat (they made me watch it), <no comment>
Saw Brother Bear, cute, but Disney's magic seems to be fading.

Saturday, April 10, 2004
 
Code generation with Templates
I have to write a ton of application layer stuff that should be simple to auto-generate. So I went looking for free-as-in-beer open-source code generators. Hello SourceForge!....

I finally (very quickly) settled on ncodegen.

ncodegen is implemented in .NET with c#. It is a code generating system that can use different template engines prefferably NVelocity. It uses templates and takes its input data used to customize or fill the templates from XML.
NVelocity is a .NET port of the Apache Jakarta project's Velocity.

Velocity is basically a pluggable template engine component (designed with web page generation in mind, but fully general nonetheless). It parses templates that contain text mixed with VTL (Velocity template language). The engine processes the template and spits out the resultant file. The language is simple, but flexible and bound through reflection to Java (in NVelocity .NET) allowing the engine to access simply and neatly from the template (in VTL), data that is exposed from the hosting component.

Edris Hasani Nasab the author of ncodegen put together a good looking design for a code generator that can plug into many template engines. I only looked at its NVelocity use. The documentation is good looking but minimal (the english could do with a bit of improvement, given time I might offer to help out - it is not his first language) and the examples are too simple. To use it I needed to read the original Velocity Documentation (both user and developer), NVelocity source code and ncodegen source code as well as experiment quite a bit.

Excellent infrastructure and good looking code (can be understood while containing no comments = quite good).

I don't think it has been used to generate much. The current implementation is a bit limited. If this was a closed source product I would not touch it would be unusable for real complex work. But as an open source (GNU Lesser public licence) it is a good project supplying solid infrastructure on which to build. The modifications needed are well locallized and easy to make.

The criticism is that I have with the current implementation is that the way it exposes the input XML to the template engine is WAY too simple with a bit of a hack. Basically it exposes any node to VTL in its path form eg. $Input.Whatever.ChildOfWhatever. VTL can do nothing with that, but find the child of ChildOfWhatever (like so: $Input.Whatever.ChildOfWhatever.ChildOfChildOfWhatever or access an attribute of whatever e.g. $Input.Whatever.Attribute.
Now for the hack: if the Node (e.g. <Name> has a name that ends in "s" it is assumed to be a collection and return a collection of all of its child nodes to VTL (which can access it with a #foreach loop).
Since my XML input contained nodes like <Class> I was quite confused by the results until I looked at the sourcecode.

Any modification to this is made quite simple through good design by all involved. A single method in a single class in ncodegen can be modified to behave as desired. Very complex behaviour could be very simply implemented. For example: exposing full XPath queries from VTL should be a few minutes worth of work and most of that will be testing.

I'm interested in making some modifications while using it and giving them to the author if he is interested.
A plugin for Visual Studio also seems like it would be very nice. And syntax highlighting for VTL templates would be stellar.
(However: The thought of all that COM interop and using Microsoft MSDN documentation : ( ).

 
Problems Gone

Wednesday, April 07, 2004
 
Having problems with Blogger
My posts are not appearing.

 
Read an interesting transcription of a keynote address concerning social software.
What I found most insightful are the default or built-in social behaviour which humans exhibit in groups, even when the groups are not mediated by normal face-to-face interaction.


Powered by Blogger

My Livejournal