<?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>emphess .NET &#187; Software</title>
	<atom:link href="http://www.emphess.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emphess.net</link>
	<description>Freshly Draught Code</description>
	<lastBuildDate>Fri, 11 Nov 2011 11:57:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Goodbye</title>
		<link>http://www.emphess.net/2011/11/11/goodbye/</link>
		<comments>http://www.emphess.net/2011/11/11/goodbye/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 11:56:42 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=302</guid>
		<description><![CDATA[It&#8217;s time for a change! Please find my new blog at http://waistcode.net Would love to see you there! &#8211;Chris]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s time for a change! Please find my new blog at <a href="http://waistcode.net">http://waistcode.net</a><br />
Would love to see you there! &#8211;Chris</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Goodbye+http%3A%2F%2Femphess.net%2F%3Fp%3D302" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2011/11/11/goodbye/&amp;title=Goodbye" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2011/11/11/goodbye/&amp;title=Goodbye" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2011/11/11/goodbye/&amp;t=Goodbye" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2011/11/11/goodbye/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Suggest a Page to all facebook Friends</title>
		<link>http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/</link>
		<comments>http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 15:13:51 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=284</guid>
		<description><![CDATA[Bulk operations on facebook aren&#8217;t too easy to accomplish and typically involve some javascript hacking. For example, there&#8217;s a number of scripts on the net that show you how to invite all your friends to an event. However, when I want to share a page, I&#8217;d rather not come up with some kind of wannabe-event. [...]]]></description>
			<content:encoded><![CDATA[<p>Bulk operations on facebook aren&#8217;t too easy to accomplish and typically involve some javascript hacking. For example, there&#8217;s <a href="http://www.v3im.com/2011/03/inviting-all-friends-to-facebook-events/#axzz1JVdF3HkK">a number of scripts</a> on the net that show you how to invite all your friends to an event.</p>
<p>However, when I want to share a page, I&#8217;d rather not come up with some kind of wannabe-event. I simply want to suggest the page to my friends. </p>
<p>It took me some time to figure out how to do that. The basic idea is the same &#8211; inject a bit of javascript that invokes a click() on all items, preferably using Chrome&#8217;s console. The problem is that the actual list of friends is in an IFRAME, and Same Origin Policy will prevent you from gaining access to the contents of the IFRAME.</p>
<h3>The Solution</h3>
<ol>
<li>If you haven&#8217;t installed it yet, install Google Chrome. It&#8217;s definitely the best browser for this kind of productivity boosting.</li>
<li>Create a new shortcut to Chrome with an added command line option <code>--disable-web-security</code>. This will <a href="http://stackoverflow.com/questions/3102819/chrome-disable-same-origin-policy">deliberately disable a security feature</a> called &#8220;<a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a>&#8220;. On my machine, the link looks like<br />
<code>C:\Users\UserName\AppData\Local\Google\Chrome\Application\chrome.exe --disable-web-security</code></li>
<li>Warning: This is dangerous. <strong>Do not use this shortcut for regular browsing</strong> , but only to toggle all selected friends.</li>
<li>Open the security-disabled Chrome and navigate to the facebook page you want to share and click &#8220;Suggest to Friends&#8221;</li>
<li>Right-Click the page somewhere and select &#8216;inspect element&#8217; to open developer tools. Choose <b>Console</b></li>
<li>Now, enter the following line:
<pre class="brush: php">
javascript:v=document.getElementById(&quot;social_graph_invite_iframe&quot;);var friends = v.contentWindow.document.getElementById(&quot;all_friends&quot;).childNodes;for(i=0;i&lt;friends.length;i++){friends[i].childNodes[0].onclick()};
</pre>
</li>
<li>Hit Enter in the console window to select/deselect all friends. This is nothing but a &#8216;toggle all&#8217; feature the hard way.</li>
</ol>
<h3>A Detailed Walkthrough</h3>
<h4>Create a new shortcut</h4>
<div>
First, find your existing Chrome link, right-click it and select &#8220;Properties&#8221;:<br />
<a href="http://www.emphess.net/wp-content/uploads/2011/04/shortcut0.png"><img src="http://www.emphess.net/wp-content/uploads/2011/04/shortcut0.png" alt="A screenshot depicting the properties dialog of the google chrome browser&#039;s default shortcut with the &#039;target&#039; highlighted" title="Copying Google Chrome shortcut" width="489" height="574" class="alignleft size-full wp-image-294" /></a></p>
<p>Select the text in &#8220;Target&#8221; and copy it (Ctrl + C).</p>
<div class="clear"></div>
</div>
<div style="padding-top: 20px;">
Next, right-click the desktop and choose &#8220;New -&gt; Shortcut&#8221;:<br />
<a href="http://www.emphess.net/wp-content/uploads/2011/04/shortcut1.png"><img src="http://www.emphess.net/wp-content/uploads/2011/04/shortcut1.png" alt="A screenshot depicting the desktop&#039;s context menu with new.shortcut highlighted" title="Selecting New Shortcut" width="537" height="320" class="alignleft size-full wp-image-296" /></a></p>
<div class="clear"></div>
</div>
<div style="padding-top: 20px;">
In the dialog, paste (Ctrl + V) what you just copied and add <code> --disable-web-security</code>. Mind the space character in between!<br />
<a href="http://www.emphess.net/wp-content/uploads/2011/04/shortcut2.png"><img src="http://www.emphess.net/wp-content/uploads/2011/04/shortcut2.png" alt="" title="Adding the command line parameter to the new shortcut" width="668" height="582" class="alignleft size-full wp-image-297" /></a></p>
<div class="clear"></div>
</div>
<div style="padding-top: 20px;">
Click &#8220;Next&#8221; and enter a name for the new link, for example &#8220;Chrome (Insecure)&#8221; which reminds you NOT to use this for day-to-day browsing:<br />
<a href="http://www.emphess.net/wp-content/uploads/2011/04/shortcut3.png"><img src="http://www.emphess.net/wp-content/uploads/2011/04/shortcut3.png" alt="" title="Select a name for the new shortcut" width="668" height="582" class="aligncenter size-full wp-image-298" /></a></p>
<div class="clear"></div>
</div>
<div style="padding-top: 20px;">
Click &#8220;Finish&#8221; and you should end up with a new shortcut on your desktop:<br />
<a href="http://www.emphess.net/wp-content/uploads/2011/04/shortcut4.png"><img src="http://www.emphess.net/wp-content/uploads/2011/04/shortcut4.png" alt="" title="Two Shortcuts as a result" width="133" height="233" class="alignleft size-full wp-image-299" /></a></p>
<div class="clear"></div>
<h4>Applying the Javascript</h4>
<p>Screenshots for the facebook / chrome part are coming, but that takes a little longer to ensure privacy&#8230;</p>
<p>That&#8217;s about it for now. Now go and share this link with all your friends <img src='http://www.emphess.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</div>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Suggest+a+Page+to+all+facebook+Friends+http%3A%2F%2Femphess.net%2F%3Fp%3D284" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/&amp;title=Suggest+a+Page+to+all+facebook+Friends" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/&amp;title=Suggest+a+Page+to+all+facebook+Friends" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/&amp;t=Suggest+a+Page+to+all+facebook+Friends" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2011/04/14/suggest-a-page-to-all-facebook-friends/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Create High-Quality PDFs With Razor View Engine and LaTeX</title>
		<link>http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/</link>
		<comments>http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 17:48:23 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[MVC3]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Razor]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=257</guid>
		<description><![CDATA[ASP.NET MVC3 is a blast! If you haven&#8217;t tried it, you definitely should &#8211; it&#8217;s really fun to work with and brings so many cool new features! Now that the MVC3 Release Candidate is out, there&#8217;s practically nothing missing. Most importantly however, MVC3 introduces the Razor View Engine and separates MVC and WebPages, so the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.asp.net/mvc/mvc3">ASP.NET MVC3</a> is a blast! If you haven&#8217;t tried it, you definitely should &ndash; it&#8217;s really fun to work with and brings so many cool new features! Now that the <a href="http://weblogs.asp.net/scottgu/archive/2010/11/09/announcing-the-asp-net-mvc-3-release-candidate.aspx">MVC3 Release Candidate</a> is out, there&#8217;s practically nothing missing.</p>
<p>Most importantly however, MVC3 introduces the <a href="http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx">Razor View Engine</a> and separates MVC and WebPages, so the web rendering is no longer hard-wired into the ASP.NET subsystem.</p>
<p>Apart from its much cleaner syntax, Razor is also more flexible and it&#8217;s open source. <a href="http://www.fidelitydesign.net/">Matthew Abbot</a> and <a href="http://buildstarted.com">Ben of BuildStarted.com</a> have written some interesting articles on how to <a href="http://www.fidelitydesign.net/?p=208">use Razor without MVC</a> and even <a href="http://buildstarted.com/2010/09/29/razor-view-engine-without-mvc-at-all/">without ASP.NET at all</a>.</p>
<h2>PDFs vs. HTML</h2>
<p>Now, what does all that have to do with PDFs? Writing to PDFs itself isn&#8217;t necessarily too hard &ndash; you can easily <a href="http://www.devshed.com/c/a/Java/Creating-Simple-PDF-Files-With-iTextSharp/1/">draw some text</a> here and there or draw lines, for example using the excellent <a href="http://sourceforge.net/projects/itextsharp/">iTextSharp</a> library. But the real deal is typesetting!<a href="http://www.emphess.net/wp-content/uploads/2010/11/p2.png"><img src="http://www.emphess.net/wp-content/uploads/2010/11/p2.png" alt="" title="p2" width="496" height="249" class="alignleft size-full wp-image-268" /></a></p>
<p>Unfortunately, HTML and paper don&#8217;t make a very good fit. Breaking HTML tables across pages, for example, is an insufferable pain. HTML wasn&#8217;t made with paper in mind &#8211; a good thing for HTML, and a good reason not to abuse it for printing PDFs.</p>
<h2>Introducing RazorTex</h2>
<p>Now, Razor makes only a few assumptions about the type of data it renders &#8211; it doesn&#8217;t really have to be HTML&#8230; With <a href="http://github.com/cmenge/RazorTex/">RazorTex</a>, you can create LaTeX-Views on the fly instead! A word of warning though: RazorTex is extremely young and unstable &#8211; more sample code than anything else &#8211; so be prepared! There&#8217;s a ton of features missing, but it works. If you&#8217;re ready for a rather rough ride, go ahead! </p>
<p>So how does it work, behind the scenes? RazorTex will use the Razor engine to compile code into a LaTeX file. A sample section from a <code>.cstex</code> file might look like this:</p>
<pre class="brush: php">
\frac{@Model.Factor.ToString(&quot;F2&quot;)}{@Model.Denominator.ToString(&quot;F2&quot;)} &amp;= @Model.Result.ToString(&quot;F2&quot;) \\
\int_{@Model.LowerBound}^{@Model.UpperBound} @Model.Expression @Model.IntegrationVariable &amp;= @Model.IntegrationResult \\
</pre>
<div style="float: right;">
<a href="http://www.emphess.net/wp-content/uploads/2010/11/p1.png"><img src="http://www.emphess.net/wp-content/uploads/2010/11/p1.png" alt="" title="p1" width="248" height="351" class="alignleft size-full wp-image-267" /></a>
</div>
<p>The <code>'&#038;='</code> and <code>'\\'</code> are special LaTeX-Commands, an alignment character and a line break, respectively. </p>
<p>If you don&#8217;t know LaTeX, the syntax can be really terrifying at first. However, there is no doubt LaTeX is extremely powerful when it comes to <a href="http://www.tug.org/texshowcase/">typesetting complicated document layouts</a>. For example, it supports high-quality text rendering with <a href="http://en.wikipedia.org/wiki/Microtypography">microtypography</a>, breaking tables across pages, typesetting mathematical formulas and rendering vector images, to name only a few. There are many additional packages you can use for practically any type of typesetting problem.</p>
<div style="clear: both;"></div>
<h2>Running the Sample</h2>
<p>Unfortunately, there are some smaller obstacles when running the sample. Also, you&#8217;ll have to install a bunch of things:</p>
<ol>
<li>Download and install <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a920ccee-1397-4feb-824a-2dfefee47d54&#038;displaylang=en">ASP.NET MVC3 Release Candidate</a> from Microsoft. This includes the Razor view engine</li>
<li>Download and install <a href="http://miktex.org/2.8/setup">MiKTeX 2.8</a></li>
<li>Download and install <a href="http://www.winshell.de/">WinShell for LaTeX</a>, an IDE for LaTeX [recommended]</li>
<li>Before running the sample, open the two included sample .TeX files and open them with WinShell. Run the PDF Compiler. This will install the required packages. <strong>If you don&#8217;t install the packages, the sample might dead-lock!</strong></li>
<li>Adjust the settings in app.config according to your needs and create the temporary and output folders.</li>
<li>Finally, the application should run and create great pdfs from a console application&hellip;</li>
</ol>
<h2>The Architecture</h2>
<p>Let&#8217;s take a quick look at the architecture of the Razor pipeline. Most importantly, Razor views are compiled &#8211; a huge advantage when you need to render a lot files with similar structure. However, we need to care for the compilation ourselves. Fortunately, <a href="http://blog.andrewnurse.net/CommentView,guid,6acc0b07-0db5-4353-b375-fbe60a209bb1.aspx">Andrew Nurse</a> has already accomplished that for us. For details, refer to his article. In short, we read the <code>.cstex</code> file, create a RazorParser and throw in our template string. This will create C# code which in turn can be compiled to binary using <code>CodeDom.GenerateCodeFromCompileUnit</code>. Of course, there are some subtleties involved such as assigning the correct base class, importing some namespaces, and so forth.</p>
<p>Once they are compiled, executing the latex view is blazing fast, but compilation takes some time. Therefore, it&#8217;s a good idea to cache these. Right now, there is some caching in RazorFlux, but it&#8217;s probably a good idea to compile all the latex-views in one go (and into a single assembly) &#8211; at least, that&#8217;s the way ASP.NET does it.</p>
<h2>Additional Features, LatexHelper</h2>
<p>Two particularly helpful features in HTML are the <code>HtmlHelper</code> and <code>UrlHelper</code> extensions. Of course, they don&#8217;t make a lot of sense in LaTeX, but there are some LaTeX-features where a custom helper would come in handy &#8211; a <code>LatexHelper</code>!?</p>
<p>Indeed, we can inject our own helpers through the base class:</p>
<pre class="brush: php">
Type baseType = (modelType == null)
            ? typeof(LatexTemplate)
            : typeof(LatexTemplate&lt;&gt;).MakeGenericType(modelType);

generator.GeneratedClass.BaseTypes.Add(baseType);

public abstract class LatexTemplate : ILatexTemplate
{
    public LatexHelper Latex { get; set; }
    public bool SuppressEmptyLines { get; set; }
}
</pre>
<p>So far, the LatexHelper is used primarily for &#8220;display templates&#8221;. Also, the LatexHelper certainly contains the worst hacks in the code. More about that later.</p>
<h2>Drawbacks</h2>
<p>Some disadvantages shouldn&#8217;t go unmentioned:</p>
<ul>
<li>While Razor doesn&#8217;t seem to make too many assumptions, it does assume that line breaks don&#8217;t play a role &#8211; true for HTML but damn wrong for LaTeX. I have had some trouble with that, but nothing that can&#8217;t be solved in the <code>.cstex</code> file. Still looking for a better solution though.</li>
<li>Pdflatex isn&#8217;t too fast &#8211; there might be faster solutions for creating PDFs, but the quality of pdflatex is very high.</li>
<li>It seems impossible to get pdflatex to work with streams instead of files, so you&#8217;ll have to write temporary files &#8211; no big deal, but a little painful. If anybody knows how to it, I&#8217;d be glad to know!</li>
</ul>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Create+High-Quality+PDFs+With+Razor+View+Engine+and+LaTeX+http%3A%2F%2Femphess.net%2F%3Fp%3D257" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/&amp;title=Create+High-Quality+PDFs+With+Razor+View+Engine+and+LaTeX" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/&amp;title=Create+High-Quality+PDFs+With+Razor+View+Engine+and+LaTeX" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/&amp;t=Create+High-Quality+PDFs+With+Razor+View+Engine+and+LaTeX" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/11/09/create-high-quality-pdfs-with-razor-view-engine-and-latex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google Pimps its Webmaster Tools</title>
		<link>http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/</link>
		<comments>http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 11:00:54 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Entrepreneurship]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Webmaster]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=186</guid>
		<description><![CDATA[Google&#8217;s Webmaster tools underwent some changes over the last few weeks, but most of them had been minor. Now, they released a completely overhauled &#8220;Top Search Queries&#8221; section and it&#8217;s really cool. Most importantly, Webmaster tools will no longer indicate your page is on position x for a given keyword, but it will show how [...]]]></description>
			<content:encoded><![CDATA[<p>Google&#8217;s <a href="https://www.google.com/webmasters/tools">Webmaster tools</a> underwent some changes over the last few weeks, but most of them had been minor. Now, they released a <a href="http://googlewebmastercentral.blogspot.com/2010/04/more-data-and-charts-in-top-search.html">completely overhauled &#8220;Top Search Queries&#8221; section</a> and it&#8217;s really cool. Most importantly, Webmaster tools will no longer indicate your page is on position x for a given keyword, but it will show how often it appeared on what page (e.g. how often your site appeared on page three for the keyword &#8220;buzzword&#8221; and how many people clicked it). The old way of doing it was obviously incompatible with customized search results and therefore was often indicating very confusing positions. It once told me I was on pos #1 for <a href="http://www.google.com/search?rls=en&#038;hl=en&#038;q=linq">the Keyword &#8220;Linq&#8221;</a>&#8230;</p>
<p><a href="http://www.emphess.net/wp-content/uploads/2010/04/gwt.png"><img src="http://www.emphess.net/wp-content/uploads/2010/04/gwt-300x178.png" alt="A screenshot of webmaster tools in action" title="Google Webmaster Tools" width="300" height="178" class="alignright size-medium wp-image-187" /></a></p>
<p>They also added fancy charts (although I suspect these don&#8217;t work accurately yet, because of that peak you see in the screenshot) that look like <a href="https://www.google.com/analytics/">Google Analytics</a> a lot. The downside is that clicking on google search results will link to another google page which will then redirect you to the target &#8211; not exactly big trouble, but annoying when you&#8217;re used to copying links into your blog posts <img src='http://www.emphess.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Google+Pimps+its+Webmaster+Tools+http%3A%2F%2Femphess.net%2F%3Fp%3D186" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/&amp;title=Google+Pimps+its+Webmaster+Tools" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/&amp;title=Google+Pimps+its+Webmaster+Tools" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/&amp;t=Google+Pimps+its+Webmaster+Tools" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/04/15/google-pimps-its-webmaster-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My db4o Wishlist</title>
		<link>http://www.emphess.net/2010/04/14/my-db4o-wishlist/</link>
		<comments>http://www.emphess.net/2010/04/14/my-db4o-wishlist/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 22:30:18 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[db4o]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[Object Database]]></category>
		<category><![CDATA[OODBMS]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=168</guid>
		<description><![CDATA[After finding that db4o did not screw up in our projects, I dug a bit through their issue tracker, which is a very important resource you should definitely check out if you&#8217;re working with db4o! Just to get that straight: I&#8217;m an avid db4o user and really love it. These issues are not critical and [...]]]></description>
			<content:encoded><![CDATA[<p>After finding that <a href="http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/">db4o did not screw up</a> in our projects, I dug a bit through <a href="http://tracker.db4o.com/secure/Dashboard.jspa">their issue tracker</a>, which is a very important resource you should definitely check out if you&#8217;re working with db4o!</p>
<p>Just to get that straight: I&#8217;m an avid db4o user and really love it. These issues are not critical and they don&#8217;t stop me from using or evangelizing db4o. However, I think there is some lack of awareness of some issues.</p>
<p>Also, I&#8217;d like to spawn some discussion about the issues below. Unfortunately, due to their changes to the forum system, most of the original discussions on the <a href="http://developer.db4o.com/Forums.aspx">db4o forum</a> are hard to find or possibly lost. You may want to <em>vote on the issues you deem most pressing</em>, which you can easily do in their issue tracker! I&#8217;m very interested in what you think about this little selection.</p>
<h2>Selected Issues</h2>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-1133">Don&#8217;t run SODA when no more constraints are present</a><br />
I <a href="http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/">blogged about this already</a>, because you experience this in very common scenarios, namely whenever you query a small subset of a larger candidate set. For example, consider selecting the last 50 posts on a blog/qa-site/etc. What will happen is that db4o runs the BTREE query for the sort operation (blazing), <em>then hydrates (?) all objects</em>, the returns the first 50 of them and throws away the rest. Thing is that there is no need to further inspect the items, and activating all them is basically a linear operation. Thus, this common type of query currently runs in <em>O(n)</em> instead of <em>O(log n)</em> which is an incredibly dramatic difference.</p>
<p><span id="more-168"></span></p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-1899">LINQ-Implementation is not &#8216;thread&#8217;-safe</a><br />
A very <a href="http://blog.stevensanderson.com/2007/11/29/linq-to-sql-the-multi-tier-story/">similar issue has been on LINQ-to-SQL&#8217;s todo list some time ago</a>.<br />
I&#8217;m not sure whether this is so much the typical use case. For the db4o case, it teaches us two things right now:</p>
<ul>
<li>Container reuse is non-trivial and should be approached with extreme care. You don&#8217;t want to run into this kind of byzantine error in a live app.</li>
<li>The object identity problem is similar in both Object-Relational Mapping and OODBMS</li>
</ul>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-191">Scalable server architecture: multiple readers against the same file, transactional files</a><br />
This sounds daunting, and it&#8217;s probably a huge one, as you can see from its age. I also believe this might be politically challenging, because this moves into the direction of <a href="http://www.versant.com">Versant&#8217;s</a> large-scale object database. However, there is a lot of movement into that direction from the user-side it seems &#8211; people are asking for features of this kind more and more lately, largely due to the ultra-cool LINQ integration db4o has. I suppose I&#8217;d be wise to focus on this kind of scenario as it could really become the preferred way of writing web applications: it&#8217;s extremely agile, supports rapid development, is flexible in that the same (LINQ) code could be used for different persistence layers if that should ever be needed and leads to clean, compile-time checked, type-safe code.</p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-236">Sanitize reflector design &#8211; remove core dependencies on generic reflector</a><br />
Being able to get rid of the generic reflector seems important, I&#8217;m already building my own code for this. Here we have conflicting requirements: The GenericReflector makes db4o very easy to use and may help beginners. It is also required in client-server scenarios where the server doesn&#8217;t have the necessary model dlls, but for most applications I think you should try to avoid it. Storing data in a generic manner is slow and requires a lot more space, making it highly inefficient.</p>
<p>Current attack vector: <a href="http://developer.db4o.com/Forums/tabid/98/aff/4/aft/9635/afv/topic/Default.aspx">Throw a Listener on the object created event</a> on the server and make sure the server knows the type.</p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-1905">Allow immediate TCP port reuse</a><br />
When opening a server, the TCP port will be blocked in case the server crashes, the app is terminated, etc. Since that might happen quite often when you use the &#8216;integrated server&#8217; where the server is actually created in your web application, a restart of the web application will fail because the TCP port is blocked. In a client-server scenario, on the other hand, a simple restart wouldn&#8217;t be possible because you need to assign a new port to clients or wait 6 minutes. This should be fairly simple, but I don&#8217;t know if that comes with any side-effects.</p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-113">Fast Collections</a><br />
This is a huge one. The cool thing is that this could allow much more complicated queries to be executed in reasonable timeframes. However, I&#8217;m a bit worried about <a href="http://tracker.db4o.com/browse/COR-644">the issue &#8220;FastCollections: Inside BTree List implementation&#8221;</a>, because that sounds really important, but is in state &#8220;Won&#8217;t fix&#8221;.</p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-478">Locking</a><br />
Optimistic locking would be a nice-to-have thingie, but you do this yourself rather easy I think.</p>
<p>&raquo; <a href="http://tracker.db4o.com/browse/COR-1772">A new object is stored upon value type updates</a><br />
This is rated critical, so it&#8217;s not an item for a &#8220;wishlist&#8221;. I&#8217;m not sure if I understand its implications and I rarely use value types apart from Guids, and updating Guids is pointless &#8211; still a db4o user should probably know this and keep this in mind, so I felt it should go here &#9760;.</p>
<h2>db4o Configuration</h2>
<p>This one is not really in the issue tracker as a single item, and it&#8217;s more of a general remark. <em>One of the rather messy things in db4o is configuration</em>. Even with the <a href="http://programing-fun.blogspot.com/2008/10/changes-in-db4o-configuration.html">new configuration interface</a>, there is quite a bit of confusion among users. The reason, in my eyes, is mostly a combination of incomplete documentation and unexpected behaviour. Examples:</p>
<ul>
<li>The indexation setting for fields is the only configuration setting that is persistent. Everything else, including unique constraints, needs to be re-set when (or &ndash; more precisely &ndash; <em>before</em>) opening the <code>ObjectContainer</code>.</li>
<li>Applying an option to a field that doesn&#8217;t exist will not trigger a warning or an <code>Exception</code></li>
<li>Some settings simply won&#8217;t have any effect when you perform them after opening the <code>ObjectContainer</code>, but they do not warn you.</li>
<li>Certain settings <strong>must</strong> be applied on the server, a few <strong>must</strong> be applied on the client and with some &#8230; well, you just set them on both just to make sure. Here, db4o does throw exceptions, however!</li>
<li>Several options need to be set before <em>creating</em> the object container (e.g. string encoding) and cannot be reset afterwards, again being completely silent about the ineffectiveness of the respective settings.</li>
<li>Some settings, such as field-based cascade-on-activate, <a href="http://developer.db4o.com/Forums/tabid/98/aff/4/aft/9783/afv/topic/Default.aspx">simply don&#8217;t seem to work at all</a></li>
</ul>
<p>This leads to lots and lots of confusion. Most importantly, it is often hard to determine whether a certain setting was successfully applied, or not. Also, some defaults are unexpected:</p>
<ul>
<li>Default <code>ActivationDepth</code> is (completely random) 5. Why not 8? Or 2? This troubles beginners a lot. Either set it to infinity, or to zero. Everything else feels just random. You can still include a line <code>ActivationDepth = 5;</code> in beginner&#8217;s samples, thereby showing them that the setting is there and that they need to be aware of it.</li>
<li>Default string encoding seems to be <code>UTF-16</code> or <code>UCS-2</code>, probably the most useless encodings around, despite the Windows Kernel working with it. <code>UTF-8</code> would come in as a reasonable default, but with <code>UTF-16</code> half of your database is probably zeros, because even in non-english environments, there is still a lot of mostly ASCII-data to be stored (such as URLs, Email addresses, base64 encoded information, SHA-hashes, etc.). Also many languages have non-ASCII characters only sparingly, German being one example.</li>
</ul>
<p>I think it&#8217;d be really cool if the configuration interface was a little more explicit and would throw Exceptions instead of silently ignoring requests that cannot be fulfilled.</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=My+db4o+Wishlist+http%3A%2F%2Femphess.net%2F%3Fp%3D168" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/04/14/my-db4o-wishlist/&amp;title=My+db4o+Wishlist" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/04/14/my-db4o-wishlist/&amp;title=My+db4o+Wishlist" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/04/14/my-db4o-wishlist/&amp;t=My+db4o+Wishlist" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/04/14/my-db4o-wishlist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StackExchange Changes Everything, Risks a Lot</title>
		<link>http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/</link>
		<comments>http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 21:12:52 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Entrepreneurship]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[StackExchange]]></category>
		<category><![CDATA[Wikorum]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=155</guid>
		<description><![CDATA[The wikorum-engine StackExchange just announced they completely changed their business model. Basically, instead of buying a license from them, you now need to suggest a concept for a site. That concept can then be voted for by the community and if you can prove you have enough people interested, they will set up the site. [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.wikorum.net">wikorum-engine</a> <a href="http://stackexchange.net">StackExchange</a> just announced they <a href="http://blog.stackexchange.com/post/518474918/stack-exchange-2-0">completely changed their business model</a>. Basically, instead of buying a license from them, you now need to suggest a concept for a site. That concept can then be voted for by the community and if you can prove you have enough people interested, they will set up the site. The whole site is then community-owned and will be operated by <a href="http://stackoverflow.com">StackOverflow</a>. <a href="http://blog.stackexchange.com/post/518474918/stack-exchange-2-0">The details are much more complicated, of course</a>. I still consider StackExchange a commercial technology. They don&#8217;t charge you for the technology, but they don&#8217;t let you participate in any effort you put in there, either.</p>
<h2>That Domain-Issue</h2>
<p>There is something peculiar about this I really don&#8217;t understand: If the <em>domain</em> is actually owned by the individual who suggested the concept, the FogCreek will never have a reliable revenue stream because the owner of the domain is the master &mdash; he could simply switch to a different technology, if he manages to <strong>keep the links intact</strong>, which might be a very <a href="http://shapado.com/questions/when-importing-stackexchange-sites-do-links-change">important technology-factor</a> when choosing some alternate technology.</p>
<p>On the other hand, if the domain is supposed to be owned by <a href="http://www.fogcreek.com">FogCreek</a>, they have to buy every domain that is being suggested in the forum that exact second, otherwise domain grabbers will just &#8230; well, grab it (or even other users signed in). <em>Democratic voting for domain names?</em> I don&#8217;t think so. Personally, I would <strong>never</strong> even write down a domain name -especially not in a forum- if I like it and it&#8217;s not taken, I&#8217;d simply buy it &#8211; that gives me a year to think about it.</p>
<h2>Not Convincing</h2>
<p>Summing it up, <em>I don&#8217;t think the move to their new model is a wise decision</em>. My primary concerns are:</p>
<ul>
<li>The net is a trial-and-error place. You set something up, and see if it works. That might not be a wise model, but it is very democratic and has proven to work fine. Perhaps because it is not so &#8216;wise&#8217;. Note that wisdom grows from experience, inherently incapacitating certain types of innovation, namely those that completely contradict experience made.</li>
<li>The code remains closed, so real customizations are not possible. This is a major flaw. I&#8217;ve got a dozen ideas of sites that could become really, really helpful to people, but they need some additional features or some heavy customization that is a major pain if you can&#8217;t access the sources. They don&#8217;t even have an XSLT processor you could use as of now&#8230;</li>
<li>If a page does not offer any way to gain revenue, you can&#8217;t invest in it&#8217;s development, both technical development and marketing, where the first is already inhibited by the fact that customization is not possible from the technical side.</li>
<li>This move will dramatically increase commitment to the development of open source clones such as <a href="http://www.osqa.net/">OSQA</a>, which looks very interesting by the way. There is also <a href="http://shapado.com/">Shapado</a>, and I think more will come. Crowd development can be extremely efficient and fast.</li>
</ul>
<p>For all who operate a StackExchange site as of now, there is the cool thing that the site will operate for another three months, or if you have some real action going on, one year for free. That is great, because it allows for an <a href="http://www.osqa.net/2010/03/10/stackexchange-import-a-big-milestone-for-osqa/">easy transition to some other technology</a>. It&#8217;s a bit sad to see that happen to such great technology, but I don&#8217;t believe this will work. Building a community <em>remains</em> a lot of effort, and people won&#8217;t put that effort in if they can&#8217;t call it their baby, can&#8217;t make any revenues, can&#8217;t make any customizations to the code, and can&#8217;t use the page to direct some traffic to other projects, I believe. We&#8217;ll see how it works out. I guess I will establish a small knowledge-base / link list at <a href="http://www.wikorum.net">wikorum.net</a> to aggregate some related information.</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=StackExchange+Changes+Everything%2C+Risks+a+Lot+http%3A%2F%2Femphess.net%2F%3Fp%3D155" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/&amp;title=StackExchange+Changes+Everything%2C+Risks+a+Lot" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/&amp;title=StackExchange+Changes+Everything%2C+Risks+a+Lot" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/&amp;t=StackExchange+Changes+Everything%2C+Risks+a+Lot" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/04/13/stackexchange-changes-everything-risks-a-lot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NoSQL Approaches: Trying to use db4o in the Real World</title>
		<link>http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/</link>
		<comments>http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 22:14:38 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[db4o]]></category>
		<category><![CDATA[Entrepreneurship]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=138</guid>
		<description><![CDATA[We&#8217;ve been working a lot on db4o related and db4o based projects lately, and close to completion of the first and most simple product, we really hit a few roadblocks. UPDATE: Just after releasing this article, I found the bug in our code. It&#8217;s not db4o&#8217;s fault after all&#8230; Motivation One thing up front: We [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been working a lot on <a href="http://www.db4o.com">db4o</a> related and db4o based projects lately, and close to completion of the first and most simple product, we really hit a few roadblocks.<br />
<strong>UPDATE: Just after releasing this article, I found the bug in our code. It&#8217;s not db4o&#8217;s fault after all&#8230;</strong></p>
<h2>Motivation</h2>
<p>One thing up front: We don&#8217;t need an <a href="http://en.wikipedia.org/wiki/Object_database">object database</a> for the simple tools we currently build, but we felt it was a good idea to get some acquaintance with the technology, because we will certainly need it for our (stealth) startup &#8220;pactas&#8221; soon. In pactas, the data structure is really complicated (with a fancy class hierarchy) and it probably will change very frequently.</p>
<p>Also, since I am such a big fan of reusability, we really develop a web engine &#8211; a framework that allows us to reuse a lot of the code for different projects and make sure most of our code has been tested thoroughly in the field. This proves to be a significant design decision when it comes to data modeling, and while I&#8217;m very happy with the decision, it certainly makes development harder.</p>
<h2>The Problem</h2>
<p>So, in time with the release of our simple <a href="http://www.backlink-tracker.net">backlink tracker</a>, one of our development database files started to show strange behaviour &#8211; a certain query (via LINQ) would not order objects anymore &#8211; the <code>orderby</code>-clause seemingly was completely ignored. Our live server even came up with an &#8220;Invalid DateTimeKind specified&#8221; exception when trying to perform the query! What&#8217;s worse: The problem kept occurring from time to time, but it was not reproducible! Byzantine errors are clearly my favourite&#8230; </p>
<p>We thought the issue might be related to the current development/unstable versions of db4o that we were using (7.12 and 7.13). Using the stable version of db4o (7.4) proved difficult, because the old LINQ provider falls back to LINQ to Objects very often, which requires to fetch all objects in question from the database &#8211; that is very, very slow for a lot of objects, so we had to abandon that. We clearly wanted to stick to LINQ for a number of reasons (compile-time checking, readability, reusability).</p>
<p>Obviously the problem is related to the <code>orderby</code> operation on <code>DateTime</code> fields. I tried to modify the query, removed grouping because I feared it might be unstable (<em>warning</em>: the <em>sort</em> operation is, in fact, unstable! Unstable grouping would be useless, but the grouping is stable so that&#8217;s fine), even debugged the db4o code, but I couldn&#8217;t find any problem in there. Since the code is rather complex and that was the first time I took a look at it, I was happy to find some of the relevant code at all. <font style="text-decoration: line-through;">Somewhere in the deeps of it, something screwed up.</font> I didn&#8217;t want to spend too much time on that since I had to chew some particle physics on the side. </p>
<h2>Solutions?</h2>
<p>At the time of writing this (in fact, yesterday) I had something like a hotfix, but it turned out it&#8217;s completely nonsense &#8211; it worked around our internal bug in a very peculiar way. No more, no less.</p>
<p>When talking about this, somebody mentioned that it wasn&#8217;t such a good idea to use <code>DateTime</code> at all, and we should store the ticks instead. That lead to two long discussions with my co-ed Christian. We concluded: First, the power of object databases is that they do not force you to hack around and find different representations for your data (which raises the bar for object databases). The one big shortcoming of SQL is that it forces you to find a second, equally good, but different representation of your data and you need to translate between these representations all the time. You need to synchronize them. And you lose a lot of fancy features (such as lists, generics, inheritance, etc.) on the way.</p>
<p>Secondly, Christian suggested that object databases suffer from <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">leaky abstractions</a> badly, in that they break encapsulation in a way that leaks out a hell of a lot of implementation details. As Joel puts it: &#8220;All non-trivial abstractions, to some degree, are leaky.&#8221; The point is: <font style="text-decoration: strikethrough">With the error we&#8217;re currently encountering, it&#8217;s becoming a <em>real problem</em>. This is not an <a href="http://www.codinghorror.com/blog/2009/06/all-abstractions-are-failed-abstractions.html">imperfect piece of architecture</a>, it&#8217;s an exception in a database query. It kills the app dead! Boom!</font></p>
<p>In order to get activation [depth] straight, db4o needs to know how .NET&#8217;s containers work internally &#8211; that is clearly a detail that should be hidden, but db4o knows about it. db4o also takes care of that, but it leads to some messy issues. There is special code in db4o that handles containers, non-trivial objects such as <code>strings</code>, <code>DateTime</code> (which are non-trivial because they use 62 bits for the actual ticks and 2 bits for the <a href="http://msdn.microsoft.com/en-us/library/shx7s921.aspx">DateTimeKind</a>) and Lists. This is an implementation detail of the .NET framework, and it might change over time. There&#8217;s <a href="http://tracker.db4o.com/browse/COR-1582">been a bug with <code>Map</code></a>, and I&#8217;m almost sure there is a bug with <code>DateTime</code>, too. Don&#8217;t get me wrong: The fact that <em>some kind of mapping</em> is needed is a somewhat generic (if not <em>the</em>) problem of serialization, it&#8217;s not really db4o-specific, and cannot be eliminated. In Hibernate, there is also a lot of code that handles the mapping of lists and the like but it doesn&#8217;t rely on implementation detail, thus it&#8217;s not (as) leaky.</p>
<h2>Back to SQL?</h2>
<p>Here&#8217;s the thing: I&#8217;d be beneficial to have a storage that is <em>independent of the actual implementation on top</em>, because it decouples the data store from the application which is <a href="http://developer.db4o.com/Forums/tabid/98/aff/4/aft/9847/afv/topic/Default.aspx">not what db4o does</a>. But wait, that is exactly what SQL is, right? Indeed: SQL forces you to map (or to cut down) your stuff to it&#8217;s internal features. A list becomes a foreign key on the other table, but that doesn&#8217;t play well with derived types, generics, etc&#8230; This is tricky as we all know, and <a href="http://www.ohloh.net/p/nhibernate/analyses/latest">you need lots of code to do that</a>. </p>
<p>Worse, SQL forces you do that mapping for everything, including your own classes, and it demands a schema for every type of object &#8211; this is not what I want. I&#8217;d like to see a set of base objects in an object database which are natively understood by the DB. These objects can be mapped from and to by a layer which may be part of the db, or can be added manually if you need something very special. Still, it should allow to store your object in the database with all it&#8217;s magic, only that known objects will be translated, e.g. a <code>DateTime</code> will be stored as <code>long Ticks</code> and a <code>DateTimeKind</code> flag separated, making comparison operations easier (note that the comparison only works on the ticks: Whether the time is local or UTC is not considered by .NET in comparisons). Lists will be unfolded into an internal tree representation if indexed, so they become much easier to cope with for the database. That would also make <a href="http://www.gamlor.info/wordpress/?p=1069">managing m:n relations</a> easier, since they could then be viewed as bilateral relationships &#8211; something you often need. Right now, they&#8217;re unilateral, thereby requiring some additional management on your behalf.</p>
<p>Migrating to SQL is clearly an option for this product, since data couldn&#8217;t fit SQL any better, but that doesn&#8217;t solve the issue for our pactas project, where we certainly will need schema-less data, complex object hierarchies, etc.</p>
<p>However, there are a few issues that <font style="text-decoration: line-through;">remain unresolved as of now and they do qualify as show stoppers</font> :</p>
<ul>
<li style="text-decoration: line-through;">There&#8217;s an irreproducible bug that potentially wrecks the db</li>
<li>There&#8217;s a <a href="http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/">nasty performance issue with larger amounts of data</a></li>
</ul>
<h2>Alternatives</h2>
<p>I&#8217;m quite dissatisfied that we <font style="text-decoration: line-through;">have to abandon db4o at this stage</font>, because I believe it&#8217;s the best kind of serialization I&#8217;ve ever experienced. It&#8217;s <a href="http://blog.wekeroad.com/2010/02/06/nosql-a-practical-approach-part-1">perfectly simple</a>, it&#8217;s fast and most importantly, code-centric. If reusability is a concern, having the database structure and/or the ORM mapper dictate the objects is a major pain.</p>
<p><a href="http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework">Entity Framework 4 (EF4)</a> promises to handle this a lot better through <a href="http://blogs.msdn.com/adonet/archive/2009/05/12/sneak-preview-model-first-in-the-entity-framework-4-0.aspx">&#8220;Model First&#8221;</a> and <a href="http://blogs.msdn.com/efdesign/archive/2009/06/10/code-only.aspx">&#8220;Code Only&#8221;</a>, but I am still a bit afraid of EF because it doesn&#8217;t appear to be anything near lightweight and we will need schemaless storage for our future products anyways.</p>
<p><a href="http://www.versant.com">Versant</a>, which bought db4o some time ago also offers its large-scale object database, which seems to suit large web-applications a lot better. First, it&#8217;s certainly made for huge amounts of data (unlike db4o, which comes from an embedded background and <a href="http://www.sdtimes.com/link/33117">is aimed at database sizes in the low GB area</a>, but <a href="https://developer.db4o.com/Documentation/Reference/db4o-7.4/java/reference/html/reference/tuning/performance_hints/increasing_the_maximum_database_file_size.html">supports up to 254 GB per file</a>) and <a href="http://developer.db4o.com/Forums/tabid/98/aff/4/aft/9855/afv/topic/Default.aspx">handles multi-threading better</a>. Also, since db4o <a href="http://www.itwire.com/sponsored-announcements/38149-versant-expands-db4o-open-source-licensin">now moved to v3 of the GPL</a>, it may not be freely usable in non-open source web applications anymore, so both solutions now have a price tag.</p>
<p>There is also an <a href="http://www.versant.com/en_US/solutions/oem_program/">ISV/OEM empowerment program</a> for Versant&#8217;s Object Database, which seems to make it affordable, but I haven&#8217;t looked at it in detail yet. Over the next weeks, I will have to evaluate a few of those other NoSQL solutions such as <a href="http://cassandra.apache.org/">Cassandra</a> and <a href="www.mongodb.org/">MongoDB</a>, just to name two totally different options. </p>
<h2>Aftermath</h2>
<p>So what was the issue, after all? db4o did not screw up, we did: Take a blend of local and UTC time based on a completely random criterion, add two spoons of daylight savings time changes, add some misconfigured timezone on the server, bake for two weeks at 500 &deg; C and pling! You got yourself some really strange issue cake. Lessons learned:</p>
<ul>
<li>Debugging issue with object databases is harder than with RDBMS because the information is not chopped up.</li>
<li>Do code reviews. Do code reviews.</li>
<li>There aren&#8217;t too many alternatives to db4o, after all</li>
<li>With the elaborated architecture and code-centric design we currently have, going back to SQL is a huge pain, and we won&#8217;t do it</li>
</ul>
<p>All serialization is painful.</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=NoSQL+Approaches%3A+Trying+to+use+db4o+in+the+Real+World+http%3A%2F%2Femphess.net%2F%3Fp%3D138" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/&amp;title=NoSQL+Approaches%3A+Trying+to+use+db4o+in+the+Real+World" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/&amp;title=NoSQL+Approaches%3A+Trying+to+use+db4o+in+the+Real+World" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/&amp;t=NoSQL+Approaches%3A+Trying+to+use+db4o+in+the+Real+World" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/04/12/nosql-approaches-trying-to-use-db4o-in-the-real-world/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>db4o Performance Pitfalls</title>
		<link>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/</link>
		<comments>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 01:04:18 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[db4o]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Native Query]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[OODBMS]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=96</guid>
		<description><![CDATA[This is just a quick note, but I just gotta share this right now. It&#8217;s actually in the manual so this is not exactly a secret, but I managed to overlook it so perhaps I&#8217;m not the only one&#8230; In our specific scenario, db4o was about 3 times slower than MSSQL via Linq to SQL [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick note, but I just gotta share this <em>right now</em>.</p>
<p>It&#8217;s actually in the manual so this is not exactly a secret, but I managed to overlook it so perhaps I&#8217;m not the only one&#8230; </p>
<p>In our specific scenario, db4o was about 3 times slower than MSSQL via Linq to SQL in the past days.</p>
<p>Just a few minutes ago, I finally read this:</p>
<blockquote><p>Native Query optimizer for .NET requires the following libraries to work:<br />
Db4obects.Db4o.Instrumentation.dll<br />
Db4objects.Db4o.NativeQueries.dll<br />
Mono.Cecil.dll<br />
Cecil.FlowAnalysis.dll</p></blockquote>
<p>(see <a href="http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html">http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html</a>)</p>
<p>I added these dll&#8217;s to my solution and wooosh! Now it&#8217;s up to 50 times faster than before! That&#8217;s what I needed&#8230; Will see how this works with larger data sets&#8230;</p>
<p><strong>Update</strong>: There have been some important changes in builds past 14021, see my <a href="http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq">more recent post</a> on that topic. In short, the new kid in town is <code>Mono.Reflection.dll</code>, which took Cecil&#8217;s place. </p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=db4o+Performance+Pitfalls+http%3A%2F%2Femphess.net%2F%3Fp%3D96" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;title=db4o+Performance+Pitfalls" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;title=db4o+Performance+Pitfalls" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;t=db4o+Performance+Pitfalls" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Areas, Routes and defaults in MVC 2 RC</title>
		<link>http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/</link>
		<comments>http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 17:36:44 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC 2]]></category>
		<category><![CDATA[MVC 2 Areas]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=89</guid>
		<description><![CDATA[Download sample There has been some discussion over at stackoverflow on setting a default route to an area in mvc, so I want to post some very crude, but working example code here&#8230; I will write some explanatory text here if I find the time. I feel that the fact that the order of operation [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.emphess.net/wp-content/uploads/2010/01/MvcApplication.zip'>Download sample</a></p>
<p>There has been some discussion over at stackoverflow on <a href="http://stackoverflow.com/questions/2140208/how-to-set-a-default-route-to-an-area-in-mvc/2172438#2172438">setting a default route to an area in mvc</a>, so I want to post some <a href='http://www.emphess.net/wp-content/uploads/2010/01/MvcApplication.zip'>very crude, but working example code here</a>&#8230; I will write some explanatory text here if I find the time.</p>
<p>I feel that the fact that the order of operation in <code>Application_Start()</code> matters is quite problematic, but that has been discussed elsewhere (I&#8217;ll be searching for the link&#8230;) Anyway, when registering the areas first, the default route can be set to an area.</p>
<pre class="brush: csharp">
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);
        }
</pre>
<p>In the AreaRegistration, </p>
<pre class="brush: csharp">
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                &quot;ShopArea_default&quot;,
                &quot;{controller}/{action}/{id}&quot;,
                new { action = &quot;Index&quot;, id = &quot;&quot;, controller = &quot;MyRoute&quot; },
                new { controller = &quot;MyRoute&quot; }
            );
        }
</pre>
<p>will do the job. Note the use of the constraint that will only accept requests to the areas&#8217; controller that should be used as a default.</p>
<p>This is a working solution, but I think it is quite error-prone and not very elegant. In the meantime, I started to use <a href="http://www.MvcContrib.org">MvcContrib</a>, because it&#8217;s <a href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx">portable areas are really smart</a>, make deployment easier and foster reusability of the code, <em>and</em> the views.</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Areas%2C+Routes+and+defaults+in+MVC+2+RC+http%3A%2F%2Femphess.net%2F%3Fp%3D89" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/&amp;title=Areas%2C+Routes+and+defaults+in+MVC+2+RC" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/&amp;title=Areas%2C+Routes+and+defaults+in+MVC+2+RC" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/&amp;t=Areas%2C+Routes+and+defaults+in+MVC+2+RC" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/01/31/areas-routes-and-defaults-in-mvc-2-rc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Simple Standalone Server for db4o as Windows Service</title>
		<link>http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/</link>
		<comments>http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 03:48:38 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[db4o]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[EventLog]]></category>
		<category><![CDATA[Object Database]]></category>
		<category><![CDATA[OODBMS]]></category>
		<category><![CDATA[ServiceBase]]></category>
		<category><![CDATA[ServiceInstaller]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=73</guid>
		<description><![CDATA[Download: db4oSimpleServer Lately, I have fiddled around with Versant&#8217;s excellent dual-license object database db4o a little and I think object databases are very neat. In fact, I read a few pages in PoEAA [Patterns of Enterprise Application Architecture] today, and here and there Fowler writes how cool object databases are. The Fowler knows! Well, anyhow [...]]]></description>
			<content:encoded><![CDATA[<p>Download: <a href='http://www.emphess.net/wp-content/uploads/2010/01/db4oSimpleServer.zip'>db4oSimpleServer</a><br />
<a href="http://www.emphess.net/wp-content/uploads/2010/01/solution.png"><img src="http://www.emphess.net/wp-content/uploads/2010/01/solution.png" alt="" title="Solution Layout" width="222" height="372" class="alignright size-full wp-image-75" /></a></p>
<p>Lately, I have fiddled around with Versant&#8217;s excellent dual-license object database <a href="http://www.db4o.com">db4o</a> a little and I think object databases are very neat. In fact, I read a few pages in PoEAA [Patterns of Enterprise Application Architecture] today, and here and there Fowler writes how cool object databases are. The Fowler knows!</p>
<p>Well, anyhow when you <a href="http://www.db4o.com/DownloadNow.aspx">download db4o</a> (sign up and go for the latest release) there is no standalone server application included. That makes perfect sense, because the server needs access to your domain model / data model dll. In an object database, <em>there are no tables</em>, but there are objects, so you have to compile them into the application that runs the actual db4o server. There is server <em>code</em> which handles practically everything that is tricky, but it&#8217;s in a dll so you&#8217;ll have to write a few lines to build an application out of it. I figured this would be a great time to write my first windows service and so I mashed up some code I found on the net. </p>
<p>I initially thought the VS 2008 designer would set up pretty much everything, but it turned out that things are a little more complicated.</p>
<h2>The Installer</h2>
<p>Since a service will run in a different manner, potentially using a different user account, etc. it needs to be installed first. There is a tool called <code>installutil.exe</code>, but using it is a little awkward. Also, you&#8217;d have to deploy it along your application. <a href="http://stackoverflow.com/questions/593454/easiest-language-to-create-a-windows-service">Matt Davis posted a cool guide on stackoverflow</a> and <a href="http://stackoverflow.com/questions/1195478/how-to-make-a-net-windows-service-start-right-after-the-installation/1195621#1195621">some additional information here</a> on how to write a windows service that is esentially able to install itself! </p>
<h3>Unexpected Features</h3>
<p>One of the most peculiar features is that -should you prefer to have your own event log instead of writing to the ApplicationLog- you have to search through a tree of installers, find the <code>EventLogInstaller</code> and modify it instead of simply adding a new one because the <code>ServiceInstaller</code> will come along with the <code>EventLogInstaller</code> as a child:</p>
<pre class="brush: csharp">
EventLogInstaller installer = FindInstaller(this.Installers);
if (installer != null)
    installer.Log = ServiceConfiguration.LogName;
</pre>
<p>We also need to take care of spawning the actual worker thread, but fortunately there is a <a href="http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase(VS.80).aspx">comprehensive guide on MSDN</a> explaining this.</p>
<h2>Using the Sample</h2>
<p>First things first: Of course, this is not <em>nearly</em> production-safe code! Also, I did not include the db4o dll&#8217;s because I&#8217;m not sure about the licence terms.<br />
<div id="attachment_74" class="wp-caption alignleft" style="width: 695px"><a href="http://www.emphess.net/wp-content/uploads/2010/01/install.png"><img src="http://www.emphess.net/wp-content/uploads/2010/01/install.png" alt="" title="Install" width="685" height="193" class="size-full wp-image-74" /></a><p class="wp-caption-text">The installer in 'action'. Note the Administrator prompt</p></div></p>
<ol>
<li>Download <a href='http://www.emphess.net/wp-content/uploads/2010/01/db4oSimpleServer.zip'>the sample</a>, extract</li>
<li>Download db4o, install</li>
<li>Copy <code>Db4objects.Db4o.dll</code> and <code>Db4objects.Db4o.CS.dll</code> from the db4o install directory to the samples&#8217; lib directory</li>
<li>Compile</li>
<li>Open an <b>Administrator</b> command prompt and find the sample&#8217;s <code>bin</code> folder. There is no feedback in case anything goes wrong (at best, the program crashes)</li>
<li>Call the install routine by executing <code>emphess.db4oServer.exe -install</code>. This will install the db4o server and the associated event log. The server will not be started automatically.</li>
<li>Head over to <code>services.msc</code> or your EventLog, where you <a href="http://blogs.msdn.com/helloworld/archive/2008/12/11/creating-an-event-log.aspx">should find a new entry!</a></li>
<li>Edit the configuration file, ready to run!</li>
<li>Don&#8217;t use this for anything production&#8230;</li>
</ol>
<h3>The App.Config</h3>
<p>The configuration file looks like this</p>
<pre class="brush: xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key=&quot;UseLocalFile&quot; value=&quot;false&quot; /&gt;
    &lt;!-- &lt;add key=&quot;DatabaseLocalFileName&quot; value=&quot;irrelevant&quot;/&gt; --&gt;
    &lt;add key=&quot;DatabaseHost&quot; value=&quot;localhost&quot; /&gt;
    &lt;add key=&quot;DatabasePort&quot; value=&quot;52354&quot; /&gt;
    &lt;add key=&quot;DatabaseServerFileName&quot; value=&quot;C:/Development/db4oServer/db/server.db4o&quot; /&gt;
    &lt;add key=&quot;DatabaseUser&quot; value=&quot;test&quot; /&gt;
    &lt;add key=&quot;DatabasePassword&quot; value=&quot;test&quot; /&gt;
  &lt;/appSettings&gt;
&lt;/configuration&gt;
</pre>
<p>The <code>UseLocalFile</code> setting is meant for clients so you can easily switch between file-based and network-based configurations. Since <code>db4oServer.Shared</code> contains a small class that holds this configuration data, you can easily reuse the code in a different app, e.g. in the client.</p>
<h3>Todo-List</h3>
<p>There are some things I&#8217;d like to add over the next weeks, so I put the list here to give me some &#8216;pseudo-extrinsic motivation&#8217;&#8230; (yes, I like complicated words)</p>
<ul>
<li>Simple sample client</li>
<li>Out-of-band data for backup, defragmentation commands, etc.</li>
<li>Tests / Benchmarks</li>
</ul>
<p>I hope you have any use for this.</p>
<div class="tweetthis" style="text-align:right;"><p> <a rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=A+Simple+Standalone+Server+for+db4o+as+Windows+Service+http%3A%2F%2Femphess.net%2F%3Fp%3D73" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/&amp;title=A+Simple+Standalone+Server+for+db4o+as+Windows+Service" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/delicious/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/&amp;title=A+Simple+Standalone+Server+for+db4o+as+Windows+Service" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/digg/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/&amp;t=A+Simple+Standalone+Server+for+db4o+as+Windows+Service" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/en/facebook/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/01/23/a-simple-standalone-server-for-db4o-as-windows-service/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

