Monthly Archives: October 2008

Sabattical Week Results

From September 19th thru September 29th, I had my second sabbatical week of this year, a week free of courses, meetings, speeches, only dedicated to software development, readings and creation. I had published my commitments:

Sabbatical Week

Now, it’s time to publish the outcomes. I think that writing down a list of commitments help me to make clear what I want to do, and it should be completed with another post describing the deliverables of the process. This post and the previous one are deliverables, too, of the project.

The list of commitments and the result:

– Terminate a first running version of AjSharp, my C#-like interpreter, now in development inside my AjBasic project. COMPLETE You can explore the outcome at project code repository, there are two new solutions that define the new language. I published a post with a short implementation description:

AjSharp- a C Sharp-like interpreter, work in progress

AjSharp- un intérprete a la C Sharp, trabajo en progreso

– Write the code for a textual model support in AjGenesis, instead of only XML files, as in current version. You can see some progress at project code repository. COMPLETE Finally, it was implemented. I published posts about this:

Textual model for code generation in AjGenesis

Modelo textual para generación de código con AjGenesis

There are new ideas, model in a spreedsheet, still to be implemented:

Another model for AjGenesis

Otro modelo para AjGenesis

– Publish some example of AjGenesis generating files for LINQ and Visual Studio 2008. COMPLETE These are the post:

Code Generation for LINQ and C# 3.0 with AjGenesis

Generación de código para LINQ y C# 3.0 con AjGenesis

– Pouring love in AjTalk project, to support the reading of basic class definitions from .st-like files. COMPLETE Now, the project can load code from .st file, you can see some tests at published code. There are details to complete in the language itself, as support for blocks between [ and ], primitives invocation from code, and indexed variables support. After the sabbatical week, I tested the new Load, and it looks interesting: now, the work is to complete the details and begin to implement the base library. I’m studying the implementation inside Smallatlk/X.

– Write two posts about AjGenesis. COMPLETE The mentioned posts:

Code Generation for LINQ and C# 3.0 with AjGenesis

Generación de código para LINQ y C# 3.0 con AjGenesis


Textual model for code generation in AjGenesis

Modelo textual para generación de código con AjGenesis

– Write to post about F#. PARCIAL I wrote one post

F# and Functional Programming Resources

Recursos de F# y Programación Funcional

but there is no second one. As compensation, I wrote a detailed description of last Microsoft TechNight at Buenos Aires, related to programming language, only in Spanish

Babel de lenguajes en .NET

– Write two posts related to CCR (Concurrent and Coordination Runtime) of Microsoft Robotics. PENDING I wrote down a short introduction, but it’s still incomplete.

No overdeliveries in this week outcome, but using the generated impulse, I was working in language interpreters, resulting in: Functional language implementation, named AjFunc. It follows the sintax of F#. I have to add type support, type inference, and thousands details more. But the core is taking form. First step in Logo programming language implementation. AjMessages implemented using DSS/CCR. I wrote the example last year, but I updated it, and now, it’s published. The last year I published another example over WCF. Next steps: unify the two implementation, better object serialization, better configuration. Post with short description:

Distributed applications with AjMessages using DSS/CCR

Aplicaciones distribuidas con AjMessages usando DSS/CCR

As usual, I had fun in this sabbatical week, and I learnt a lot of new stuff.

Angel “Java” Lopez

Sky is azure

Yesterday, Microsoft unveils Azure Services Platform, at PDC 2008. According to the revamped Microsoft Strategy Software + Service site:

Azure Services Platform

The Azure Services Platform is part of this vision, providing the power of choice and flexibility in developing, operating, migrating, and managing applications that exist on the internet or devices to provide the best experience for users.  The services platform enables this by utilizing common languages, runtimes and frameworks – a common toolset that spans from the service in the cloud to a server, and from the PC to the browser to the phone.

But, what it means all this stuff? There is more detailed information at:

Microsoft Azure

What is Azure

The following paragraphs are based on the published information:

The Azure Services Platform is hosted in Microsoft data centers, providing an operating system and a set of developer services that can be used one by one or together. You can leverage your existing skills with Visual Studio and .NET Framework. In the future, Azure will support more programming language, as Python, Ruby, and development environments, as Eclipse. Azure uses HTTP, RESP, SOAP and XML: it’s based on open standards.

Windows Azure

