<?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>source code bean</title>
	<atom:link href="http://sourcecodebean.com/feed" rel="self" type="application/rss+xml" />
	<link>http://sourcecodebean.com</link>
	<description>thoughts and ideas from a .net developer</description>
	<lastBuildDate>Sat, 26 May 2012 09:45:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Limiting MongoDB memory usage on Windows 2008 Server</title>
		<link>http://sourcecodebean.com/archives/limiting-mongodb-memory-usage-on-windows-2008-server/1695</link>
		<comments>http://sourcecodebean.com/archives/limiting-mongodb-memory-usage-on-windows-2008-server/1695#comments</comments>
		<pubDate>Sat, 26 May 2012 09:44:34 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Windows Server]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1695</guid>
		<description><![CDATA[By default MongoDB tries to memory map as much as possible of the database file. Given a fairly big database, this will consume all your memory. If MongoDB is running on a dedicated server this is totally fine, but when running on a shared server this will cause unnecessary swapping for your other applications. At [...]]]></description>
			<content:encoded><![CDATA[<p>By default MongoDB tries to memory map as much as possible of the database file. Given a fairly big database, this will consume all your memory. If MongoDB is running on a dedicated server this is totally fine, but when running on a shared server this will cause unnecessary swapping for your other applications. At this point you want to limit the max amount of memory MongoDB can use. On Linux I have not found a way on how to do this (if you know a way please let me know!), but on Windows Server it is possible to limit it using WSRM. </p>
<p>WSRM allows greater control over the CPU and Memory available to a process and is an additional feature shipped with Windows Server that can be installed from the server manager under &#8220;Features Summary&#8221;:</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/05/AddFeature.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/AddFeature.png" alt="" title="AddFeature" width="702" height="201" class="aligncenter size-full wp-image-1700" /></a></p>
<p>Once installed we need to create a new resource allocation policy from the manager:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/2.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/2.png" alt="" title="2" width="935" height="202" class="aligncenter size-full wp-image-1702" /></a></p>
<p>and give it some name:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/3.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/3.png" alt="" title="3" width="355" height="541" class="aligncenter size-full wp-image-1703" /></a></p>
<p>Now we need to select processes to match with the policy:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/4.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/4.png" alt="" title="4" width="379" height="414" class="aligncenter size-full wp-image-1704" /></a></p>
<p>We will select process from the list of registered services:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/5.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/5.png" alt="" title="5" width="389" height="438" class="aligncenter size-full wp-image-1705" /></a></p>
<p>Here we find MongoDB:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/6.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/6.png" alt="" title="6" width="502" height="264" class="aligncenter size-full wp-image-1706" /></a></p>
<p>Click OK a few times to exit the process selection. On the memory tab we can limit the memory for this resource allocation policy:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/7.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/7.png" alt="" title="7" width="356" height="420" class="aligncenter size-full wp-image-1707" /></a></p>
<p>The final step is to make the policy active. To do this, go to the top level page in the manager and click the &#8220;Selected Policy&#8221; link. In here you can set the active policy:<br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/05/8.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/05/8.png" alt="" title="8" width="371" height="420" class="aligncenter size-full wp-image-1708" /></a></p>
<p>That&#8217;s it! Now MongoDB will not consume more than 500MB of memory.</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/limiting-mongodb-memory-usage-on-windows-2008-server/1695/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColourSearch &#8211; a simple image search engine</title>
		<link>http://sourcecodebean.com/archives/coloursearch-a-simple-image-search-engine/1671</link>
		<comments>http://sourcecodebean.com/archives/coloursearch-a-simple-image-search-engine/1671#comments</comments>
		<pubDate>Thu, 26 Apr 2012 20:48:15 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1671</guid>
		<description><![CDATA[A few weeks I randomly got interested in how you match images with other images. Having a very limited background in computer graphics I started reading some research papers on how to match images. One strategy that seemed to work pretty well for most people was a histogram based comparison. Given two histograms it is [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks I randomly got interested in how you match images with other images. Having a very limited background in computer graphics I started reading some research papers on how to match images. One strategy that seemed to work pretty well for most people was a histogram based comparison. Given two histograms it is possible to calculate the distance, or correlation, between the histograms. The image with the lowest distance or highest correlation would be the best match. To try out my newly learnt knowledge I created a small application, ColourSearch, which given a directory calculates a histogram for each image and stores it in memory. In the GUI you can then pick a color to search and the application will find the best matching images using 4 different algorithms and present the result side by side. </p>
<p>A problem with the current implementation is that I have not found any way to index histograms, so when searching the input image needs to be compared to each image in the database (O(n) yay!). For larger datasets this would of course not be feasible, but at least the problem is easy to scale over several CPUs, so I can take advantage of all my cores. </p>
<p>You can find ColourSearch on GitHub (code in C#, works perfect under Mono!):<br />
<a href="https://github.com/moberg/coloursearch">https://github.com/moberg/coloursearch</a></p>
<p>If you have any ideas on how indexing can be done or on more efficient matching algorithms I would be very interested in hearing them!</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/coloursearch-a-simple-image-search-engine/1671/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unlocking your Windows Phone for development</title>
		<link>http://sourcecodebean.com/archives/unlocking-your-windows-phone-for-development-2/1662</link>
		<comments>http://sourcecodebean.com/archives/unlocking-your-windows-phone-for-development-2/1662#comments</comments>
		<pubDate>Sun, 01 Apr 2012 08:00:45 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1662</guid>
		<description><![CDATA[It is not totally obious how to unlock your WP7 device for development. The first step is of course to sign up for the development program at http://create.msdn.com. But then? I had the exact same experience as this guy: http://www.pitorque.de/MisterGoodcat/post/Unlocking-a-Windows-Phone-7-device-for-development.aspx So together with the SDK a small activation program was installed, &#8220;Windows Phone Developer Registration&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>It is not totally obious how to unlock your WP7 device for development. The first step is of course to sign up for the development program at <a href="http://create.msdn.com">http://create.msdn.com</a>. But then? I had the exact same experience as this guy: </p>
<p><a href="http://www.pitorque.de/MisterGoodcat/post/Unlocking-a-Windows-Phone-7-device-for-development.aspx">http://www.pitorque.de/MisterGoodcat/post/Unlocking-a-Windows-Phone-7-device-for-development.aspx</a></p>
<p>So together with the SDK a small activation program was installed, &#8220;Windows Phone Developer Registration&#8221;. Start it and login to active your device! </p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/WPDevRegistration.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/WPDevRegistration.png" alt="" title="WPDevRegistration" width="510" height="460" class="aligncenter size-full wp-image-1663" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/unlocking-your-windows-phone-for-development-2/1662/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Force update of your Lumia 800 to WP7 1600.2487.8107.12070</title>
		<link>http://sourcecodebean.com/archives/force-update-of-your-lumia-800-to-wp7-1600-2487-8107-12070/1650</link>
		<comments>http://sourcecodebean.com/archives/force-update-of-your-lumia-800-to-wp7-1600-2487-8107-12070/1650#comments</comments>
		<pubDate>Sat, 31 Mar 2012 09:28:18 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1650</guid>
		<description><![CDATA[So for some reason it takes Nokia a long time to push out the WP7 updates. 1600.2487.8107.12070 is a new official build of WP7 that was released a while back, but Zune still tells me that there is no update for my phone. The most important features of the update to me seems to be [...]]]></description>
			<content:encoded><![CDATA[<p>So for some reason it takes Nokia a long time to push out the WP7 updates. 1600.2487.8107.12070 is a new official build of WP7 that was released a while back, but Zune still tells me that there is no update for my phone. The most important features of the update to me seems to be improved battery performance and improved bass in audio performance. I have been quite happy with the current battery performance of my phone (about 1,5 days on one charge), but at the same time I know other Lumia 800 owners that are very unhappy with theirs, not even lasting one work day. It seems like there are some good and some not so great devices out there. Even better battery life would of course be great! On the audio side, the audio has been quite flat and improved bass performance would be very welcome. </p>
<p>This blog post has great step by step instructions on how to force the update:<br />
<a href="http://nokiagadgets.com/2012/03/08/force-the-newest-lumia-800-update-1600-2487-8107-12070-to-your-phone/">http://nokiagadgets.com/2012/03/08/force-the-newest-lumia-800-update-1600-2487-8107-12070-to-your-phone/</a></p>
<p>Basically what you have to do is to download the update and install some tools for phone developers. Once you have downloaded everything you run the &#8220;WP7 Update Cab Sender.bat&#8221;:</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/WP7_cab_updater.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/WP7_cab_updater.png" alt="" title="WP7_cab_updater" width="669" height="751" class="aligncenter size-full wp-image-1651" /></a></p>
<p>The update process takes about 10 minutes. The first thing I tested out after updating was of course to play some music, the audio is indeed much improved. Time will tell if the battery performance got better!</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/force-update-of-your-lumia-800-to-wp7-1600-2487-8107-12070/1650/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protothon #2 &#8211; WebRTC</title>
		<link>http://sourcecodebean.com/archives/protothon-2-webrtc/1625</link>
		<comments>http://sourcecodebean.com/archives/protothon-2-webrtc/1625#comments</comments>
		<pubDate>Sun, 25 Mar 2012 20:05:56 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1625</guid>
		<description><![CDATA[Yesterday I went to a hackathon called Protothon. Protothon describes itself as &#8220;Space for the place between code and creativity&#8221; and the idea is to bring together programmers, creatives and entrepreneurs together and under a very limited time build an application from scratch. The focus of this hackathon was WebRTC, which is a new standard [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I went to a hackathon called Protothon. <a href="http://protothon.com/">Protothon</a> describes itself as &#8220;Space for the place between code and creativity&#8221; and the idea is to bring together programmers, creatives and entrepreneurs together and under a very limited time build an application from scratch. The focus of this hackathon was <a href="http://www.webrtc.org/">WebRTC</a>, which is a new standard for Real Time Communications using HTML5/Javascript. At the moment it is so new that no browser actually supports it yet, but there are special builds of Chrome and Firefox in which you can enable it.  So the task of this hackaton was basically to do something cool with WebRTC.</p>
<p>The team I was in consisted of me, <a href="https://twitter.com/blog2t">Tomek Augustyn</a>, <a href="https://twitter.com/#!/spathon">Patrik Spathon</a> and <a href="https://twitter.com/#!/seducedbylight">Pebbles Lim</a>. Tother we came up with the idea to build a multiplayer version of the classic game pong, but using motion detection to control the game. We named the game Spong:</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/Screen-Shot-2012-03-25-at-7.51.51-PM.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/Screen-Shot-2012-03-25-at-7.51.51-PM.png" alt="" title="Screen Shot 2012-03-25 at 7.51.51 PM" width="700" class="aligncenter size-full wp-image-1627" /></a></p>
<p>Each player runs the game from his web browser, which will access his web cam using WebRTC. The motion detector analyzes the video stream and detects where the most amount of movement is, this gives us a coordinate on the screen. The Y part of this coordinate is used to control the position of the players&#8217; paddle. You can see this in the image above where the cross points out where i just moved my hand. Each players&#8217; movements is sent to the other player via a Node.js/Socket.IO relay server. </p>
<p>To summarize Protothon #2 I must say that I was really impressed with all the applications presented by the different teams. It was one intense day, but a lot of fun! I am looking forward to attending again in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/protothon-2-webrtc/1625/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serving your ASP.NET MVC site on Nginx / fastcgi-mono-server4</title>
		<link>http://sourcecodebean.com/archives/serving-your-asp-net-mvc-site-on-nginx-fastcgi-mono-server4/1617</link>
		<comments>http://sourcecodebean.com/archives/serving-your-asp-net-mvc-site-on-nginx-fastcgi-mono-server4/1617#comments</comments>
		<pubDate>Tue, 20 Mar 2012 21:20:39 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1617</guid>
		<description><![CDATA[In my previous post I showed you how to compile and install mono and get your MVC site up running using the development web server xsp4. The next step is to serve your site using a real web server, my choice is nginx. First, we need a configuration file for the nginx site. If you [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://sourcecodebean.com/archives/deploying-your-asp-net-mvc3-site-on-mono/1589">previous post</a> I showed you how to compile and install mono and get your MVC site up running using the development web server xsp4. The next step is to serve your site using a real web server, my choice is nginx. </p>
<p>First, we need a configuration file for the nginx site. If you haven&#8217;t already got nginx installed, install it (<code>sudo apt-get install nginx</code>).</p>
<p>/etc/nginx/sites-enabled/mvc:</p>
<pre>
server {
    listen   80;
    server_name mvctest.sourcecodebean.com;
    root  /home/peter/MonoMvcDeploy/;

    location / {
      root /home/peter/MonoMvcDeploy/;
      index index.html index.htm default.aspx Default.aspx;
      fastcgi_index /Home;
      fastcgi_pass 127.0.0.1:8000;
      include /etc/nginx/fastcgi_params;
    }
}
</pre>
<p><span id="more-1617"></span></p>
<p>Type &#8220;sudo service nginx reload&#8221; to reload the configuration. Browsing to the site should give you a fastcgi error since there is no fastcgi server listening on 127.0.0.1:8000 yet. So far this is a good thing and shows that your configuration is correct. </p>
<p>Next we create a start script for our fastcgi server.</p>
<p>/home/peter/startmvc:</p>
<pre>
#!/bin/bash
source ./monoenv.sh
fastcgi-mono-server4 /applications=/:/home/peter/MonoMvcDeploy/ /socket=tcp:127.0.0.1:8000
</pre>
<p>This is pretty straigt forward, the only thing that might be a bit confusing is this part &#8220;/:/home/peter/MonoMvcDeploy/&#8221;. This means that we want to map the URL / to the application in /home/peter/MonoMvcDeploy/. This allows us to run several applications in the same fastcgi server on different URLs. </p>
<p>Now try running the script and browse to your site, our sample MVC site should appear! </p>
<p>The last step is to create a upstart script to have our application start automatically at system boot</p>
<p>/etc/init/mvc.conf:</p>
<pre>
#!upstart
description "sionmailer web"
author      "peter"

start on startup
stop on shutdown

respawn

script
    echo $$ > /var/run/mvc.pid
    exec sudo -H -u peter /home/peter/startmvc 2>&#038;1
end script

pre-start script
    echo "[`date`] (sys) Starting" >> /var/log/mvc.sys.log
end script

pre-stop script
    rm /var/run/mvc.pid
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/mvc.sys.log
end script
</pre>
<p>Save the config file and start the site: <code>service mvc start</code>. </p>
<p>All done, your site is being served by nginx/fastcgi-mono-server4!</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/serving-your-asp-net-mvc-site-on-nginx-fastcgi-mono-server4/1617/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying your ASP.NET MVC3 site on Mono</title>
		<link>http://sourcecodebean.com/archives/deploying-your-asp-net-mvc3-site-on-mono/1589</link>
		<comments>http://sourcecodebean.com/archives/deploying-your-asp-net-mvc3-site-on-mono/1589#comments</comments>
		<pubDate>Sat, 10 Mar 2012 14:26:49 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1589</guid>
		<description><![CDATA[In this blog post I am going to show you how easy it is to create a new ASP.NET MVC site and deploy it on Linux/Mono. Step 1 &#8211; Create project Create a new ASP.NET MVC 3 project. Compile and run it. Step 2 &#8211; Add assemblies needed by Mono Add references: System.Web.WebPages System.Web.WebPages.Deployment System.Web.WebPages.Razor [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog post I am going to show you how easy it is to create a new ASP.NET MVC site and deploy it on Linux/Mono. </p>
<p><strong>Step 1 &#8211; Create project</strong><br />
Create a new ASP.NET MVC 3 project. Compile and run it.</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/CreateProject.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/CreateProject.png" alt="" title="CreateProject" width="700" class="aligncenter size-full wp-image-1595" /></a></p>
<p><span id="more-1589"></span><br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/03/2-CreateProject.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/2-CreateProject.png" alt="" title="2 CreateProject" width="400" class="aligncenter size-full wp-image-1596" /></a></p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/3-Up-and-running.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/3-Up-and-running.png" alt="" title="3 Up and running" width="700" class="aligncenter size-full wp-image-1597" /></a></p>
<p><strong>Step 2 &#8211; Add assemblies needed by Mono</strong><br />
Add references:<br />
System.Web.WebPages<br />
System.Web.WebPages.Deployment<br />
System.Web.WebPages.Razor</p>
<p><strong>Step 3 &#8211; Copy local</strong><br />
Make sure to set &#8220;Copy Local&#8221; to True for all of the following assemblies:<br />
System.Web.Helpers<br />
System.Web.Mvc<br />
System.Web.Razor (C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll)<br />
System.Web.Routing<br />
System.Web.WebPages<br />
System.Web.WebPages.Deployment<br />
System.Web.WebPages.Razor</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/4.-Copy-local.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/4.-Copy-local.png" alt="" title="4. Copy local" width="435" height="629" class="aligncenter size-full wp-image-1598" /></a></p>
<p>Remove Entity Framework and other unnecessary assemblies. </p>
<p><strong>Step 4 &#8211; Publish your site</strong><br />
Publish it to a directory and copy it to your Linux server</p>
<p><strong>Step 5 &#8211; Get latest Mono and compile it from source</strong><br />
I run Ubuntu 11.10 on my server. Ubuntu has Mono 2.10.6 in its repository, which is quite new, but Mono is moving so fast so I recommend getting the latest version and compiling it from source. The latest version at the time of writing is 2.10.8. <a href="http://www.integratedwebsystems.com/2011/08/install-mono-2-10-3-on-ubuntu-using-bash-script/">Nathan Bridgewater has created a script</a> to simplify this process, if you are running Ubuntu, this is what you will need to run to install Mono:</p>
<pre>
mkdir mono-2.10
cd mono-2.10
wget --no-check-certificate https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.10.sh
chmod 755 install_mono-2.10.sh
./install_mono-2.10.sh
</pre>
<p>It will take a while to compile it, so now is the time to go grab a cup of coffee. </p>
<p><strong>Step 6 &#8211; Run your site with xsp4</strong><br />
Mono have a development web server called xsp4, the first thing we are going to do is to run our site in xsp4 to make sure it works. Mono has been installed to /opt, but does not exist in our PATH, so before we can run Mono we need to setup the mono enviroment variables. To do that I found a script somewhere on the internets, monoenv.sh:</p>
<pre>
MONO_PREFIX=/opt/mono-2.10
export DYLD_LIBRARY_FALLBACK_PATH=/lib:
export LD_LIBRARY_PATH=/lib:/opt/mono-2.10/lib:
export C_INCLUDE_PATH=/include:/include
export ACLOCAL_PATH=/share/aclocal
export PKG_CONFIG_PATH=/lib/pkgconfig:/lib/pkgconfig
export PATH=/bin:/opt/mono-2.10/bin:$PATH
</pre>
<p>At your bash prompt type: source monoenv.sh</p>
<p>Now cd into the directory where you have your published web site and run xsp4. </p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/03/6.-Running-on-mono.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/03/6.-Running-on-mono.png" alt="" title="6. Running on mono" width="655" height="564" class="aligncenter size-full wp-image-1600" /></a></p>
<p>Now your MVC site should be up running on Mono! </p>
<p>In my next blog post I will cover how to configure your site to run using Nginx and the fastcgi-mono server.</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/deploying-your-asp-net-mvc3-site-on-mono/1589/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One week with the Nokia Lumia 800</title>
		<link>http://sourcecodebean.com/archives/one-week-with-the-nokia-lumia-800/1576</link>
		<comments>http://sourcecodebean.com/archives/one-week-with-the-nokia-lumia-800/1576#comments</comments>
		<pubDate>Mon, 20 Feb 2012 21:48:19 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1576</guid>
		<description><![CDATA[One week ago I got a Nokia Lumia 800 from my company, this is my random thoughts so far: + Amazing screen + Good batery life for being a smart phone + Really beautiful + User interface is blazing fast + Integration with Google, Facebook and MSN works great. All my contacts was synced from [...]]]></description>
			<content:encoded><![CDATA[<p>One week ago I got a Nokia Lumia 800 from my company, this is my random thoughts so far:</p>
<p><a href="http://sourcecodebean.com/archives/one-week-with-the-nokia-lumia-800/1576"><img src="http://sourcecodebean.com/wp-content/uploads/2012/02/nokia_lumia_800_tiles.jpg" alt="" title="nokia_lumia_800_tiles" width="227" height="414" class="aligncenter size-full wp-image-1578" /></a></p>
<p>+ Amazing screen<br />
+ Good batery life for being a smart phone<br />
+ Really beautiful<br />
+ User interface is blazing fast<br />
+ Integration with Google, Facebook and MSN works great. All my contacts was synced from Google.<br />
+ Fast web browser, zooming and scrolling is super smooth<br />
+ Live tiles are really cool, but not sure if it is the best use of space<br />
+ Hubs! This is a great concept, messages goes to the messages hub, music to the music hub and so on. </p>
<p>- The lack of applications, good thing i am not a big app user<br />
- Applications are not as mature as on iOS or Android. For example the Facebook application is missing a lot of functionality found on iOS and Android.<br />
- The default search engine is Bing and I can&#8217;t find a way to change it.<br />
- Navigating back in the web browser. Navigating back to the previous page is done by clicking the back button in the bottom left corner, works great if you are surfing some pages, but if you leave the browser and come back, the back button will take you back to the main screen (or where you were before going back to the web browser). At this point there is no way to navigate back in your surfing history, really dumb!</p>
<p>But over all I must say I am very happy with it!</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/one-week-with-the-nokia-lumia-800/1576/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node.js: Callbacks are polluting your code</title>
		<link>http://sourcecodebean.com/archives/callbacks-are-polluting-your-code/1488</link>
		<comments>http://sourcecodebean.com/archives/callbacks-are-polluting-your-code/1488#comments</comments>
		<pubDate>Wed, 25 Jan 2012 18:27:05 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Node.js]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1488</guid>
		<description><![CDATA[I have been hacking on a project in Node.js/Express.js for some time now. I am really impressed by how fast it is to code and prototype in Node, not much gets in your way. However, there is one thing I am still struggling with, the callback model of Node.js applications. It is not that it [...]]]></description>
			<content:encoded><![CDATA[<p>I have been hacking on a project in Node.js/Express.js for some time now. I am really impressed by how fast it is to code and prototype in Node, not much gets in your way. However, there is one thing I am still struggling with, the callback model of Node.js applications. It is not that it is conceptually hard to understand or use, but i feel that it keeps me from writing clean code. </p>
<p>Let&#8217;s imagine that we are writing a small nonsense program. The program receives a post, create some variable x, if some condition is true we call an async method to get some result and assign it to x.result. In the end we want to save x (also async). This would probably be my first attempt in node:<br />
&nbsp;</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">app.<span class="me1">post</span><span class="br0">&#40;</span><span class="st0">&#8216;/someurl&#8217;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>req, res<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> x = <span class="br0">&#123;</span>..<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>some contidion<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; someOperation<span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>err, result<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; x.<span class="me1">result</span> = result</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; x.<span class="me1">save</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>err, result<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>err<span class="br0">&#41;</span> next<span class="br0">&#40;</span>err<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;res.<span class="me1">redirect</span><span class="br0">&#40;</span>url<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; x.<span class="me1">save</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>err, result<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>err<span class="br0">&#41;</span> next<span class="br0">&#40;</span>err<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; res.<span class="me1">redirect</span><span class="br0">&#40;</span><span class="st0">&#8216;/&#8217;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>&nbsp;</p>
<p>(Edit: To clarify, both someOperation and save is doing some kind of I/O)</p>
<p>So is this clean code? In my opinion it is not. <span id="more-1488"></span>One problem is that we have the save code in two places. Another is that the code is not very easy to read and understand (remember this is a very simple program and so should the code), but it is not. Sure we could move it to a separate function, or refactor it in some other way, that would help some, but if we are still saving in two places, or the code is not crystal clear, we are not really addressing the problem. </p>
<p>Let&#8217;s instead pretend that we are using synchronous methods (which of course would be a very bad thing in Node.js, so don&#8217;t do it)  and save are methods that would block:<br />
&nbsp;</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">app.<span class="me1">post</span><span class="br0">&#40;</span><span class="st0">&#8216;/someurl&#8217;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>req<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> x = <span class="br0">&#123;</span>..<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>some contidion<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; x.<span class="me1">result</span> = someOperation<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="co1">//synchronous</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">x.<span class="me1">save</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="co1">// synchronous</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> Redirect<span class="br0">&#40;</span><span class="st0">&#8216;/&#8217;</span><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>&nbsp;<br />
To me this is much cleaner and easier to read, saving is only done in one place and the intent of the code is very clear. But why is it so much easier to read? Being synchronous? I wouldn&#8217;t say so. The reason is because we do not have to deal with verbose callbacks. In my opinion <strong>callbacks are polluting the code.</strong> So now you are probably thinking, how can he be programming in Node if he doesn&#8217;t like using callbacks? I would say that, at least for the small applications i have build on Node so far, the benefits of simplicity and development speed on Node has totally justified using Node. Even with all the horrible callbacks <img src='http://sourcecodebean.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  However, in a larger application I am not so sure, it would be very interesting to try out. </p>
<p>So is there anyway we can get rid of the verbose callback syntax? Yes, if some modifications were made to Javascript. But Javascript as a language is not really evolving that fast, so in the meantime it could probably be implemented in a language that compiles to Javascript, like CoffeScript. What we want to do is to be able to do is asynchronicity, but without callbacks. In C# 5 there is a great solution to this problem, the async/await keywords. By using async/await the application could be implemented something like this (pseudo code warning again):<br />
&nbsp;</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">private async Task&lt;Redirect&gt; Post<span class="br0">&#40;</span>req<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; var x = new &#8230;;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>some contidion<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; x.<span class="me1">result</span> = await someAsyncOperation<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; await x.<span class="me1">save</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> <span class="kw1">return</span> new Redirect<span class="br0">&#40;</span><span class="st0">&#8216;/&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>&nbsp;<br />
In short, async tells the compiler that the above method is asynchronous and await will suspend execution of the method until someAsyncOperation is done. </p>
<p>So the above example behaves in exactly the same way as the first example, but with the benefits of the second. In the background a lot of magic is used to construct this behavior, but this is something that the compiler will take care of for us and we don&#8217;t have to pollute our code with. </p>
<p>If something like this would be available for Javascript I think it would really make life a lot easier for a lot of Node.js developers. Maybe there is a good solution to this and I am not aware of it (I am far from a Javascript or Node.js expert), if so please enlighten me! </p>
<p>How do you handle flow control in your Node.js applications? How would you have written the example? Any Node.js magic I am missing? </p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/callbacks-are-polluting-your-code/1488/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>MongoDB, C# and Mono</title>
		<link>http://sourcecodebean.com/archives/mongodb-c-and-mono/1408</link>
		<comments>http://sourcecodebean.com/archives/mongodb-c-and-mono/1408#comments</comments>
		<pubDate>Wed, 11 Jan 2012 18:53:48 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[NoSQL]]></category>

		<guid isPermaLink="false">http://sourcecodebean.com/?p=1408</guid>
		<description><![CDATA[MongoDB is one of the many free open source NoSQL databases that exist today. I wanted to try out how well the official drivers for C# worked when using Mono. On the MongoDB web site they have pre built binaries of MongoDB for almost every platform, i grabbed the 64 bit binary for OSX. No [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mongodb.org/">MongoDB</a> is one of the many free open source NoSQL databases that exist today. I wanted to try out how well the official drivers for C# worked when using Mono. </p>
<p>On the MongoDB web site they have pre built binaries of MongoDB for almost every platform, i grabbed the 64 bit binary for OSX. No installation is required, just unzip the file and run the &#8220;mongod&#8221; binary from the directory. There is also a binary called &#8220;mongo&#8221;, this is the <a href="http://www.mongodb.org/display/DOCS/Overview+-+The+MongoDB+Interactive+Shell">mongo interactive shell</a> which is very useful. </p>
<p>The C# drivers are available, both in binary form and as source, from the <a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center">C# language center</a>. To get started I fired up MonoDevelop 2.8 running on Mono 2.10.8:</p>
<p><a href="http://sourcecodebean.com/wp-content/uploads/2012/01/monodevelop.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/01/monodevelop-300x187.png" alt="" title="monodevelop" width="300" height="187" class="aligncenter size-medium wp-image-1451" /></a><br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/01/edit_references.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/01/edit_references-300x187.png" alt="" title="edit_references" width="300" height="187" class="aligncenter size-medium wp-image-1449" /></a><br />
<a href="http://sourcecodebean.com/wp-content/uploads/2012/01/add_references.png"><img src="http://sourcecodebean.com/wp-content/uploads/2012/01/add_references-300x201.png" alt="" title="add_references" width="300" height="201" class="aligncenter size-medium wp-image-1450" /></a></p>
<p>MonoDevelop has matured a lot since I used it the first time. It is still not as good as Visual Studio, but it is getting there. What takes most time to get used to is the totally different set of shortcuts, and the lack of all ReSharper magic. </p>
<p>Let me break down a simple console application example on how to use MongoDB using the official driver from 10gen: <span id="more-1408"></span></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">using System;</div>
</li>
<li class="li1">
<div class="de1">using System.<span class="me1">Collections</span>.<span class="me1">Generic</span>;</div>
</li>
<li class="li2">
<div class="de2">using System.<span class="me1">Linq</span>;</div>
</li>
<li class="li1">
<div class="de1">using MongoDB.<span class="me1">Bson</span>;</div>
</li>
<li class="li1">
<div class="de1">using MongoDB.<span class="me1">Driver</span>;</div>
</li>
<li class="li1">
<div class="de1">using MongoDB.<span class="me1">Driver</span>.<span class="me1">Builders</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">namespace MongoDbTest</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; public class Article</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public MongoDB.<span class="me1">Bson</span>.<span class="me1">ObjectId</span> id <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; public <span class="kw4">string</span> title <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public <span class="kw4">string</span> status <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public <span class="kw4">string</span><span class="br0">&#91;</span><span class="br0">&#93;</span> tags <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; class MainClass</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public <span class="kw4">static</span> <span class="kw4">void</span> Main <span class="br0">&#40;</span><span class="kw4">string</span><span class="br0">&#91;</span><span class="br0">&#93;</span> args<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="co1">// Connect to the database and get a colleciton</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; MongoServer server = MongoServer.<span class="me1">Create</span> <span class="br0">&#40;</span><span class="st0">&quot;mongodb://localhost&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; MongoDatabase db = server.<span class="me1">GetDatabase</span> <span class="br0">&#40;</span><span class="st0">&quot;mongodb-tutorial&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Get an article collection</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; MongoCollection&lt;BsonDocument&gt; articles = db.<span class="me1">GetCollection</span>&lt;BsonDocument&gt; <span class="br0">&#40;</span><span class="st0">&quot;articles&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Empty the collection (so all runs of this program will result in the same output)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; articles.<span class="me1">RemoveAll</span> <span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Create two articles</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; articles.<span class="me1">Save</span> <span class="br0">&#40;</span>new BsonDocument</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;title&quot;</span>, <span class="st0">&quot;A MongoDB article&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;published&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;tags&quot;</span>, new BsonArray <span class="br0">&#123;</span> <span class="st0">&quot;c#&quot;</span>, <span class="st0">&quot;mongodb&quot;</span> <span class="br0">&#125;</span><span class="br0">&#125;</span>&nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; articles.<span class="me1">Save</span> <span class="br0">&#40;</span>new BsonDocument</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;title&quot;</span>, <span class="st0">&quot;A Mono article&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;draft&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;tags&quot;</span>, new BsonArray <span class="br0">&#123;</span> <span class="st0">&quot;c#&quot;</span>, <span class="st0">&quot;mono&quot;</span> <span class="br0">&#125;</span><span class="br0">&#125;</span>&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<blockquote><p>If you type this in the MongoDB shell, you will see that the following articles are stored in the database:</p>
<pre>
> db.articles.find()
        {
          "_id" : ObjectId("4f097f8e74b5b343b97f56a7"),
          "title" : "A MongoDB article",
          "status" : "published",
          "tags" : [ "c#", "mongodb" ]
        }

        {
          "_id" : ObjectId("4f097f8e74b5b343b97f56a8"),
          "title" :
          "A Mono article",
          "status" : "draft",
          "tags" : [ "c#", "mono" ]
       }
</pre>
</blockquote>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="co1">// Find and print the first article</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; BsonDocument firstArticle = articles.<span class="me1">FindOne</span> <span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; PrintArticle <span class="br0">&#40;</span> <span class="co1">// Access the properties using indexing and then casting using the .As*</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; firstArticle<span class="br0">&#91;</span><span class="st0">&quot;_id&quot;</span><span class="br0">&#93;</span>.<span class="me1">AsObjectId</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; firstArticle<span class="br0">&#91;</span><span class="st0">&quot;title&quot;</span><span class="br0">&#93;</span>.<span class="me1">AsString</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; firstArticle<span class="br0">&#91;</span><span class="st0">&quot;status&quot;</span><span class="br0">&#93;</span>.<span class="me1">AsString</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#40;</span>firstArticle<span class="br0">&#91;</span><span class="st0">&quot;tags&quot;</span><span class="br0">&#93;</span>.<span class="me1">AsBsonArray</span><span class="br0">&#41;</span>.<span class="me1">Select</span> <span class="br0">&#40;</span>x =&gt; x.<span class="me1">AsString</span><span class="br0">&#41;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Typed collections&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">//</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Using indexing and the .As* operations is not that convenient. A better way</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// is to use a typed collection. Earlier we defined a Article class, lets use it:</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; MongoCollection&lt;Article&gt; typedArticles = db.<span class="me1">GetCollection</span>&lt;Article&gt; <span class="br0">&#40;</span><span class="st0">&quot;articles&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Article typedArticle = typedArticles.<span class="me1">FindOneAs</span>&lt;Article&gt; <span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; PrintArticle <span class="br0">&#40;</span>typedArticle.<span class="me1">id</span>, typedArticle.<span class="me1">title</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; typedArticle.<span class="me1">status</span>, typedArticle.<span class="me1">tags</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Save a typed article</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; typedArticles.<span class="me1">Save</span> <span class="br0">&#40;</span>new Article <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title = <span class="st0">&quot;An article about MonoDevelop&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; status = <span class="st0">&quot;published&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tags = new <span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="br0">&#123;</span><span class="st0">&quot;c#&quot;</span>, <span class="st0">&quot;mono&quot;</span>, <span class="st0">&quot;mono-develop&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Querying</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Find article with status draft</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Article draftArticle = typedArticles</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; .<span class="me1">FindOneAs</span>&lt;Article&gt; <span class="br0">&#40;</span>Query.<span class="me1">EQ</span> <span class="br0">&#40;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;draft&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; PrintArticle <span class="br0">&#40;</span>draftArticle.<span class="me1">id</span>, draftArticle.<span class="me1">title</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; draftArticle.<span class="me1">status</span>, draftArticle.<span class="me1">tags</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; <span class="co1">// Updating</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// Lets update the draft article and set status published</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span><span class="st0">&quot;Nr of published articles before update:&quot;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ typedArticles.<span class="me1">Find</span> <span class="br0">&#40;</span>Query.<span class="me1">EQ</span> <span class="br0">&#40;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;published&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">Count</span> <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; typedArticles.<span class="me1">Update</span> <span class="br0">&#40;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; new QueryDocument <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="st0">&quot;_id&quot;</span>, draftArticle.<span class="me1">id</span> <span class="br0">&#125;</span> <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; new UpdateDocument <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="st0">&quot;$set&quot;</span>, new BsonDocument <span class="br0">&#40;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;published&quot;</span><span class="br0">&#41;</span> <span class="br0">&#125;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// $set is atomic</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span><span class="st0">&quot;Nr of pubhlished articles after update:&quot;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ typedArticles.<span class="me1">Find</span> <span class="br0">&#40;</span>Query.<span class="me1">EQ</span> <span class="br0">&#40;</span><span class="st0">&quot;status&quot;</span>, <span class="st0">&quot;published&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">Count</span> <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// MapReduce</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// </span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="co1">// This will count the number of times a tag has been used by using MapReduce</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; var map =</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;function() {&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;this.tags.forEach(function(t) {&quot;</span> + <span class="co1">// Iterate all the tags and </span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp; &nbsp; &nbsp;emit(t, { count : 1 }); &quot;</span> + &nbsp; &nbsp;<span class="co1">// emit the tag name and initial count </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;})&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;}&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; var reduce =</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;function(key, emits) {&quot;</span> + <span class="co1">// Reduce by tag name and summarize the result</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;total = 0;&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;for (var i in emits) {&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp; &nbsp; &nbsp;total += emits[i].count;&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;}&quot;</span> +</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot; &nbsp; &nbsp;return { count : total };&quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;}&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span><span class="st0">&quot;MapReduce result:&quot;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; var mr = typedArticles.<span class="me1">MapReduce</span> <span class="br0">&#40;</span>map, reduce<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; foreach <span class="br0">&#40;</span>var document in mr.<span class="me1">GetResults</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span>document.<span class="me1">ToJson</span> <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public <span class="kw4">static</span> <span class="kw4">void</span> PrintArticle <span class="br0">&#40;</span>ObjectId id, <span class="kw4">string</span> title, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw4">string</span> status, IEnumerable&lt;string&gt; tags<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span><span class="st0">&quot;id: &quot;</span> + id + <span class="st0">&quot;, title: &quot;</span> + title<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; Console.<span class="me1">WriteLine</span> <span class="br0">&#40;</span><span class="st0">&quot;- tags: &quot;</span> + <span class="kw4">string</span>.<span class="me1">Join</span> <span class="br0">&#40;</span><span class="st0">&quot;, &quot;</span>, tags<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Output from the program:</p>
<blockquote>
<p>id: 4f0989fc74b5b3458ae38105, title: A MongoDB article<br />
- tags: c#, mongodb<br />
id: 4f0989fc74b5b3458ae38105, title: A MongoDB article<br />
- tags: c#, mongodb<br />
id: 4f0989fc74b5b3458ae38106, title: A Mono article<br />
- tags: c#, mono<br />
Nr of pubhlished articles before update:2<br />
Nr of pubhlished articles after update:3<br />
MapReduce result:<br />
{ &#8220;_id&#8221; : &#8220;c#&#8221;, &#8220;value&#8221; : { &#8220;count&#8221; : 3.0 } }<br />
{ &#8220;_id&#8221; : &#8220;mongodb&#8221;, &#8220;value&#8221; : { &#8220;count&#8221; : 1.0 } }<br />
{ &#8220;_id&#8221; : &#8220;mono&#8221;, &#8220;value&#8221; : { &#8220;count&#8221; : 2.0 } }<br />
{ &#8220;_id&#8221; : &#8220;mono-develop&#8221;, &#8220;value&#8221; : { &#8220;count&#8221; : 1.0 } }
</p></blockquote>
<p>Using the C# driver for MongoDB, is as you can see, very straight forward. Usually when I run applications on Mono I make sure to build all libraries using the Mono compiler, to make sure the Microsoft compiler have not used any optimizations that is not supported under Mono (I have run into this issue in the past). However, in this case the .NET binaries on the MongoDB site seems to work just fine under Mono. I also downloaded the MongoDB C# driver source and build them using MonoDevelop without any problems. </p>
<p>One improvement I would like to see is LINQ support in the driver. It would be so much more convenient to be able to use LINQ and strongly typed objects to query the database or create MapReduce-functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://sourcecodebean.com/archives/mongodb-c-and-mono/1408/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: sourcecodebean.com @ 2012-05-30 05:07:51 -->
