<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>CaptainCodeman</title>
	<atom:link href="http://captaincodeman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://captaincodeman.com</link>
	<description>.NET Developer</description>
	<lastBuildDate>Fri, 08 Mar 2013 23:22:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='captaincodeman.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>CaptainCodeman</title>
		<link>http://captaincodeman.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://captaincodeman.com/osd.xml" title="CaptainCodeman" />
	<atom:link rel='hub' href='http://captaincodeman.com/?pushpress=hub'/>
		<item>
		<title>Simon Green Quadrus Development Calgary</title>
		<link>http://captaincodeman.com/2013/03/08/simon-green-quadrus-calgary/</link>
		<comments>http://captaincodeman.com/2013/03/08/simon-green-quadrus-calgary/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 20:59:14 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://captaincodeman.com/?p=959</guid>
		<description><![CDATA[Just in case anyone is trying to get in touch with me at my simong@quadrus.com address and never get&#8217;s a response &#8230; Let me apologize on behalf of my former employer, Quadrus Development Inc of Calgary. It turns out that &#8230; <a href="http://captaincodeman.com/2013/03/08/simon-green-quadrus-calgary/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=959&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just in case anyone is trying to get in touch with me at my simong@quadrus.com address and never get&#8217;s a response &#8230;</p>
<p>Let me apologize on behalf of my former employer, Quadrus Development Inc of Calgary. It turns out that they don&#8217;t bounce emails when someone leaves. Instead they quietly read them all but don&#8217;t bother to let people know that you no longer work there even when it&#8217;s an old friend trying to get in touch.</p>
<p>Anyone who wants to contact me should use simon@captaincodeman.com</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/959/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/959/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=959&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2013/03/08/simon-green-quadrus-calgary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating labels for GitHub issue system</title>
		<link>http://captaincodeman.com/2012/03/07/creating-labels-github-issue-system/</link>
		<comments>http://captaincodeman.com/2012/03/07/creating-labels-github-issue-system/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 18:27:41 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=319</guid>
		<description><![CDATA[I liked the ideas for Managing your backlog with GitHub Issues and the type of labels used but creating them was harder than it should have been because of the unicode characters and custom colors and so using them consistently &#8230; <a href="http://captaincodeman.com/2012/03/07/creating-labels-github-issue-system/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=319&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I liked the ideas for <a href="http://blog.h3rald.com/managing-your-backlog-with-github-issues">Managing your backlog with GitHub Issues</a> and the type of labels used but creating them was harder than it should have been because of the unicode characters and custom colors and so using them consistently on multiple projects would mean repeating the same work each time (unless there is a &#8216;copy labels&#8217; button that I haven&#8217;t noticed!).</p>
<p>So, I decided to write a little script to automate the process. It creates a slightly different set of labels as shown below but could be easily adapted to your own needs:</p>
<p><a href="http://captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/291-autosave/" rel="attachment wp-att-320"><img class="alignnone size-large wp-image-320" title="github-issue-labels" alt="" src="http://captaincodeman.files.wordpress.com/2012/04/github-issue-labels-540x400.png?w=540&#038;h=400" width="540" height="400" /></a></p>
<p>You need to add <a href="http://curl.haxx.se/download.html">curl</a> to your path or put it in the same folder as the script which prompts you for your GitHub Profile, Password and Project name.</p>
<p>The actual script (save as a cmd file):</p>
<pre>@echo off
SETLOCAL
echo This script creates issue labels for a GitHub repository
echo.
echo Please specify the GitHub Profile containing the Repository, e.g.:
echo https://github.com/MyProfile/MyCoolProject
echo                    ~~~~~~~~~
set /P username= "  Enter Profile   : "
echo.
echo Please specify the GitHub password for that profile:
set /P password= "  Enter Password  : "
echo.
echo Please specify the GitHub Repository, e.g.:
echo https://github.com/MyProfile/MyCoolProject
echo                              ~~~~~~~~~~~~~
echo.
set /P repository= "  Enter Repository: "
echo.
echo Creating labels ...
curl -k -u "%username%:%password%" -d "{\"name\":\"Feature\",\"color\":\"2d9e11\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"Bug\",\"color\":\"e10c02\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"Rejected\",\"color\":\"000000\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"Idea\",\"color\":\"e102d8\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"Task\",\"color\":\"0b02e1\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\",\"color\":\"fffdd6\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\u2605\",\"color\":\"fff875\"}" https://api.github.com/repos/%username%/%repository%/labels
curl -k -u "%username%:%password%" -d "{\"name\":\"\u2605\u2605\u2605\",\"color\":\"fff200\"}" https://api.github.com/repos/%username%/%repository%/labels
echo.
echo Current labels ...
curl -k -u "%username%:%password%" https://api.github.com/repos/%username%/%repository%/labels
ENDLOCAL
pause</pre>
<p>Feb 2013: Script updated to work with latest Curl for Windows that I tried on Windows 8</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/319/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=319&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2012/03/07/creating-labels-github-issue-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/github-issue-labels-540x400.png" medium="image">
			<media:title type="html">github-issue-labels</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing Embed.ly client for .NET</title>
		<link>http://captaincodeman.com/2011/07/15/embedly-client-dotnet/</link>
		<comments>http://captaincodeman.com/2011/07/15/embedly-client-dotnet/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 22:50:00 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[embedly]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[reactive extensions]]></category>
		<category><![CDATA[Rx]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/2011/07/15/embedly-client-dotnet/</guid>
		<description><![CDATA[At it's core, embedly is an oEmbed provider. oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly. This details a .NET client to make accessing embedly easier. <a href="http://captaincodeman.com/2011/07/15/embedly-client-dotnet/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=318&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>First of all if you haven&#8217;t heard of <a href="http://embed.ly/" target="_blank">Embed.ly</a> you really should check it out:</p>
<p><a href="http://embed.ly/" target="_blank"><img src="http://embed.ly/static/images/logos/embedly-powered-large-light.png" alt="" /></a></p>
<p>At it&#8217;s core, embedly is an <a href="http://oembed.com/" target="_blank">oEmbed</a> provider. oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</p>
<p>If you&#8217;ve ever posted a link on facebook and been impressed that it automatically added a title, some descriptive text and one or more preview images to select from or included a playable video automatically and want to build something like that into your own site then this is for you.</p>
<p>There were already <a href="http://embed.ly/docs/libraries/libraries" target="_blank">client libraries for several other languages</a> but none for .NET so I developed this. I&#8217;ve been using it on a forum app to automatically detect links to videos and images to build up a gallery of both and to make them playable within the post. You can also use it on the client via a jQuery plugin but then you lose the ability to build up the gallery and index the additional content. If someone has posted a link to a Bob Dylan video then I&#8217;d like that post to be returned if someone searches for &#8216;Dylan&#8217;.</p>
<p>The response from embedly can also include a flag to indicate if the URL is considered &#8216;safe&#8217; (based on Google&#8217;s safe-browsing API).</p>
<h2>Example</h2>
<p>Here is an example of the original content posted showing how the link is converted into a video and the additional information retrieved.</p>
<h3>Original Post</h3>
<p>The user makes a post and just copies and pastes a regular link</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/original.png"><img style="display:inline;" title="original" src="http://captaincodeman.files.wordpress.com/2012/04/original.png?w=584" alt="original" /></a></p>
<h3>Embedly Enhanced</h3>
<p>The HTML is parsed and sanitized (using <a href="http://htmlagilitypack.codeplex.com/" target="_blank">HtmlAgilityPack</a> and a custom Html cleaning library) and the discovered URL checked with Embedly. We told embedly we wanted a preview of 640px maximum width so the html snippet returned fits perfectly and shows a playable preview:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/with-embedly.png"><img style="display:inline;" title="with-embedly" src="http://captaincodeman.files.wordpress.com/2012/04/with-embedly.png?w=584" alt="with-embedly" /></a></p>
<h3>Thumbnail Gallery</h3>
<p>Embedly also returns static thumbnail images which are perfect to add to a gallery of content:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/video-library.png"><img style="display:inline;" title="video-library" src="http://captaincodeman.files.wordpress.com/2012/04/video-library.png?w=584" alt="video-library" /></a></p>
<h3>Additional Content</h3>
<p>As well as the html preview and thumbnail, the title, description and other information is returned by embedly which can enhance the page to host the content or make it more searchable on our site:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/video-preview.png"><img style="display:inline;" title="video-preview" src="http://captaincodeman.files.wordpress.com/2012/04/video-preview.png?w=584" alt="video-preview" /></a></p>
<p>Embedly provides a much richer experience to the end user.</p>
<h2>So what does the .NET client do?</h2>
<p>Basically, it provides an easy way to make requests to embedly and get strongly-typed results back. It automatically handles the request to the embedly service to get the details of the services they support fully and has a high-performance regex-less way of matching URLs against them to see if they are supported (doing 500+ regex lookups against each URL is too slow when batch processing).</p>
<p>Requests to embedly can be filtered based on the provider information making it easy to limit requests to YouTube videos or Amazon products or perhaps any video or photo provider.</p>
<p>When requesting more than one URL the client will automatically batch them into a single HTTP request to embedly (which supports up to 20 URLs per request) and uses async downloading to handle the response without blocking or using valuable CPU time.</p>
<p>Finally, a caching mechanism helps avoid re-requesting URLs that you have recently checked operating at the URL level &#8211; the individual URL results are cached, not the entire embedly response which could be for 20 URLs so if you requested 60 URLs and 40 had already been requested it would only sand a single HTTP request to embedly whatever sequence they were requested in.</p>
<p>The caching can be disabled completed if required and there is also an InMemory cache provided as well as examples of an ADO / SQL Client cache and a MongoDB cache (which is the one I&#8217;m using myself).</p>
<h2>What doesn&#8217;t it do?</h2>
<p>At the moment it works for the base oEmbed endpoint only but I plan on adding support for the <a href="http://embed.ly/docs/endpoints/1/preview" target="_blank">Preview</a> and <a href="http://embed.ly/docs/endpoints/2/objectify" target="_blank">Objectify</a> endpoints in the future.</p>
<h2>Where do I get it?</h2>
<p>You can download the source from GitHub: <a href="https://github.com/CaptainCodeman/embedly-dotnet">https://github.com/CaptainCodeman/embedly-dotnet</a> or get a binary version as a NuGet package:</p>
<p><a href="http://nuget.org/List/Packages/embedly">http://nuget.org/List/Packages/embedly</a></p>
<p>NOTE: I&#8217;ll probabably be splitting the NuGet version into a core / base package and separate cache providers to avoid bloating the dependencies.</p>
<h2>How do I use it?</h2>
<p>The source includes a sample project showing some of the ways you can use it but I&#8217;ll give a brief summary here.</p>
<h3>Create a client</h3>
<p>All requests go through the client which, at a minimum, needs an embedly account key provided which you can store however you want (the sample shows it stored in a .config file using the standard .NET COnfigurationManager). You can sign-up for a free account at <a href="http://embed.ly/pricing">http://embed.ly/pricing</a> to get a key</p>
<pre class="brush:csharp">var key = ConfigurationManager.AppSettings["embedly.key"]; 
var client = new Client(key);</pre>
<h3>Use a Cache</h3>
<p>If you want to use a cache then this should be passed into the client constructor. Here&#8217;s an example using the MongoDB cache:</p>
<pre class="brush:csharp">var key = ConfigurationManager.AppSettings["embedly.key"]; 
var database = ConfigurationManager.ConnectionStrings["embedly.cache"]; 
var cache = new MongoResponseCache(database.ConnectionString); 
var client = new Client(key, cache);</pre>
<p>The final optional parameter when creating a client is the embedly request timeout. If the HTTP request to embedly takes longer than this then it is aborted and an exception returned instead of the embedly result. The default timeout for requests is 30 seconds.</p>
<h3>List Embed.ly Providers</h3>
<p>Once you have a client then you can see the list of providers that embedly supports:</p>
<pre class="brush:csharp">foreach (var provider in client.Providers) 
{ 
    Console.WriteLine("{0} {1}", provider.Type, provider.Name); 
}</pre>
<h3>Check if a URL is supported:</h3>
<p><a href="http://embed.ly/providers" target="_blank">Embed.ly supports over 200 different providers</a> (all the big names like YouTube) although they will return results for the non-provider backed requests too.</p>
<pre class="brush:csharp">var url = new Uri(@"http://www.youtube.com/watch?v=YwSZvHqf9qM") 
var supported = client.IsUrlSupported(url);</pre>
<h3>Get provider information for a URL:</h3>
<p>You can get the provider for a URL (this does not make any additional requests to embedly beyond the initial retrieval of the provider list itself).</p>
<pre class="brush:csharp">var url = new Uri(@"http://www.youtube.com/watch?v=YwSZvHqf9qM") 
var supported = client.IsUrlSupported(url); 
Console.WriteLine("Supported      : {0}", supported); 
Console.WriteLine();

var provider = client.GetProvider(url); 
Console.WriteLine("PROVIDER"); 
Console.WriteLine("About          : {0}", provider.About); 
Console.WriteLine("DisplayName    : {0}", provider.DisplayName); 
Console.WriteLine("Domain         : {0}", provider.Domain); 
Console.WriteLine("Favicon        : {0}", provider.Favicon); 
Console.WriteLine("Name           : {0}", provider.Name); 
Console.WriteLine("Regexs         : {0}", string.Join(", ", provider.Regexs)); 
Console.WriteLine("Subdomains     : {0}", string.Join(", ", provider.Subdomains)); 
Console.WriteLine("Types          : {0}", provider.Type);</pre>
<h3>Get the oEmbed information for a single URL:</h3>
<p>The API supports single URL requests.</p>
<pre class="brush:csharp">var url = new Uri(@"http://www.youtube.com/watch?v=YwSZvHqf9qM") 
var result = client.GetOEmbed(url, new RequestOptions { MaxWidth = 320 }); 

// basic response information 
var response = result.Response; 
Console.WriteLine("Type           : {0}", response.Type); 
Console.WriteLine("Version        : {0}", response.Version);

// link details 
var link = result.Response.AsLink; 
Console.WriteLine("Author         : {0}", link.Author); 
Console.WriteLine("AuthorUrl      : {0}", link.AuthorUrl); 
Console.WriteLine("CacheAge       : {0}", link.CacheAge); 
Console.WriteLine("Description    : {0}", link.Description); 
Console.WriteLine("Provider       : {0}", link.Provider); 
Console.WriteLine("ProviderUrl    : {0}", link.ProviderUrl); 
Console.WriteLine("ThumbnailHeight: {0}", link.ThumbnailHeight); 
Console.WriteLine("ThumbnailUrl   : {0}", link.ThumbnailUrl); 
Console.WriteLine("ThumbnailWidth : {0}", link.ThumbnailWidth); 
Console.WriteLine("Title          : {0}", link.Title); 
Console.WriteLine("Url            : {0}", link.Url);

// video specific details 
var video = result.Response.AsVideo; 
Console.WriteLine("Width          : {0}", video.Width); 
Console.WriteLine("Height         : {0}", video.Height); 
Console.WriteLine("Html           : {0}", video.Html);</pre>
<h3>Get oEmbed information for a list of URLs:</h3>
<p>Any IEnumerable&lt;Uri&gt; list of URLs can be processed as a batch. The .NET client will return results as they arrive.</p>
<pre class="brush:csharp">var results = client.GetOEmbeds(urls, new RequestOptions { MaxWidth = 320 })</pre>
<h3>Limit the URLs to request to supported providers only:</h3>
<p>(embedly can return results for &#8216;unsupported&#8217; providers but the supported ones typically have richer content.</p>
<pre class="brush:csharp">var results = client.GetOEmbeds(urls, provider =&gt; provider.IsSupported);</pre>
<h3>Limit the URLs to request to a single provider:</h3>
<p>A lambda expression enables the request to be filtered on any property of the provider identified for a URL.</p>
<pre class="brush:csharp">var results = client.GetOEmbeds(urls, provider =&gt; provider.Name == "youtube")</pre>
<h3>Limit the URLs to request based on the type of provider:</h3>
<p>Each provider has a Type to indicate the content they return so if you are only interested in video links you can filter on that type.</p>
<pre class="brush:csharp">var results = client.GetOEmbeds(urls, provider =&gt; provider.Type == ProviderType.Video);</pre>
<p>NOTE: &#8216;urls&#8217; is an IEnumerable&lt;Uri&gt; in the above.</p>
<p>NOTE: RequestOptions enables a number of additional request arguments to be specified, see: <a href="http://embed.ly/docs/endpoints/arguments">http://embed.ly/docs/endpoints/arguments</a></p>
<p>The Result returned contains the original request (URL and any matching provider) an Exception (if the HTTP request failed) or a Response which could be an embedly Error (used to indicate if the URL being inspected doesn&#8217;t exist for instance) or one of the specific response types (Link, Photo, Rich and Video).</p>
<p>Extension methods enable the results to be filtered as a convenience for:</p>
<pre class="brush:csharp">result.Success()</pre>
<p>Returns results that were successful only</p>
<pre class="brush:csharp">result.Failed()</pre>
<p>Returns results that failed (HTTP error during request to embedly)</p>
<pre class="brush:csharp">result.Errors()</pre>
<p>Returns results that embedly responded with an error code. i.e. the request to embedly was successful but maybe the URL doesn&#8217;t exist</p>
<pre class="brush:csharp">result.Link()</pre>
<p>Returns results that are of type Link</p>
<pre class="brush:csharp">result.Photos()</pre>
<p>Returns results that are of type Photo</p>
<pre class="brush:csharp">result.Richs()</pre>
<p>Returns results that are of type Rich</p>
<pre class="brush:csharp">result.Videos()</pre>
<p>Returns results that are of type Video</p>
<p>If you are iterating over multiple results and want to handle them correctly then the first step is to check each result&#8217;s Exception property. If there was an exception during the HTTP request to embedly then this will be set. If it is null then the request to embedly was successful in that embedly returned a response but that response may be an Error, a Link or a Phot, Rich or Video. The Respone.Type will indicate the response and the As[type] property is a convenience way to get the Response as the particular type.</p>
<pre class="brush:csharp">foreach (var result in results.Successful()) 
{ 
    if (result.Exception == null) 
    { 
        Console.WriteLine("{0} found for {1} ({2})", result.Response.Type, result.Request.Url, result.Request.Provider.Name); 
        switch (result.Response.Type) 
        { 
            case ResourceType.Error: 
                var error = result.Response.AsError; 
                Console.WriteLine("  code:{0} message:{1}", error.ErrorCode, error.ErrorMessage); 
                break; 
            case ResourceType.Link: 
                var link = result.Response.AsLink; 
                Console.WriteLine("  title:{0}", link.Title); 
                Console.WriteLine("  url:{0}", link.Url); 
                break; 
            case ResourceType.Photo: 
                var photo = result.Response.AsPhoto; 
                Console.WriteLine("  title:{0} ({1}x{2})", photo.Title, photo.Width, photo.Height); 
                Console.WriteLine("  url:{0}", photo.Url); 
                break; 
            case ResourceType.Rich: 
                var rich = result.Response.AsRich; 
                Console.WriteLine("  title:{0} ({1}x{2})", rich.Title, rich.Width, rich.Height); 
                Console.WriteLine("  url:{0}", rich.Url); 
                break; 
            case ResourceType.Video: 
                var video = result.Response.AsVideo; 
                Console.WriteLine("  title:{0} ({1}x{2})", video.Title, video.Width, video.Height); 
                Console.WriteLine("  url:{0}", video.Url); 
                break; 
        } 
    } 
    else 
    { 
        Console.WriteLine("Exception requesting {0} : {1}", result.Request.Url, result.Exception);                
    } 
}</pre>
<h2>Logging</h2>
<p>The library uses the Common.Logging 2 library so you can plug it in to whatever your preferred logging framework is. The log output isn’t very rich right now but I’ll be expanding that in future so you can peek into what is happening.</p>
<h2>Reactive Extensions</h2>
<p>The other dependency is the Reactive Extensions which I’m new to but it really made the caching of individual LINQ responses much easier than it would otherwise be. The Push vs Pull model allows the pipeline to be split with cached items going to the return pipeline immediately and non-cached requests going through the full download pipeline. I’ll try and make a further post describing how this works.</p>
<h2>Roadmap</h2>
<p>I’d like to add support for the other embedly endpoints (<a href="http://embed.ly/docs/endpoints/1/preview" target="_blank">Preview</a> and <a href="http://embed.ly/docs/endpoints/2/objectify" target="_blank">Objectify</a>) although I’m not using them myself at the moment – let me know if you’d find these useful.</p>
<p>Some custom Windows Performance Counters would probably be good to track how many requests are going through the library and what the cache-hit ratio is.</p>
<p>The current caching system is very simple and doesn’t have much support for expiring items which should be added.</p>
<h2>Feedback</h2>
<p>If you find the library useful or have any comments or suggestions to improve things I&#8217;d welcome any feedback.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/318/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=318&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/07/15/embedly-client-dotnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://embed.ly/static/images/logos/embedly-powered-large-light.png" medium="image" />

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/original.png" medium="image">
			<media:title type="html">original</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/with-embedly.png" medium="image">
			<media:title type="html">with-embedly</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/video-library.png" medium="image">
			<media:title type="html">video-library</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/video-preview.png" medium="image">
			<media:title type="html">video-preview</media:title>
		</media:content>
	</item>
		<item>
		<title>Event-sourcing benefit: migrating between storage types</title>
		<link>http://captaincodeman.com/2011/06/24/event-sourcing-benefit-migrate-storage/</link>
		<comments>http://captaincodeman.com/2011/06/24/event-sourcing-benefit-migrate-storage/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 15:15:01 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[event-sourcing]]></category>
		<category><![CDATA[eventstore]]></category>
		<category><![CDATA[incremental]]></category>
		<category><![CDATA[migrate]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=307</guid>
		<description><![CDATA[Here&#8217;s an example of one benefit of Event Sourcing &#8230; How much work would typically result from &#8220;hey, we need to change platform and store our data in a different database …&#8220;? Even using NHibernate and going from one relational &#8230; <a href="http://captaincodeman.com/2011/06/24/event-sourcing-benefit-migrate-storage/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=307&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s an example of one benefit of Event Sourcing &#8230;</p>
<p>How much work would typically result from &#8220;<em>hey, we need to change  platform and store our data in a different database …</em>&#8220;? Even using NHibernate and going from one relational database to another, you’d potentially be looking at a <em>significant</em> piece of effort.</p>
<p>Now imagine instead trying to migrate between fundamentally different storage engines such as from SQL Server to Amazon S3 or from Oracle to MongoDB?!</p>
<p>Well, EventSourcing not only makes it possible, it also makes it trivially simple too. Here&#8217;s an actual <a href="http://blog.jonathanoliver.com/2011/06/cqrs-eventstore-v2-0-release/">EventStore</a> migrator implementation that took all of  two minutes to write:</p>
<pre class="brush:csharp">	var source = GetSourceEventStore();
	var destination = GetDestinationEventStore();

	foreach (var commit in source.GetFrom(StartDate))
		destination.Commit(commit);</pre>
<p>Oh look, it&#8217;s done !! Ok, before you accuse me of being slow there is the  event-store wire-up which is where one of the minutes went (I could add some XML  DI configuration to make it really generic but it’s probably not worth the  effort):</p>
<pre class="brush:csharp">	private static IPersistStreams GetSourceEventStore()
	{
		return Wireup.Init()
			.UsingMongoPersistence("source", new DocumentObjectSerializer())
			.UsingSynchronousDispatcher()
				.PublishTo(new NullDispatcher())
			.Build()
			.Advanced;
	}

	private static IPersistStreams GetDestinationEventStore()
	{
		return Wireup.Init()
			.UsingSqlPersistence("destination")
				.WithDialect(new MsSqlDialect())
				.InitializeStorageEngine()
				.UsingBinarySerialization()
				.Compress()
			.UsingSynchronousDispatcher()
				.PublishTo(new NullDispatcher())
			.Build()
			.Advanced;
	}</pre>
<p>BTW: The &#8220;source&#8221; and &#8220;destination&#8221; strings are the names of connection  strings in the &lt;connectionStrings&gt; section of the config file.</p>
<p>Version 2 of the &#8220;EventStore Migrator Enterprise Edition<sup>TM</sup>&#8221; may add the ability to store the last commit DateTime migrated and then restart from there to enable incremental replication. A real-life version would also need a little exception handling and that would probably make use of the last DateTime to continue from the right point after any failure.</p>
<p>So, with a couple of minutes work you can easily migrate between different  storage engines and also have a mechanism to incrementally keep them in sync &#8211; maybe for disaster recovery or backup where you use a lower cost / higher latency event store in an emergency (and still have a way to migrate back).</p>
<p>Event sourcing and immutable events makes all this possible.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/307/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=307&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/06/24/event-sourcing-benefit-migrate-storage/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>
	</item>
		<item>
		<title>MongoDB provider for Elmah</title>
		<link>http://captaincodeman.com/2011/05/31/mongodb-provider-elmah/</link>
		<comments>http://captaincodeman.com/2011/05/31/mongodb-provider-elmah/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 02:21:02 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=299</guid>
		<description><![CDATA[As a follow up to my Elmah Error Logging with MongoDB Official Driver post: I&#8217;ve created a github repo for it and also published it as a NuGet package. Please let me know if you have any troubles (first attempt &#8230; <a href="http://captaincodeman.com/2011/05/31/mongodb-provider-elmah/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=299&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As a follow up to my <a href="http://www.captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/">Elmah Error Logging with MongoDB Official Driver</a> post:</p>
<p>I&#8217;ve created a <a href="https://github.com/CaptainCodeman/elmah-mongodb">github repo</a> for it and also published it as a <a href="http://nuget.org/List/Packages/elmah.mongodb">NuGet package</a>.</p>
<p>Please let me know if you have any troubles (first attempt with NuGet!).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/299/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=299&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/05/31/mongodb-provider-elmah/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Service Bus / Message Queue with MongoDB</title>
		<link>http://captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/</link>
		<comments>http://captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/#comments</comments>
		<pubDate>Sat, 28 May 2011 22:13:45 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[queue]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291</guid>
		<description><![CDATA[A simple service-bus / messaging queue based on MongoDB capped collections. <a href="http://captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=291&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A service bus or message queue allow producers and subscribers to communicate asynchronously so that a system can handle disconnects, processes being stopped and started or enable peaks of demand to be handled beyond what the subscriber can immediately cope with. The queue acts as a buffer that the producer writes to and the subscriber reads from.</p>
<p>There are lots of implementations such as <a href="http://www.nservicebus.com/">NServiceBus</a>, <a href="http://masstransit-project.com/">MassTransit</a>, <a href="http://hibernatingrhinos.com/open-source/rhino-service-bus">Rhino Service Bus</a> and the cloud-provided services such as <a href="http://aws.amazon.com/sqs/">Amazon’s Simple Queue Service</a> and <a href="http://www.microsoft.com/windowsazure/AppFabric/Overview/default.aspx">Window Azure’s AppFabric Service Bus</a>. Some take a little time to get started with and the cloud ones can also rack up charges pretty quickly if you are doing too much polling.</p>
<p>Often, all that is needed is something fairly simple to buffer messages between processes and persist them. I’ve been making good use of MongoDB recently in conjunction with <a href="http://blog.jonathanoliver.com/">Jonathan Oliver’s</a> <a href="https://github.com/joliver/EventStore/">EventStore</a> library for a CQRS-based project so it seemed the obvious place to start – why not use MongoDB to store the queue?!</p>
<p>Now, I did have a look round first to see if anyone else had created something already and the closest I got was the post here: <a href="http://www.mattinsler.com/why-and-how-i-replaced-amazon-sqs-with-mongodb/">Why (and How) I Replaced Amazon SQS with MongoDB</a>. However, from reading the MongoDB website I’d seen that it had <a href="http://www.mongodb.org/display/DOCS/Tailable+Cursors">Tailable Cursors</a> which, together with the <a href="http://www.mongodb.org/display/DOCS/Capped+Collections">Capped Collections</a> feature, seemed like the ideal tools to build a queue on and possibly more efficient – in fact, MongoDB uses these very features internally for its <a href="http://www.mongodb.org/display/DOCS/Replication+Internals">replication</a>.</p>
<p>Why are these features important?</p>
<p>We don’t want the queue to just grow and grow and grow but would like to put a cap on the size. Once a capped collection in MongoDB is full it wraps round and starts overwriting the oldest records. Capped collections are actually pre-allocated which helps with performance too. All we need is a collection that will be big enough to cope with any downtime from the subscriber so that messages are not lost.</p>
<p>Capped collections also support natural sort order where you can read records in the order they were written to which means we don’t need an index which means both reads and writes will be much faster without MongoDB having as much extra work to do.</p>
<p>Tailable cursors block at the server so we don’t have to keep polling or have to give up some latency. If a cursor is opened and there is no data to return it just sits there waiting but will fire off the next record to you as soon as it comes in (actually, it doesn’t wait indefinitely but somewhere around 4 seconds but the result is the same – we only ‘poll’ every 4 seconds but get immediate notification of a new message).</p>
<p>So, with the newly released <a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center">Official C# MongoDB Driver</a> in hand I set-out to build my queue …</p>
<p>Before the details though, you can take a look at the finished result from this Jinq screen-cast:</p>
<p><a href="http://screencast.com/t/nHeFuhVeAD" target="_blank"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;" title="video" src="http://captaincodeman.files.wordpress.com/2012/04/video.png?w=584" alt="video" border="0" /></a></p>
<p>We’ll try and keep things really simple for this example so welcome to the simplest queue interfaces ever conceived! We just have an interface for adding things to the queue and another for reading from it:</p>
<pre class="brush:csharp">public interface IPublish&lt;in T&gt; where T : class
{
    void Send(T message);
}</pre>
<pre class="brush:csharp">public interface ISubscribe&lt;out T&gt; where T : class
{
    T Receive();
}</pre>
<p>And of course we need something to actually send – again, we’ll keep things simple for the demo and have a very simple message with a couple of properties:</p>
<pre class="brush:csharp">public class ExampleMessage
{
    public int Number { get; private set; }
    public string Name { get; private set; }

    public ExampleMessage(int number, string name)
    {
        Number = number;
        Name = name;
    }

    public override string ToString()
    {
        return string.Format("ExampleMessage Number:{0} Name:{1}", Number, Name);
    }
}</pre>
<p>The ExampleMessage will be the generic &lt;T&gt; parameter to the queue interfaces but we’re going to want to store a bit more information in MongoDB than the message itself so we’ll also use a MongoMessage class to add the extra properties and act as a container / wrapper for the message itself. Nothing outside of the queue will ever see this though:</p>
<pre class="brush:csharp">public class MongoMessage&lt;T&gt; where T : class
{
    public ObjectId Id { get; private set; }
    public DateTime Enqueued { get; private set; }
    public T Message { get; private set; }

    public MongoMessage(T message)
    {
        Enqueued = DateTime.UtcNow;
        Message = message;
    }
}</pre>
<p>This will give each message that we send an Id and also record the date / time that it was enqueued (which would enable us to work-out the latency of the queue). The Id is an <a href="http://www.mongodb.org/display/DOCS/Object+IDs">ObjectId</a> and this is the default Document ID type that MongoDB uses. All of the messages that we write to our queue will be assigned an Id and these should be sortable which we can use to pick up our position when reading from the queue should we need to re-start.</p>
<p>Here is what the messages look like inside of MongoDB (via the excellent <a href="http://www.mongovue.com/">MongoVUE GUI tool</a>):</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/queue.png"><img class="alignnone  wp-image-294" title="queue" src="http://captaincodeman.files.wordpress.com/2012/04/queue.png?w=584" alt="" /></a></p>
<p>With the interfaces and commands in place we can add a couple of projects to show how each side will be used. First the producer which will just write commands to our queue:</p>
<pre class="brush:csharp">class Program
{
    private static readonly ManualResetEvent Reset = new ManualResetEvent(false);
    private static long lastWrite;
    private static long writeCount;
    private static Timer timer;
    private static readonly object _sync = new object();

    static void Main(string[] args)
    {
        Console.WriteLine("Publisher");
        Console.WriteLine("Press 'R' to Run, 'P' to Pause, 'X' to Exit ...");

        timer = new Timer(TickTock, null, 1000, 1000);

        var t = new Thread(Run);
        t.Start();

        var running = true;
        while (running)
        {
            if (!Console.KeyAvailable) continue;

            var keypress = Console.ReadKey(true);
            switch (keypress.Key)
            {
                case ConsoleKey.X:
                    Reset.Reset();
                    running = false;
                    break;
                case ConsoleKey.P:
                    Reset.Reset();
                    Console.WriteLine("Paused ...");
                    break;
                case ConsoleKey.R:
                    Reset.Set();
                    Console.WriteLine("Running ...");
                    break;
            }
        }

        t.Abort();
    }

    public static void Run()
    {
        IPublish&lt;ExampleMessage&gt; queue = Configuration.GetQueue&lt;ExampleMessage&gt;();

        var i = 0;

        while (true)
        {
            Reset.WaitOne();
            i++;

            var message = new ExampleMessage(i, "I am number " + i);
            queue.Send(message);
            Interlocked.Increment(ref writeCount);

            if (i == int.MaxValue)
                i = 0;
        }
    }

    public static void TickTock(object state)
    {
        lock (_sync)
        {
            Console.WriteLine("Sent {0} {1}", writeCount, writeCount - lastWrite);
            lastWrite = writeCount;
        }
    }
}</pre>
<p>… and the consumer which will read from the queue:</p>
<pre class="brush:csharp">class Program
{
    private static readonly ManualResetEvent Reset = new ManualResetEvent(false);
    private static long lastRead;
    private static long readCount;
    private static Timer timer;
    private static readonly object _sync = new object();

    static void Main(string[] args)
    {
        Console.WriteLine("Subscriber");
        Console.WriteLine("Press 'R' to Run, 'P' to Pause, 'X' to Exit ...");

        timer = new Timer(TickTock, null, 1000, 1000);

        var t = new Thread(Run);
        t.Start();

        var running = true;
        while (running)
        {
            if (!Console.KeyAvailable) continue;

            var keypress = Console.ReadKey(true);
            switch (keypress.Key)
            {
                case ConsoleKey.X:
                    Reset.Reset();
                    running = false;
                    break;
                case ConsoleKey.P:
                    Reset.Reset();
                    Console.WriteLine("Paused ...");
                    break;
                case ConsoleKey.R:
                    Reset.Set();
                    Console.WriteLine("Running ...");
                    break;
            }
        }

        t.Abort();
    }

    public static void Run()
    {
        ISubscribe&lt;ExampleMessage&gt; queue = Configuration.GetQueue&lt;ExampleMessage&gt;();

        while (true)
        {
            Reset.WaitOne();
            var message = queue.Receive();
            Interlocked.Increment(ref readCount);
        }
    }

    public static void TickTock(object state)
    {
        lock (_sync)
        {
            Console.WriteLine("Received {0} {1}", readCount, readCount - lastRead);
            lastRead = readCount;
        }
    }
}</pre>
<p>Both show the total number of messages sent or received and also the number in the last second.</p>
<p>Finally, the MongoQueue implementation. It could be a little simpler but I wanted to make sure things were as simple as possible for the consumers and should be easy enough to follow.</p>
<pre class="brush:csharp">public class MongoQueue&lt;T&gt; : IPublish&lt;T&gt;, ISubscribe&lt;T&gt; where T : class
{
    private readonly MongoDatabase _database;
    private readonly MongoCollection&lt;MongoMessage&lt;T&gt;&gt; _queue;	// the collection for the messages
    private readonly MongoCollection&lt;BsonDocument&gt; _position;	// used to record the current position
    private readonly QueryComplete _positionQuery;

    private ObjectId _lastId = ObjectId.Empty;					// the last _id read from the queue

    private MongoCursorEnumerator&lt;MongoMessage&lt;T&gt;&gt; _enumerator;	// our cursor enumerator
    private bool _startedReading = false;						// initial query on an empty collection is a special case

    public MongoQueue(string connectionString, long queueSize)
    {
        // our queue name will be the same as the message class
        var queueName = typeof(T).Name;
        _database = MongoDatabase.Create(connectionString);

        if (!_database.CollectionExists(queueName))
        {
            try
            {
                Console.WriteLine("Creating queue '{0}' size {1}", queueName, queueSize);

                var options = CollectionOptions
                    // use a capped collection so space is pre-allocated and re-used
                    .SetCapped(true)
                    // we don't need the default _id index that MongoDB normally created automatically
                    .SetAutoIndexId(false)
                    // limit the size of the collection and pre-allocated the space to this number of bytes
                    .SetMaxSize(queueSize);

                _database.CreateCollection(queueName, options);
            }
            catch
            {
                // assume that any exceptions are because the collection already exists ...
            }
        }

        // get the queue collection for our messages
        _queue = _database.GetCollection&lt;MongoMessage&lt;T&gt;&gt;(queueName);

        // check if we already have a 'last read' position to start from
        _position = _database.GetCollection("_queueIndex");
        var last = _position.FindOneById(queueName);
        if (last != null)
            _lastId = last["last"].AsObjectId;

        _positionQuery = Query.EQ("_id", queueName);
    }

    public void Send(T message)
    {
        // sending a message is easy - we just insert it into the collection
        // it will be given a new sequential Id and also be written to the end (of the capped collection)
        _queue.Insert(new MongoMessage&lt;T&gt;(message));
    }

    public T Receive()
    {
        // for reading, we give the impression to the client that we provide a single message at a time
        // which means we maintain a cursor and enumerator in the background and hide it from the caller

        if (_enumerator == null)
            _enumerator = InitializeCursor();

        // there is no end when you need to sit and wait for messages to arrive
        while (true)
        {
            try
            {
                // do we have a message waiting?
                // this may block on the server for a few seconds but will return as soon as something is available
                if (_enumerator.MoveNext())
                {
                    // yes - record the current position and return it to the client
                    _startedReading = true;
                    _lastId = _enumerator.Current.Id;
                    _position.Update(_positionQuery, Update.Set("last", _lastId), UpdateFlags.Upsert, SafeMode.False);
                    return _enumerator.Current.Message;
                }

                if (!_startedReading)
                {
                    // for an empty collection, we'll need to re-query to be notified of new records
                    Thread.Sleep(500);
                    _enumerator.Dispose();
                    _enumerator = InitializeCursor();
                }
                else
                {
                    // if the cursor is dead then we need to re-query, otherwise we just go back to iterating over it
                    if (_enumerator.IsDead)
                    {
                        _enumerator.Dispose();
                        _enumerator = InitializeCursor();
                    }
                }
            }
            catch (IOException)
            {
                _enumerator.Dispose();
                _enumerator = InitializeCursor();
            }
            catch (SocketException)
            {
                _enumerator.Dispose();
                _enumerator = InitializeCursor();
            }
        }
    }

    private MongoCursorEnumerator&lt;MongoMessage&lt;T&gt;&gt; InitializeCursor()
    {
        var cursor = _queue
            .Find(Query.GT("_id", _lastId))
            .SetFlags(
                QueryFlags.AwaitData |
                QueryFlags.NoCursorTimeout |
                QueryFlags.TailableCursor
            )
            .SetSortOrder(SortBy.Ascending("$natural"));

        return (MongoCursorEnumerator&lt;MongoMessage&lt;T&gt;&gt;)cursor.GetEnumerator();
    }
}</pre>
<p>After opening a cursor we get an enumerator and try to read records. The call to MoveNext() will block for a few seconds if we’re already at the end of the cursor and may then timeout without returning anything. In this case we need to dispose of the enumerator and get another from the cursor but we don’t need to re-run the query – it’s still connected and available and we just need to ‘get more’ on it.</p>
<p>The reason for the _startedReading flag is that the initial query against an empty collection will result in an invalid cursor and we need to re-query in this case. However, we don’t want to re-query after that as it’s more efficient to let the cursor wait for additional results (unless the cursor is dead when we do need to re-query).</p>
<p>Occasionally, the connection will be broken which will cause an exception so we need to catch that and setup the cursor and enumerator again.</p>
<p>Assuming we got a record back then we return it to the client (yield return) and go back to get the next item. We also store the position of the last item read in the queue so that when we re-start we can skip any existing entries.</p>
<p>Here is an explanation of the query flags.</p>
<p>Query Flags:</p>
<p><strong>AwaitData</strong></p>
<p>If we get to the end of the cursor and there is no data we’d like the server to wait for a while until some more arrives. The default appears to be around 2-4 seconds.</p>
<p><strong>TailableCursor</strong></p>
<p>Indicates that we want a tailable cursor where it will wait for new data to arrive.</p>
<p><strong>NoCursorTimeout</strong></p>
<p>We don’t want our cursor to timeout.</p>
<p>So there it is – a simple but easy to use message queue or service bus that hopefully makes splitting an app into multiple processes with re-startability and fast asynchronous communication a little less challenging. I’ve found the performance of MongoDB to be outstanding and ease of setting this up beats the ‘proper’ message queue solutions. When it comes to the cloud, the small amount of blocking that the cursor does at the server saves us having to do a lot of polling while still giving us the fast low-latency response we want.</p>
<p>Please let me know what you think of the article and if you run into any issues or have any ideas for improvement for this approach.</p>
<p>UPDATED: Source code now on GitHub (<a href="https://github.com/CaptainCodeman/mongo-queue">https://github.com/CaptainCodeman/mongo-queue</a>)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/291/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=291&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/video.png" medium="image">
			<media:title type="html">video</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/queue.png" medium="image">
			<media:title type="html">queue</media:title>
		</media:content>
	</item>
		<item>
		<title>Elmah Error Logging with MongoDB Official Driver</title>
		<link>http://captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/</link>
		<comments>http://captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/#comments</comments>
		<pubDate>Sat, 28 May 2011 20:23:31 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[elmah]]></category>
		<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/</guid>
		<description><![CDATA[This basically takes the work that Pablo M. Cibraro did here to use Elmah with the Samus CSharp Driver and converts it to work with the Official 10Gen CSharp Driver instead plus a few additional minor changes. <a href="http://captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=286&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This basically takes the work that <a href="http://weblogs.asp.net/cibrax/about.aspx">Pablo M. Cibraro</a> did to <a href="http://weblogs.asp.net/cibrax/archive/2011/05/27/integrating-elmha-with-mongodb.aspx">use Elmah with the Samus CSharp Driver</a> and converts it to work with the <a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center">Official 10Gen CSharp Driver</a> instead plus a few additional minor changes:</p>
<ol>
<li>A capped collection is still used but the maximum size (in bytes) and the document limit can now be set using the ‘maxDocuments’ and ‘maxSize’ parameters in the configuration. By default the limit is based on size only with 100mb allocated.</li>
<li>The paged-results for the Elmah reporting page are sorted in descending order so the latest errors are shown first. This uses the $natural sort order of the capped collection.</li>
<li>I’ve used the <a href="http://www.mongodb.org/display/DOCS/Object+IDs">native MongoDB ObjectId</a> for the error id which should be slightly faster that using a Guid and sorts better (also, if you were interested in saving a few bytes this stores the date and time too so could avoid saving it separately).</li>
<li>Finally, I’ve use the convention of calling the collection ‘Elmah’ when there is no ApplicationName set and ‘Elmah-ApplicationName’ when it is.</li>
</ol>
<p>Configuration is very similar (but uses the 10Gen driver connection string format):</p>
<pre class="brush:xml">&lt;elmah&gt;
    &lt;errorLog type="Elmah.MongoErrorLog, Elmah.MongoDB" connectionStringName="ELMAH.MongoDB" maxSize="10485760" maxDocuments="10000" /&gt;
&lt;/elmah&gt;
&lt;connectionStrings&gt;
    &lt;add name="ELMAH.MongoDB" connectionString="server=localhost;database=elmah;"/&gt;
&lt;/connectionStrings&gt;</pre>
<p>The <a href="http://www.captaincodeman.com/wp-content/uploads/2011/05/Elmah-MongoDB-src.zip">source code</a> and <a href="http://www.captaincodeman.com/wp-content/uploads/2011/05/Elmah-MongoDB-bin.zip">compiled binaries</a> are attached. I’ll look at submitting this to the Elmah codebase.</p>
<p>Thanks again to Pablo for doing the hard work !</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/286/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=286&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>
	</item>
		<item>
		<title>Running ElasticSearch as a Service on Windows 2008 x64</title>
		<link>http://captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/</link>
		<comments>http://captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/#comments</comments>
		<pubDate>Fri, 20 May 2011 15:57:14 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[elasticsearch]]></category>
		<category><![CDATA[full-text]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[procrun]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[x64]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/</guid>
		<description><![CDATA[How to run ElasticSearch as a Windows Service on Windows 2008 x64 <a href="http://captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=281&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I think I first started using <a href="http://lucene.apache.org/java/docs/index.html">Apache Lucene</a> for full-text indexing as part of NHibernate Search. At some point I decided I needed more control and did my own indexing using Lucene directly. Now, it seems the easiest approach is to make use of a packaged up search service and so I’ve been looking at <a href="http://www.elasticsearch.org/">ElasticSearch</a>. So far, I’m very happy with it – it’s doing everything it say’s on the box and lets me offload all the full-text indexing and search functionality.</p>
<p>The only issue I’ve come across is trying to run it as a service on 64-bit Windows 7 or Windows 2008. While there is a <a href="https://github.com/elasticsearch/elasticsearch-servicewrapper">service-wrapper</a> available it just wasn’t working for me and I think the x64 platform may be part of that as there was only a elasticsearch-windows-x86-<strong><span style="text-decoration:underline;">32</span></strong>.exe included, no elasticsearch-windows-x86-<strong><span style="text-decoration:underline;">64</span></strong>.exe. This service wrapper seems to be based off a product that doesn’t appear to have a free community edition for 64-bit Windows.</p>
<p>So, I had a hunt around for ‘how to run a Java app as a Windows Service’ and came across the <a href="http://commons.apache.org/daemon/procrun.html">Apache Commons Daemon</a> or ‘<a href="http://commons.apache.org/daemon/procrun.html">procrun</a>‘. This worked so I thought I’d share it here in case anyone else is trying to do the same thing.</p>
<p>First of all, there are the pre-requisites: it’s a Java app so you need to have the Sun Java SDK installed and JAVA_HOME environment variable set.</p>
<p><a href="http://www.elasticsearch.org/download">Download ElasticSearch</a> and extract it to a folder. I’m using 0.16.0 and put it into D:elasticsearch (because Program Files and UAC caused too many issues for me).</p>
<p>Before trying to set it to run as a service it’s best to make sure it runs as a regular app first. To start ElasticSearch on Windows there is a “binelasticsearch.bat” file to launch it which should show it running. As an extra check, there is a handy little web-based admin tool you can get called <a href="https://github.com/mobz/elasticsearch-head">elasticsearch-head</a> which will show the running status and provides a neat little browser / search interface. I extract this to D:elasticsearchtools. When you open the index.html file it lets you connect to your elasticsearch instance and show it’s status:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/created.png"><img style="border-style:initial;border-color:initial;border-image:initial;border-width:0;" title="created" src="http://captaincodeman.files.wordpress.com/2012/04/created-300x191.png?w=300&#038;h=191" alt="created" width="300" height="191" border="0" /></a></p>
<p>Downloading the Apache Commons Daemon or procrun is a little harder because it isn’t in the links on the <a href="http://commons.apache.org/daemon/download_daemon.cgi">download page</a>. Instead you need to follow the ‘browse native binaries download area…’ link, then look in the windows folder for the zip file. The file I used was: <a title="http://apache.skazkaforyou.com//commons/daemon/binaries/1.0.5/windows/commons-daemon-1.0.5-bin-windows.zip" href="http://apache.skazkaforyou.com//commons/daemon/binaries/1.0.5/windows/commons-daemon-1.0.5-bin-windows.zip">commons-daemon-1.0.5-bin-windows.zip</a></p>
<p>Extract this to D:elasticsearchservice and then copy the amd64prunsrv.exe to the D:elasticsearchservice folder to replace the x86 version (or skip this step if you are actually running on a 32-bit OS).</p>
<p>Although we can set everything up with the exe files as they are, we’re going to rename them because it makes it clearer what is running on Windows Task Manager if you have other processes using this service runner. The convention is to use the service name and append a ‘w’ to the GUI manager exe so they become:</p>
<p>prunsvr.exe =&gt; ElasticSearch.exe<br />
prunmgr.exe =&gt; ElasticSearchw.exe</p>
<p>Because we’ll be running things as a service it will be running under a different account than the regular process does when we run it interactively. I used the ‘NETWORK SERVICE’ account which is able to handle network traffic and gave this account full permissions to the D:elasticsearch folder so it will also be able to create data and log files.</p>
<p>Figuring out the command line to actually run the service is what took the longest. With a bit of trial and error and looking at the output from the batch file to launch elasticsearch I ended up with this which ‘works on my machine’. If it doesn’t work on yours try enabling the echo output from the batch file and checking the parameters are the same.</p>
<p>It’s easiest to put this into a create.cmd file to make editing and running it easier:</p>
<pre>ElasticSearch.exe //IS//ElasticSearch --DisplayName="ElasticSearch" --Description="Distributed RESTful Full-Text Search Engine based on Lucene (http://www.elasticsearch.org/) --Install=D:elasticsearchserviceElasticSearch.exe --Classpath="D:elasticsearchlibelasticsearch-0.16.0.jar;D:elasticsearchlib*;D:elasticsearchlibsigar*" --Jvm="C:Program FilesJavajre6binserverjvm.dll" --JvmMx=512 --JvmOptions="-Xms256m;-Xmx1g;-XX:+UseCompressedOops;-Xss128k;-XX:+UseParNewGC;-XX:+UseConcMarkSweepGC;-XX:+CMSParallelRemarkEnabled;-XX:SurvivorRatio=8;-XX:MaxTenuringThreshold=1;-XX:CMSInitiatingOccupancyFraction=75;-XX:+UseCMSInitiatingOccupancyOnly;-XX:+HeapDumpOnOutOfMemoryError;-Djline.enabled=false;-Delasticsearch;-Des-foreground=yes;-Des.path.home=D:elasticsearch" --StartMode=jvm --StartClass=org.elasticsearch.bootstrap.Bootstrap --StartMethod=main --StartParams="" --StopMode=jvm --StopClass=org.elasticsearch.bootstrap.Bootstrap --StopMethod=main --StdOutput=auto --StdError=auto --LogLevel=Debug --LogPath="D:elasticsearchlogs" --LogPrefix=service --ServiceUser="NT AUTHORITYNetworkService" --Startup=auto</pre>
<p>Phew !</p>
<p>Running that should create the service and running the ElasticSearchw.exe should how pop-up a GUI that lets us view and edit all the settings. The various tabs are shown below and should correspond to the settings defined above:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/1-general.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="1-general" src="http://captaincodeman.files.wordpress.com/2012/04/1-general_thumb.png?w=584" alt="1-general" border="0" /></a> <a href="http://captaincodeman.files.wordpress.com/2012/04/2-logon.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="2-logon" src="http://captaincodeman.files.wordpress.com/2012/04/2-logon_thumb.png?w=584" alt="2-logon" border="0" /></a></p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/3-logging.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="3-logging" src="http://captaincodeman.files.wordpress.com/2012/04/3-logging_thumb.png?w=584" alt="3-logging" border="0" /></a><a href="http://captaincodeman.files.wordpress.com/2012/04/4-java.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="4-java" src="http://captaincodeman.files.wordpress.com/2012/04/4-java_thumb.png?w=584" alt="4-java" border="0" /></a></p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/5-startup.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="5-startup" src="http://captaincodeman.files.wordpress.com/2012/04/5-startup_thumb.png?w=584" alt="5-startup" border="0" /></a> <a href="http://captaincodeman.files.wordpress.com/2012/04/6-shutdown.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;margin:10px;" title="6-shutdown" src="http://captaincodeman.files.wordpress.com/2012/04/6-shutdown_thumb.png?w=584" alt="6-shutdown" border="0" /></a></p>
<p>You can also have the GUI run as a task-tray which gives you a handy way to start and stop the service while you’re developing. To do this, create a monitor.cmd file with the following command:</p>
<pre>start ElasticSearchw.exe //MS</pre>
<p>You should be able to right-click on the new tray icon and start the service:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/starting.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;" title="starting" src="http://captaincodeman.files.wordpress.com/2012/04/starting_thumb.png?w=584" alt="starting" border="0" /></a></p>
<p>This isn’t mandatory though – the service should appear in the normal Windows Service Manager where it can be stopped and started as usual:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/windows-services.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-style:initial;border-color:initial;border-image:initial;border-width:0;" title="windows-services" src="http://captaincodeman.files.wordpress.com/2012/04/windows-services_thumb.png?w=584" alt="windows-services" border="0" /></a></p>
<p>Whether everything starts or not, you should get some useful information written to the log files. Here’s how mine looked after the service was started successfully.</p>
<p>service.2011-05-19.log:</p>
<pre style="font-size:9px;">[2011-05-19 10:21:30] [debug] ( prunsrv.c:1494) Commons Daemon procrun log initialized
[2011-05-19 10:21:30] [info]  (          :0   ) Commons Daemon procrun (1.0.5.0 64-bit) started
[2011-05-19 10:21:30] [info]  (          :0   ) Running 'ElasticSearch' Service...
[2011-05-19 10:21:30] [debug] ( prunsrv.c:1246) Inside ServiceMain...
[2011-05-19 10:21:30] [info]  (          :0   ) Starting service...
[2011-05-19 10:21:30] [debug] ( javajni.c:206 ) loading jvm 'C:Program FilesJavajre6binserverjvm.dll'
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[0] -Xms256m
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[1] -Xmx1g
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[2] -XX:+UseCompressedOops
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[3] -Xss128k
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[4] -XX:+UseParNewGC
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[5] -XX:+UseConcMarkSweepGC
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[6] -XX:+CMSParallelRemarkEnabled
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[7] -XX:SurvivorRatio=8
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[8] -XX:MaxTenuringThreshold=1
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[9] -XX:CMSInitiatingOccupancyFraction=75
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[10] -XX:+UseCMSInitiatingOccupancyOnly
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[11] -XX:+HeapDumpOnOutOfMemoryError
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[12] -Djline.enabled=false
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[13] -Delasticsearch
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[14] -Des-foreground=yes
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[15] -Des.path.home=D:elasticsearch
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[16] -Djava.class.path=C:Program Files (x86)Javajre6libextQTJava.zip;D:elasticsearchlibelasticsearch-0.16.1.jar;D:elasticsearchlibelasticsearch-0.16.1.jar;D:elasticsearchlibjline-0.9.94.jar;D:elasticsearchlibjna-3.2.7.jar;D:elasticsearchliblog4j-1.2.15.jar;D:elasticsearchliblucene-analyzers-3.1.0.jar;D:elasticsearchliblucene-core-3.1.0.jar;D:elasticsearchliblucene-highlighter-3.1.0.jar;D:elasticsearchliblucene-memory-3.1.0.jar;D:elasticsearchliblucene-queries-3.1.0.jar;D:elasticsearchlibsigarsigar-1.6.4.jar
[2011-05-19 10:21:30] [debug] ( javajni.c:660 ) Jvm Option[17] -Xmx512m
[2011-05-19 10:21:31] [debug] ( javajni.c:891 ) Java Worker thread started org/elasticsearch/bootstrap/Bootstrap:main
[2011-05-19 10:21:32] [debug] ( prunsrv.c:1058) Java started org/elasticsearch/bootstrap/Bootstrap
[2011-05-19 10:21:32] [info]  (          :0   ) Service started in 2066 ms.
[2011-05-19 10:21:32] [debug] ( prunsrv.c:1369) Waiting for worker to finish...
[2011-05-19 10:21:39] [debug] ( javajni.c:907 ) Java Worker thread finished org/elasticsearch/bootstrap/Bootstrap:main with status=0
[2011-05-19 10:21:39] [debug] ( prunsrv.c:1374) Worker finished.
[2011-05-19 10:21:39] [debug] ( prunsrv.c:1397) Waiting for all threads to exit</pre>
<p>elasticsearch.log:</p>
<pre style="font-size:9px;">[2011-05-19 10:21:32,709][INFO ][node                     ] [Hack] {elasticsearch/0.16.1}[2344]: initializing ...
[2011-05-19 10:21:32,711][INFO ][plugins                  ] [Hack] loaded []
[2011-05-19 10:21:36,149][INFO ][node                     ] [Hack] {elasticsearch/0.16.1}[2344]: initialized
[2011-05-19 10:21:36,150][INFO ][node                     ] [Hack] {elasticsearch/0.16.1}[2344]: starting ...
[2011-05-19 10:21:36,268][INFO ][transport                ] [Hack] bound_address {inet[/0.0.0.0:9300]}, publish_address {inet[/10.0.1.8:9300]}
[2011-05-19 10:21:39,311][INFO ][cluster.service          ] [Hack] new_master [Hack][Gkn9PLFTR0KdX2X__ybpIQ][inet[/10.0.1.8:9300]], reason: zen-disco-join (elected_as_master)
[2011-05-19 10:21:39,337][INFO ][discovery                ] [Hack] elasticsearch/Gkn9PLFTR0KdX2X__ybpIQ
[2011-05-19 10:21:39,351][INFO ][gateway                  ] [Hack] recovered [0] indices into cluster_state
[2011-05-19 10:21:39,366][INFO ][http                     ] [Hack] bound_address {inet[/0.0.0.0:9200]}, publish_address {inet[/10.0.1.8:9200]}
[2011-05-19 10:21:39,366][INFO ][node                     ] [Hack] {elasticsearch/0.16.1}[2344]: started</pre>
<p>Hopefully, this helps you get ElasticSearch up and running as a service on Windows x64. It’s a great app and really worth looking at. I’m hoping to make good use of it on a couple of projects, particularly the faceted search feature.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/281/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/281/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=281&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/created-300x191.png" medium="image">
			<media:title type="html">created</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/1-general_thumb.png" medium="image">
			<media:title type="html">1-general</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/2-logon_thumb.png" medium="image">
			<media:title type="html">2-logon</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/3-logging_thumb.png" medium="image">
			<media:title type="html">3-logging</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/4-java_thumb.png" medium="image">
			<media:title type="html">4-java</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/5-startup_thumb.png" medium="image">
			<media:title type="html">5-startup</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/6-shutdown_thumb.png" medium="image">
			<media:title type="html">6-shutdown</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/starting_thumb.png" medium="image">
			<media:title type="html">starting</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/windows-services_thumb.png" medium="image">
			<media:title type="html">windows-services</media:title>
		</media:content>
	</item>
		<item>
		<title>Limit MongoDB memory use on Windows without Virtualization</title>
		<link>http://captaincodeman.com/2011/02/27/limit-mongodb-memory-use-windows/</link>
		<comments>http://captaincodeman.com/2011/02/27/limit-mongodb-memory-use-windows/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 17:25:29 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=260</guid>
		<description><![CDATA[How to limit MongoDB memory use on Windows without virtualization by making use of the Windows System Resource Manager. <a href="http://captaincodeman.com/2011/02/27/limit-mongodb-memory-use-windows/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=260&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img style="display:inline;" src="http://captaincodeman.files.wordpress.com/2012/04/logo-mongodb-onwhite.png?w=584" alt="" align="right" /></p>
<p>I’ve seen the question of how to control MongoDB’s memory usage on Windows come up several times and the stock answer always seemed to be “you can’t – it uses memory-mapped files and if you want to limit resources you need to use some form of virtualization to do it (HyperV, VMWare, Virtuozzo etc…)”.</p>
<p><img style="display:inline;" title="win2008r2" src="http://captaincodeman.files.wordpress.com/2012/04/win2008r2_thumb.png?w=584" alt="win2008r2" align="right" /></p>
<p>If you are using MongoDB on a dedicated server then you generally <em>want</em> it to use all the memory it can but if you want to use it on a server shared with other processes (e.g. an IIS website using MongoDB for storage, maybe with SQL Server as well) then you <strong><em>will</em></strong> want to put a cap on how much it uses to ensure memory is kept available for the other processes.</p>
<p>So is it possible if you are not on a virtualized environment? Yes (otherwise this would be a very short blog post!) and we’ll explore how …</p>
<p>The standard behaviour described above is actually a result of the default resource manager used by Windows but both Windows 2003 and Windows 2008 have a separate installable option called the “Windows System Resource Manager” (WSRM) that allows greater control over the CPU and Memory available to a process.</p>
<p>First of all, lets look at what we’re trying to solve. Here we have a low-memory server (only 2Gb) running MongoDB on Windows 2008 R2 x64. There are a few databases of a few Gb each so the mongod.exe process quickly starts consuming as much memory as it can (rightly so) to keep as much of it’s indexes in memory for the fast performance we know and love:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/2-performance.png"><img style="display:inline;" title="2-performance" src="http://captaincodeman.files.wordpress.com/2012/04/2-performance_thumb.png?w=584" alt="2-performance" /></a></p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/1-processes.png"><img style="display:inline;" title="1-processes" src="http://captaincodeman.files.wordpress.com/2012/04/1-processes_thumb.png?w=584" alt="1-processes" /></a></p>
<p>What we’d like to do is save some memory for other processes by limiting the mongod.exe process to 1Gb in this case (I know this is ridiculously low but the only thing that will change for you are the actual limits you want to use).</p>
<p>To do this we first need to install Windows System Resource Manager which on Windows 2008 is available under the Features section of the Server Manager.</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/windows-features.png"><img style="display:inline;" title="windows-features" src="http://captaincodeman.files.wordpress.com/2012/04/windows-features_thumb.png?w=584" alt="windows-features" /></a></p>
<p>Once that’s installed fire it up and you’ll see the default resource management policies. By default the standard Windows “memory is given to whoever shouts loudest” policy is used but other pre-configured alternatives are available. WSRM also provides a calendar / event system where the policy can be changed at certain times (a typical scenario is giving critical business apps priority during the day but then batch processes greater priority overnight). We’re not going to go into the calendar features here but it’s interesting to know about.</p>
<p>Let’s create a new policy to control the resources that MongoDB can consume. To do this, right click on the “Resource Allocation Policies” container and chose “New Resource Allocation Policy …”. This will present us with the New Resource Allocation Policy dialog below:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/6-new.png"><img style="display:inline;" title="6-new" src="http://captaincodeman.files.wordpress.com/2012/04/6-new_thumb.png?w=584" alt="6-new" /></a></p>
<p>First of all, we need to add a new resource allocation entry so click the ‘Add…’ button and we get to another “Add or Edit Resource Allocation” dialog:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/7-add.png"><img style="display:inline;" title="7-add" src="http://captaincodeman.files.wordpress.com/2012/04/7-add_thumb.png?w=584" alt="7-add" /></a></p>
<p>We don’t have a Process matching criteria for MongoDB yet so choose &lt;New…&gt; to get … yes, you guessed – another dialog, this time “New Process Matching Criteria”. We’ll call it “mongod_process” and click the Add… button to get another death-by-dialog to define it.</p>
<p>There are a few ways to do this – if MongoDB is installed as a service then you can choose “Registered Service” in the drop-down, click “Select” and choose it from the list or you can select from a list of running processes or you can just enter the full path and filename to mongod.exe. Here is the entry after selecting an installed MongoDB Windows Service:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/9-edit-rule.png"><img style="display:inline;" title="9-edit-rule" src="http://captaincodeman.files.wordpress.com/2012/04/9-edit-rule_thumb.png?w=584" alt="9-edit-rule" /></a></p>
<p>After clicking OK we get back to the Process Matching Criteria dialog showing our new rule:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/10-mongod-process-criteria.png"><img style="display:inline;" title="10-mongod-process-criteria" src="http://captaincodeman.files.wordpress.com/2012/04/10-mongod-process-criteria_thumb.png?w=584" alt="10-mongod-process-criteria" /></a></p>
<p>After clicking OK we’re now back at the Resource Allocation dialog with the new “mongod_process” Process matching criteria selected and can now decide what resources we want to allocate to the process. Lets limit the CPU to 50% (not that MongoDB seems to consume much CPU):</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/11-allocation-general.png"><img style="display:inline;" title="11-allocation-general" src="http://captaincodeman.files.wordpress.com/2012/04/11-allocation-general_thumb.png?w=584" alt="11-allocation-general" /></a></p>
<p>The Memory tab allows us to limit the memory and here there are two options. The maximum committed memory limit is more to control apps that may have a memory leak and can be setup to stop or alert someone when the process goes above the configured limit. We don’t want this one … instead we’ll set a maximum working set limit which will control how much memory is allocated to MongoDB. In this case, we’ll set the limit to 1Gb but the actual value to use will depend on your circumstances:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/12-allocation-memory.png"><img style="display:inline;" title="12-allocation-memory" src="http://captaincodeman.files.wordpress.com/2012/04/12-allocation-memory_thumb.png?w=584" alt="12-allocation-memory" /></a></p>
<p>After clicking OK we should then be at the Resource Allocation Policy dialog with our process matching criteria, CPU and memory limits shown. We could include more limits in the policy but we’ll leave it as it is for now – any remaining resources will be allocated to other processes as normal after the limits have been imposed.</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/13-limit-mongo-policy.png"><img style="display:inline;" title="13-limit-mongo-policy" src="http://captaincodeman.files.wordpress.com/2012/04/13-limit-mongo-policy_thumb.png?w=584" alt="13-limit-mongo-policy" /></a></p>
<p>The final piece is to make this policy active which is done by clicking on the “Selected Policy” link on the main ‘page’ or right-clicking on the new entry under the “Resource Allocation Policies” and choosing “Set as Managing Policy&#8217;”. You can also right-click on the “Windows System Resource Manager (local)” entry and choose “Properties …” to display the dialog below which allows you to select the Current resource allocation policy:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/14-properties.png"><img style="display:inline;" title="14-properties" src="http://captaincodeman.files.wordpress.com/2012/04/14-properties_thumb.png?w=584" alt="14-properties" /></a></p>
<p>So, we’ve created a new policy that has a criteria to match the mongod.exe process which will limit the CPU usage to 50% and memory to 1Gb … does it work? Here’s the result after it’s enabled showing the memory used immediately dropping:</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/15-performance.png"><img style="display:inline;" title="15-performance" src="http://captaincodeman.files.wordpress.com/2012/04/15-performance_thumb.png?w=584" alt="15-performance" /></a></p>
<p>… and the MongoDB / mongod.exe process using the 1Gb limit we specified (1Gb = 1024Mb = 1,048,576Kb).</p>
<p><a href="http://captaincodeman.files.wordpress.com/2012/04/16-processes.png"><img style="display:inline;" title="16-processes" src="http://captaincodeman.files.wordpress.com/2012/04/16-processes_thumb.png?w=584" alt="16-processes" /></a></p>
<p>So, we’ve successfully limited the CPU and memory that MongoDB can consume without havign to resort to any form of server-virtualization and while MongoDB will probably not run as fast as it did when it had free-reign to consume as much as it wanted (or rather, when the default windows resource manager gave it what it asked for) we will probably have a faster overall system as our other processes are allocated the memory and CPU that they need for a better balanced system.</p>
<p>Please let me know what you think of the above technique and if you find it useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=260&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2011/02/27/limit-mongodb-memory-use-windows/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/logo-mongodb-onwhite.png" medium="image" />

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/win2008r2_thumb.png" medium="image">
			<media:title type="html">win2008r2</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/2-performance_thumb.png" medium="image">
			<media:title type="html">2-performance</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/1-processes_thumb.png" medium="image">
			<media:title type="html">1-processes</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/windows-features_thumb.png" medium="image">
			<media:title type="html">windows-features</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/6-new_thumb.png" medium="image">
			<media:title type="html">6-new</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/7-add_thumb.png" medium="image">
			<media:title type="html">7-add</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/9-edit-rule_thumb.png" medium="image">
			<media:title type="html">9-edit-rule</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/10-mongod-process-criteria_thumb.png" medium="image">
			<media:title type="html">10-mongod-process-criteria</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/11-allocation-general_thumb.png" medium="image">
			<media:title type="html">11-allocation-general</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/12-allocation-memory_thumb.png" medium="image">
			<media:title type="html">12-allocation-memory</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/13-limit-mongo-policy_thumb.png" medium="image">
			<media:title type="html">13-limit-mongo-policy</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/14-properties_thumb.png" medium="image">
			<media:title type="html">14-properties</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/15-performance_thumb.png" medium="image">
			<media:title type="html">15-performance</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/16-processes_thumb.png" medium="image">
			<media:title type="html">16-processes</media:title>
		</media:content>
	</item>
		<item>
		<title>Error with Azure local development storage and table named &#8216;event&#8217;</title>
		<link>http://captaincodeman.com/2010/06/30/error-azure-local-development-storage-table-named-event/</link>
		<comments>http://captaincodeman.com/2010/06/30/error-azure-local-development-storage-table-named-event/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 01:53:34 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[cqrs]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.captaincodeman.com/?p=217</guid>
		<description><![CDATA[While working on an Azure event-sourcing provider for my CQRS framework I came across a really strange problem so I&#8217;m posting the details in-case anyone else comes across a similar issue so they can save wasting as much time on &#8230; <a href="http://captaincodeman.com/2010/06/30/error-azure-local-development-storage-table-named-event/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=217&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>While working on an Azure event-sourcing provider for my CQRS framework I came across a really strange problem so I&#8217;m posting the details in-case anyone else comes across a similar issue so they can save wasting as much time on it as I did! Basically, the local development storage doesn&#8217;t seem to like you having a table called &#8216;event&#8217; (I haven&#8217;t tested it on the live system).</p>
<p>Here is some test code to demonstrate the behavior:</p>
<pre class="brush:csharp">class Program
{
    static void Main(string[] args)
    {
        const string tableName = "test";
        var storageAccount = CloudStorageAccount.DevelopmentStorageAccount;

        var tableClient = storageAccount.CreateCloudTableClient();
        tableClient.CreateTableIfNotExist(tableName);

        var dataContext = tableClient.GetDataServiceContext();

        var bobdylan = new Artist
            {
                PartitionKey = "folk",
                RowKey = "bob-dylan",
                Name = "Bob Dylan"
            };

        dataContext.AddObject(tableName, bobdylan);
        dataContext.SaveChanges();
    }
}

[DataServiceKey("PartitionKey", "RowKey")]
public class Artist
{
    public virtual String PartitionKey { get; set; }
    public virtual String RowKey { get; set; }
    public DateTime Timestamp { get; set; }
    public string Name { get; set; }
}</pre>
<p>With the table called &#8216;test&#8217; in the example shown everything works fine and the table and data appear in the storage explorer:</p>
<p><a href="http://captaincodeman.com/?attachment_id=214" rel="attachment wp-att-214"><img class="alignnone  wp-image-214" title="azure-table-working" src="http://captaincodeman.files.wordpress.com/2012/04/azure-table-working.png?w=584" alt="" /></a></p>
<p>If we change the table name to &#8220;event&#8221; though we&#8217;ll get a DataServiceRequestException raised when we attempt to save changes:</p>
<p><a href="http://captaincodeman.com/?attachment_id=218" rel="attachment wp-att-218"><img class="alignnone  wp-image-218" title="azure-table-error" src="http://captaincodeman.files.wordpress.com/2012/04/azure-table-error.png?w=584" alt="" /></a></p>
<p>Strangely, the table <strong><em>does</em></strong> get created OK but just won&#8217;t let you save anything into it. I originally thought this may be an issue with a SQL reserved word (because the development storage is simulated using a SQL database) but I&#8217;m not sure this is the actual cause.</p>
<p>I guess I can&#8217;t have an &#8216;event&#8217; table like I wanted and will have to settle for &#8216;events&#8217; instead!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/captaincodeman.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/captaincodeman.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=captaincodeman.com&#038;blog=34504812&#038;post=217&#038;subd=captaincodeman&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://captaincodeman.com/2010/06/30/error-azure-local-development-storage-table-named-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e290f3debe90a4711b3aff447f4bf25e?s=96&#38;d=http%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">intesoft</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/azure-table-working.png" medium="image">
			<media:title type="html">azure-table-working</media:title>
		</media:content>

		<media:content url="http://captaincodeman.files.wordpress.com/2012/04/azure-table-error.png" medium="image">
			<media:title type="html">azure-table-error</media:title>
		</media:content>
	</item>
	</channel>
</rss>