Windows Azure lives at the base of the stack. It’s a cloud services operating system, supporting development, service hosting and service management environment for all the platform. You can create applications with Visual Studio: CTP version is integrated with VS experience. Notably, support for Eclipse, Ruby, PHP, and Python is welcome, altought is not clear the timeline and origin of such features. Windows Azure includes:

Computation Services

– Ability to run Microsoft ASP.NET Web applications or .NET code in the cloud
– Service hosting environment that includes Internet Information Services 7.0 and Microsoft .NET Framework 3.5 SP1
– Security supported by flexible Code Access Security policies
– Small runtime API that supports logging and local scratch storage
– Web portal that helps you deploy, scale, and upgrade your services quickly and easily

Simple data storage services

– Blobs, tables, and queues hosted in the cloud, close to your computation
– Authenticated access and triple replication to help keep your data safe
– Easy access to data with simple REST interfaces, available remotely and from the data center 

Development Tools

– Complete offline development environment, including computation and storage services
– Complete command-line SDK tools and samples
– Visual Studio add-in that enables local debugging

All this is the release of the former Red Dog project. The data storage services in interesing: I guess is the evolution of SQL Data Services, another technology included in the stack. I’m not sure on the relation and dependencies of both technologies. Related links: 

 Learn more about Windows Azure
Video- Manuvir Das- Inside Windows Azure
Video- Steve Marx- Windows Azure for Developers

Live Services

Live Services is composed by building blogs to handle user data and application resource. There is an emphasis on supporting a wide range of digital devices. During last years, Microsoft was pushing towards the device application world, and now is the time to connect anything, anywhere. Yeap! Resistence is futile… you will be connected… 😉

The strong poing is the easy creation of mashups: applications that combine data or content from several sources into a new single integrated application. There is a web service API that can be used to create mashup applications. There are some running application that is this technology, an example: 3d Geology Maps. This site overlays geologic maps on three dimensions. Dozens of applications to view at the Mashups Library.

Learn more about Live Services
View the Quick Apps

SQL Services

SQL Services extends the SQL Server capabilities to the cloud, using web-based services. You can create and store structured, semi-structured and unstructured data. It hosts Microsoft SQL Data Services, that can be accessed via REST and SOAP based web protocols. All this is built on SQL Server database. SQL Services Labs could be used to develop prototypes and incubate projects.

Learn more about SQL Services

Microsoft .NET Services

Formerly Biztalk Service, now the official name is .NET Services (good choice, it has no tie with Biztalk Server). .NET Services are a set of services oriented to cloud-based and cloud-aware applications. They addresses identity, workflow and connection of application:

Access Control

– Standards-based identity providers
– Support for Windows Live ID
– Enterprise directories
– Authorization decision
– Claim based with declarative rules

Service Bus

– Implements the Enterprise Service Bus application pattern
– Register and expose services, crossing network, security, organizational boundaries
– Internet-scale

Workflow Service

– Host workflows (yes, Windows Microsoft Workflow)

There are web and windows tools to consume and manage these services, and APIs to access them from our applications.

Learn more about .NET Services


I was part of the team that develop tools to access and consume these services. It was a challenging mission. In my opinion, all thess tools and services are a significant breakthrough to cloud computing. Since Ray Ozzie arrival to Microsoft, most of these stuff were nurtured by architects and developer, all around the world, and now, at PDC, all was unveiled.

The cloud computing sky is not blue: it’s azure.

Some articles:

Microsoft’s Azure is so 1997 (and Why I Love It)
Microsoft to battle in the clouds
steve clayton- geek in disguise – Clearing Clouds
Web 2.0 and Cloud Computing – O’Reilly Radar

Cloud Computing in my delicious

Angel “Java” Lopez

State Machines in C# 3.0 Using AjGenesis Templates

Recently, I found a code generation scenario, written by Andrew Matthews:

Permanent Link to State Machines in C# 3.0 using T4 Templates

I took the example, and reimplemented it using my code generation project AjGenesis. To run this example, you have to download the published 0.5 version, from Codeplex project page.

(more info about AjGenesis in my previous posts).

The code for this example.

The model is the same of Andrew’s original post:

<?xml version="1.0" encoding="utf-8" ?> <StateModels> <StateModel ID="My" start="defcon1"> <States> <State ID="defcon1" name="defcon1"/> <State ID="defcon2" name="defcon2"/> <State ID="defcon3" name="defcon3"/> </States> <Inputs> <Input ID="diplomaticIncident" name="diplomaticIncident"/> <Input ID="assassination" name="assassination"/> <Input ID="coup" name="coup"/> </Inputs> <Transitions> <Transition from="defcon1" to="defcon2" on="diplomaticIncident"/> <Transition from="defcon2" to="defcon3" on="assassination"/> <Transition from="defcon3" to="defcon1" on="coup"/> </Transitions> </StateModel> </StateModels>

