<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>While True</title>
	<atom:link href="http://www.whiletrue.nl/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.whiletrue.nl/blog</link>
	<description></description>
	<lastBuildDate>Sun, 12 Feb 2012 14:32:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>GAE Fulltext search capabilities</title>
		<link>http://www.whiletrue.nl/blog/?p=147</link>
		<comments>http://www.whiletrue.nl/blog/?p=147#comments</comments>
		<pubDate>Sun, 12 Feb 2012 14:31:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=147</guid>
		<description><![CDATA[Just found out a nice App Engine feature: full text enabled entities.

from google.appengine.ext import search  

class Entity(search.SearchableModel):
  Name = db.StringProperty()

This allows queries like:
lst = Entity.all().search(&#8221;john&#8221;)
Very nice indeed.
]]></description>
			<content:encoded><![CDATA[<p>Just found out a nice App Engine feature: full text enabled entities.</p>
<pre>
from google.appengine.ext import search  

class Entity(search.SearchableModel):
  Name = db.StringProperty()
</pre>
<p>This allows queries like:<br />
lst = Entity.all().search(&#8221;john&#8221;)</p>
<p>Very nice indeed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=147</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to *simply* load a .NET assembly while locked</title>
		<link>http://www.whiletrue.nl/blog/?p=145</link>
		<comments>http://www.whiletrue.nl/blog/?p=145#comments</comments>
		<pubDate>Sat, 11 Feb 2012 13:21:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=145</guid>
		<description><![CDATA[Using T4 templates it can be very desirable to load an assembly while it is locked by Visual Studio. There are a lot of complex examples out there, here&#8217;s a very simple one. Its a T4 template processing an assembly generating some JavaScript.







	//
function (){

	this.=null;

}


]]></description>
			<content:encoded><![CDATA[<p>Using T4 templates it can be very desirable to load an assembly while it is locked by Visual Studio. There are a lot of complex examples out there, here&#8217;s a very simple one. Its a T4 template processing an assembly generating some JavaScript.</p>
<pre>
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".js" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.IO" #>

<#
// Assembly you want to load
String fileName = @"C:\Icris\Icris.MDADemo.Model.dll";
byte[] fileContent;
using (System.IO.FileStream dll = System.IO.File.OpenRead(fileName))
{
   fileContent = new byte[dll.Length];
   dll.Read(fileContent, 0, (int)dll.Length);
}
var assembly = System.Reflection.Assembly.Load(fileContent);

foreach(var type in assembly.GetTypes())
{
#>
	//
function <#=type.Name#>(){
<#
			foreach(var property in type.GetProperties())
			{
#>
	this.<#=property.Name#>=null;
<#
			}
#>
}
<#
}
#>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=145</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google App Engine Recipes</title>
		<link>http://www.whiletrue.nl/blog/?p=138</link>
		<comments>http://www.whiletrue.nl/blog/?p=138#comments</comments>
		<pubDate>Tue, 16 Nov 2010 20:39:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=138</guid>
		<description><![CDATA[For several workshops and other educational purposes I have been using the Google App Engine lately (Python version). During this time I collected some standard partial solutions that might come in handy for any other project using this platform. I compiled it into a little booklet with 10 recipes for different constructs (AJAX calls, JSON [...]]]></description>
			<content:encoded><![CDATA[<p>For several workshops and other educational purposes I have been using the Google App Engine lately (Python version). During this time I collected some standard partial solutions that might come in handy for any other project using this platform. I compiled it into a little booklet with 10 recipes for different constructs (AJAX calls, JSON Serialization, Association modeling, mailing, etc.). Download below. Price: one tweet <img src='http://www.whiletrue.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><iframe src="http://www.paywithatweet.com/dlbutton01.php?id=24e0b999493a807cb1050a317e4c9fed" name="paytweet_button" scrolling="no" frameborder="no" height = "24px" width = "145px"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=138</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hudson buildserver for GAE projects</title>
		<link>http://www.whiletrue.nl/blog/?p=133</link>
		<comments>http://www.whiletrue.nl/blog/?p=133#comments</comments>
		<pubDate>Sun, 18 Jul 2010 19:17:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=133</guid>
		<description><![CDATA[I just created a Hudson buildserver for (Python-based) Google Appengine projects. Thanks to this great guide: http://www.rhonabwy.com/wp/2009/11/04/setting-up-a-python-ci-server-with-hudson/ I was able to get Hudson up-and-running for python projects. However Google Appengine requires some extra features (the Appengine SDK for example).
Thanks to this guide: http://heisel.org/blog/2009/11/21/django-hudson/ I was able to use nose for my unit tests publishing the [...]]]></description>
			<content:encoded><![CDATA[<p>I just created a Hudson buildserver for (Python-based) Google Appengine projects. Thanks to this great guide: <a href="http://www.rhonabwy.com/wp/2009/11/04/setting-up-a-python-ci-server-with-hudson/">http://www.rhonabwy.com/wp/2009/11/04/setting-up-a-python-ci-server-with-hudson/</a> I was able to get Hudson up-and-running for python projects. However Google Appengine requires some extra features (the Appengine SDK for example).</p>
<p>Thanks to this guide: <a href="http://heisel.org/blog/2009/11/21/django-hudson/">http://heisel.org/blog/2009/11/21/django-hudson/</a> I was able to use nose for my unit tests publishing the coverage results for cobertura (Hudson plugin). Now the complete picture looks somewhat like this:</p>
<p><a href="http://www.whiletrue.nl/blog/wp-content/uploads/Hudson_GAE_Project_small.png"><img class="alignnone size-full wp-image-132" title="Hudson_GAE_Project_small" src="http://www.whiletrue.nl/blog/wp-content/uploads/Hudson_GAE_Project_small.png" alt="Hudson_GAE_Project_small" width="500" height="357" /></a></p>
<p>I&#8217;ve whipped up an Ubuntu 10.04 desktop VM with all the prerequisites installed: a turnkey solution. If you want a copy I&#8217;ll share it with you, leave me an email below. (1,5 GB rarred download).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google App Engine Development</title>
		<link>http://www.whiletrue.nl/blog/?p=128</link>
		<comments>http://www.whiletrue.nl/blog/?p=128#comments</comments>
		<pubDate>Mon, 03 May 2010 20:31:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=128</guid>
		<description><![CDATA[Finally, this weekend I got to some App Engine experimenting. Great chance to learn a new language, Python  . I was really amazed by how easy it is to get your first app up and running, but I&#8217;m a graphics junkie so I think I can add some value to the net by publishing [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, this weekend I got to some App Engine experimenting. Great chance to learn a new language, Python <img src='http://www.whiletrue.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I was really amazed by how easy it is to get your first app up and running, but I&#8217;m a graphics junkie so I think I can add some value to the net by publishing this picture:</p>
<p><a href="http://www.whiletrue.nl/blog/wp-content/uploads/AppEngineOverview.png"><img class="alignnone size-full wp-image-129" title="AppEngineOverview" src="http://www.whiletrue.nl/blog/wp-content/uploads/AppEngineOverview.png" alt="AppEngineOverview" width="500" height="333" /></a></p>
<p>It gives a short overview of the developer&#8217;s context in which to operate when developing Python-based App Engine Apps. Three main tools are at the developer&#8217;s disposal: the Google App Engine Launcher (download via the tutorial), a browser to run/test your apps and an IDE for writing the Python code, IDLE for example. The GAE launcer can interact with a local development server which serves the code files from a local development folder (with a subfolder for each project). Using the same app, the launcher can deploy the app to the Google Cloud where it can be accessed by the customer, among other Google services.</p>
<p>I&#8217;ll try and put my own appengine experiences (handy patterns / examples etc) here regularly, but blog promises are rarely kept&#8230; <img src='http://www.whiletrue.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=128</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET application reference sheet</title>
		<link>http://www.whiletrue.nl/blog/?p=121</link>
		<comments>http://www.whiletrue.nl/blog/?p=121#comments</comments>
		<pubDate>Sun, 28 Feb 2010 13:26:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=121</guid>
		<description><![CDATA[Last week I gave a short overview of the .NET framework for a few collegues. They mainly knew the Java platform, so I gave a global overview of the ASP.NET event/page lifecycle. Just as a reference I made a sheet as how different elements are handled in ASP.NET (modules, httphandlers, pages, user controls and the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I gave a short overview of the .NET framework for a few collegues. They mainly knew the Java platform, so I gave a global overview of the ASP.NET event/page lifecycle. Just as a reference I made a sheet as how different elements are handled in ASP.NET (modules, httphandlers, pages, user controls and the global asax).</p>
<p>The result of my efforts can be downloaded here (2-A4 ref sheet): <a href='http://www.whiletrue.nl/blog/wp-content/uploads/ASP.NET.pdf'>ASP.NET</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=121</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The new development hype: CQRS</title>
		<link>http://www.whiletrue.nl/blog/?p=116</link>
		<comments>http://www.whiletrue.nl/blog/?p=116#comments</comments>
		<pubDate>Sat, 12 Dec 2009 22:01:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.whiletrue.nl/blog/?p=116</guid>
		<description><![CDATA[Why is everybody referring to EDA (Event Driven Architecture) as CQRS nowadays?
I can say we&#8217;re doing EDA in practice at Sogyo and I love the loosely coupled nature and all of this approach, but why o why do we all of a sudden need to call it CQRS in the software development world? We don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Why is everybody referring to EDA (Event Driven Architecture) as CQRS nowadays?</p>
<p>I can say we&#8217;re doing EDA in practice at Sogyo and I love the loosely coupled nature and all of this approach, but why o why do we all of a sudden need to call it CQRS in the software development world? We don&#8217;t go and rebrand something like object oriented design and call it someting hypish like &#8220;domain driven design&#8221; now do we? (oh, stupid me, we did a few years ago <img src='http://www.whiletrue.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).</p>
<p>No flame intended to Greg Young, I believe he has done great work with CQRS for certain problems but come on, don&#8217;t over-hype it people&#8230;</p>
<p>Merry christmas to all for now, I&#8217;m going to enjoy my holiday. More on EDA will follow in 2010!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=116</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A general repository for datagrids in Virtual Mode</title>
		<link>http://www.whiletrue.nl/blog/?p=84</link>
		<comments>http://www.whiletrue.nl/blog/?p=84#comments</comments>
		<pubDate>Sat, 24 Oct 2009 15:34:36 +0000</pubDate>
		<dc:creator>Andr Boonzaaijer</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://whiletrue.nl/blog/?p=84</guid>
		<description><![CDATA[For a series of posts in Dutch on Model Driven Development using MS DSL Tools in Visual Studio I used some code I wrote for feeding a DataGridView component in virtual mode with data. First of all, the code for the gridview itself: (pretty straightforward, I use a simple &#8216;employee&#8217; class as datasource elements).
partial class [...]]]></description>
			<content:encoded><![CDATA[<p>For a <a href="http://www.software-innovators.nl/2008/12/28/modelgedreven-ontwikkelstraat-in-net-7-objectbrowser/">series of posts</a> in Dutch on Model Driven Development using MS DSL Tools in Visual Studio I used some code I wrote for feeding a DataGridView component in virtual mode with data. First of all, the code for the gridview itself: (pretty straightforward, I use a simple &#8216;employee&#8217; class as datasource elements).
<pre lang=csharp>partial class EmployeeBrowser : System.Windows.Forms.DataGridView
{
    EmployeeRepository repository = new EmployeeRepository();
     public EmployeeBrowser()
        : base()
    {
        this.VirtualMode = true;
        this.Columns.Add("Id", "Id");
        this.Columns.Add("Name", "Name");
        this.CellValueNeeded += new DataGridViewCellValueEventHandler(Browser_CellValueNeeded);
        this.RowCount = repository.Count;
        repository.CachefetchingStart += new EventHandler(repository_CachefetchingStart);
        repository.CachefetchingDone += new EventHandler(repository_CachefetchingDone);
    }
    void repository_CachefetchingDone(object sender, EventArgs e)
    {
        Cursor.Current = Cursors.Arrow;
    }
    void repository_CachefetchingStart(object sender, EventArgs e)
    {
        Cursor.Current = Cursors.AppStarting;
    }
    void Browser_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
    {
        if (repository[e.RowIndex] != null)
            e.Value = repository[e.RowIndex].GetValueForIndexedProperty(e.ColumnIndex);
        else
            e.Value = null;
    }
}
</pre>
<p>As you can see, I&#8217;m using an &#8220;EmployeeRepository&#8221; class to fetch my data. This is where the real magic occurs. I chose to implement an IList<employee></employee> in this class so it can be generally accessed. For the DataGridView component, a few methods in this class are interesting. The index based access method for example:
<pre lang=csharp>public Employee this[int index]
{
    get
    {
        if (localcache.ContainsKey(index))
            return localcache[index];
        else
        {
            AddToCache(index, Get(index));
            if (localcache.ContainsKey(index))
                return this[index];
            else
                return null;
        }
    }
    set
    {
        throw new NotImplementedException();
    }
}
</pre>
<p>As you can see, there is a localcache dictionary that performs a lookup in the getter. If a cache miss occurs, the AddToCache() fed with the Get() method is performed, which looks something like this:
<pre lang=csharp>
private List Get(int startindex)
{
    if (CachefetchingStart != null)
        CachefetchingStart(this, null);

    OdbcCommand cmd = new OdbcCommand(
        @"
		With tmp AS
		(SELECT *,
			ROW_NUMBER() OVER (order by name) as RowNumber,
			(select count(*) from Employee) as TotalRows
		    FROM Employee)
			select *
			from tmp
			Where RowNumber Between " + startindex + " and " + (startindex + Constants.CacheSize), connection);

    List items = new List();

    DataTable dt = new DataTable();
    OdbcDataAdapter da = new OdbcDataAdapter(cmd);
    da.Fill(dt);

    foreach (DataRow row in dt.Rows)
    {
        Employee instance = new Employee();
        instance.id = (Guid)row["id"];
        if (row["name"] != DBNull.Value)
            instance.name = (String)row["name"];
        items.Add(instance);
    }

    if (CachefetchingDone != null)
        CachefetchingDone(this, null);

    return items;
}
<pre>
This shows how a page of data is loaded for insertion into the cache. This weird SQL Query is explained in <a href="http://whiletrue.nl/blog/?p=79">this previous post</a>. A configurable cachesize can be set in a Constants class.

I tested this code using a database in which I generated one million (1 000 000) customer objects and it performed nicely. The cachesize may be tweaked in order to enable faster scrolling with little steps (e.g. using arrow keys; a larger cache size can be benificial here) or making large jumps (a smaller cache size is better for this).

The entire working solution can be downloaded <a href="http://www.boonzaaijer.com/files/Whiletrue.DemoApp.zip">here</a>.</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=84</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCF pub-sub example with callback contract</title>
		<link>http://www.whiletrue.nl/blog/?p=109</link>
		<comments>http://www.whiletrue.nl/blog/?p=109#comments</comments>
		<pubDate>Thu, 01 Oct 2009 20:51:27 +0000</pubDate>
		<dc:creator>Andr Boonzaaijer</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://whiletrue.nl/blog/?p=109</guid>
		<description><![CDATA[Today I produced a little demo of a pub-sub structure using callback contracts in WCF. I learned a few important lessons.First let&#8217;s have a look at the servicecontract code:

[ServiceContract(CallbackContract = typeof(IEventCallback))]
public interface IEventsService
{
  [OperationContract(IsOneWay = true)]
  void Subscribe(string name);
  [OperationContract(IsOneWay = true)]
  void NotifyAll(string eventName);
}
[ServiceContract]
public interface IEventCallback
{
  [OperationContract]
  void [...]]]></description>
			<content:encoded><![CDATA[<p>Today I produced a little demo of a pub-sub structure using callback contracts in WCF. I learned a few important lessons.First let&#8217;s have a look at the servicecontract code:</p>
<p><code><br />
[ServiceContract(CallbackContract = typeof(IEventCallback))]<br />
public interface IEventsService<br />
{<br />
  [OperationContract(IsOneWay = true)]<br />
  void Subscribe(string name);</p>
<p>  [OperationContract(IsOneWay = true)]<br />
  void NotifyAll(string eventName);<br />
}<br />
[ServiceContract]<br />
public interface IEventCallback<br />
{<br />
  [OperationContract]<br />
  void Notify(string eventName);<br />
}<br />
</code></p>
<p>Pretty straightforward. Note the IsOneWay=true and CallbackContract settings. The implementation of the service is equally straightforward:</p>
<p><code><br />
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single,<br />
  ConcurrencyMode=ConcurrencyMode.Multiple)]<br />
public class EventsService : IEventsService<br />
{<br />
    List<ieventCallback> callbacks = new List<ieventCallback>();<br />
    public void Subscribe(string name)<br />
    {<br />
        callbacks.Add(OperationContext.Current.GetCallbackChannel<ieventCallback>());<br />
    }</p>
<p>    public void NotifyAll(string s)<br />
    {<br />
        foreach (IEventCallback cb in callbacks)<br />
            cb.Notify(s);<br />
    }<br />
}<br />
</code></p>
<p>Note the concurrencymode and the instancemode here. The service needs to be a singleton in order to distibute all events to all subscribers (a real single broker infrastructure), and the concurrencymode is necessary in order to be able to fire all the callback notifications. The callbacks are listed via the subscribe method using the GetCallbackChannel method.</p>
<p>I added an extremely simple windows forms client that subscribes and can send events. Multiple instances of this client can be executed in order to test if this works. Note that I used the NetTCPBinding in this solution. Please download it <a href='http://whiletrue.nl/blog/wp-content/sogyowcf.zip' title='here'>here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standard Logging in C# / .NET</title>
		<link>http://www.whiletrue.nl/blog/?p=108</link>
		<comments>http://www.whiletrue.nl/blog/?p=108#comments</comments>
		<pubDate>Thu, 30 Jul 2009 20:02:27 +0000</pubDate>
		<dc:creator>Andr Boonzaaijer</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Development (C#)]]></category>

		<guid isPermaLink="false">http://whiletrue.nl/blog/?p=108</guid>
		<description><![CDATA[For a discussion with some collegues I whipped up a little reference sheet on how to implement logging using the standard System.Diagnostics.Trace class. It works out-of-the box so no extra frameworks are required.Despite my effort we went with the standard log4net way. For the ones interested in frameworkless logging, this refsheet might be handy.The sheet [...]]]></description>
			<content:encoded><![CDATA[<p>For a discussion with some collegues I whipped up a little reference sheet on how to implement logging using the standard System.Diagnostics.Trace class. It works out-of-the box so no extra frameworks are required.<br/><br/>Despite my effort we went with the standard log4net way. For the ones interested in frameworkless logging, this refsheet might be handy.<br/>The sheet is available for download: <a href="http://whiletrue.nl/blog/wp-content/wt-logging.pdf" title="wt-logging.pdf">wt-logging.pdf</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiletrue.nl/blog/?feed=rss2&amp;p=108</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

