<?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>Luminis Software Development</title>
	<atom:link href="http://lsd.luminis.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://lsd.luminis.nl</link>
	<description></description>
	<lastBuildDate>Wed, 18 Aug 2010 10:10:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>nl</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting to know CouchDB &#8211; 2/x</title>
		<link>http://lsd.luminis.nl/getting-to-know-couchdb-2x/</link>
		<comments>http://lsd.luminis.nl/getting-to-know-couchdb-2x/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 09:40:58 +0000</pubDate>
		<dc:creator>Dennis Geurts</dc:creator>
				<category><![CDATA[couchdb]]></category>
		<category><![CDATA[iPhone/ iPad]]></category>
		<category><![CDATA[mobility]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[_changes]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=1038</guid>
		<description><![CDATA[Last time around, we were able to store the OSGi log messages into a CouchDB. Now I want to tap into the _changes API that CouchDB offers. The options are simple, connect to the &#8216;_changes&#8217; document in a CouchDB database and you will be presented with a log of all changes that have occurred on [...]]]></description>
			<content:encoded><![CDATA[<p>Last time around, we were able to store the OSGi log messages into a CouchDB. Now I want to tap into the <a href="http://books.couchdb.org/relax/reference/change-notifications">_changes</a> API that CouchDB offers. The options are simple, connect to the &#8216;_changes&#8217; document in a CouchDB database and you will be presented with a log of all changes that have occurred on the database.</p>
<pre class="brush: php;">
http://localhost:5984/db/_changes

{&quot;results&quot;:[
{&quot;seq&quot;:3,&quot;id&quot;:&quot;_design/app&quot;,&quot;changes&quot;:[{&quot;rev&quot;:&quot;2-0dc1002d841221e8d8d7f325b87ffd67&quot;}]},
{&quot;seq&quot;:196,&quot;id&quot;:&quot;994cf6817a74882cecda6425e8001a96&quot;,&quot;changes&quot;:[{&quot;rev&quot;:&quot;193-083ec5c1e1359789eb2cf09c46097fee&quot;}]}
,
&quot;last_seq&quot;:196}
</pre>
<p>For each document in the database only the last change is presented. This could result in quite a lot of information. It is therefore also possible to fetch changes while applying a server-side filter. For this to work, you first need to define a filter in a design document. Mine looks like this:</p>
<pre class="brush: jscript;">
function(doc, req) {
    if (doc.type == &quot;EVENT&quot;) { return true; }
    return false;
}
</pre>
<p>and is stored (using couchapp) in a design document called &#8216;app&#8217;. The name of the filter is &#8216;events&#8217;. The filters&#8217; meaning should obvious: pass through all documents for which the function returns &#8216;true&#8217;. The proper URL for accessing the changes will now be:</p>
<pre class="brush: php;">
http://localhost:5984/db/_changes?filter=app/events

{&quot;results&quot;:[
{&quot;seq&quot;:196,&quot;id&quot;:&quot;994cf6817a74882cecda6425e8001a96&quot;,&quot;changes&quot;:[{&quot;rev&quot;:&quot;193-083ec5c1e1359789eb2cf09c46097fee&quot;}]}
],
&quot;last_seq&quot;:196}
</pre>
<p>The &#8220;last_seq&#8221; part can be used for bookkeeping: If you plan to make  multiple calls to the _changes feed (say every hour) then it is nice to be able to skip the ones you already saw during a previous call. So, the second time you call the _changes feed, you can skip all previous changes by employing the following URL:</p>
<pre class="brush: php;">
http://localhost:5984/db/_changes?filter=app/events&amp;since=196

{&quot;results&quot;:[

],
&quot;last_seq&quot;:196}
</pre>
<p>Obviously, no update has occurred since we accessed the _changes feed for the first time. If, however we now add a new document to the database (with doc.type == &#8220;EVENT&#8221;) and call the _changes feed again:</p>
<pre class="brush: php;">
http://localhost:5984/db/_changes?filter=app/events&amp;since=196

{&quot;results&quot;:[
{&quot;seq&quot;:197,&quot;id&quot;:&quot;f0a4a559fac65ab3cca87baf1c014fa7&quot;,&quot;changes&quot;:[{&quot;rev&quot;:&quot;1-c8dfffec4e08ca8db2b95f30613e213d&quot;}]}
],
&quot;last_seq&quot;:197}
</pre>
<p>Also, a call to &#8220;http://localhost:5984/db&#8221; will result in a JSON object, where &#8220;update_seq&#8221; provides the current update sequence. This comes in handy if you&#8217;re really not interested in previous changes:</p>
<pre class="brush: php;">
http://localhost:5984/db

{&quot;db_name&quot;:&quot;db&quot;,&quot;doc_count&quot;:4,&quot;doc_del_count&quot;:0,&quot;update_seq&quot;:196,
&quot;purge_seq&quot;:0,&quot;compact_running&quot;:false,&quot;disk_size&quot;:1871961,
&quot;instance_start_time&quot;:&quot;1282049630257719&quot;,&quot;disk_format_version&quot;:5,
&quot;committed_update_seq&quot;:196}
</pre>
<p>This is all great functionality if your time granularity is in the order of hours or days. But hardly optimal if you want to be notified <em>immediately</em> of changes to the database. Fortunately, by supplying &#8220;feed=continuous&#8221; to the URL, CouchDB will keep your socket connection open and supply the changes as soon as they become available. Each change is represented by a well-formatted JSON line. This breaks from the previous examples, where the complete response consisted of well-formatted JSON, so beware!</p>
<pre class="brush: php;">
http://localhost:5984/db/_changes?filter=app/events&amp;since=196&amp;feed=continuous

{&quot;seq&quot;:197,&quot;id&quot;:&quot;f0a4a559fac65ab3cca87baf1c014fa7&quot;,&quot;changes&quot;:[{&quot;rev&quot;:&quot;1-c8dfffec4e08ca8db2b95f30613e213d&quot;}]}
...
...
{&quot;last_seq&quot;:197}
</pre>
<p>Eventually, if no changes have been sent for 60 secs, the socket connection closes. Before it does so, it spits out the last_seq, again for bookkeeping purposes.</p>
<p>I was wondering if it would be possible to create a simple iPhone/iPad application that is able to report specific events on a MapView using the _changes feed from CouchDB. All one then has to do as iPhone/ iPad application is connect to the continuous feed, parse the JSON data and display the events on your MKMapView. Server-side, all one has to do is insert/ update documents in the database. How easy! </p>
<p>So I started off by connecting to the _changes feed using an asynchronous NSURLConnection, expecting that its delegate would receive connection:didReceiveData: calls on each change. Unfortunately, this did not work: The NSURLConnection employs buffering internally that cannot be circumvented. Thus only after about 5 or 6 updates the delegate received some data. This is definitely not good enough. Some searching pointed me to the CFSocket/NSStream class. This class fortunately employs some more basic (read: unbuffered) socket handling, allowing me to receive data from the socket as soon as it becomes available!</p>
<pre class="brush: php;">
    //open the socket
    CFReadStreamRef readStream;
    CFWriteStreamRef writeStream;
    CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)[theURL host], [[theURL port] intValue], &amp;readStream, &amp;writeStream);

    inputStream = (NSInputStream *)readStream;
    outputStream = (NSOutputStream *)writeStream;

    [inputStream setDelegate: self];
    [outputStream setDelegate :self];
    [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    [inputStream open];
    [outputStream open];    
</pre>
<p>The containing class is set as delegate for both the NSInputStream and NSOutputStream. This causes the following method being called, based on events that occur on the streams:</p>
<pre class="brush: php;">
/* stream eventing */
- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode {

    switch(eventCode) {
        case NSStreamEventOpenCompleted:
            [self connection: nil didReceiveResponse: nil];
			break;

		case NSStreamEventErrorOccurred:
            [self connection: nil didFailWithError: [stream streamError]];
			break;

		case NSStreamEventEndEncountered:
            [stream close];
            [stream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
            [stream release];
            inputStream = nil;
            outputStream = nil;
            [self connectionDidFinishLoading: nil];
			break;            

        case NSStreamEventHasSpaceAvailable:
        {
            if (stream == outputStream) {
                [self connection: nil willSendRequest: [NSURLRequest requestWithURL: theURL] redirectResponse: nil];

                NSString *str = [NSString stringWithFormat: @&quot;GET %@?%@ HTTP/1.0\r\n\r\n&quot;, [theURL path], [theURL query]];
                const uint8_t *rawstring = (const uint8_t *)[str UTF8String];
                [outputStream write:rawstring maxLength: [str length]];
                [outputStream close];
            }
        }
            break;
		case NSStreamEventHasBytesAvailable:
        {
			if (stream == inputStream)
			{
				uint8_t buffer[1024];
				int len;
				while ([inputStream hasBytesAvailable])
				{
					len = [inputStream read: buffer maxLength: sizeof(buffer)];
					if (len &gt; 0)
					{
						NSData *theData = [[NSData alloc] initWithBytes: buffer length:len];
                        [self connection: nil didReceiveData: theData];
					}
				}
			}
        }
            break;
    }
}
</pre>
<p>As you can see, this method kind of delegates the occurring events to calls to the NSURLConnectionDelegate (which the containing class also implements, due to my initial effort to read the changes feed using a normal NSURLConnection). </p>
<p>Then, the connection:didReceiveData method handles the actual changes:</p>
<pre class="brush: php;">
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    NSString *str = [[NSString alloc] initWithData:data encoding: NSUTF8StringEncoding];

    NSArray *ary = [str componentsSeparatedByString:@&quot;\n&quot;];
    for (NSString *line in ary) {
        if ([line length] &gt; 0 &amp;&amp; [line characterAtIndex: 0] == '{') {
            id json = [line JSONValue];

            NSDictionary *dict = (NSDictionary*)json;
            NSObject *seq = [dict objectForKey: @&quot;seq&quot;];

            if (seq &amp;&amp; delegate) {
                [delegate changeReceived: dict];
            }
            NSObject *last_seq = [dict objectForKey: @&quot;last_seq&quot;];
            if (last_seq &amp;&amp; delegate) {
                int last = [((NSNumber*)last_seq) intValue];
                [delegate lastSequence: last];
            }
        }
    }

}
</pre>
<p>This method converts the JSON data to a NSDictionary and forwards these changes to a (self-defined) @protocol called ChangesDelegate:</p>
<pre class="brush: php;">
@protocol ChangesDelegate

@optional

-(void) changeReceived:(NSDictionary*) dict;
-(void) lastSequence:(int) last;
-(void) changesComplete:(NSError*)error;

@end
</pre>
<p>The implementation that performs the actual calls to CouchDB can be created using:</p>
<pre class="brush: php;">
    m_changes = [[Changes alloc] initWithHost: @&quot;localhost&quot; database: @&quot;db&quot; andFilter: @&quot;app/events&quot;];
    m_changes.delegate = self;

    m_lastSeq = [m_changes last_seq];
</pre>
<p>Since the calling class also implements the ChangesDelegate @protocol, it will receive the changes events. I am currently using it to display MKAnnotations onto a MKMapView and it works like a charm! </p>
<p>Thank you CouchDB for making life easy!</p>
<p>p.s. I&#8217;ve made the Changes class available through github: <a href="http://github.com/dennisg/changesfeed_xcode">changesfeed_xcode</a>. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/getting-to-know-couchdb-2x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting to know CouchDB 1/x</title>
		<link>http://lsd.luminis.nl/getting-to-know-couchdb-1x/</link>
		<comments>http://lsd.luminis.nl/getting-to-know-couchdb-1x/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 12:32:31 +0000</pubDate>
		<dc:creator>Dennis Geurts</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=941</guid>
		<description><![CDATA[
Some time ago, I started looking at CouchDB. Getting to know technologies is IMO always best performed by thinking up some kind of project. So first, I started thinking of what to do with it. Now that the 1.0.0 has been released I thought it would be good to (finally) blog about my findings so [...]]]></description>
			<content:encoded><![CDATA[<div style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font: normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-family: Times; line-height: normal; font-size: small; padding: 0.6em; margin: 0px;">
<p>Some time ago, I started looking at CouchDB. Getting to know technologies is IMO always best performed by thinking up some kind of project. So first, I started thinking of what to do with it. Now that the 1.0.0 has been released I thought it would be good to (finally) blog about my findings so far.</p>
<p>The project I came up with is the following: A simple (OSGi) log listener that stores its log messages into a CouchDB database.</p>
<p>At Luminis we use <a title="more on OSGi" href="http://www.osgi.nl" target="_blank">OSGi</a> a lot. It is a highly modular framework (written in Java) that allows you to combine several modules (called &#8216;bundles&#8217;) that each expose or make use of functionality provided by other bundles. Careful combination of several bundles will result (almost like &#8216;emerging behavior&#8217;) in a complete application that suits your needs. The functionality provided by a particular bundle is best exposed through interfaces, enabling you to switch implementations without breaking the contract with other bundles that use the exposed functionality.</p>
<p>One of the compendium services that are available is the <a title="API doc" href="http://www.osgi.org/javadoc/r4v42/index.html?org/osgi/service/log/LogService.html">LogService</a>. It allows any service to log the things it considers of any importance. It is then up to the LogService implementation where these log statements end up. Logging is usually sent to standard out or a file, which is fine in most cases. Sometimes however, logging onto the device itself and retrieving the log file for inspection is not an easy task. Take for example an Android device. Thanks to Aaron Miller&#8217;s <a href="http://github.com/apage43/couch-android-launcher" target="_blank">effort</a>, we are now able to run CouchDB on Android. Android apps (<a href="http://www.ezdroid.com/">EZDroid</a> apps) will now be able to store their logging data in this local instance. This data can then be easily replicated to another instance for inspection.</p>
<p>Also,  for limited devices (where there&#8217;s e.g. limited storage available) logging to a file is simply not an option.</p>
<p>Therefore I thought of the following scenarios where</p>
<ul>
<li>CouchDB is installed locally on the device/ server. Access to CouchDB is then guaranteed and no logging is missed. A drawback might be that the OSGi application would require a local installation of CouchDB (for those who consider that a drawback!).</li>
</ul>
<ul>
<li>CouchDB is installed on a remote instance. Access to the CouchDB instance might be interrupted due to network instability. Then, some log messages might get lost. Since most applications require a working internet connection,  I think we could live with this.</li>
</ul>
<p>The target of the project would be to store a JSON representation of the actually logged messages into CouchDB. This can easily be accomplished by using a <a title="API doc" href="http://www.osgi.org/javadoc/r4v42/index.html?org/osgi/service/log/LogListener.html">LogListener</a>.</p>
<p>In both cases, the OSGi LogListener that &#8216;lives&#8217; inside the OSGi application, receives all <a title="API doc" href="http://www.osgi.org/javadoc/r4v42/index.html?org/osgi/service/log/LogEntry.html">LogEntries</a>, that contain the messages that are being sent to the LogService (and some meta-data). All it then has to do is convert it to JSON and create a new document in some database at the CouchDB server. If one ever wanted to inspect the log messages, a single call to the CouchDB server would initiate a replication of the database to your local CouchDB instance. Then, you could peruse the log messages offline at your leisure.</p>
<p>Installation and the basic usage of CouchDB is not covered here, there are excellent descriptions already available on the <a href="http://wiki.apache.org/couchdb/Installing_on_OSX">Wiki</a>, <a href="http://github.com/halorgium/couchdb">Halorgium&#8217;s GitHub</a> and the <a href="http://books.couchdb.org/relax/">O&#8217;Reilly Free Book</a>.</p>
<p>To test the setup described above, I created such a LogListener implementation. I use <a href="http://code.google.com/p/json-simple/" target="_blank">json-simple</a> to convert the LogEntry into JSON and end up with a JSON Object such as the following:</p>
<pre class="brush: css;">
{
'message': 'This is a test message',
'time': 1269783246909,
'level': 'LOG_DEBUG',
'serviceReference': {},
'bundle': {
   'id': 5,
    'lastModified': 1269783246510,
    'location': 'file:bundle/net.luminis.log.couchdb-1.0.0.jar',
    'symbolicName': 'net.luminis.log.couchdb'
    }
}
</pre>
<p>A unique serverId/ instanceId could also be added to be able to distinguish between server instances if you decide to send the logging to a central server.</p>
<p>This, I POST to the configured server. By not submitting an &#8216;_id&#8217; in the JSON string, CouchDB will make one up for me. The HTTP (1.0) POST itself is done (thus keeping it lightweight) opening a raw socket to the couchdb server:</p>
<pre class="brush: xml;">
POST /db HTTP/1.0
Content-Length: xxx
Content-Type: application/json

{ ... the data here ... }
</pre>
<p>The response is also a valid JSON response which can be inspected for success (along with the HTTP response code, of course).</p>
<p>In my current implementation, I can choose between two modes; either each message is sent to the couchdb instance on at a time, or I send all messages in bulk mode every x seconds. The latter is probably the best for remote couchdb instances.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/getting-to-know-couchdb-1x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhoneGap, een alternatief voor native mobiele applicaties</title>
		<link>http://lsd.luminis.nl/phonegap/</link>
		<comments>http://lsd.luminis.nl/phonegap/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 06:55:32 +0000</pubDate>
		<dc:creator>Erik Sanders</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobility]]></category>
		<category><![CDATA[Google Android]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[News Item]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=1005</guid>
		<description><![CDATA[PhoneGap, een alternatief voor native mobiele applicaties
PhoneGap is een interessante open source alternatief voor het schrijven van native applicaties voor elk (mobiel) platform dat er is. In het kort komt het erop neer dat PhoneGap zorgt dat je een HTML applicatie met javascript.  De specifiek API, zoals location, contact, e.d. worden afgeschermd door een standaard API [...]]]></description>
			<content:encoded><![CDATA[<h1>PhoneGap, een alternatief voor native mobiele applicaties</h1>
<p>PhoneGap is een interessante open source alternatief voor het schrijven van native applicaties voor elk (mobiel) platform dat er is. In het kort komt het erop neer dat PhoneGap zorgt dat je een HTML applicatie met javascript.  De specifiek API, zoals location, contact, e.d. worden afgeschermd door een standaard API van PhoneGap.</p>
<h3>iPhone</h3>
<p><span style="font-size: 13.3333px;">Voor de iPhone kan de HTML applicatie gewoon worden aangeboden via de appstore. Dit is dan ook direct de truc waardoor er voldoende rechten zijn om de hardware aan te spreken. Er zijn al vele applicatie geplaatst in de appstore (zie een selectie in<a href="http://www.phonegap.com/apps" target="_blank"> www.phonegap.com/apps</a>).  Er is tevens een <a href="http://phonegap.pbworks.com/Getting-Started-with-PhoneGap-(iPhone)" target="_blank">getting started</a> en er zijn  extra <a href="http://github.com/purplecabbage/PhoneGap-Plugins">plugins</a> beschikbaar</span></p>
<h3>Ondersteunde platformen</h3>
<p>Naast iPhone wordt zowel Android, Blackberry, Symbian, Palm, N900 en Windows Mobile. Ook Windows Mobile 7 is zodra dit uitkomt eenvoudig te ondersteunen en ze zullen ook geen blokkade opwerpen in het voordeel van silverlight. Interesante gedachte is natuurlijk ook de iets minder mobiele system met Linux, Windows MacOS hebben ook allemaal een browser.</p>
<table style="float:lefts" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td></td>
<td>IPHONE</td>
<td>ANDROID</td>
<td>BLACKBERRY</td>
<td>SYMBIAN</td>
<td>PALM</td>
</tr>
<tr>
<td>GEO   LOCATION</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
</tr>
<tr>
<td>VIBRATION</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
</tr>
<tr>
<td>ACCELEROMETER</td>
<td>√</td>
<td>√</td>
<td>OS 4.7</td>
<td>√</td>
<td>√</td>
</tr>
<tr>
<td>SOUND</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
</tr>
<tr>
<td>CONTACT   SUPPORT</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>√</td>
<td>N/A</td>
</tr>
</tbody>
</table>
<p>Voor meer informatie zie <a href="http://www.phonegap.com" target="_blank">www.phonegap.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/phonegap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Being a .NET developer in a Mac OSX world: storing null values in a database</title>
		<link>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-storing-null-values-in-a-database/</link>
		<comments>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-storing-null-values-in-a-database/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 13:40:50 +0000</pubDate>
		<dc:creator>Richard de Zwart</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=982</guid>
		<description><![CDATA[When developing on Mac OSX, while targeting the Windows platform, you can get into some really nasty stuff when the Mono implementation of the .NET framework turns out to be different from (i.e. better than) the Microsoft implementation.]]></description>
			<content:encoded><![CDATA[<p>In this post I want to shine a light on a different aspect of developing on one OS to deliver on a different OS: different implementations of the .NET framework can have different behaviour. What runs on one, might crash on the other. That happened to me when accessing my SQL Server database using ADO.NET.</p>
<h3>Storing data using plain ADO.NET</h3>
<p>Ok, you might argue that there is no need to talk about plain ADO.NET, since nobody in his right mind is actually doing that anymore. Of course we -developers- have evolved and use document-databases like <a href="http://couchdb.apache.org/" target=_blank>CouchDB</a> and <a href="http://ravendb.net/" target=_blank>Raven DB</a> or ORMs like <a href="http://nhforge.org/Default.aspx" target=_blank>NHibernate</a> and <a href="http://msdn.microsoft.com/en-us/data/aa937723.aspx" target=_blank>Entity Framewok</a>.</p>
<p>But every now and then you need code like the code below. In my case because we were building a demo and needed to be done quickly. Which we were not, because of the problems I ran into when trying to store null values in the database.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Book book <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Book <span style="color: #000000;">&#123;</span>
	Id <span style="color: #008000;">=</span> Guid.<span style="color: #0000FF;">NewGuid</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,
	ISBN <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;123-456-222&quot;</span>,
	Title <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Through the looking glass&quot;</span>
<span style="color: #000000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>SqlConnection connection <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SqlConnection <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;some connections string&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	connection.<span style="color: #0000FF;">Open</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>SqlCommand cmd <span style="color: #008000;">=</span> connection.<span style="color: #0000FF;">CreateCommand</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		cmd.<span style="color: #0000FF;">CommandText</span> <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;INSERT INTO Book ([Id], [ISBN], [Title], [Publisher], [SuggestedPrice])
		       VALUES (@Id, @ISBN, @Title, @Publisher, @SuggestedPrice)&quot;</span><span style="color: #008000;">;</span>
&nbsp;
		cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@Id&quot;</span>, book.<span style="color: #0000FF;">Id</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@ISBN&quot;</span>, book.<span style="color: #0000FF;">ISBN</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@Title&quot;</span>, book.<span style="color: #0000FF;">Title</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@Publisher&quot;</span>, book.<span style="color: #0000FF;">Publisher</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@SuggestedPrice&quot;</span>, book.<span style="color: #0000FF;">RetailPrice</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
		var rowsAffected <span style="color: #008000;">=</span> cmd.<span style="color: #0000FF;">ExecuteNonQuery</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>rowsAffected <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;No rows inserted!&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The sql to create the table is like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> Book <span style="color: #66cc66;">&#40;</span>
	Id			uniqueidentifier	<span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
	ISBN			varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>		<span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
	Title			varchar	<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span>	<span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
	Publisher		varchar	<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #66cc66;">&#41;</span>	<span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
	SuggestedPrice	money 			<span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">PRIMARY</span><span style="color: #66cc66;">&#93;</span></pre></div></div>

<p>Finally the Book class is this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> Book
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> Guid Id <span style="color: #000000;">&#123;</span>
		get<span style="color: #008000;">;</span>
		set<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> ISBN <span style="color: #000000;">&#123;</span>
		get<span style="color: #008000;">;</span>
		set<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Title <span style="color: #000000;">&#123;</span>
		get<span style="color: #008000;">;</span>
		set<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Publisher <span style="color: #000000;">&#123;</span>
		get<span style="color: #008000;">;</span>
		set<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">decimal</span><span style="color: #008000;">?</span> RetailPrice <span style="color: #000000;">&#123;</span>
		get<span style="color: #008000;">;</span>
		set<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The reason to use SqlXXXX objects in stead of programming against interfaces like IDbConnection and IDbCommand is that I know I have a SQL Server database and will not change that in the course of this project and the fact that I have this nice simple syntax for setting parameters on the Command object:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">cmd.<span style="color: #0000FF;">Parameters</span>.<span style="color: #0000FF;">AddWithValue</span> <span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;@Title&quot;</span>, book.<span style="color: #0000FF;">Title</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>The AddWithValue-method is not on the IDbCommand interface, but is available as a public method on the SqlCommand class.</p>
<p>The book object comes from somewhere outside of this piece of code normally, and I cannot make any assumptions on the properties that are filled or not. For example the RetailPrice property is a nullable decimal, so it might therefore be null. No problem, since the database column SuggestedPrice is also nullable.</p>
<p>No problem? No problem in Mono. Run this code in MonoDevelop and store a book with a null value for the retaill-price and the publisher. Sweet.</p>
<h3>A problem on Windows</h3>
<p>Copy this code (or the compiled assemblies) to your Windows VM and run it there. You get an exception:<br />
<a href="http://lsd.luminis.nl/wp-content/uploads/2010/08/SqlException.png"><img src="http://lsd.luminis.nl/wp-content/uploads/2010/08/SqlException.png" alt="SqlException" title="SqlException" width="452" height="90" class="alignnone size-full wp-image-991" /></a><br />
Why is that? Why would .NET complain about the Publisher parameter, suggesting it is not there? It contains a null value, right, but the parameter itself is there anyway.</p>
<p>So the message itself is confusing. It took me quite some time (and the use of the great <a href="http://sites.google.com/site/sqlprofiler/" target=_blank>SqlProfiler from AnjLab</a>) to find out that the problem was in the null values. That must have happened to other people before. So Google to the rescue? Even that took some time before I found a thread on a <a href="http://www.pcreview.co.uk/forums/thread-2140022.php" target=_blank>PC Review forum</a> from 2005 that suggested to go through all the parameters in your command to see if they are null or not and then set them to DBNull.</p>
<h3>The platform independent version</h3>
<p>Are you kidding me? Every time and everywhere I have a Command object and add Parameters to it, I must go through all the parameters like this?</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>SqlParameter parameter <span style="color: #0600FF;">in</span> cmd.<span style="color: #0000FF;">Parameters</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>parameter.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        parameter.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> DBNull.<span style="color: #0000FF;">Value</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>And that has been like that since .NET 2.0? No improvements in the last 5 years? Probably, the reason you haven&#8217;t bumped into this problem lately, is that you have been using NHibernate (I did) and that solved it for you. I haven&#8217;t tried it with Entity Framework yet, but I guess that would solve it too. </p>
<p>I really think Mono does a better job here. When I set a parameter on a DbCommand object to null, I expect that object to translate that null value to something that the database understands. As is does for any other value. </p>
<p><a href='http://lsd.luminis.nl/wp-content/uploads/2010/08/NullValuesInADO.zip'>Download the code</a></p>
<p>P.S. At one time in the process of finding a solution , I got so frustrated with Microsoft .NET and Visual Studio 2008 (since that somehow stopped building properly) that I decided to run Mono on Windows too. It took me 5 minutes to download and install Mono on my VM, then 5 more minutes to discover the existence of XPS (the Mono web-server) and I had my webservice running! Unfortunately, that was not an option for our production server, but to me it proved that the guys at Mono do a really good job.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-storing-null-values-in-a-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who writes my user stories</title>
		<link>http://lsd.luminis.nl/who-writes-my-user-stories/</link>
		<comments>http://lsd.luminis.nl/who-writes-my-user-stories/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 06:44:44 +0000</pubDate>
		<dc:creator>Albert Oudenampsen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[requirements]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=961</guid>
		<description><![CDATA[The user story is one of the useful initiatives that came out of the Agile movement. It expresses a very specific user need. Usually it&#8217;s written in just a few sentences in the language of the users. So any user and developer should be able to read a user story and immediately understand it.
User stories [...]]]></description>
			<content:encoded><![CDATA[<p>The user story is one of the useful initiatives that came out of the Agile movement. It expresses a very specific user need. Usually it&#8217;s written in just a few sentences in the language of the users. So any user and developer should be able to read a user story and immediately understand it.</p>
<p>User stories gained popularity after realizing that developers had to start working with users throughout the project to understand their needs. It certainly works better than letting a developer discuss the needs with a user, which tends to end after a few minutes in a &#8220;Yes, I get it! No worries, know what you need&#8221;, followed by a near endless code-and-fix cycles.</p>
<p>So user stories are great, but who writes them? Hmmm, users probably. After all it&#8217;s their story. Question is &#8220;can users write user stories&#8221;? The answer is simple: it depends….</p>
<p>Certainly some users can write user stories. Sysadmins can, helpdesk and application support too. But the &#8220;real&#8221; users, can they write user stories? I don&#8217;t know about that. When you leave the writing of user stories in the hands of the users that can write user stories you may end up with &#8220;unbalanced systems&#8221; like the ones in the famous what-if-airplanes picture. After all, you don&#8217;t build a system just to do application support or system admin (unless that is your business). You build systems to increase &#8220;business value&#8221; or whatever greater purpose and for that you need the &#8220;real&#8221; users. <br/><br />
<img src="http://lsd.luminis.nl/wp-content/uploads/2010/07/what_if_airplanes2.JPG" alt="what_if_airplanes" title="what_if_airplanes" width="825" height="540" class="alignleft size-full wp-image-966" />
</p>
<p>As stated before: &#8220;any user and developer should be able to read a user story and immediately understand it&#8221;. If it is that simple, it cannot be too hard to learn how to write a user story. </p>
<p>A user story consists of two parts:<br/><br />
-Just a few lines of text that describe the problem;<br/><br />
-A Test that serves as an example and that can be used to determine when a story is complete.<br/><br />
A simple template for this can be found here: <a href="http://cukes.info">cukes.info</a><br/><br />
All very simple, and I bet it is possible to make a training course with exercises were the stories and their tests just drip of the table….</p>
<p>Unfortunately, most systems we build nowadays are not that simple. Recently I explained user stories to a group of barristers who were asked to describe their new system. After the theoretical part it was time for some their first user story. Not some lab example a real life one.<br/><br />
Barrister: how do we start?<br/><br />
Me: just go over the things you do during the day and see where your new system system comes in<br/><br />
Barrister: I visit people with a legal document, hand it over, explain the implications and sometimes I give them advice or propose a solution. Then I make notes on their file. That&#8217;s it.<br/><br />
Me: Hmmm, that is too simple, there must be more&#8230;..<br/><br />
The discussion continued for quite some time and finally we found that the user story was about efficiency. In the morning they receive a pile of documents for that day, they order them by address, program their navigation system and they make their visits.</p>
<p>Or the cukes.info template:<br/><br />
<code>In order to make as many visits as possible during a day<br/><br />
As a barrister<br/><br />
I want to receive an daily workload optimized for traveling time and in such a way that I spend the least possible time in programming my navigation system.</code>
</p>
<p>Barrister: not in a million years I would have come up with this user story! And how do I write a test for this? Is the navigation system part of the whole system? And what if there are traffic jams or rush hours should that be in there too? And what about different makes of navigation systems?</p>
<p>My conclusion: help your users in writing user stories and certainly help them in writing test scenario&#8217;s. </p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/who-writes-my-user-stories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Being a .NET developer in a Mac OSX world: connecting Mono to SQL Server</title>
		<link>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-connecting-mono-to-sql-server/</link>
		<comments>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-connecting-mono-to-sql-server/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 17:54:48 +0000</pubDate>
		<dc:creator>Richard de Zwart</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[MonoDevelop]]></category>
		<category><![CDATA[SQL server]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=928</guid>
		<description><![CDATA[How did I get here?
I&#8217;m a long time Windows developer.  Started with VB3 en FoxPro and such, and couldn&#8217;t imagine needing another plaform. Like the Mac that my geeky artistic brother-in-law loved so much. Windows was cool and I knew all about it and the Mac was for people that didn&#8217;t know how to [...]]]></description>
			<content:encoded><![CDATA[<h3>How did I get here?</h3>
<p>I&#8217;m a long time Windows developer.  Started with VB3 en FoxPro and such, and couldn&#8217;t imagine needing another plaform. Like the Mac that my geeky artistic brother-in-law loved so much. Windows was cool and I knew all about it and the Mac was for people that didn&#8217;t know how to use a PC.</p>
<h3>The dawn of a new era</h3>
<p>Then I came with my current employer and they provided a mobile phone and a laptop of course (like all companies in Dutch IT do). But this was about an iPhone and a MacBook Pro.<br />
I decided to leave OSX on the machine, although I could have erased the disk and installed Windows Something, it&#8217;s got an Intel processor after all.<br />
But leaving OSX on it, meant I had to install VMWare and run Windows and Visual Studio and such within that. And even though my machine is pretty fast, you notice the performance hit.</p>
<p>I kept trying, and started to like OSX and the applications on it. But what I liked most of all: hardly any updates and no reboots. I shut down my machine once a week or once every two weeks because I feel it&#8217;s something I should do. But I don&#8217;t have to: OSX keeps on running. Just close the lid, simply know that everything is suspended and know that everything will run as before when you open the lid the next day.</p>
<p>Amazing! I would shut down my Windows machine every night, just to make sure I had a stable system the next morning. My wife still has a Windows machine and to ensure that she makes backups every day, we configured the backup software to run &#8220;on system shutdown&#8221;. Because that is what you do every day, as a Windows user.</p>
<h3>And then there was Mono</h3>
<p>I&#8217;ve written about the <a href="http://www.mono-project.com/Main_Page" target=_blank>Mono project</a> before, albeit in the context of <a href="http://monotouch.net" target=_blank>MonoTouch</a> and iPhone development. Mono brings .NET to a lot of platforms, including Mac OSX. And it is really good. The Mono team is really close behind the Microsoft team in porting new API&#8217;s and Framework versions. .NET 4.0 is recently available on Windows, but Mono is already compatible.<br />
And the amazing thing is that you can take your Windows assemblies and use them straight away on OSX! That might not be very imported for assemblies that you have the sources for, but it is very convenient for third party libraries you use, like <a href="http://logging.apache.org/log4net/" target=_blank>log4net</a> (although that has a Mono version) and <a href="http://www.ayende.com/projects/rhino-mocks.aspx" target=_blank>Rhino Mocks</a>.<br />
And one of the best things the Mono team delivers is <a href="http://monodevelop.com/" target=_blank>MonoDevelop</a>: an excellent IDE for .NET development that will feel really comfortable when you come from Visual Studio.</p>
<h3>Being a .NET developer, not necessarily a Windows developer</h3>
<p>I still like the .NET framework, but I no longer feel that automatically implies I am a Windows developer. There are so many good tools that allow you to do everything on the Mac that you are normally doing on Windows.  So I decided that in the new project I recently started (in which we <em>will</em> deliver on Windows) I will try to go as far as possible to develop my code on Mac OSX.<br />
I will blog about my experiences in a series of posts. This first one is about connecting to SQL Server.</p>
<h3>I can&#8217;t do without SQL Server</h3>
<p>We will deliver our project an a SQL Server database, so it makes sense to use that during development also. It&#8217;s not that you have to, there are other options. If you have something like a nice Data Access Layer, you can run any SQLLite or MySql database and easily move to SQL Server later.<br />
There also is a <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0d2357ea-324f-46fd-88fc-7364c80e4fdb&#038;displaylang=en">file-based no-install version of SQL Server</a> these days that might run on Mono. Haven&#8217;t tried it yet, but could be promising.<br />
But if you need SQL Server, you can still work in MonoDevelop in your comfortable Mac environment.</p>
<h3>Inside the VM</h3>
<p>SQL Server will run on Windows in your VM, but that will be the only thing you&#8217;ll need your VM for. SImply minimize the window after all the configuration is done and don&#8217;t think about it anymore.</p>
<h4>Step one: opening up your Windows</h4>
<p>You need access to your VM from your Mac, so you have to open up some things.</p>
<p>Go into Control Panel and choose  Windows Firewall. Go to the advanced tab and add some ports. Port 1433 for SQL Server over TCP/IP and port 1434 for SQL Server over UDP. Maybe you can do without the UDP version, haven&#8217;t tried yet.</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.45.38-PM.png"><img class="size-full wp-image-934 alignnone" title="Firewall Exceptions" src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.45.38-PM.png" alt="Firewall Exceptions" width="430" height="518" /></a></p>
<h4>Step two: configure SQL Server</h4>
<p>First, make sure the SQL browser is running.</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.35.00-PM.png"><img class="size-full wp-image-929 alignnone" title="SQL Browser" src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.35.00-PM.png" alt="SQL Browser" width="295" height="142" /></a></p>
<p>Then enable TCP/IP in the Client Protocols</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.35.45-PM.png"><img class="size-full wp-image-930 alignnone" title="Protocols" src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.35.45-PM.png" alt="Protocols" width="601" height="165" /></a></p>
<p>And check that the Default Port is on 1433.</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.36.13-PM.png"><img class="size-full wp-image-932 alignnone" title="Poort " src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.36.13-PM.png" alt="Poort " width="387" height="435" /></a></p>
<p>In SQL Server Management Console open the properties of the server and make sure you have mixed authentication.</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.48.59-PM.png"><img class="size-full wp-image-935 alignnone" title="Mixed Authentication" src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-12-at-7.48.59-PM.png" alt="Mixed Authentication" width="705" height="218" /></a></p>
<h4>Step three: connect from your code or MonoDevelop</h4>
<p>In your connection string use the IP-address of your VMWare instance. Something like</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;connectionStrings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dossiers&quot;</span> <span style="color: #000066;">connectionString</span>=<span style="color: #ff0000;">&quot;Server=172.16.86.128;Database=mydefaultdatabase;User ID=sa;Password=bladiebla&quot;</span> <span style="color: #000066;">providerName</span>=<span style="color: #ff0000;">&quot;System.Data.SqlClient&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/connectionStrings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>That is! You can test your connection from MonoDevelop: Go to Tools/Database/Add database connection/SQL server:<br />
<img src="http://lsd.luminis.nl/wp-content/uploads/2010/07/MonoDevelopDatabaseTools.png" alt="MonoDevelopDatabaseTools" title="MonoDevelopDatabaseTools" width="661" height="179" class="alignnone size-full wp-image-955" /><br />
<img src="http://lsd.luminis.nl/wp-content/uploads/2010/07/Screen-shot-2010-07-18-at-9.33.05-PM.png" alt="Screen shot 2010-07-18 at 9.33.05 PM" title="Screen shot 2010-07-18 at 9.33.05 PM" width="612" height="379" class="alignnone size-full wp-image-956" /></p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/being-a-net-developer-in-a-mac-osx-world-connecting-mono-to-sql-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Developer Hub</title>
		<link>http://lsd.luminis.nl/windows-phone-7-developer-hub/</link>
		<comments>http://lsd.luminis.nl/windows-phone-7-developer-hub/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 20:43:41 +0000</pubDate>
		<dc:creator>Erik Sanders</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[mobility]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[News Item]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=913</guid>
		<description><![CDATA[Ik heb vorige week de Windows Phone 7 Developer Hub bijgewoond met de verwachting in een keer een compleet overzicht te krijgen van de nieuwe Microsoft smartphone. Ik heb niet de intentie in deze blog alles even uit te leggen, dat kan Microsoft prima zelf. Ik wil hier alleen het beeld dat ik heb gekregen [...]]]></description>
			<content:encoded><![CDATA[<p>Ik heb vorige week de Windows Phone 7 Developer Hub bijgewoond met de verwachting in een keer een compleet overzicht te krijgen van de nieuwe Microsoft smartphone. Ik heb niet de intentie in deze blog alles even uit te leggen, dat kan Microsoft prima zelf. Ik wil hier alleen het beeld dat ik heb gekregen schetsen vanuit het perspectief van de gebruiker, ontwikkelaar en business.</p>
<h2>Gebruiker</h2>
<p>Ik heb de telefoon niet zelf bedient maar heb toch een redelijke indruk gekregen. Zelf ben ik een iPhone gebruiker en zie wel wat verbeteringen en interessante ontwikkelingen</p>
<ul>
<li>Het gebruik is opgezet rond hubs. Er is bijvoorbeeld een social hub, op deze hub komt alle sociale media bij elkaar en bieden ze mogelijkheden tot integratie. Er zijn dus geen aparte ingangen meer voor linked-in, contacts, facebook e.d. maar alle informatie wordt gebundeld weergegeven.</li>
<li>Drie verplichte toetsen op de telefoon waarbij naast de enige toets op de iPhone om applicaties te starten er ook een<strong> zoek<span style="font-weight: normal;"> toets</span> </strong>is die de standaard zoek functionaliteit heeft maar ook kan worden gebruikt voor zoeken binnen de applicatie. Daarnaast is er de <strong>back </strong>toets hiermee kan je terug naar de applicatie die een andere heeft aangeroepen. Een typisch voorbeeld waar ik mij vaak aan heb geërgerd is: Je leest je mail daar staat een link in die je opent en vervolgens zit je in safari. De enige manier om die te verlaten is stoppen en je mail opnieuw opstarten.</li>
<li>Het metro concept van de user interface (Kort samengevat: beperkt grafisch en meer tekst) aangevuld met een panorama view en pivot view is wel een verfrissende aanpak waarbij je direct informatie ziet die je nodig hebt en niet alleen een menu.</li>
</ul>
<h2>Ontwikkelaar</h2>
<p>Voor een .Net ontwikkelaar is er eigenlijk niets nieuws. Je kunt namelijk gewoon ontwikkelen met je opgedane kennis in XAML (WPF en Silverlight) in je vertrouwde ontwikkelomgeving. Ik wil echter wel een aantal punten benadrukken</p>
<ul>
<li><span style="font-size: 13.3333px;">Een virtuele machine met de phone OS op de ontwikkel PC dus g</span>een emulator of simulator dus betere test omgeving</li>
<li>Naast API&#8217;s die telefoonfunctionaliteit geven zijn er ook API&#8217;s voor bijbehorende services in de cloud</li>
<li>Er is een gratis omgeving bestaande uit visual studio express voor ontwikkelaars en Blend express voor designers</li>
</ul>
<p>Het lijkt mij een eitje om de look en feel van de quote eetgids (een iphone app gemaakt door luminis) te bouwen voor W7</p>
<h2>Business</h2>
<ul>
<li>Beperkt aantal modellen en veel verplichte onderdelen zoals een grafische processor en sensoren als GPS e.d. Dit maakt de herkenbaarheid groter</li>
<li>Geen exclusieve contracten met KPN&#8217;s en de TMobile&#8217;s</li>
<li>Vergelijkbare appstore als Apple waarin een applicatie gegarandeerd binnen dagen wordt geplaatst.</li>
<li>Office applicaties en zelf een sharepoint front-end</li>
</ul>
<h2>Het evenement</h2>
<p>Het evenement zelf was wat mij betreft teleurstellend. Op een developer event verwacht ik concrete presentaties met duidelijke concepten en voorbeelden. Helaas bleven de presentaties erg oppervlakkig ook al aangemoedigd door de vele bizarre vragen die gesteld werden. Wat mij wel duidelijk is geworden dat Microsoft serieus hun best doet om weer aansluiting te vinden of zoals ze zelf beweren een voorsprong te nemen maar dat ze nog  heel goed hun best moeten doen om alles in de winkels te krijgen voor de kerst.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/windows-phone-7-developer-hub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FitNesse and OSGi</title>
		<link>http://lsd.luminis.nl/fitnesse-and-osgi/</link>
		<comments>http://lsd.luminis.nl/fitnesse-and-osgi/#comments</comments>
		<pubDate>Tue, 25 May 2010 19:59:38 +0000</pubDate>
		<dc:creator>Angelo van der Sijpt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[acceptance testing]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[modularity]]></category>
		<category><![CDATA[OSGi]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=901</guid>
		<description><![CDATA[Recently, I built a demonstrator project connecting FitNesse and OSGi. We show how that can help your project, and how we did it.]]></description>
			<content:encoded><![CDATA[<p>As a demonstrator for a customer, I recently built a set of fixtures that allow <a href="http://www.fitnesse.org">FitNesse</a> acceptance tests to talk to an OSGi framework. <strong>This code is by no means production quality, but merely intended to show the concept and explain the challenges.</strong></p>
<p>I will not explain the details of the acceptance tests here, however, if there&#8217;s one point I would like to get across, it&#8217;s <em>your fixtures should be as narrow as possible</em> to easily accommodate for implementation changes. Study the different <code>UserAdmin</code> fixtures for more details. Also, I assume some familiarity with OSGi.</p>
<h2>FitNesse and OSGi. Why?</h2>
<p>Of course its fun, there is some real benefit to be gained here. While the industry well understands the need for unit- and integration testing, also in a modular context, it becomes more complex to create the necessary link between business and code. Yes, using a modular architecture we can behave in a more agile fashion, but all that agility is no good if the business doesn&#8217;t hop on the train, and explain well what it needs. FitNesse allows the business to explain its goals in business-lingo, while forcing the specification to be precise enough to be executable: if a concept cannot be explained by simple scenarios, something is wrong, but that&#8217;s a different story.</p>
<p>The modular nature of OSGi means that behavior of an application is more emergent than deterministic, making it harder to reason about its correctness: we can prove that our code and bundles are correct (unit tests), that everything works together as it should (integration tests), and that it looks right (user interface tests). However, proving that the business rules (which may well be one of those emergent properties) are handled correctly in a given setting, is another can of worms: we need to connect our acceptance tests to the OSGi framework.</p>
<h2>The big picture</h2>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/05/Screen-shot-2010-05-25-at-9.27.41-PM.png"><img src="http://lsd.luminis.nl/wp-content/uploads/2010/05/Screen-shot-2010-05-25-at-9.27.41-PM-300x146.png" alt="FitNesse and OSGi - overview" title="FitNesse and OSGi - overview" width="300" height="146" class="alignnone size-medium wp-image-903" /></a></p>
<p>The solution presented below uses a special &#8216;fixtures&#8217; bundle, which can be deployed along side other bundles in your framework. This bundles exposes an interface (in our case, through an <code>HTTPServlet</code>), which is used by a set of connectors, which in turn are used by FitNesse.</p>
<h2>The details</h2>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/05/2010_05_25_21_38_03.png"><img src="http://lsd.luminis.nl/wp-content/uploads/2010/05/2010_05_25_21_38_03-300x212.png" alt="FitNesse and OSGi - detailed" title="FitNesse and OSGi - detailed" width="300" height="212" class="alignnone size-medium wp-image-905" /></a></p>
<p>The ingredients are two parts connector code, one part boiler plate, and one part genuine OSGi-aware fixtures.</p>
<h3>The connectors</h3>
<p>Starting at the level closest to FitNesse, we find a set of fixtures that FitNesse can use. For us, these contain merely boiler plate code.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removeUser<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    doRemoteCall<span style="color: #009900;">&#40;</span>buildRemoteCall<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UserAdmin&quot;</span>, name<span style="color: #009900;">&#41;</span>, <span style="color: #003399;">Void</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This code instructs our <code>RemoteInvoker</code> to do some call to the outside world. For more details, see <code>RemoteInvoker.java</code> in the <code>UserAdminRemoteFixtures</code> project.</p>
<h3>The fixture bundle</h3>
<p>Moving one step closer to our service, and into the OSGi framework, we find a <code>FixtureServlet</code>, whose task it is to receive calls from the <code>RemoteInvoker</code>, and turn them into actual method calls on the fixtures.</p>
<p>The fixtures, then, are almost regular OSGi aware objects. I chose to use the <a href="http://felix.apache.org/site/apache-felix-dependency-manager.html">Apache Felix Dependency Manager</a> for the dependency management of the fixtures. So, for our UserAdmin fixture, the dependencies are</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">manager.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>createService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    .<span style="color: #006633;">setInterface</span><span style="color: #009900;">&#40;</span>UserAdminListener.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    .<span style="color: #006633;">setImplementation</span><span style="color: #009900;">&#40;</span>userAdmin<span style="color: #009900;">&#41;</span>
    .<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>createServiceDependency<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        .<span style="color: #006633;">setService</span><span style="color: #009900;">&#40;</span>UserAdmin.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
        .<span style="color: #006633;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here, we state that we have some instance of a fixture <code>userAdmin</code> that registers itself as a <code>UserAdminListener</code> and needs a <code>UserAdmin</code>. How straightforward is that?
</p>
<p>The final step takes us to the actual fixture,</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserAdminFixture <span style="color: #000000; font-weight: bold;">implements</span> UserAdminListener <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">volatile</span> UserAdmin m_userAdmin<span style="color: #339933;">;</span>
...
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addUser<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		m_usersCreatedInLastCall <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		m_userAdmin.<span style="color: #006633;">createRole</span><span style="color: #009900;">&#40;</span>name, Role.<span style="color: #006633;">USER</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
...
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>which is just another component using a the <code>UserAdmin</code> service.
</p>
<h2>Putting it all together</h2>
<p>All we now need to do is deploy the fixture bundle in our project, and instruct FitNesse to use the remote connector. The zip file at the bottom of this post contains two shell scripts to do exactly that.</p>
<h2>Future work</h2>
<p>As I stated at the top of this story, this is by no means production quality code, but the concepts stand as they are. Given the way FitNesse works, the connectors do not need much extra work, perhaps support for collections. However, we could use</p>
<ul>
<li>a way to reduce the boiler plate code,</li>
<li>a way to ensure that that both side of the fixtures use the same function naming, and</li>
<li>better integration, for instance by only firing up a framework once a FitNesse suite is started.</li>
</ul>
<h2>Let&#8217;s play with it!</h2>
<p>I have built a <a href='http://lsd.luminis.nl/wp-content/uploads/2010/05/FitnesseAndOSGi.zip'>zip file</a> containing everything you need to get started, including a set of scenarios that can run with both a homebrew implementation of a User Admin, and the actual <a href="http://felix.apache.org">Apache Felix User Admin</a>. A Readme gives you more information on getting it all up and running.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/fitnesse-and-osgi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building iPad applications using MonoTouch: the UISplitView</title>
		<link>http://lsd.luminis.nl/building-ipad-applications-using-monotouch-the-uisplitview/</link>
		<comments>http://lsd.luminis.nl/building-ipad-applications-using-monotouch-the-uisplitview/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 05:00:03 +0000</pubDate>
		<dc:creator>Richard de Zwart</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[mobility]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[MonoDevelop]]></category>
		<category><![CDATA[monotouch]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=625</guid>
		<description><![CDATA[First of all, I bow deeply to the people that bring us MonoTouch. It was less than 2 days after the introduction of the iPad and the release of a beta of the iPhone/iPad SDK that a version of MonoTouch (and MonoDevelop) was available that covers the new API.
To build iPad apps, you need a [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, I bow deeply to the people that bring us MonoTouch. It was less than 2 days after the introduction of the iPad and the release of a beta of the iPhone/iPad SDK that a version of MonoTouch (and MonoDevelop) was available that covers the new API.</p>
<p>To build iPad apps, you need a couple of things that are all listed on the <a href="http://monotouch.net/ipad" target="_blank">MonoTouch iPad page</a>.</p>
<p>I couldn&#8217;t wait to build something that used the way bigger UI-surface that the iPad has. The first thing that attracted my attention when I fired up the Interface Builder was the UISplitViewController.<br />
The idea behind the <a href="https://developer.apple.com/iphone/prerelease/library/documentation/General/Conceptual/iPadProgrammingGuide/UserInterface/UserInterface.html" target="_blank">SplitView</a> is that you have some navigation on the left (like a NavigationController, or just a TableViewController) and a data view on the right. That is, only when the display is in landscape mode. As soon as you turn the iPad (the iPad SImulator, of course) to portrait, the left side disappears and all the screen is available to the data view.<br />
That behaviour is entirely taken care of by the UISplitViewController, at least if you stick to the conventions!</p>
<p>I decided to make a simple app with a list of places on the left side, and a map-view on the right:</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/Landscape.png"><img class="alignleft size-medium wp-image-626" title="Landscape" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/Landscape-300x232.png" alt="Landscape" width="352" height="272" /></a><a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/Portrait.png"><img class="size-medium wp-image-627 alignleft" title="Portait version of the UI" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/Portrait-233x300.png" alt="Portait version of the UI" width="233" height="300" /></a></p>
<h3>The obvious start</h3>
<p>When you start a new iPad application from the New Project menu, you get the well-known set-up of files in your project. Double-click the MainWindow.xib to fire up Interface Builder. Then drag the Split View Controller from the Library Window and drop it below the Window object in de MainWindow:<br />
<a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/MainWindow1.png"><img class="alignleft size-medium wp-image-629" title="MainWindow" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/MainWindow1-300x230.png" alt="MainWindow" width="300" height="230" /></a></p>
<p>As you can see, you get a lot for free, including stuff you don&#8217;t want. Now it gets less obvious. After clicking Cmd-Backspace a thousand times and positioning my cursor everywhere, I had an epiphany. Since the SplitViewController won&#8217;t work without two other controllers I had to add something new before I could remove the old!</p>
<p>No kidding, that was really the solution. So  I added a UITableViewController, Interface Builder magically removed the default NavigationController, and I added a MKMapView to the view-controller on the right.</p>
<p>This is the result:</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/SplitView.png"><img class="alignleft size-medium wp-image-632" title="SplitView" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/SplitView-300x233.png" alt="SplitView" width="300" height="233" /></a> I then added outlets to the AppDelegate for the map, the tableview and the splitview:</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/Outlets.png"><img class="alignleft size-full wp-image-633" title="Outlets" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/Outlets.png" alt="Outlets" width="290" height="238" /></a></p>
<h3>The less obvious code</h3>
<p>To make the controllers react properly when the orientation of the UI changes, you need to override the ShouldAutorotateToInterfaceOrientation() method in each of your controllers. How do you do that?<br />
The first step is to add a class to your project, make it inherit from your controller (a UITableViewController in my case) and override the ShouldAutorotateToInterfaceOrientation() method as below:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PlacesController <span style="color: #008000;">:</span> UITableViewController
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> PlacesController <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">bool</span> ShouldAutorotateToInterfaceOrientation <span style="color: #000000;">&#40;</span>UIInterfaceOrientation toInterfaceOrientation<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Repeat the step for the second controller:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Map <span style="color: #008000;">:</span> UIViewController
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> Map <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">bool</span> ShouldAutorotateToInterfaceOrientation <span style="color: #000000;">&#40;</span>UIInterfaceOrientation toInterfaceOrientation<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This should still compile. But it doesn&#8217;t work yet.</p>
<h3>The even less obvious link from the code to the UI</h3>
<p>The objects in the Interface Builder are standard objects. They need to be of the types that we just defined, to make the overridden methods work. See we need to make our own classes known to Interface Builder. That&#8217;s done by adding a Register-atribute and overriding the constructor with one that accepts an IntPtr.<br />
The Map class changed in something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Register<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Map&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Map <span style="color: #008000;">:</span> UIViewController
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> Map <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> Map<span style="color: #000000;">&#40;</span>IntPtr p<span style="color: #000000;">&#41;</span> <span style="color: #008000;">:</span> <span style="color: #0600FF;">base</span><span style="color: #000000;">&#40;</span>p<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">bool</span> ShouldAutorotateToInterfaceOrientation <span style="color: #000000;">&#40;</span>UIInterfaceOrientation toInterfaceOrientation<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The final step is setting the right class on the controller. Go to Interface Builder, select the UIViewController (e.g.) in the MainWindow, then go to the Inspector Window and type your classname over the default one:</p>
<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/01/Inspector.png"><img class="alignleft size-full wp-image-638" title="Inspector" src="http://lsd.luminis.nl/wp-content/uploads/2010/01/Inspector.png" alt="Inspector" width="286" height="243" /></a></p>
<p>And then it works! The map will re-orientate itself when the iPad is turned, and the Table View appears and disappears.<br />
Of course you want some location data in the table and the map to show the locations when clicked on, but that&#8217;s all in the <a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/SplitViewDemo.zip">code you can download</a>.</p>
<p>Enjoy making software for a device that makes you need to rethink the way you always made software&#8230;!!!</p>
<p>Mmmmh. re-reading that last line, I realize it&#8217;s a little hard to read. What I meant was something like <a href="http://joehewitt.com/post/ipad/" target="_blank">Joe Hewitt</a> wrote.</p>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/building-ipad-applications-using-monotouch-the-uisplitview/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Presentaties AgileMDD kennissessie &#8211; 30 maart 2010</title>
		<link>http://lsd.luminis.nl/agilemdd-300310/</link>
		<comments>http://lsd.luminis.nl/agilemdd-300310/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 12:28:56 +0000</pubDate>
		<dc:creator>Richard van der Laan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[AgileMDD]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[kennissessie]]></category>
		<category><![CDATA[mda]]></category>
		<category><![CDATA[mdd]]></category>

		<guid isPermaLink="false">http://lsd.luminis.nl/?p=759</guid>
		<description><![CDATA[Op 30 maart organiseerde luminis samen met ArchitecIT een kennissessie over model-driven development. In deze kennissessie stond het delen van praktijkervaringen centraal. De presentaties van deze avond zijn inmiddels online beschikbaar.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-300310-5.jpg"><img class="aligncenter size-full wp-image-834" title="AgileMDD-300310-5" src="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-300310-5.jpg" alt="" width="638" height="235" /></a></p>
<p>Op 30 maart organiseerde luminis samen met <a href="http://www.architecit.nl">ArchitecIT</a> een kennissessie over model-driven development. Aan de hand van vijf verschillende thema&#8217;s deelden sprekers van diverse organisaties hun praktijkervaringen met MDD. De volgende organisaties waren als deelnemer vertegenwoordigd: <strong>ArchitecIT, Delphino Consultancy, luminis, Ministerie van Defensie, Nedap, Nuon, PANalytical, Radboud Universiteit Nijmegen, Sogeti, Tennet en Thales.</strong></p>
<p>De presentaties van deze avond zijn inmiddels online beschikbaar en kunnen hieronder worden gedownload.</p>
<p><a href="http://www.agilemdd.nl"></a><a href="http://www.agilemdd.nl"><img class="alignleft size-full wp-image-509" title="agilemdd_logo" src="http://lsd.luminis.nl/wp-content/uploads/2009/09/agilemdd_logo.png" alt="agilemdd_logo" width="141" height="45" /></a><br />
<strong> </strong><br />
<strong> </strong><br />
<strong> </strong></p>
<p>In de praktijk zijn er bij softwareontwikkeling nog veel communicatie (overdrachtsmomenten) en bestaan de meeste ontwikkeltaken uit veel handwerk. Op basis van een MDD aanpak kunnen ontwikkeltaken worden geautomatiseerd en kan de onderlinge communicatie worden verbeterd. Hierbij is het echter wel belangrijk om te weten hoe MDD het beste kan worden toegepast en wat hierbij de meest voorkomende valkuilen zijn. Vanuit onze AgileMDD filosofie moet bij model-driven development een pragmatische en doelgerichte aanpak vooral centraal staan. Zo kan de bestaande ontwikkelkracht in de organisatie slimmer worden ingezet.<br />
<img class="alignright size-full wp-image-762" src="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-300310-1.jpg" alt="" width="160" height="230" /></p>
<p><strong></strong><br />
<strong>Programma kennissessie 30 maart:</strong></p>
<ul>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-Trends-en-ontwikkelingen-Deel-1.pdf">Agile MDD: huidige trends en ontwikkelingen &#8211; Deel 1 (Richard van der Laan)</a></li>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-Trends-en-ontwikkelingen-Deel-2.pdf">Agile MDD: huidige trends en ontwikkelingen &#8211; Deel 2 (Tony Sloos)</a></li>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-Realtime-heterogeneous-systems.pdf">Thales case: MDA in realtime heterogene systemen (Rene van Hees, Alexander Broekhuis)</a></li>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-DSL-toolkit.pdf">Defensie case: Microsoft DSL Toolkit in de praktijk (Gerrit Jan Timmermans, Erik Sanders)</a></li>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-MDSD-en-software-architectuur.pdf">MDD en software architectuur (Angelo Hulshout)</a></li>
<li><a href="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-kennissessie-MDE-Opportunities-and-Risks.pdf">MDD kansen en risico&#8217;s (Andriy Levytskyy)</a></li>
</ul>
<p>Wil je op de hoogte blijven van aankomende AgileMDD sessies of geïnteresseerd in advies op maat? Neem dan contact op met Inge Dokter (<a href="mailto:inge.dokter@luminis.nl?SUBJECT=Interesse%20in%20AgileMDD">inge.dokter@luminis.nl</a>) of bel 026-3653470.</p>
<table>
<td><img class="alignleft size-full wp-image-773" src="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-300310-4.jpg" alt="" width="276" height="187" /><img class="alignright size-full wp-image-780" title="Discussie resultaat vorige MDD kennissessie" src="http://lsd.luminis.nl/wp-content/uploads/2010/04/AgileMDD-300310-3.jpg" alt="Discussie resultaat vorige MDD kennissessie" width="305" height="187" /></td>
</table>
]]></content:encoded>
			<wfw:commentRss>http://lsd.luminis.nl/agilemdd-300310/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