(Andrew wrotes that it is a bit “24 (TV Series)” oriented example… 😉

I modified Andrew’s solution:

Now, there is an Model.xml file containing the above file. MyStateModel.cs is automatically generated from the model. I changed the solution to have have a Pre-Build event in TestHarness project:


The .cmd file contains:

cd ..\..\..
c:\ajlopez\ProyectosNet2\AjGenesis-0.5\bin\AjGenesis.Console TestHarness\Model.xml GenStates.ajg

(You MUST change the second line to point to the AjGenesis 0.5 distribution directory)

With this command, AjGenesis.Console loads the .xml file model, and applies a task, GenStates.ajg, written in AjBasic:

for each StateModel in StateModels
end for

There is another command, you can launch from the command line, MakeStates.cmd, containing:

c:\ajlopez\ProyectosNet2\AjGenesis-0.5\bin\AjGenesis.Console TestHarness\Model.xml GenStates.ajg

I love my AjBasic template GenStates.ajg (fragment):

using System; using System.Collections.Generic; using Aabs; using Core; namespace ${StateModel.ID} { public enum ${StateModel.ID}States : int { <# sep = "" for each State in StateModel.States #> ${sep}${State.ID} // ${} <# sep = "," end for #> } // end enum ${StateModel.Id}States ...

It’s based in the .tt file from Andrew Matthews. Note that there is no reference to .XML nodes or similar. AjGenesis loads the model in memory, as a dynamic object. AjBasic language can access to that model, using it as an usual object. The use of ${ } replaces the output with some value, from the variables or from the model in process.

The main point in this example is that it’s based on a free model (AjGenesis can load any model, it’s not use a predefined one). If you want to add more info, you can write more attributes, elements, in .xml file. And use them from the template code.

Another main point: it could be modified to generate the full VS solution, or to generate a solution in other languages (an example generating a full VS solution:
Code Generation for LINQ and C# 3.0 with AjGenesis

Thanks to Andrew for such interesting example. You can read more about his implementation in the mentioned post:

Permanent Link to State Machines in C# 3.0 using T4 Templates

Angel “Java” Lopez

F# and Functional Programming Resources

F# is a functional language, created by Microsoft. Implemented under .NET CLR, it’s a typed language, with access to .NET framework. It inherits most of ML/OCaml features.

F# was born in Microsoft Research, and its main creator is Don Syme. Although is a functional language, it supports object programming, too. After years of development, now it’s mature. It’s gaining momentum in scientific community, thanks to its flexibility: it’s not limited to its own library: it can access all .NET framework (The image at left shows F# program running a demo using DirectX from .NET).

Citing Expert F# book promotion at Apress:

While inspired by OCaml, F# isn’t just another functional programming language. Drawing on many of the strengths of both OCaml and .NET, it’s a general–purpose language ideal for real–world development. F# integrates functional, imperative, and object–oriented programming styles so you can flexibly and elegantly solve programming problems, and brings .NET development alive with interactive execution. Whatever your background, you’ll find that F# is easy to learn, fun to use, and extraordinarily powerful. F# will help change the way you think about and go about programming.

There is lot of information about the language. This post is a collection of links, blogs, posts, resources, books, about this very interesting language.


The first page to visit  Microsoft F# Home page:

Microsoft Research’s website for F#
F# Manual
F# Documentation

There are blogs and forums at
hubFS- The place for F# – F# news, forums and blogs

Personal blogs with F# info:
Don Syme’s web log, a key source of information on F#
Robert Pickering’s blog
Tomas Petricek
Granville Barnett’s blog
Luke Hoban’s blog
Chris Smith (F# Tester)
Brian McNamara (F# Dev)
Jomo Fisher (F# Dev)
Andrew Kennedy (MSR)
Luca Bolognese (Managed Languages Principal PM)

Harry Pierson has written many post about functional programming, C# and F#:
DevHawk Functional Programming category

Posts and podcasts

Some links to blog posts (there are hundreds in the above links), only to taste the language and its power:

Episode 18- Matt Podwysocki on F# and Functional Programming Herding Code
Matt Podwysocki puts the fun in functional programming with a deep dive into F#.

Concurrency on a single thread
F# has the async computation expression for writing parallel programs.

F# September 2008 CTP Released
The F# Team has released the F# September 2008 CTP. 

F# Overview (I.) – Introduction Articles TomasP.Net

Functional Understanding

Practical F# Parsing- The Parse Buffer

Play Ball Script in F#

Units of Measure in F#- Part One, Introducing Units

The Weekly Source Code 34 – The Rise of F#

To listen

Herding Code 18- Matthew Podwysocki on F# and Functional Programming
Software Engineering Radio Episode 108 – Simon Peyton Jones on Functional Programming and Haskel
.NET Rocks Episode 310 – Simon Peyton Jones on Functional Programming and Haskell


F# Samples – Home
Ant Colony Simulation

F# Books

  Foundations of F#

Every professional .NET programmer needs to learn about FP, and there’s no better way to do it than by learning F#–and no easier way to learn F# than from Foundations of F#. Written by F# evangelist Rob Pickering, this is an elegant, comprehensive introduction to all aspects of the language and an incisive guide to using F# for real-world professional development.

by Robert Pickering | ISBN-13: 978-1-59059-757-6 | Published May 2007 | 360pp.


 Expert F#

Written by F#’s inventor and two major contributors to its development, Expert F# is the authoritative, comprehensive, and in–depth guide to the language and its use. Designed to help others become experts, the first part of the book quickly yet carefully describes the F# language. The second part then carefully shows how to use F# elegantly for a wide variety of practical programming tasks.

by Don Syme, Adam Granicz, Antonio Cisternino | ISBN-13: 978-1-59059-850-4 | Published Dec 2007 | 609pp.

Another book by Jon Harrop: 

F# for Scientists

F# for Scientists will bring you up to speed with basic syntax and programming language concepts. Written in a clear and concise style with practical and enlightening examples, this book is accessible and easy to understand. By reviewing the Visual Studio screen shots that illustrate compilation, debugging and interactive use, you will understand both the functional aspects of F# and the object-oriented task-based features that make F# so useful in practice.

Functional Programming

If you are looking for functional programming in general:

Functional Programming for the Rest of Us

Why Functional Programming Matters a classic by John Hughes

Why Haskell Matters

The classic paper by Backus backus.pdf

A “potpurry” of links:

Are FP and OO Incompatible Syntactic Styles-
A Gentle Introduction to Haskell, Version 98
About Erlang
APL (programming language) (one of my first encounter with FP)
An APL Compiler (Timothy Budd book)
The Cat Programming Language
YouTube – Tangible Functional Programming
Functional Programming Notables #1 (more links to FP)
The Little MLer
functional objects Felleisen
Erlang in Lisp
Free Online Functional Programming Books —
The Expression Lemma (very geek, category theory, functional programming and LINQ!!)
Chaitin’s construction (more geeky, more category theory, Chaitin visited my country many times, he’s argentinian)
On being stateful
The Glasgow Haskell Compiler
A Neighborhood of Infinity- You Could Have Invented Monads! (And Maybe
InfoQ- Domain Specific Languages in Erlang

Functional C#

.NET and C# are moving to functional style. All you want to know about programming functional C# at Mattew Podwysocki post:

Richmond Code Camp 2008.2 – Functional C# Recap

Other links:

Functional C# Project
Is C# Becoming a Functional Language- – Mads Torgersen
Functional C# – Learn from F# and LINQ

My Delicious

As usual, the links I found useful are added to my delicious. Check:

Angel “Java” Lopez

Distributed applications with AjMessages using DSS/CCR

Well, it’s only a project. The sample application is minimal. But it’s the evolution of my previous work with AjMessages via Windows Communication Foundation:

AjMessages- a message processor

Last year, I wrote that example, and another one that uses DSS/CCR. Only the first was published, now, I’m reviewing my DSS/CCR implementation, mounted on Microsoft Robotics technology. Currently, you can download the code from CodePlex at:

Both examples were based on Fabriq project ideas, trasposed to new technologies. Recently, Arvindra Sehmi posted about a new version of Fabriq, named Fabriq4Dss, that is using DSS/CCR in a more powerful ways. He prepared a presentation for JAOO, read more at:

JAOO 2008 Presentation

Keep tuned!

The solution

It’s composed by three projects:

The first one is a core implementation, that is independent of the transport to use for distributed messages:

The second project contains a simple message handler to use in the demo. The third project is the DSS service component to use as a host node:


For a more detailed description of application, message, hosts, read my previous post:

AjMessages- a message processor

The application

A configuration XML file define the applications to run. An application has:

  • Nodes: a collection of actions to process.
  • Handlers: objects to process a message. A handler can be a composite of other handlers.
  • Actions: named entry points to a handler

An example application definition (from AjMessages.SampleApp\Configurations\Server1.xml):

<?xml version="1.0" encoding="utf-8" ?> <AjMessages> <Application Name="AjMessages"> <Node Name="Administration"> <Handler Name="ConfigureHandler" Type="AjMessages.ConfigureHandler, AjMessages"/> <Handler Name="PrintHandler" Type="AjMessages.PrintHandler, AjMessages"/> <Handler Name="PrintMessageHandler" Type="AjMessages.PrintMessageHandler, AjMessages"/> <Handler Name="ConfigurePipeline"> <Handler Name="PrintHandler"> <Property Name="Text" Value="Reconfiguring server..."/> </Handler> <Handler Name="ConfigureHandler"/> </Handler> <Action Name="Configure" Handler="ConfigurePipeline"/> </Node> </Application> <Application Name="App1"> <Node Name="Node1"> <Handler Name="PrintMessageHandler" Type="AjMessages.PrintMessageHandler, AjMessages"/> <Handler Name="PostHandler" Type="AjMessages.PostHandler, AjMessages"/> <Handler Name="DecrementHandler" Type="AjMessages.SampleApp.Handlers.DecrementHandler, AjMessages.SampleApp"/> <Handler Name="Pipeline1"> <Handler Name="DecrementHandler"/> <Handler Name="PostHandler"> <Property Name="Action" Value="App1/Node1/Process"/> </Handler> </Handler> <Action Name="Process" Handler="Pipeline1"/> </Node> <Node Name="Node2"/> </Application> <Host Name="Server1" Activate="true"> <Application Name="AjMessages"> <Node Name="Administration"/> </Application> <Application Name="App1"> <Node Name="Node1"/> <Node Name="Node2"/> </Application> </Host> <Host Name="Server2" Address="http://localhost:50002/ajmessages/node"> <Application Name="AjMessages"> <Node Name="Administration"/> </Application> <Application Name="App1"> <Node Name="Node1"/> <Node Name="Node2"/> </Application> </Host> </AjMessages>

Running the example

Load the solution in Visual Studio 2008 (you must have Microsoft Robotics Developer Studio, a CTP version of this year, and you must configure the output path of the projects to point to your MRDS directory). Running the DSS project lunch a DSS Host that shows a controller window:

The host is running on ports 50000/50001. Configure the host using the AjMessages.SampleApp\Configurations\Server1.xml.

You can launch a second host from DSS prompt:

bin/dsshost /p:50002 /t:50003

A second form controller appears:

Use the other config file AjMessages.SampleApp\Configurations\Server2.xml and port 50002.

You can send a message to the sample app. The message is only an integer, that is decremented in each node. The decrement node is installed in the two servers, so the message travels from one to another server.

Next steps

I want to support an arbitrary object, serialized in DSS, and uses WCF as a transport, too. The previous post describes the WCF implementation.

Angel “Java” Lopez

Another model for AjGenesis

This post describes an idea, there is no implementation yet. AjGenesis, my open source code generation project, is based in models, tasks and template. Each artifact is used defined, so you can generate outputs for any technology, framework or platform.

The model resides in memory, during the process. You can load many models at the same time: in the provided examples, an abstract model (describing the solution to generate) and a technology model (defining the language, technology, database to use), are both used in the same process.

The model can be loaded from XML files, or from text files (this is a new feature I published recently, under testing). Now, I want to propose another way: model in Excel/spreedsheets files.

The example

In a recent post:

Textual model for code generation in AjGenesis

I presented a simple model, in two representations: XML and textual. That model could be expressed in an Excel spreadsheet as:


The scope of an object description is determined by the indent: Entity Customer is an element of Entities. You can use a table to describe an element with multiple elements. A simple property can be described in two consecutives columns: first columm has the property, second one has the value. If you want to describe an object in another worksheet, [..] has the name of the worksheet where the rest of description resides, as in “Entity [Employee]”:


The main benefit for this model is the clear presentation you can achieve. Colors and fonts will be ignored when AjGenesis loaded the model. But the presentation is improved. 

Next steps

If this proposal is found useful by users, I could write the new model builder from Excel files. I have to choose what library to use: I could use the Excel object model provided by the tool. Any comments, suggestions?

Angel “Java” Lopez