<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Angel "Java" Lopez on Blog</title>
	<atom:link href="http://ajlopez.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ajlopez.wordpress.com</link>
	<description>Software Development, in the Third Millenium</description>
	<pubDate>Fri, 25 Apr 2008 11:58:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>The new Microsoft baby: Live Mesh</title>
		<link>http://ajlopez.wordpress.com/2008/04/25/the-new-microsoft-baby-live-mesh/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/25/the-new-microsoft-baby-live-mesh/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 11:54:56 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Software as a Service]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=92</guid>
		<description><![CDATA[
These week, the Redmond giant announced its new creation, Live Mesh (a tech preview):
https://www.mesh.com/Welcome/Welcome.aspx
 
Thanks to Arvindra Sehmi post:
 &#160;http://blogs.msdn.com/asehmi/archive/2008/04/24/introducing-live-mesh.aspx
we now&#160;have a list of comments about this new Microsoft baby. Thise new&#160;redmonian inception&#160;is not easy to describe briefly, but it deserves to take a shot.&#160;It is an incursion from Microsoft into Web 2.0 and its [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /></p>
<p>These week, the Redmond giant announced its new creation, Live Mesh (a tech preview):
<p><a href="https://www.mesh.com/Welcome/Welcome.aspx">https://www.mesh.com/Welcome/Welcome.aspx</a>
<p align="center"><img src="http://www.ajlopez.com/images/articles/livemesh.png"> </p>
<p>Thanks to Arvindra Sehmi post:
<p><img style="margin:0 20px 20px 0;" src="http://www.ajlopez.com/images/articles/sehmipost.png" align="left"> &nbsp;<a href="http://blogs.msdn.com/asehmi/archive/2008/04/24/introducing-live-mesh.aspx">http://blogs.msdn.com/asehmi/archive/2008/04/24/introducing-live-mesh.aspx</a>
<p>we now&nbsp;have a list of comments about this new Microsoft baby. Thise new&nbsp;redmonian inception&nbsp;is not easy to describe briefly, but it deserves to take a shot.&nbsp;It is an incursion from Microsoft into Web 2.0 and its own creation, Software plus Service world.
<p>(for bloggers, note the use of links with screenshots, great idea Arvindra!)
<p>This video explains the high level architecture (thanks to <a href="http://staff.southworks.net/blogs/matiaswoloski/default.aspx" target="_blank">Matias Woloski</a> for this link)
<p><a href="http://channel9.msdn.com/Showpost.aspx?postid=399577">http://channel9.msdn.com/Showpost.aspx?postid=399577</a>
<p>In that list of articles, I found&nbsp;a good introduction by the ineffable Mary Jo Foley
<p><a href="http://blogs.zdnet.com/microsoft/?p=1355" target="_blank">Ten things to know about Microsoft&#8217;s Live Mesh</a>
<p>Read the point one:<br />
<blockquote>
<p><strong>1. The definition</strong>. As has become the norm with so many of its Software + Services products and strategies, Microsoft isn’t the best at coming up with a succinct Live Mesh definition. The closest I found (in a Live Mesh reviewer’s guide) was this: “Live Mesh is a ’software-plus-services’ platform and experience from Microsoft that enables PCs and other devices to ‘come alive’ by making them aware of each other through the Internet, enabling individuals and organizations to manage, access, and share their files and applications seamlessly on the Web and across their world of devices.” If I were in charge of defining Live Mesh, I think I’d go with “a Software + Services platform for synchronization and collaboration.”</p>
</blockquote>
<p>Here, I&nbsp;detect the reborn of some ideas envisioned by Bill Joy for Jini, a technology that was born too early:
<p><a href="http://java.sun.com/developer/technicalArticles/jini/JiniVision/jiniology.html" target="_blank">The Jini Technology Vision</a><br />
<blockquote>
<p>Jini technology redefines the concept of a client. Instead of a fixed set of &#8220;local&#8221; devices, Jini technology supplies the Java client with a federation of remote &#8220;plug and play&#8221; devices in a dynamic configuration (the Jini Federation) that is personalized for each client. With Jini technology, the network truly becomes the client computer! </p>
</blockquote>
<p>All this new move from MS could be the visible result of some of Ray Ozzie&#8217;s ideas, expressed years ago in his noteworthy memo:
<p><a href="http://www.scripting.com/disruption/ozzie/theinternetservicesdisruptio.htm" target="_blank">The Internet Services Disruption</a>
<p>I guess Microsoft is moving more and more to the Internet (remember its Yahoo affaire). That&#8217;s a company that embraced the Andy Grove&#8217;s motto: <a href="http://www.intel.com/pressroom/kits/bios/grove/paranoid.htm" target="_blank">only the paranoid survive</a>. There are betting on RIA, Silverlight, web 2.0, rich client&#8230; Any number on roulette is covered, even the double zero&#8230; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
<p>One note: it&#8217;s amusing that, after all this effort, Microsoft still reveals its new tools only to US residents. Google, instead,&nbsp;pushed its innovations as beta or whatever, but for all the world at once. Hey, toc, toc, McFly&#8230;. some MS VP reading here? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
<p>Angel &#8220;EverMeshed&#8221; Lopez<br /><a href="http://www.ajlopez.com/en">http://www.ajlopez.com/en</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/92/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/92/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=92&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/25/the-new-microsoft-baby-live-mesh/feed/</wfw:commentRss>
	
		<media:content url="http://www.ajlopez.com/images/articles/livemesh.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/sehmipost.png" medium="image" />
	</item>
		<item>
		<title>AjGenesis: Generating the model from assemblies</title>
		<link>http://ajlopez.wordpress.com/2008/04/23/ajgenesis-generating-the-model-from-assemblies/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/23/ajgenesis-generating-the-model-from-assemblies/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 10:28:03 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AjGenesis]]></category>

		<category><![CDATA[Code Generation]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=91</guid>
		<description><![CDATA[&#160;Darío Quintana have rewrote his program that generates an&#160; AjGenesis model starting from compiled .NET assemblies. The last version is described at (Spanish post):
Generando con AjGenesis desde los assemblies
The image shows the main project directory content. There are other projects, with NUnit tests, examples, and compiled code. 
It is interesting to see how a model [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img style="margin:0 20px 20px 0;" src="http://www.ajlopez.com/images/articles/fromassembly.jpg" align="left">&nbsp;<a href="http://blog.darioquintana.com.ar/" target="_blank">Darío Quintana</a> have rewrote his program that generates an&nbsp; <a href="http://ajlopez.com/ajgenesis">AjGenesis</a> model starting from compiled .NET assemblies. The last version is described at (Spanish post):</p>
<p><a href="http://blog.darioquintana.com.ar/2007/11/20/generando-con-ajgenesis-desde-los-assemblies/" target="_blank">Generando con AjGenesis desde los assemblies</a></p>
<p>The image shows the main project directory content. There are other projects, with NUnit tests, examples, and compiled code. </p>
<p>It is interesting to see how a model (there is no fixed model in AjGenesis) could be obtained from different sources. In a previous post I described a short example, showing how to obtain a model from the database structure:</p>
<p><a href="http://ajlopez.wordpress.com/2008/04/21/ajgenesis-generating-the-model-from-the-database/" target="_blank">AjGenesis: Generating the model from the database</a></p>
<p>Darío, in his post, shows how he uses his project from an AjGenesis tasks:</p>
<div class="wlWriterSmartContent" id="c16c827e-a831-4a62-980d-764f1becd75a" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">function</span><span style="color:#000000;"> GetEntities(path)

    AssemblyManager.LoadFrom(AjGenesisFromAssemblyPath)
    obj </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> AjGenesis.FromAssembly.Collector()
    list </span><span style="color:#000000;">=</span><span style="color:#000000;"> obj.GetEntities(path,null)
    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> list

</span><span style="color:#0000FF;">end function</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>This code uses the new <strong>AssemblyManager</strong> to load the library <strong>AjGenesis.FromAssembly</strong>.</p>
<p>The classes <strong>Model</strong>, <strong>Entity</strong>, <strong>Property</strong> are the model, like in other AjGenesis examples. The class <strong>Collector</strong> creates a <strong>Generator </strong>object. This object is in charge of the hard work, finding the entities inside an assembly:</p>
</p>
<div class="wlWriterSmartContent" id="582809d9-d40a-4fec-b79d-ed9e2d9cfd1e" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#0000FF;">using</span><span style="color:#000000;"> System.Collections;

</span><span style="color:#0000FF;">namespace</span><span style="color:#000000;"> AjGenesis.FromAssembly
{
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> Collector
    {
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> ArrayList GetEntities(</span><span style="color:#0000FF;">string</span><span style="color:#000000;"> assemblyPath, </span><span style="color:#0000FF;">string</span><span style="color:#000000;"> ns) {
            Generator g </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Generator();
            g.Path </span><span style="color:#000000;">=</span><span style="color:#000000;"> assemblyPath;
            g.AssemblyToObjects();
            ArrayList array </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> ArrayList();

            </span><span style="color:#0000FF;">foreach</span><span style="color:#000000;"> (Entity entity </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> g.Model.Entities)
            {
                array.Add(entity);
            }
            </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> array;
        }
    }
}</span></div>
</pre>
</div>
<p>Un fragmento de <strong>Generator</strong>:</p>
<p>&nbsp;</p>
</p>
<div class="wlWriterSmartContent" id="21ef576d-f2dd-4757-b752-4a879d8cfbb3" style="display:inline;float:none;width:571px;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> AssemblyToObjects() {
    Assembly assembly </span><span style="color:#000000;">=</span><span style="color:#000000;"> Assembly.LoadFrom(Path);
    Type[] types;

    types </span><span style="color:#000000;">=</span><span style="color:#000000;"> assembly.GetTypes();

    </span><span style="color:#008000;">//</span><span style="color:#008000;">Get all types from the assembly</span><span style="color:#008000;">
</span><span style="color:#000000;">    </span><span style="color:#0000FF;">for</span><span style="color:#000000;"> (</span><span style="color:#0000FF;">int</span><span style="color:#000000;"> i </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">0</span><span style="color:#000000;">; i </span><span style="color:#000000;">&lt;</span><span style="color:#000000;"> types.Length; i</span><span style="color:#000000;">++</span><span style="color:#000000;">)
    {
        </span><span style="color:#008000;">//</span><span style="color:#008000;">Veo que interfaces est&#225; implementando</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#0000FF;">bool</span><span style="color:#000000;"> ImplementaIEntity </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">;

        Type[] interfacesTypes </span><span style="color:#000000;">=</span><span style="color:#000000;"> types[i].GetInterfaces();

        ImplementaIEntity </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">true</span><span style="color:#000000;">;

        </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (ImplementaIEntity)
        {
            Entity entity </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Entity();

            entity.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> GetTypeName(types[i].Name);
            entity.FullName </span><span style="color:#000000;">=</span><span style="color:#000000;"> types[i].FullName;

            </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (types[i].BaseType </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">)
            {
                entity.Inherits </span><span style="color:#000000;">=</span><span style="color:#000000;"> GetTypeName(types[i].BaseType.Name);
                entity.InheritsFullName </span><span style="color:#000000;">=</span><span style="color:#000000;"> types[i].BaseType.FullName;
            }

            PropertyInfo[] propertyInfo </span><span style="color:#000000;">=</span><span style="color:#000000;"> types[i].GetProperties();

            </span><span style="color:#0000FF;">foreach</span><span style="color:#000000;"> (PropertyInfo pi </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> propertyInfo)
            {
                Property prop </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> Property();
                prop.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> pi.Name;
                prop.TypeName </span><span style="color:#000000;">=</span><span style="color:#000000;"> pi.PropertyType.Name;
                </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> (pi.PropertyType.FullName </span><span style="color:#000000;">!=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">null</span><span style="color:#000000;">)
                {
                    prop.TypeFullName </span><span style="color:#000000;">=</span><span style="color:#000000;"> pi.PropertyType.FullName;
                }
                </span><span style="color:#0000FF;">else</span><span style="color:#000000;">
                    prop.TypeFullName </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">string</span><span style="color:#000000;">.Empty;

                entity.Properties.Add(prop);
            }

            _model.Entities.Add(entity);
        }
    }
}
</span></div>
</pre>
</div>
<p>This is only a fragment of the code, see the complete project to have more detail. It uses reflection to obtain the types in an assembly, and its properties. I guess Darío wants to improve the way of detecting when a type is an entity, using interfaces and attributes.</p>
<p>Angel &#8220;Java&#8221; Lopez<br /><a href="http://www.ajlopez.com/">http://www.ajlopez.com/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/91/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/91/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=91&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/23/ajgenesis-generating-the-model-from-assemblies/feed/</wfw:commentRss>
	
		<media:content url="http://www.ajlopez.com/images/articles/fromassembly.jpg" medium="image" />
	</item>
		<item>
		<title>AjGenesis: Generating the model from the database</title>
		<link>http://ajlopez.wordpress.com/2008/04/21/ajgenesis-generating-the-model-from-the-database/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/21/ajgenesis-generating-the-model-from-the-database/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 09:39:24 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AjGenesis]]></category>

		<category><![CDATA[Code Generation]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=90</guid>
		<description><![CDATA[My code generation project AjGenesis uses one or many user-defined models to generate text artifacts, using programmable tasks and templates. When I started the project, I read the&#160;Kathleen Dollard&#8217;s&#160;book Code Generation in Microsoft .NET
One of her recommendations is take metatadata from some resource, like a database. In my opinion, not all needed metadata resides in [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>My code generation project <a href="http://www.ajlopez.com/ajgenesis">AjGenesis</a> uses one or many user-defined models to generate text artifacts, using programmable tasks and templates. When I started the project, I read the&nbsp;<a href="http://gendotnet.com/" target="_blank">Kathleen Dollard</a>&#8217;s&nbsp;book <a href="http://www.amazon.com/exec/obidos/ASIN/1590591372/qid%3D1103643269/sr%3D11-1/ref%3Dsr_11_1/104-5797382-2343919" target="_blank">Code Generation in Microsoft .NET</a></p>
<p>One of her recommendations is take metatadata from some resource, like a database. In my opinion, not all needed metadata resides in a database schema, so, from the very beginning of the project, I follow the way of a free user-defined model (I quickly go away from the&nbsp;Dollard&#8217;s&nbsp;ideas of using XSLT transformations: I think XSLT is the devil&#8217;s work&#8230; don&#8217;t try it&nbsp;at your home..;-). There are many interesting points her ideas, I should write a post about her book.</p>
<p>But metadata from database is not discarded. It can be used, applying some work. Remember: code generation is a pragmatic solution, don&#8217;t ignore&nbsp;useful metadata source.</p>
<p>So, some months ago, I wrote a simple example inside the ones that come with AjGenesis. You can try the example, downloading the last published version of the project:</p>
<p><a href="http://www.codeplex.com/ajgenesis/Release/ProjectReleases.aspx?ReleaseId=7262" target="_blank">AjGenesis Versión 0.5</a></p>
<p>The example is located at <strong>examples\LoadDB</strong> directory.</p>
<p>It works using the&nbsp;Northwind database that comes as example for MS SQL Server. In the directory example, from the command line, execute</p>
<p><font face="Consolas">make</font></p>
<p>This command executes an AjGenesis task:</p>
<p><font face="Consolas">..\..\bin\AjGenesis.Console Tasks\DbProcess.ajg<br />pause</font>
<p>It connects with database:</p>
</p>
<div class="wlWriterSmartContent" id="e6cd5e30-c2b9-4ea3-a7c8-a3457b3262e0" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Connection</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

AssemblyManager.LoadWithPartialName(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">System.Data</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)

con </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> System.Data.SqlClient.SqlConnection()

</span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">ConnectionString</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

con.ConnectionString </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">server=(local);uid=sa;database=Northwind</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

</span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Command</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

cmd </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> System.Data.SqlClient.SqlCommand()

cmd.Connection </span><span style="color:#000000;">=</span><span style="color:#000000;"> con
cmd.CommandText </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">select * from Information_Schema.Tables</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

con.Open()
</span></div>
</pre>
</div>
<p>This code uses the information inside Information_Schema.Tables. Take notice of the use of the new AssemblyManager, an utility in AjGenesis that loads assemblies.</p>
<p>Then, the code obtains the table names:</p>
<div class="wlWriterSmartContent" id="09916ab7-2bfd-4732-b2bc-56841cc1870c" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#000000;">dr </span><span style="color:#000000;">=</span><span style="color:#000000;"> cmd.ExecuteReader()

TableNames </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> System.Collections.ArrayList()

</span><span style="color:#0000FF;">while</span><span style="color:#000000;"> dr.Read()
    </span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Table </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Table_Name</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">: </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Table_Type</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
    TableName </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Table_Name</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
    </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Table_Type</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)</span><span style="color:#000000;">=</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">BASE TABLE</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
        TableNames.Add(TableName)
    </span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">while</span><span style="color:#000000;">

dr.Close()

</span></div>
</pre>
</div>
</p>
<p>Once this info was obtained, it gets the columns of the tables, making an in-memory model in a Tables collection:</p>
</p>
<div class="wlWriterSmartContent" id="c70b67c4-eb21-4a2f-9346-13b1ad45818d" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#000000;">Tables </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> System.Collections.ArrayList()

</span><span style="color:#0000FF;">For</span><span style="color:#000000;"> </span><span style="color:#0000FF;">each</span><span style="color:#000000;"> TableName </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> TableNames
    </span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Loading Table </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> TableName
    Table </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> AjGenesis.Models.DynamicModel.DynamicObject()
    Table.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> TableName
    Table.Columns </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> System.Collections.ArrayList()

    cmd.CommandText </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">SELECT * from Information_Schema.Columns where Table_name=&#8217;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> TableName </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">&#8216;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
    dr </span><span style="color:#000000;">=</span><span style="color:#000000;"> cmd.ExecuteReader()

    </span><span style="color:#0000FF;">while</span><span style="color:#000000;"> dr.Read()
        ColumnName </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Column_Name</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
        </span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Processing Column </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> ColumnName </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">: </span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&amp;</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Data_Type</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
        Column </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> AjGenesis.Models.DynamicModel.DynamicObject()
        Column.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> ColumnName
        Column.DataType </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Data_Type</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
        </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Character_Maximum_Length</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
            Column.Length </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Character_Maximum_Length</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
            Column.IsNumeric </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">false</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">else</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">if</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Numeric_Precision</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">) </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
                Column.Length </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Numeric_Precision</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
                Column.Scale </span><span style="color:#000000;">=</span><span style="color:#000000;"> dr.Item(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Numeric_Scale</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
                Column.IsNumeric </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#0000FF;">true</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">
        Column.SqlName </span><span style="color:#000000;">=</span><span style="color:#000000;"> Column.Name
        Column.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> Column.Name.Replace(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">,</span><span style="color:#000000;">&quot;&quot;</span><span style="color:#000000;">)
        Table.Columns.Add(Column)
    </span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">while</span><span style="color:#000000;">

    dr.Close()

    Table.SqlName </span><span style="color:#000000;">=</span><span style="color:#000000;"> Table.Name
    Table.Name </span><span style="color:#000000;">=</span><span style="color:#000000;"> Table.Name.Replace(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">,</span><span style="color:#000000;">&quot;&quot;</span><span style="color:#000000;">)

    Tables.Add(Table)
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">for</span><span style="color:#000000;">

</span></div>
</pre>
</div>
<p>Finally, I use the old trick of visiting the model, applying a template to it to generate other model. This is an interesting idea that deserves more attention: multi-step model generation and transformation. I could inject some expert system to complete the model, and infers any missing part. The model can be a in-memory one, or it can saved in an XML file, to be adapted and improved:</p>
<p><div class="wlWriterSmartContent" id="f4097faa-fdf4-4f55-8642-cfb58405ba63" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#000000;">FileManager.CreateDirectory(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Model</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)

</span><span style="color:#0000FF;">for</span><span style="color:#000000;"> </span><span style="color:#0000FF;">each</span><span style="color:#000000;"> Table </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> Tables
    TransformerManager.Transform(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Templates\Table.tpl</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Model\${Table.Name}.xml</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, Environment)
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">for</span><span style="color:#000000;">

</span></div>
</pre>
</div>
<p>A generated model as example:</p>
<div class="wlWriterSmartContent" id="c68b624a-3d9b-4db4-ab6a-f62c8834bb6a" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#0000FF;">&lt;?</span><span style="color:#FF00FF;">xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; standalone=&quot;yes&quot;</span><span style="color:#0000FF;">?&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Table</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">Region</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">Region</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">

    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Columns</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Column</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">RegionID</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">RegionID</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">DataType</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">int</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">DataType</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Length</span><span style="color:#0000FF;">&gt;&lt;/</span><span style="color:#800000;">Length</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Scale</span><span style="color:#0000FF;">&gt;&lt;/</span><span style="color:#800000;">Scale</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Column</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Column</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">RegionDescription</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">RegionDescription</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">SqlName</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">DataType</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">nchar</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">DataType</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Length</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">50</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Length</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Scale</span><span style="color:#0000FF;">&gt;&lt;/</span><span style="color:#800000;">Scale</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Column</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Columns</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Table</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>Now, using AssemblyManager, we can load any .dll assembly, and use it to generate any code.&nbsp;<a href="http://blog.darioquintana.com.ar/" target="_blank">Darío Quintana</a>&nbsp;works with&nbsp;this feature to generate code from compiled code&nbsp;(post in&nbsp;Spanish&nbsp;<a href="http://blog.darioquintana.com.ar/2007/11/20/generando-con-ajgenesis-desde-los-assemblies/" target="_blank">Generando con AjGenesis desde los assemblies</a>). You can download his utility from</p>
<p><a title="http://code.google.com/p/darioquintana/downloads/detail?name=AjGenesis.FromAssembly.7z" href="http://code.google.com/p/darioquintana/downloads/detail?name=AjGenesis.FromAssembly.7z">http://code.google.com/p/darioquintana/downloads/detail?name=AjGenesis.FromAssembly.7z</a></p>
<p>One idea: we can use the Meta library from <a href="http://www.mygenerationsoftware.com/" target="_blank">MyGenerationSoftware</a> to obtain metadata from any supported database. Notably, now this utility&nbsp;has published source code.</p>
<p>Angel &#8220;Java&#8221; Lopez<br /><a href="http://www.ajlopez.com/en">http://www.ajlopez.com/en</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/90/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/90/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=90&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/21/ajgenesis-generating-the-model-from-the-database/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Distributed Scribble with Microsoft Robotics Developer Studio and DSS</title>
		<link>http://ajlopez.wordpress.com/2008/04/20/distributed-scribble-with-microsoft-robotics-developer-studio-and-dss/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/20/distributed-scribble-with-microsoft-robotics-developer-studio-and-dss/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 15:07:37 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Concurrency and Coordination Runtime]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=89</guid>
		<description><![CDATA[I&#8217;m playing withthe new CTP release of Microsoft Robotics Developer Studio. It has new features, as deploying and running a Visual Programming Language diagram in many nodes.
To explore some of this new functionality, I&#8217;ve write the dream of any software developer: a distributed multiuser scribble program&#8230;;-)&#8230; Well, it&#8217;s a very simple one, but it works, [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m playing withthe new CTP release of Microsoft Robotics Developer Studio. It has new features, as deploying and running a Visual Programming Language diagram in many nodes.</p>
<p>To explore some of this new functionality, I&#8217;ve write the dream of any software developer: a distributed multiuser scribble program&#8230;;-)&#8230; Well, it&#8217;s a very simple one, but it works, and it&nbsp;can run in many places, exposing and sharing your most inspired mouse drawings. The code can be downloaded <a href="http://www.ajlopez.com/downloads/DssScribble.zip">from here</a>.</p>
<h3>The project</h3>
<p>I have the 1.5 version of the MSRS and the new CTP MRDS (new acronym, guys), running in the same machine, without glitches. I&#8217;ve started creating a new Simple Dss Service RDS 2008:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribprj.png"> </p>
<p align="left">The project contains one service component named DssScribble, and one Windows form, that is in charge of the drawing:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribsln.png"> </p>
<p align="left">At the start of the service component, it creates the form, and connects to it using ports and its dispatcher queue:</p>
<p>
<div class="wlWriterSmartContent" id="be5c684c-2d45-4b54-8900-6139c92c1a63" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">protected</span><span style="color:#000000;"> </span><span style="color:#0000FF;">override</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> Start()
{
    </span><span style="color:#0000FF;">base</span><span style="color:#000000;">.Start();
    </span><span style="color:#008000;">//</span><span style="color:#008000;"> Add service specific initialization here.</span><span style="color:#008000;">
</span><span style="color:#000000;">   WinFormsServicePort.Post(</span><span style="color:#0000FF;">new</span><span style="color:#000000;"> RunForm(CreateForm));
}

</span><span style="color:#0000FF;">private</span><span style="color:#000000;"> Form CreateForm()
{
    </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> </span><span style="color:#0000FF;">new</span><span style="color:#000000;"> CanvasForm(_mainPort, linePort, TaskQueue);
}
</span></div>
</pre>
</div>
<p>Each line the user draw in the window is posted to service component, to be distributed to any interested subscriber:</p>
<div class="wlWriterSmartContent" id="9c1e3690-1e0e-4f8a-a7fd-11cc3954d16e" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#000000;">[ServiceHandler(ServiceHandlerBehavior.Exclusive)]
</span><span style="color:#0000FF;">public</span><span style="color:#000000;"> IEnumerator</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">ITask</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> PostLineHandler(PostLine postLine)
{
    SendNotification</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">PostLine</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">(_submgrPort, postLine);

    </span><span style="color:#0000FF;">yield</span><span style="color:#000000;"> </span><span style="color:#0000FF;">break</span><span style="color:#000000;">;
}
</span></div>
</pre>
</div>
<p>The lines are received&nbsp;in the NewLineHandler (the way to connect two components is via VPL, we&#8217;ll see later). The linePort is the port to communicate with the WinForm instance:</p>
<div class="wlWriterSmartContent" id="2b7373d7-6830-4789-84c6-435af48c8805" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#000000;">[ServiceHandler(ServiceHandlerBehavior.Exclusive)]
</span><span style="color:#0000FF;">public</span><span style="color:#000000;"> IEnumerator</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">ITask</span><span style="color:#000000;">&gt;</span><span style="color:#000000;"> NewLineHandler(NewLine newLine)
{
    linePort.Post(newLine.Body);

    newLine.ResponsePort.Post(DefaultUpdateResponseType.Instance);

    </span><span style="color:#0000FF;">yield</span><span style="color:#000000;"> </span><span style="color:#0000FF;">break</span><span style="color:#000000;">;
}
</span></div>
</pre>
</div>
<p>The service component has no state. I use a class to transport the information of new lines to draw and distribute:</p>
<p><div class="wlWriterSmartContent" id="4ba65ae9-4694-4a58-b156-5cb25864e3fe" style="display:inline;float:none;width:398px;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#000000;">    [DataContract()]
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> DssScribbleState
    {
    }

    [DataContract()]
    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> DssScribbleLine
    {
        [DataMember()]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> fromX;

        [DataMember()]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> fromY;

        [DataMember()]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> toX;

        [DataMember()]
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> toY;

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> DssScribbleLine()
        {
        }

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> DssScribbleLine(</span><span style="color:#0000FF;">int</span><span style="color:#000000;"> fromX, </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> fromY, </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> toX, </span><span style="color:#0000FF;">int</span><span style="color:#000000;"> toY)
        {
            </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.fromX </span><span style="color:#000000;">=</span><span style="color:#000000;"> fromX;
            </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.fromY </span><span style="color:#000000;">=</span><span style="color:#000000;"> fromY;
            </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.toX </span><span style="color:#000000;">=</span><span style="color:#000000;"> toX;
            </span><span style="color:#0000FF;">this</span><span style="color:#000000;">.toY </span><span style="color:#000000;">=</span><span style="color:#000000;"> toY;
        }
    }
</span></div>
</pre>
</div>
<h3>Drawing with VPL</h3>
<p>The Visual Programming Language is a fascinating tool, with so many features. You can drag and drop service components from the toolbar. When the tool is launched, you can search the DssScrible service component in the left bottom toolbox:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribvpl3.png"> </p>
<p>I dropped two instances of DssScribble service component, and renamed them to DssScribble1 and DssScribble2:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribvpl2.png"> </p>
<p>I connected the instances, so they listen their notifications. Every line produced in one instance, is transmitted to the other. In this way, what you draw in a window is viewed in the other.</p>
<p>The connection is between the PostLine notification to a NewLine operation:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribconn.png"> </p>
<p>To launch the application, go to <strong>Run -&gt; Start</strong> menu. A windows appears, showing the log messages:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribrun.png"> </p>
<p align="left">Few moments, and the two instances of DssScribble service&nbsp;are created, each one shows a form. You can draw in any form, and the mouse drawn lines are replayed in the other form:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribwin.png"> </p>
<p align="left">That is my self-portrait: my left eye with a tear, because the emotion of distributed scribbling&#8230;. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h3>Running on distributed nodes</h3>
<p>VPL IDE has a node designer. At the right, there is a node branch on the Project tree. Each node represents a DSS node hosting DSS service components. I added two nodes, the first containing the instance and diagram of the current application (diagrams are services that can be viewed during the debug phase in your browser, you&#8217;ll love that featuer). I&nbsp;dragged and dropped DssScribble2 instance to the second node:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribvpl1.png"> </p>
<p align="left">Note the right bottom panel: I set the properties for Windows0 node, in the same localhost machine, but with other ports (Windows node will run at 50000/50001 ports). In other project, I tried to have a remote machine, and the distribution of the application worked without problems. You can define any number of nodes, each in a machine of your office, put on them DssScribble instances, related each other, and play scribbling with your coworkers (after work, please&#8230;. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p align="left">In order to run the application in a distribute way, you must compile it. Use the <strong>Build -&gt; Compile as a Service </strong>menu option. You must set a directory where to generate the code and solution. Then, VPL tool compile the solution and generate packages to deploy. You can open the generated solution with Visual Studio, if you are curious (the code is a very interesting, a very clever one, implementing, I suppose, an state or stack machine, look at Decrement and Increment methods).</p>
<p align="left">Each node must have a package deployer service, running on another port (the same one for all nodes, default value is 55555). Go to run bin directory of Microsoft Robotics Developer Studio, and run the <strong>rundeployer.cmd</strong>:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribrd.png"> </p>
<p align="left">&nbsp;</p>
<p align="left">Note: if you want to compile the service again, you must stop the deployer node: this is using the bin directory and the compilation conflicts with the package deployer host.</p>
<p align="left">Now, we are ready to deploy our killer app: execute <strong>Run -&gt; Run on distributed nodes. </strong>The system warns about to have deployers running:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribwarn.png"> </p>
<p align="left">And the magic begins: each node is contacted, and the application is deployer to them. A DSS node is started in each node, and its corresponding service instances are created. In this example, you will have two new old-DOS windows, running each DSS node. This is my second node window:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/dssscribhost.png"> </p>
<p align="left">Now, each node show its scribbling window, and the fun begins.</p>
<h3>Notes</h3>
<p>I&#8217;m not using partners in this example. Instead, I&#8217;m put notification of events, in this case, new lines, so other components can receive such notification. You can write other components, other than scribble windows, to receive and process the lines. One idea is to use the coordinates of a new line to control a robot motor, or to persists the lines produced with a new persistence component. To control a robot motor, you should play with VPL, without rewriting the service component code.</p>
<h3>Conclusions</h3>
<p>Using VPL you can compose new applications&nbsp;from preexisting components. You&nbsp;can create your own activities, too. And using node diagrams (in VPL or using the DSS Manifest Editor) with the packager deployer, we can distribute the application in many physical nodes, in any convenient manner. But you must define each node and component: there is no provisioning of have a grid, so we can clone and distribute a working component. A gridified DSS application can be written, but in my opinion, it should be created with custom code. Idea to explore: write a custom control application that, using package deployer, deploys&nbsp;tasks to nodes in a grid.</p>
<p>All these tools opened my brain. Writing DSS service component is a new way of thinking and programming, something I want to explore for years: how to write objects with one-way message processing, in a distributed and parallel way (<a href="http://ajlopez.wordpress.com/category/ajagents/" target="_blank">AjAgents</a> was motivated by that objective). I envision some system that model Minsky ideas about the human mind.</p>
<p>Well, it&#8217;s a new brave world.&nbsp;Dorothy: we are not in Kansas anymore&#8230; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Angel &#8220;Java&#8221; Lopez<br /><a href="http://www.ajlopez.com/en">http://www.ajlopez.com/en</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/89/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/89/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=89&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/20/distributed-scribble-with-microsoft-robotics-developer-studio-and-dss/feed/</wfw:commentRss>
	
		<media:content url="http://www.ajlopez.com/images/articles/dssscribprj.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribsln.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribvpl3.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribvpl2.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribconn.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribrun.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribwin.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribvpl1.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribrd.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribwarn.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/dssscribhost.png" medium="image" />
	</item>
		<item>
		<title>Code Generation as a Service with AjGenesis</title>
		<link>http://ajlopez.wordpress.com/2008/04/19/code-generation-as-a-service-with-ajgenesis/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/19/code-generation-as-a-service-with-ajgenesis/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 10:48:46 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[AjGenesis]]></category>

		<category><![CDATA[C Sharp]]></category>

		<category><![CDATA[Code Generation]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Visual Basic .NET]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=88</guid>
		<description><![CDATA[
I&#8217;m back! I want to write in this post about the new features I&#8217;ve added to my code generation project AjGenesis. The main points are:
- A new interactive way to use it, a web based application
- Examples with that new interface, to generate&#160;C#, VB.Net,&#160;Java and&#160;PHP applications, all from the same abstract model
These features were published [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /></p>
<p>I&#8217;m back! I want to write in this post about the new features I&#8217;ve added to my code generation project <a href="http://www.ajlopez.com/ajgenesis">AjGenesis</a>. The main points are:</p>
<p>- A new interactive way to use it, a web based application</p>
<p>- Examples with that new interface, to generate&nbsp;C#, VB.Net,&nbsp;Java and&nbsp;PHP applications, all from the same abstract model</p>
<p>These features were published last January at <a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=ajgenesis&amp;ReleaseId=7262" target="_blank">release 0.5 in CodePlex</a></p>
<h3>Using AjGenesis</h3>
<p>Years ago, I began to work in this project. Those days, the only way to execute and use it were the console, with commands. Later, I adopted&nbsp;<a href="http://sourceforge.net/projects/nant/" target="_blank">NAnt</a>, and <a href="http://nantgui.berlios.de/" target="_blank">NAntGui</a>, as interfaces to launch the system and execute tasks and transformations. The project can be used as a set of .DLLs, referenced from custom application.&nbsp;<a href="http://carlossantos.wordpress.com/" target="_blank">Carlos Marcelo Santos</a> has published posts&nbsp;(in Spanish) about&nbsp;how to use AjGenesis from NAnt</p>
<p><a href="http://carlossantos.wordpress.com/2007/10/30/como-generar-codigo-con-ajgenesis-sirviendonos-de-nant/" target="_blank">Cómo generar código con AjGenesis sirviéndonos de NAnt</a><br /><a href="http://carlossantos.wordpress.com/2007/11/17/como-generar-codigo-con-ajgenesis-sirviendonos-de-nant-parte-ii/" target="_blank">Cómo generar código con AjGenesis sirviéndonos de NAnt - Parte II</a></p>
<p>Last year, 2007, Jonathan Cisneros wrote a great Windows interface, named AjGenesis Studio:</p>
<p><a href="http://msmvps.com/blogs/lopez/archive/2007/12/24/genesis-studio-una-ide-para-ajgenesis.aspx" target="_blank">AjGenesis Studio: una IDE para AjGenesis</a><br /><a href="http://www.codeplex.com/ajgenesisstudio" target="_blank">AjGenesis Studio&nbsp;at CodePlex</a></p>
<p>As an exercise at the end of year 2007, I wrote a new project in the original solution, and I published last January inside&nbsp;the last <a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=ajgenesis&amp;ReleaseId=7262" target="_blank">release 0.5&nbsp;at CodePlex</a>.</p>
<p>It&#8217;s a new web project, that I called, inspired by the work of Jonathan, AjGenesis Web Studio</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsmain.png"> </p>
<p>The main point is, with this project, to show that the functionality from the AjGenesis core can be used and exposed in our applications, this time from a web interface, using ASP.NET. With this approach, we can put a server in our internal network or at Internet, and create, edit, upload and download user defined models,&nbsp;generate&nbsp;source code, and download the results. We could call this,&nbsp;Code Generation as a Service.</p>
<p>Let&#8217;s look the project, its functions and some inners.</p>
<h3>The project</h3>
<p><img style="margin:0 20px 20px 0;" src="http://www.ajlopez.com/images/articles/ajgenesiswssln.png" align="left">It&#8217;s a web project,&nbsp;named <strong>AjGenesis.WebStudio</strong>.</p>
<p>To launch it, load the&nbsp;<strong>AjGenesis.sln</strong> solution (located at src directory inside the version 0.5 from CodePlex)&nbsp;with Visual Studio 2005, and build the complete solution.</p>
<p>(If you have errors in the&nbsp;<strong>AjGenesis.WebStudio </strong>project, probably you must add a reference to a .DLL that manages the file compressions. Add as reference to the project the file <strong>src\Libraries\Ionic.Utils.Zip.dll.</strong> This library generates .zip files, and expand them).</p>
<p>In the web solution, I used Master Pages, and a default Theme. It doesn&#8217;t manage a database, only files and directories. We&#8217;ll see below that the project has a mini wiki, to write help pages that can be defined by the user.</p>
<p>The look and feel is simple, but you can change the theme and master page to obtain a better result.</p>
<p>The system can generate code in the fly, and download it as a .zip file.&nbsp;You can use the classic AjGenesis system, as I explained <a href="http://ajlopez.wordpress.com/category/ajgenesis/" target="_blank">in past post</a>, but now, we can use it from any browser.&nbsp;You don&#8217;t need .NET in your client machine, and you can work from other operating systems.</p>
<p>After the build of the solution, click right mouse button on the file <strong>\Default.aspx</strong> in project <strong>AjGenesis.WebStudio</strong>, and choose <strong>View in browser&#8230;</strong>:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsviewinbrowser.png"> </p>
<p>This is preferred to launch the project in debug mode: if you debug the project, it will execute the code generation task in very slow way.</p>
<h3>Working Directory</h3>
<p>The system uses a working directory, with a structure that resembles the examples at <strong>AjGenesisExamples3.zip</strong> (to download from <a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=ajgenesis&amp;ReleaseId=7261" target="_blank">examples at CodePlex</a>). The default working directory is <strong>AjGenesis.WebStudioWorkingDirectory</strong>:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswswd.png"> </p>
<p>Some directories:</p>
<p><strong>Projects</strong>: There is a directory here for each project model.<br /><strong>Templates</strong>: Containing the template files to process during the code generation phase<br /><strong>Build</strong>: The code generated code resides in this directory.</p>
<p>The working directory can be changed using the left menu option <strong>Working Directory</strong> and then, choosing the option <strong>Change Working Directory:</strong></p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswschwd.png"> </p>
<h3>Generating Hello World</h3>
<p>As I used to comment in my speeches, the acid test of all code generation system is to help us to model and produce the most simple and universal software system, the reknowed Hello World example.&nbsp;There is an explanation on how to do this with classic AjGenesis in my post</p>
<p><a href="http://msmvps.com/blogs/lopez/archive/2006/11/19/generando-c-digo-hello-world-con-ajgenesis.aspx" target="_blank"><a title="Code Generation with AjGenesis- A Hello World application" href="http://ajlopez.wordpress.com/2007/01/29/code-generation-with-ajgenesis-a-hello-world-application/">Code Generation with AjGenesis- A Hello World application</a></a></p>
<p>In AjGenesis Web Studio, select the left menu option <strong>Generate</strong>. This is the result page</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiwsgen.png"> </p>
<p>There are two dropdown list. We&#8217;ll see how they are filled. At the first list, there are the defined&nbsp;projects:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsprojects.png"> </p>
<p>Choose HelloWorld. Then, go to technology list, showing:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswstechs.png"> </p>
<p>In this project, only <strong>Java</strong> and <strong>Net20 </strong>are the defined technologies. Other projects have more technologies. Choose <strong>Java</strong> and the press the <strong>Generate</strong> button. After a while, the page shows a result.</p>
<h3>How this works?</h3>
<p>First point, the system manage a working directory, the default is <strong>AjGenesis.WebStudioWorkDirectory</strong>, a syster directory of the web project. There is a&nbsp;<strong>Projects </strong>project, cointaining more directory, each one is a project for the system.</p>
<p>The directory <strong>AjGenesis.WebStudioWorkDirectory\Projects\HelloWorld</strong> has a&nbsp;<strong>Project.xml</strong> file that describes the free model we use in this case:</p>
<div class="wlWriterSmartContent" id="38f3623f-934d-4160-93da-e7a9a7500e7f" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Project</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">HelloWorld</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Description</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">HelloWorld Example</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Description</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">GenerateTask</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">GenerateHelloWorld</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">GenerateTask</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Message</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">Hello World</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Message</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Project</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>Inside the directory project, there is&nbsp;a <strong>Technologies</strong> directory. Each XML file that is found there it&#8217;s managed as a technology model in the system. Again, as I explained <a href="http://ajlopez.wordpress.com/category/ajgenesis/" target="_blank">in my posts on AjGenesis</a>&nbsp;, this file has a free model, you can put here anything to process from code generation process. The concepts of project and technology is not mandatory, but <strong>AjGenesis Web Studio</strong> takes them as special directories, and read them to obtain the list of project and associated technologies.</p>
<p>The technology&nbsp;<strong>Java.xml</strong> file contains:</p>
<div class="wlWriterSmartContent" id="84a14afd-2c70-4634-94fe-5d028a54bf21" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">Java</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span></div>
</pre>
</div>
</p>
<p>and <strong>Net20.xml</strong> contains:</p>
<div class="wlWriterSmartContent" id="b381ffd2-1d9e-4b6f-bdef-f68a80d41a7e" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
  </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">Net20</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span></div>
</pre>
</div>
<p>Nothing special. The value <strong>Name</strong> inside <strong>Technology </strong>drives what steps to execute during code generation phase.</p>
<p>After press the generate button,&nbsp;the system loads the project and technology model in memory. Then, it executes the file <strong>GenerateCode.ajg</strong> located in directory <strong>Tasks. </strong>But if&nbsp;the project file contains a&nbsp; <strong>GenerateTask</strong> tag, as in this project, that file is executed instead the default one. This is the content of <strong>Tasks\GenerateHelloWorld.ajg</strong>:</p>
<p>&nbsp;</p>
<div class="wlWriterSmartContent" id="f009026c-ab51-476b-87a1-e54535ea324b" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Generating HelloWorld&#8230;</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.BuildDir </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.BuildDir </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${WorkingDir}Build/${Project.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.Title </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.Title </span><span style="color:#000000;">=</span><span style="color:#000000;"> Project.Name
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.Version </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.Version </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">1.0.*</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.Language </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.Language </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">en</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.SystemName </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.SystemName </span><span style="color:#000000;">=</span><span style="color:#000000;"> Project.Name
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Creating Directory ${Project.BuildDir}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

FileManager.CreateDirectory(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${Project.BuildDir}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)

Include </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Tasks\BuildHelloWorld${Technology.Name}.ajg</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

</span></div>
</pre>
</div>
<p>This file is written in an scripting language, a pillar of <strong>AjGenesis</strong>, affectously named <strong>AjBasic</strong>. The <strong>Project</strong> variable is the representation in memory of the tag <strong>&lt;Project&gt;</strong> loaded from the <strong>Project.xml </strong>file, described above.&nbsp;In memory, it is as an object, with properties. It&#8217;s not an static object: you can add properties in runtime, as <strong>Project.Version</strong> in the above text. If in an <strong>if</strong> sentence we asks the value of&nbsp;&nbsp;<strong>Project.Version</strong> and this doesn&#8217;t exist, it&#8217;s not an error, the result is simply <strong>Nothing</strong> and that value is treated as false for boolean evaluations (like in other languages, notably PHP). </p>
<p>Finally, the last line includes an additional file to process dinamically. The string contants in AjBasic have expression expansion: all between <strong>${</strong> and <strong>}</strong> is evaluated. Using the value of&nbsp;<strong>Technology.Name</strong> (obtained from loading in memory the XML technology file), it executes <strong>BuildHelloWorldJava.ajg</strong> or <strong>BuildHelloWorldNet20.ajg</strong>. The first one contains the steps to generate a <strong>.java</strong> file:</p>
<div class="wlWriterSmartContent" id="15ae35fd-a2c6-44e2-ac8d-d3c9bdab3781" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#000000;">&lt;</span><span style="color:#000000;">#

</span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Generating Solution ${Project.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.Title </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.Title </span><span style="color:#000000;">=</span><span style="color:#000000;"> Project.Name
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.Version </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.Version </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">1.0.*</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span><span style="color:#0000FF;">PrintLine</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Creating Directories</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

FileManager.CreateDirectory(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${Project.BuildDir}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)
FileManager.CreateDirectory(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${Project.BuildDir}\${Technology.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">)

TransformerManager.Transform(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Templates\HelloWorld\ClassJava.tpl</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${Project.BuildDir}\${Technology.Name}\HelloWorld.java</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">, Environment)

#</span><span style="color:#000000;">&gt;</span></div>
</pre>
</div>
</p>
<p>This code uses inner AjGenesis utilities that create directories and expand a template file.&nbsp;<strong>ClassJava.tpl</strong> contains:</p>
<div class="wlWriterSmartContent" id="6672cead-773f-433f-9a08-0632d2133e24" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#000000;">
</span><span style="color:#008000;">//</span><span style="color:#008000;">
</span><span style="color:#008000;">//</span><span style="color:#008000;"> Automatically generated by AjGenesis
</span><span style="color:#008000;">//</span><span style="color:#008000;"> </span><span style="color:#008000;text-decoration:underline;">http://www.ajlopez.com/ajgenesis</span><span style="color:#008000;">
</span><span style="color:#008000;">//
</span><span style="color:#000000;">
</span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> HelloWorld {

    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">static</span><span style="color:#000000;"> </span><span style="color:#0000FF;">void</span><span style="color:#000000;"> main(String[] args) {
        System.out.println(</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${Project.Message}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">);
    }

}
</span></div>
</pre>
</div>
<p>All this produces the directory <strong>Build\HelloWorld\Java</strong>:</p>
<p><img src="http://www.ajlopez.com/images/articles/ajgenesiswsjava.png"> </p>
</p>
<p>If&nbsp;we choose the&nbsp;<strong>Net20</strong> technology,&nbsp;more files would be generated:</p>
<p><img src="http://www.ajlopez.com/images/articles/ajgenesiswsnet20.png"> </p>
<p>This is a more complete result. It has a VS 2005 solution file, two project directories, one in VB.NET and the other in C#, with source code and project files:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswshello.png"> </p>
<p>To see the generated code, its files and directories, go to left menu option <strong>Builds</strong>:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsbuilds.png"> </p>
<p>There is a directory for each project. You can download a complete directory, as a .zip file. We can create a file, download a directory, upload and expand a .zip file, and consult a help page. We can read, edit, and delete each file,&nbsp;in this case&nbsp;<strong>readme.txt</strong>.</p>
<p>Go to the&nbsp;<strong>View</strong> at&nbsp;<strong>HelloWorld</strong> directory:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswshellopage.png"> </p>
<p>You can browse directories, upload and download files. You can move a directory, or make a copy, to experiment without loosing the original content.</p>
<h3>Generating&nbsp;C# and VB.NET solutions</h3>
<p>After this simple example, let&#8217;s go for more. For more information about the next examples and their models, read:</p>
<p><a title="Application Generation using AjGenesis" href="http://ajlopez.wordpress.com/2007/11/12/application-generation-using-ajgenesis/">Application Generation using AjGenesis</a></p>
<p>Go again to&nbsp;left menu&nbsp;<strong>Generate</strong> option. Now,&nbsp;we choose a project,&nbsp;<strong>AjSecondExample</strong>.&nbsp;Its technology list is more complete:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswstechs2.png"> </p>
<p>Choose <strong>CSharp2 </strong>and generate. This process creates&nbsp;a complete solution inside&nbsp;<strong>Builds\AjSecondExample\CSharp2</strong>.&nbsp;There is an <strong>Sql</strong> directory with DDL script to create a MS SQL Server database.&nbsp;Inside the <strong>Src</strong> directory, you&#8217;ll find the solution, composed of a set of projects:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswscsharp2.png"> </p>
<p>This projects follows a layered archictecture, that you can modify from the templates. They use a data access layer, based on my&nbsp;<strong>AjFramework</strong> project, but you can change to access Enterprise Library or your own data services.</p>
<p>You must create the database using the generated scripts, and modify the connection string in the web.config to match your environment. The application can be compiled and executed:</p>
<p><img src="http://www.ajlopez.com/images/articles/ajgenesiswsse.png"> </p>
<p>The administration page shows:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsseadm.png"> </p>
<p>Back to generate page, execute the VbNet2 technology, obtaining a&nbsp;directory with the same structure, now with Visual Basic.NET code:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsvbnet2.png"> </p>
<p>All these depend of the specified technology inside the files at <strong>Projects\AjSecondExample\Technologies</strong>. The content of <strong>VbNet2.xml </strong>is:</p>
<div class="wlWriterSmartContent" id="3d77704f-bc74-4560-844b-73826a6d71dd" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Programming</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">VbNet2</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Programming</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Database</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">MsSql</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">AjSecondExample</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Username</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">sa</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Username</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Prefix</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">ajse_</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Prefix</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Host</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">(local)</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Host</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Database</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>and <strong>CSharp2.xml</strong>:</p>
<div class="wlWriterSmartContent" id="5aa1a4d3-e233-4db4-a53c-4763b538caf6" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Programming</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">CSharp2</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Programming</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Database</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">MsSql</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Dialect</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">AjSecondExample</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Name</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Username</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">sa</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Username</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Prefix</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">ajse_</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Prefix</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">Host</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">(local)</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Host</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Database</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">Technology</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>These data are used during the code generation process.</p>
<p>Note: inside&nbsp;<strong>Tasks\BuildTechnology.ajg</strong> file, you&#8217;ll find a new variable, injected from the web project:</p>
<div class="wlWriterSmartContent" id="93a3913b-0703-4fe4-bfcf-a4d4ac5437b6" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#0000FF;">if</span><span style="color:#000000;"> </span><span style="color:#0000FF;">not</span><span style="color:#000000;"> Project.BuildDir </span><span style="color:#0000FF;">then</span><span style="color:#000000;">
    Project.BuildDir </span><span style="color:#000000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">${WorkingDir}Build/${Project.Name}/${Technology.Programming.Dialect}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">if</span><span style="color:#000000;">

</span></div>
</pre>
</div>
<p>This is&nbsp;the <strong>WorkingDir</strong> variable that points to the working directory we selected in AjGenesis Web Studio.</p>
<h3>Genarating&nbsp;Java&nbsp;and JSP applications</h3>
<p>Many projects (AjFirstExample, AjSecondExample, AjTest&#8230;.) can be generated in Java with JavaServer Pages. A <strong>build.xml</strong> file is generated to be modified and used to compile the generated code using the ant utility (you can use this file from an IDE, like Eclipse or NetBeans).</p>
<p>The target <strong>build</strong>&nbsp; makes a <strong>.war</strong> deploy file. You can browse and modify the <strong>build.xml</strong> file to install the .war in a Tomcat web container.</p>
<p>The generated code is composed of <strong>.jsp</strong> files (web pages in Java) and&nbsp;Java code to compile that implements a service layer and a data access layer, exchanging simple JavaBeans&nbsp;between layers. The DDL script, in these examples, is&nbsp;a <strong>MySql</strong> one.</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsjsp.png"> </p>
<p>If you build and deploy the application, and install the database in a MySql server, you can see it working fromn a Tomcat server:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswstomcat2.png"> </p>
<h3>Generating application using Domain-Driven Design ideas and&nbsp;Hibernate, NHibernate</h3>
<p>Many example projects (AjFirstExample, AjSecondExample, AjTest&#8230;) have defined technologies CSharp2DDDNh, JavaDDDHb, VbNet2DDDNh, and even VbNet2Nh. The DDD ones implement some concepts from Domain-Driven Desigg, as Application, Domain and Infrastructure layer, but the templates could be improved. The *Nh&nbsp;projects generate code for entities using NHibernate mapping. The *Hb projects use Hibernate.</p>
<p>An example of NHibernate generated mapping:</p>
<p>&nbsp;</p>
<div class="wlWriterSmartContent" id="840c31db-d8bd-4ffb-b00c-d995330e5238" style="display:inline;float:none;width:536px;margin:0;padding:0;">
<pre style="background-color:White;white-space:pre-wrap;">
<div><span style="color:#0000FF;">&lt;?</span><span style="color:#FF00FF;">xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; </span><span style="color:#0000FF;">?&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">hibernate-mapping </span><span style="color:#FF0000;">xmlns</span><span style="color:#0000FF;">=&quot;urn:nhibernate-mapping-2.0&quot;</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">class </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;AjFirstExample.Domain.Customer, AjFirstExample.Domain&quot;</span><span style="color:#FF0000;"> table</span><span style="color:#0000FF;">=&quot;ajfe_customers&quot;</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">id </span><span style="color:#FF0000;">name</span><span style="color:#0000FF;">=&quot;Id&quot;</span><span style="color:#FF0000;"> column</span><span style="color:#0000FF;">=&quot;Id&quot;</span><span style="color:#FF0000;"> type</span><span style="color:#0000FF;">=&quot;Int32&quot;</span><span style="color:#FF0000;"> unsaved-value</span><span style="color:#0000FF;">=&quot;0&quot;</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
            </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">generator </span><span style="color:#FF0000;">class</span><span style="color:#0000FF;">=&quot;native&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">id</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">property </span><span style="color:#FF0000;">column</span><span style="color:#0000FF;">=&quot;Name&quot;</span><span style="color:#FF0000;"> type</span><span style="color:#0000FF;">=&quot;String&quot;</span><span style="color:#FF0000;"> name</span><span style="color:#0000FF;">=&quot;Name&quot;</span><span style="color:#FF0000;"> length</span><span style="color:#0000FF;">=&quot;255&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">property </span><span style="color:#FF0000;">column</span><span style="color:#0000FF;">=&quot;Address&quot;</span><span style="color:#FF0000;"> type</span><span style="color:#0000FF;">=&quot;String&quot;</span><span style="color:#FF0000;"> name</span><span style="color:#0000FF;">=&quot;Address&quot;</span><span style="color:#FF0000;"> length</span><span style="color:#0000FF;">=&quot;255&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">&lt;</span><span style="color:#800000;">property </span><span style="color:#FF0000;">column</span><span style="color:#0000FF;">=&quot;Notes&quot;</span><span style="color:#FF0000;"> type</span><span style="color:#0000FF;">=&quot;String&quot;</span><span style="color:#FF0000;"> name</span><span style="color:#0000FF;">=&quot;Notes&quot;</span><span style="color:#FF0000;"> length</span><span style="color:#0000FF;">=&quot;255&quot;</span><span style="color:#0000FF;">/&gt;</span><span style="color:#000000;">
    </span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">class</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span><span style="color:#0000FF;">&lt;/</span><span style="color:#800000;">hibernate-mapping</span><span style="color:#0000FF;">&gt;</span><span style="color:#000000;">
</span></div>
</pre>
</div>
<p>These solution can be built as the previous examples. You&#8217;ll see better generator templates for NHibernate in the <a href="http://www.codeplex.com/ajgenesis/Release/ProjectReleases.aspx?ReleaseId=7261" target="_blank">AjOmar example at CodePlex</a>. Post (in Spanish) explaining the process at</p>
<p><a href="http://msmvps.com/blogs/lopez/archive/2007/08/05/generando-c-243-digo-para-nhibernate-parte-1.aspx" target="_blank">Generando código para NHibernate (Parte 1)</a><br /><a href="http://msmvps.com/blogs/lopez/archive/2007/09/25/generando-c-243-digo-para-nhibernate-parte-2.aspx" target="_blank">Generando código para NHibernate (Parte 2)</a><br /><a href="http://msmvps.com/blogs/lopez/archive/2007/10/29/generando-c-243-digo-para-nhibernate-parte-3.aspx" target="_blank">Generando código para NHibernate (Parte 3)</a></p>
<h3>Generating PHP applications</h3>
<p>If you choose PHP technology, web page with PHP code are generated, using MySql as database. The generated code can be copied to a directory in a web site that supports PHP, Apache, or IIS. AjTest example running in a IIS with&nbsp;PHP4:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswsphp.png"> </p>
<h3>Other directories</h3>
<p>In the working directory, there are other directories:</p>
<p><strong>SourceCode</strong>: Containing some source code that is copied into the solution during code generation.</p>
<p><strong>Libraries</strong>: Additional .dlls, to copy and use in the generated applications.</p>
<p>The larger subdirectory&nbsp; is <strong>Templates</strong>:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswstemplates.png"> </p>
<p>In previous posts I described in detail the creation and use of a template file. This is the content of a template that generate a C# entity:</p>
<div class="wlWriterSmartContent" id="1bc9e6dc-6b7b-4107-8f30-15cb0d6fe1ea" style="display:inline;float:none;margin:0;padding:0;">
<pre style="background-color:White;">
<div><span style="color:#000000;">&lt;</span><span style="color:#000000;">#

</span><span style="color:#008000;">rem</span><span style="color:#008000;">        Entity Generator</span><span style="color:#008000;">
rem</span><span style="color:#008000;">        for C Sharp</span><span style="color:#008000;">
</span><span style="color:#000000;">

include    </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Templates/CSharp2/CSharpFunctions.tpl</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
message    </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Processing Entity ${Entity.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">

include </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Templates/CSharp2/Prologue.tpl</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">    

#</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">

</span><span style="color:#000000;">/*</span><span style="color:#000000;">
 </span><span style="color:#000000;">*</span><span style="color:#000000;">    Project ${Project.Name}
 </span><span style="color:#000000;">*</span><span style="color:#000000;">        ${Project.Description}
 </span><span style="color:#000000;">*</span><span style="color:#000000;">    Entity    ${Entity.Name}
 </span><span style="color:#000000;">*</span><span style="color:#000000;">        ${Entity.Description}
 </span><span style="color:#000000;">*</span><span style="color:#000000;">
 </span><span style="color:#000000;">*/</span><span style="color:#000000;">

</span><span style="color:#0000FF;">using</span><span style="color:#000000;"> System;

</span><span style="color:#0000FF;">namespace</span><span style="color:#000000;"> ${Project.SystemName}.Entities {

    </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> </span><span style="color:#0000FF;">class</span><span style="color:#000000;"> ${Entity.Name} {

</span><span style="color:#000000;">//</span><span style="color:#000000;">    </span><span style="color:#0000FF;">Private</span><span style="color:#000000;"> Fields

</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">#
</span><span style="color:#0000FF;">for</span><span style="color:#000000;"> </span><span style="color:#0000FF;">each</span><span style="color:#000000;"> </span><span style="color:#0000FF;">Property</span><span style="color:#000000;"> </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> Entity.Properties
    message    </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Processing Field ${Property.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;"> #</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">private</span><span style="color:#000000;"> ${CSharpType(</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">)} ${CSharpFieldName(</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">)};
</span><span style="color:#000000;">&lt;</span><span style="color:#000000;"># </span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">for</span><span style="color:#000000;"> #</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">

</span><span style="color:#000000;">//</span><span style="color:#000000;">    </span><span style="color:#0000FF;">Default</span><span style="color:#000000;"> Constructor

        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> ${Entity.Name}() {
        }

</span><span style="color:#000000;">//</span><span style="color:#000000;">    </span><span style="color:#0000FF;">Public</span><span style="color:#000000;"> Properties

</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">#
</span><span style="color:#0000FF;">for</span><span style="color:#000000;"> </span><span style="color:#0000FF;">each</span><span style="color:#000000;"> </span><span style="color:#0000FF;">Property</span><span style="color:#000000;"> </span><span style="color:#0000FF;">in</span><span style="color:#000000;"> Entity.Properties
    message    </span><span style="color:#000000;">&quot;</span><span style="color:#000000;">Processing Property ${Property.Name}</span><span style="color:#000000;">&quot;</span><span style="color:#000000;">
#</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">
        </span><span style="color:#0000FF;">public</span><span style="color:#000000;"> ${CSharpType(</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">)} ${</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">.Name}
        {
            </span><span style="color:#0000FF;">get</span><span style="color:#000000;"> {
                </span><span style="color:#0000FF;">return</span><span style="color:#000000;"> ${CSharpFieldName(</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">)};
            }
            </span><span style="color:#0000FF;">set</span><span style="color:#000000;"> {
                ${CSharpFieldName(</span><span style="color:#0000FF;">Property</span><span style="color:#000000;">)} </span><span style="color:#000000;">=</span><span style="color:#000000;"> value;
            }
        }

</span><span style="color:#000000;">&lt;</span><span style="color:#000000;">#
</span><span style="color:#0000FF;">end</span><span style="color:#000000;"> </span><span style="color:#0000FF;">for</span><span style="color:#000000;">
#</span><span style="color:#000000;">&gt;</span><span style="color:#000000;">

    }

}</span></div>
</pre>
</div>
</p>
<h3>Help pages</h3>
<p>I&#8217;m testing some ideas in this web project. There are code to create &#8220;wiki&#8221; pages, that can be used as help pages in the system.</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswshelp.png"> </p>
<p>You can edit this kind of pages:</p>
<p align="center"><img src="http://www.ajlopez.com/images/articles/ajgenesiswshelpedit.png"> </p>
<p>There is a way to insert links to other wiki pages and to external ones. The page data is represented as a .NET object in memory, and that object is serialized in an XML file in <strong>Pages</strong> application directory. There is no database to store page: each one is an object, serialized in a .xml file.</p>
<h3>Conclusions</h3>
<p>I hope this system helps to a better understanding of AjGenesis project features and potential. With a more user friendly interface, the project can be used by more people. We can generate code from command line, or using NAnt utility, or AjGenesis Studio.</p>
<p>I ever remark a point: all these are examples, AjGenesis is not limited to generate only this kind application. You are in charge: you can define the model that matches your project requirements, using any technology you choose. You can codify DDD ideas in a different and better way. You can generate Hibernate/NHibernate mappins&nbsp;using other patterns and mapping idioms. You can use other ORM utilities, and generate code for them. You can generate PHP5 pages that use Prado, instead of plain PHP4. You can&nbsp;generate stored procedures for Oracle, instead of my examples that use MS SQL Server.&nbsp;Or write better ones. You can generate WinForms&nbsp;code, instead of ASP.NET page. You can generate JavaServer&nbsp;Faces pages, views, beans, and abandon JavaServer Pages. You can generate the code or text you want: e.g., unit tests, or documentation pages. I recommend that the generated code resembles the&nbsp;code you could generate manually.</p>
<p>I invite anyone that uses this system, to post his/her work, or leave comments here. You can participate in the Spanish list:</p>
<p><a title="http://groups.google.com/group/codegeneration?hl=es" href="http://groups.google.com/group/codegeneration?hl=es">http://groups.google.com/group/codegeneration?hl=es</a></p>
<h3>Next steps</h3>
<p>Back to develop, I have some ideas:</p>
<p>- Improve the templates to generate more technologies, as VS 2008 projects, solutions, templates for Struts 1/2, Spring, better mapping for Hibernate, NHibernate, and code generation for the new ASP.NET MVC.</p>
<p>- Write posts about these templates</p>
<p>- Publish the new examples</p>
<p>- Write down a useful documentation (now, it&#8217;s minimal: you can found more details <a href="http://ajlopez.wordpress.com/category/ajgenesis/" target="_blank">in this posts</a>)</p>
<p>Enjoy the project!</p>
<p>Angel &#8220;Java&#8221; Lopez<br /><a href="http://www.ajlopez.com/en">http://www.ajlopez.com/en</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/88/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/88/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=88&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/19/code-generation-as-a-service-with-ajgenesis/feed/</wfw:commentRss>
	
		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsmain.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswssln.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsviewinbrowser.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswswd.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswschwd.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiwsgen.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsprojects.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswstechs.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsjava.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsnet20.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswshello.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsbuilds.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswshellopage.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswstechs2.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswscsharp2.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsse.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsseadm.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsvbnet2.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsjsp.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswstomcat2.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswsphp.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswstemplates.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswshelp.png" medium="image" />

		<media:content url="http://www.ajlopez.com/images/articles/ajgenesiswshelpedit.png" medium="image" />
	</item>
		<item>
		<title>Grid Computing Resources</title>
		<link>http://ajlopez.wordpress.com/2008/04/18/grid-computing-resources/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/18/grid-computing-resources/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 09:21:59 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[Grid Computing]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=87</guid>
		<description><![CDATA[
Past weeks,&#160;I was researching about Grid Computing, searching for links, resources, papers, implementations. This post is a&#160;result of that research.
If you are new to Grid Computing, this is a good introduction
New to Grid Computing
Grid Computing according IBM
The anatomy of the grid
The physiology of the grid
&#160;
Recommended reading list for grid developers
&#160;
Grid Cafe Grid Projects in the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /></p>
<p>Past weeks,&nbsp;I was researching about Grid Computing, searching for links, resources, papers, implementations. This post is a&nbsp;result of that research.
<p>If you are new to Grid Computing, this is a good introduction
<p><a href="http://www-128.ibm.com/developerworks/grid/newto/?ca=dgr-lnxw97Grid-Coumputing" target="_blank">New to Grid Computing</a>
<p><a href="http://www-03.ibm.com/grid/" target="_blank">Grid Computing according IBM</a>
<p><a href="http://www-unix.globus.org/alliance/publications/papers/anatomy.pdf" target="_blank">The anatomy of the grid</a>
<p><a href="http://www-unix.globus.org/alliance/publications/papers/ogsa.pdf" target="_blank">The physiology of the grid</a>
<p>&nbsp;
<p><a href="http://www.gridblog.com/comments.php?id=242_0_1_0_C" target="_blank">Recommended reading list for grid developers</a>
<p>&nbsp;
<p><a href="http://gridcafe.web.cern.ch/gridcafe/gridprojects/projects.html" target="_blank">Grid Cafe Grid Projects in the world</a>&nbsp;&nbsp;
<p><a href="http://gridcafe.web.cern.ch/gridcafe/">Grid Cafe The place for everybody to learn about the Grid</a>&nbsp;&nbsp;
<p><a href="http://gridcafe.web.cern.ch/gridcafe/whatisgrid/dreamers.html" target="_blank">What is &#8220;the Grid&#8221;?</a>&nbsp;&nbsp;
<p><a href="http://gridcafe.web.cern.ch/gridcafe/GridatCERN/gridatcern.html" target="_blank">Grid @ CERN</a>&nbsp;
<p>&nbsp;
<p>Industry status:
<p><a href="http://www.gridtoday.com/">http://www.gridtoday.com/</a> (a bit crowded, I guess)
<p><a href="http://www.gridblog.com/">http://www.gridblog.com/</a>
<p>&nbsp;
<p>The full list of links I collected at:
<p><a href="http://del.icio.us/ajlopez/gridcomputing">http://del.icio.us/ajlopez/gridcomputing</a>
<p>&nbsp;
<p>Some products to see:
<p><a href="http://www.gridgain.com/">http://www.gridgain.com</a><br /><a href="http://www.digipede.net/">http://www.digipede.net</a>&nbsp;something more about digitped at <a href="http://dotnetjunkies.com/WebLog/stefandemetz/archive/2006/12/09/Free_Grid_Computing_software.aspx">http://dotnetjunkies.com/WebLog/stefandemetz/archive/2006/12/09/Free_Grid_Computing_software.aspx</a><br /><a href="http://www.gridgistics.net/">http://www.gridgistics.net/</a>
<p><a href="http://sourceforge.net/projects/ngrid/">http://sourceforge.net/projects/ngrid/</a>
<p>&nbsp;
<p>I&#8217;ve written some articles about Grid Computing:
<p><a href="http://ajlopez.wordpress.com/category/grid-computing/">http://ajlopez.wordpress.com/category/grid-computing/</a> </p>
<p>including some toy implementation of ideas to explore.</p>
<p>&nbsp;
<p>Angel &#8220;Java&#8221; Lopez
<p><a href="http://www.ajlopez.com/en">http://www.ajlopez.com/en</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ajlopez.wordpress.com/87/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ajlopez.wordpress.com/87/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ajlopez.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ajlopez.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ajlopez.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ajlopez.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ajlopez.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ajlopez.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ajlopez.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ajlopez.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ajlopez.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ajlopez.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ajlopez.wordpress.com&blog=378226&post=87&subd=ajlopez&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://ajlopez.wordpress.com/2008/04/18/grid-computing-resources/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Message Passing Interface, CCR, DSS, and Pure MPI.NET</title>
		<link>http://ajlopez.wordpress.com/2008/04/15/message-passing-interface-ccr-dss-and-pure-mpinet/</link>
		<comments>http://ajlopez.wordpress.com/2008/04/15/message-passing-interface-ccr-dss-and-pure-mpinet/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 11:40:46 +0000</pubDate>
		<dc:creator>ajlopez</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Concurrency and Coordination Runtime]]></category>

		<category><![CDATA[Grid Computing]]></category>

		<guid isPermaLink="false">http://ajlopez.wordpress.com/?p=86</guid>
		<description><![CDATA[ Recently, during my reseach about grid computing, Microsoft Robotics Studio, DSS and CCR, I found a very interesting paper:
High Performance Multi-Paradigm Messaging Runtime Integrating Grids and Multicore Systems
The authors are Two of the authors are Xiaohong Qiu, Geoffrey C. Fox, Huapeng Yuan, Seung-Hee Bae, from Indiana University Bloomington, and George Chrysanthakopoulos, Henrik Frystyk Nielsen, [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img style="margin:0 20px 20px 0;" src="http://www.ajlopez.com/images/articles/mpi-clouds.jpg" align="left"> Recently, during my reseach about grid computing, Microsoft Robotics Studio, DSS and CCR, I found a very interesting paper:</p>
<p><a href="http://grids.ucs.indiana.edu/ptliupages/publications/CCRSept23-07eScience07.pdf" target="_blank">High Performance Multi-Paradigm Messaging Runtime Integrating Grids and Multicore Systems</a></p>
<p>The authors are Two of the authors are Xiaohong Qiu, Geoffrey C. Fox, Huapeng Yuan, Seung-Hee Bae, from Indiana University Bloomington, and George Chrysanthakopoulos, Henrik Frystyk Nielsen, from Microsoft Research. Nielsen and Chrysanthakopoulos are the &#8220;creators&#8221; of the Concurrency and Coordination Runtime (CCR) and Decentralized Software Services (DSS), pillar technologies of Microsoft Robotics Studio, that can be used beyond robotics. More on these technologies at:</p>
<p><a href="http://www.microsoft.com/robotics">http://www.microsoft.com/robotics</a></p>
<p>The paper abstract is:</p>
<blockquote><p>eScience applications need to use distributed Grid environments where each component is an individual or cluster of multicore machines. These are expected to have 64-128 cores 5 years from now and need to support scalable parallelism. Users will want to compose heterogeneous components into single jobs and run seamlessly in both distributed fashion and on a future “Grid on a chip” with different subsets of cores supporting individual components. We support this with a simple programming model made up of two layers supporting traditional parallel and Grid programming paradigms (workflow) respectively. We examine for a parallel clustering application, the Concurrency and Coordination Runtime CCR from Microsoft as a multi-paradigm runtime that integrates the two layers. Our work uses managed code (C#) and for AMD and Intel processors shows around a factor of 5 better performance than Java. CCR has MPI pattern and dynamic threading latencies of a few microseconds that are competitive with the performance of standard MPI for C.</p>
</blockquote>
<p>What is MPI? The acronym refers to <a href="http://en.wikipedia.org/wiki/Message_Passing_Interface" target="_blank">Message Passing Interface</a>. According to Wikipedia:<br />
<blockquote>
<p>Message Passing Interface (MPI) is both a computer specification and is an implementation that allows many computers to communicate with one another. It is used in computer clusters.</p>
</blockquote>
<p>There is a <a href="http://en.wikipedia.org/wiki/Microsoft_Messaging_Passing_Interface" target="_blank">Microsoft Implementation</a>:<br />
<blockquote>
<p>Microsoft Message Passing Interface (MS MPI) is an implementation of the MPI2 specification by Microsoft for use in Windows Compute Cluster Server to interconnect and communicate (via messages) between High performance computing nodes. It is mostly compatible with the MPICH2 reference implementation, with some exceptions for job launch and management. MS MPI includes bindings for C and FORTRAN languages. It supports using the Microsoft Visual Studio for debugging purposes.</p>
</blockquote>
<p>Oh! FORTRAN&#8230;.. Those old good days! ;-). I remember working with <a href="http://www.umcs.maine.edu/~chaitin/" target="_blank">Gregory Chaitin</a> implementation of Lisp on FORTRAN, last century. But no back to the past,&nbsp;paraphrasing David Hilbert: Out of this paradise that Java and .NET have created nobody will expell us&#8230;. ;-). You can read <a href="http://www.math.dartmouth.edu/~doyle/docs/heron/heron.txt" target="_blank">the original cite at this interesting thread</a>.
<p>But I disgress. Back to topic.
<p>The main sites about MPI are:
<p><a title="http://www.mpi-forum.org/" href="http://www.mpi-forum.org/">http://www.mpi-forum.org/</a><br /><a title="http://www.open-mpi.org/" href="http://www.open-mpi.org/">http://www.open-mpi.org/</a><br /><a title="http://www.lam-mpi.org/" href="http://www.lam-mpi.org/">http://www.lam-mpi.org/</a>
<p>I was thinking of implementing some MPI ideas with .NET or Java, when I visited this site:
<p><a title="http://www.purempi.net/" href="http://www.purempi.net/">http://www.purempi.net/</a><br />
<blockquote>
<p>PureMpi.NET is a completely managed implementation of the message passing interface. The object-oriented API is simple, and easy to use for parallel programming. It has been developed based on the latest .NET technologies, including Windows Communication Foundation (WCF). This allows you to declaratively specify the binding and endpoint configuration for your environment, and performance needs. When using the SDK, a programmer will definitely see the MPI&#8217;ness of the interfaces come through, and will enjoy taking full advantage of .NET features - including generics, delegates, asynchronous results, exception handling, and extensibility points.
<p>PureMpi.NET allows you to create high performance production quality parallel systems, with all the benefits of in .NET</p>
</blockquote>
<p>It is an implementation that you can download and use, with VS2005 or VS2008. It uses generics to