<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>igorbrejc.net &#187; development</title>
	<atom:link href="http://igorbrejc.net/category/development/feed" rel="self" type="application/rss+xml" />
	<link>http://igorbrejc.net</link>
	<description>Just another developer's weblog</description>
	<lastBuildDate>Sat, 12 Mar 2011 16:57:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Maperitive Build 1108</title>
		<link>http://igorbrejc.net/development/c/maperitive-build-1108</link>
		<comments>http://igorbrejc.net/development/c/maperitive-build-1108#comments</comments>
		<pubDate>Thu, 20 Jan 2011 21:12:29 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Maperitive]]></category>
		<category><![CDATA[OpenStreetMap]]></category>
		<category><![CDATA[parallel.extensions]]></category>
		<category><![CDATA[PBF]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/?p=1369</guid>
		<description><![CDATA[photo credit: Omar Eduardo My previous post about PBF reading successes was written way too prematurely. It turned out my PBF reading code had some serious bugs which made reading look much faster than it actually was (one of the reasons was that I neglected to read OSM node keys/values when written in PBF dense [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/22406241@N00/127707517/" title="Supporting the Liberty (fries?)" target="_blank"><img src="http://farm1.static.flickr.com/43/127707517_1ce118b77a.jpg" alt="Supporting the Liberty (fries?)" border="0" /></a><br /><small><a href="http://creativecommons.org/licenses/by-nc-nd/2.0/" title="Attribution-NonCommercial-NoDerivs License" target="_blank"><img src="http://igorbrejc.net/wp-content/plugins/photo-dropper/images/cc.png" alt="Creative Commons License" border="0" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a href="http://www.flickr.com/photos/22406241@N00/127707517/" title="Omar Eduardo" target="_blank">Omar Eduardo</a></small></p>

<p><a href="http://igorbrejc.net/development/maperitive-reading-osm-pbf-files">My previous post</a> about PBF reading successes was written way too prematurely. It turned out my PBF reading code had some serious bugs which made reading look much faster than it actually was (one of the reasons was that I neglected to read OSM node keys/values when written in <a href="http://wiki.openstreetmap.org/wiki/PBF_Format#Nodes">PBF dense node format</a>).</p>

<p>I’ve subsequently written some extensive tests, comparing OSM database contents from XML and PBF file of the same area (thanks Geofabrik) on an object by object basis, so I’m now 95% sure the PBF code works OK. Performance-wise the (final?) results are much less glamorous than it looked initially: PBF reading <strong>is “only” 2.5 times faster than reading OSM.bz2 files, while in memory consumption terms, they are pretty much the same</strong>. I curious what other OSM software like osmosis has to say about these results.</p>

<p>I had hoped I could speed the PBF reading by spreading the work on several processor cores. What I did is to use <a href="http://en.wikipedia.org/wiki/Parallel_Extensions">Microsoft’s Parallel Extensions library</a> to separate the fetching of PBF file blocks from the actual parsing of them into two (or more) cores. This resulted in only about 10% increase of the overall speed (tested on my two-core machine, so on more cores the result could be better).</p>

<p>It actually proved pretty hard to do a decent job of separating work in some balanced fashion. Since the file reading is sequential, this can only be done by one thread/core, so you want to put as little other work to that core as possible. As soon as file block bytes are fetched from the file, they are delegated to another core to parse it (in terms of protocol buffers) and then extract OSM objects from it. The problem is that you don’t want to enqueue too many file blocks at the same time, since this takes up valuable memory (which is already filled with extracted OSM objects). So I ended up using a <a href="http://msdn.microsoft.com/en-us/library/dd267312.aspx">blocking queue</a>, which means the main thread (which reads the file) will wait until at least one core is available before filling the queue with another file block.</p>

<p>I’ve also tried micro-management strategy – using multiple cores to extract individual OSM objects, but this only really works for ways and relations. Current PBF extracts use dense nodes format, which is <a href="http://en.wikipedia.org/wiki/Delta_encoding">delta-encoded</a> and thus forces you to read things sequentially on a single thread of execution. I guess this is the price of having a format that wants to satisfy two different (and inherently conflicting) goals: less space and less CPU.</p>

<p>I’m fairly new to Parallel Extensions and there are probably better ways of handling this, but I’ll leave it for the future.</p>

<p>Anyway, a new Maperitive release is out, grab it from <a href="http://maperitive.net/download/">the usual place</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/c/maperitive-build-1108/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:thumbnail url="http://farm1.static.flickr.com/43/127707517_1ce118b77a.jpg" />
		<media:content url="http://farm1.static.flickr.com/43/127707517_1ce118b77a.jpg" medium="image">
			<media:title type="html">Supporting the Liberty (fries?)</media:title>
		</media:content>
		<media:content url="http://igorbrejc.net/wp-content/plugins/photo-dropper/images/cc.png" medium="image">
			<media:title type="html">Creative Commons License</media:title>
		</media:content>
	</item>
		<item>
		<title>Maperitive: Reading OSM PBF Files</title>
		<link>http://igorbrejc.net/development/maperitive-reading-osm-pbf-files</link>
		<comments>http://igorbrejc.net/development/maperitive-reading-osm-pbf-files#comments</comments>
		<pubDate>Tue, 18 Jan 2011 22:03:32 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Maperitive]]></category>
		<category><![CDATA[OpenStreetMap]]></category>
		<category><![CDATA[PBF]]></category>
		<category><![CDATA[protobuf-net]]></category>
		<category><![CDATA[protocol buffers]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/maperitive-reading-osm-pbf-files</guid>
		<description><![CDATA[UPDATE: the post below was based on premature assumptions that my new PBF code is actually working. It turns out it had a number of serious bugs which made reading look faster than it actually is. Here&#8217;s a followup post. For the last couple of days I’ve been working on a PBF file reader for [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: the post below was based on premature assumptions that my new PBF code is actually working. It turns out it had a number of serious bugs which made reading look faster than it actually is. <a href="http://igorbrejc.net/development/c/maperitive-build-1108">Here&#8217;s a followup post.</a>
</strong></p>

<p>For the last couple of days I’ve been working on a <a href="http://wiki.openstreetmap.org/wiki/PBF_Format" target="_blank">PBF file</a> reader for Maperitive. PBF file is a binary file for storing OSM geo data using Google’s <a href="http://en.wikipedia.org/wiki/Protocol_Buffers" target="_blank">protocol buffers</a>.</p>

<p>It’s been a steep learning curve, since I had to learn three things at the same time: protocol buffers, using <a href="http://code.google.com/p/protobuf-net/" target="_blank">protobuf-net library</a> for .NET and understanding the PBF format. I’m mostly satisfied with the protobuf-net library, although the lack of any new development activity worries me a little bit.</p>

<p>I’ve finished most of the PBF reading stuff this evening and I was eager to test the new code against the old XML reader. I’ve used <a href="http://download.geofabrik.de/osm/europe/" target="_blank">Geofabrik’s Denmark data</a>, here are some rough results:</p>

<ul>
    <li><del datetime="2011-01-19T19:57:01+00:00">PBF file loads <strong>7.6 times quicker</strong> than the .OSM.bz2 file. This is a really good result, mostly thanks to the way the PBF format has been designed.</del></li>
    <li><del datetime="2011-01-19T19:57:01+00:00">Loading of PBF data uses <strong>a quarter less memory</strong> than the XML file. I’m talking about the memory used in the process of loading, not for storing the loaded OSM data – the data is internally stored in the exactly same way both for PBF and XML reading. This result surprised me a bit, I guess the extra memory consumed by the XML reader is due to the XML parser itself and/or the fact that a lot more strings are generated when reading XML OSM tags. PBF uses string tables and thus saves a lot of space by reusing common strings.</del></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/maperitive-reading-osm-pbf-files/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
	</item>
		<item>
		<title>Web Testing &amp; Gallio: A Little Helpful Trick</title>
		<link>http://igorbrejc.net/development/continuous-integration/web-testing-gallio-a-little-helpful-trick</link>
		<comments>http://igorbrejc.net/development/continuous-integration/web-testing-gallio-a-little-helpful-trick#comments</comments>
		<pubDate>Mon, 18 Oct 2010 05:59:08 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Gallio and MbUnit]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/?p=1290</guid>
		<description><![CDATA[When doing automatic testing of Web apps using unit testing frameworks, it can be a pain in the butt to pinpoint the proper HTML element. A lot of times tests will fail because you used a wrong locator, but since the browser will automatically close after the test, you don’t have an access to the [...]]]></description>
			<content:encoded><![CDATA[<p>When doing automatic testing of Web apps using unit testing frameworks, it can be a pain in the butt to pinpoint the proper HTML element. A lot of times tests will fail because you used a wrong locator, but since the browser will automatically close after the test, you don’t have an access to the HTML code of the page to look at what’s actually there.</p>

<p>Fortunately Gallio provides a class called <strong>TestContext</strong> which contains the current information about the running test and which you can use to determine if the latest test is successful or not. This can then be used to run your custom handling code during the test teardown:</p>

<p>
<pre class="brush: csharp; title: ; notranslate">
        [TearDown]
        protected virtual void Teardown()
        {
            if (TestContext.CurrentContext.Outcome.Status == TestStatus.Failed)
            {
                using (TestLog.BeginSection(&quot;Failed web page HTML&quot;))
                    TestLog.Write(WebDriver.PageSource);
            }
        }
</pre></p>

<p>In the above snippet, we record the current Web page’s HTML code into Gallio’s log (the <strong>TestLog</strong> class). To avoid spamming the log, we do this for failed tests only. </p>

<p>Gallio provides a powerful framework which I think is very much underused, mostly because the documentation is not very detailed (to say the least).</p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/continuous-integration/web-testing-gallio-a-little-helpful-trick/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
	</item>
		<item>
		<title>Poor Man&#8217;s Task Tracking Tool, Revisited</title>
		<link>http://igorbrejc.net/development/poor-mans-task-tracking-tool-revisited</link>
		<comments>http://igorbrejc.net/development/poor-mans-task-tracking-tool-revisited#comments</comments>
		<pubDate>Sat, 25 Sep 2010 19:08:17 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[guidelines]]></category>
		<category><![CDATA[Maperitive]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/poor-mans-task-tracking-tool-revisited</guid>
		<description><![CDATA[Back in the days before Maperitive had been released for the first time, I wrote a post about how I use simple text files to keep the track of things I have to implement (and things already implemented). It turns out the to-do list has grown so much that it is very difficult to decide [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the days before Maperitive had been released for the first time, <a href="http://igorbrejc.net/development/poor-mans-task-tracking-tool" target="_blank">I wrote a post about</a> how I use simple text files to keep the track of things I have to implement (and things already implemented).</p>

<p>It turns out the to-do list has grown so much that it is very difficult to decide which things to implement in which order. Some features or bugs come in the middle of implementing other features and I’ve frequently had to make use of SVN branches to be able to work things out.</p>

<p>So I got an idea of using <a href="http://www.google.com/google-d-s/spreadsheets/" target="_blank">Google Docs spreadsheets</a> to create a list of tasks. But a simple list was not enough: I wanted the spreadsheet to be able to tell me which tasks should be implemented first and which can wait. I’ve added two columns to the list: <strong>priority </strong>and <strong>complexity</strong>. Then there’s a third column called <strong>score</strong>, which calculates a score based on the priority and complexity using a simple formula. The complexity is measured in “<a href="http://vladhorby.wordpress.com/2007/09/04/agile-adventures-ideal-vs-real-time/" target="_blank">ideal hours</a>” the task is supposed to take (a rough estimate, of course), while the priority is some value (usually an integer from 1 to 5) which denotes how important the task (or feature) is.</p>

<p><a title="&quot;to do&quot; list using Google Docs" href="http://www.flickr.com/photos/28786233@N03/5023204079/"><img border="0" alt="&quot;to do&quot; list using Google Docs" src="http://farm5.static.flickr.com/4090/5023204079_2f6992ddf5_b.jpg" width="632" height="148" /></a></p>

<p>After entering tasks, I simply use spreadsheet’s “<em>Sort sheet Z –&gt; A</em>” function to make the tasks with the highest score appear at the top of the list.</p>

<p>Simple, but effective.</p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/poor-mans-task-tracking-tool-revisited/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:thumbnail url="http://farm5.static.flickr.com/4090/5023204079_2f6992ddf5_b.jpg" />
		<media:content url="http://farm5.static.flickr.com/4090/5023204079_2f6992ddf5_b.jpg" medium="image">
			<media:title type="html">&#34;to do&#34; list using Google Docs</media:title>
		</media:content>
	</item>
		<item>
		<title>Storing Your Source Code</title>
		<link>http://igorbrejc.net/development/storing-your-source-code</link>
		<comments>http://igorbrejc.net/development/storing-your-source-code#comments</comments>
		<pubDate>Sat, 11 Sep 2010 19:11:20 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/?p=1266</guid>
		<description><![CDATA[photo credit: eisenrah UPDATE: I received a very helpful comment, which seems to invalidate some of my statements in the post. Be sure to read the comment. I’ll make further updates when I do some more investigating on the matter. For the past three or four years I’ve been using Subversion installed on my local [...]]]></description>
			<content:encoded><![CDATA[<p><a title="bb source" href="http://www.flickr.com/photos/89082145@N00/2244075454/" target="_blank"><img border="0" alt="bb source" src="http://farm3.static.flickr.com/2334/2244075454_e250a93b9f_m.jpg" /></a>    <br /><small><a title="Attribution-NonCommercial License" href="http://creativecommons.org/licenses/by-nc/2.0/" target="_blank"><img border="0" alt="Creative Commons License" align="absMiddle" src="http://igorbrejc.net/wp-content/plugins/photo-dropper/images/cc.png" width="16" height="16" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a title="eisenrah" href="http://www.flickr.com/photos/89082145@N00/2244075454/" target="_blank">eisenrah</a></small></p>

<p><strong>UPDATE: </strong>I received a <a href="http://igorbrejc.net/development/storing-your-source-code/comment-page-1#comment-106042">very helpful comment</a>, which seems to invalidate some of my statements in the post. Be sure to read the comment. I’ll make further updates when I do some more investigating on the matter.</p>

<p>For the past three or four years I’ve been using Subversion installed on my local development machine. Initially I used a custom installation on Apache, which took me quite a few hours to set up (basically if you want to have more than one repository, Apache is a must). Later, after couple of years, I started using <a href="http://www.visualsvn.com/server/" target="_blank">VisualSVN Server</a>, which is a great free self-contained SVN server installation.</p>

<p>This all works great, but the biggest problem is accessing the repository from the outside world, both in terms of security and in terms of me not wanting to have my SVN repository computer running all of the time (I’m a believer in keeping machines turned off if you’re not using them).</p>

<p>On the other hand, I started using distributed VCS systems like git and Mercurial for my open-source projects. The biggest benefit I see in the fact that you keep your own repository on your development computer, so you can have the history of changes, which isn’t really an option when you’re working with SVN in an offline mode.</p>

<p>So I started thinking about experimenting with a commercial VCS hosting solution like <a href="http://www.assembla.com/" target="_blank">Assembla</a> or <a href="http://www.xp-dev.com/" target="_blank">xp-dev.com</a> for my closed-source projects. Apart from the decision on which provider to use (they both seem to get <a href="http://stackoverflow.com/questions/69384/opinion-of-hosted-svn-providers" target="_blank">good reviews</a>), the biggest question is: <strong>which VCS</strong>?</p>

<p>Although git and Mercurial are all the rage now, I don’t see much benefit in using them for a one-man projects on a VisualStudio platform. Let me explain why.</p>

<h2>Integration With VisualStudio</h2>

<p>I got so much used to AnkhSVN, that I simply cannot work without it. Renaming files, moving them around the solution, automatic refactoring using Resharper, that’s all handled pretty well by AnhkSVN. I still use TortoiseSVN for commits, but in VisualStudio, Ankh is the king. I <strong>never</strong> use SVN from the command line and I don’t need to. AnkhSVN is simply a great productivity booster.</p>

<p>And this is why using git or Mercurial is such a pain in VisualStudio. I frequently use “Rename class” refactoring in Resharper and it renames the class file, too. This gets undetected by git and Mercurial and I end up with “missing files” when committing.</p>

<h2>Local Repositories</h2>

<p>While having your own repositories on development computers is a truly great thing, not having them isn’t such an issue if your online SVN repository is available most of the time. And the problem with VS integration far outweighs other benefits of a distributed VCS when you’re running a one-man shop.</p>

<h2>Decisions, Decisions…</h2>

<p>So I’ll probably start using a commercial SVN hosting option, at least as a trial. Most of the providers offer limited free plans, so it’s a good place to start…</p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/storing-your-source-code/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:thumbnail url="http://farm3.static.flickr.com/2334/2244075454_e250a93b9f_m.jpg" />
		<media:content url="http://farm3.static.flickr.com/2334/2244075454_e250a93b9f_m.jpg" medium="image">
			<media:title type="html">bb source</media:title>
		</media:content>
		<media:content url="http://igorbrejc.net/wp-content/plugins/photo-dropper/images/cc.png" medium="image">
			<media:title type="html">Creative Commons License</media:title>
		</media:content>
	</item>
		<item>
		<title>Random Thoughts</title>
		<link>http://igorbrejc.net/development/random-thoughts</link>
		<comments>http://igorbrejc.net/development/random-thoughts#comments</comments>
		<pubDate>Mon, 06 Sep 2010 19:13:13 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Maperitive]]></category>
		<category><![CDATA[OpenStreetMap]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/random-thoughts</guid>
		<description><![CDATA[I feel I’ve been neglecting my blog lately and it’s a shame. It is not that I don’t have stuff to write, it’s just that I’m so immersed into developing various projects (mostly Maperitive) that I don’t seem to find the time and energy to take some time to write something interesting. Yes, I know [...]]]></description>
			<content:encoded><![CDATA[<p>I feel I’ve been neglecting my blog lately and it’s a shame. It is not that I don’t have stuff to write, it’s just that I’m so immersed into developing various projects (mostly Maperitive) that I don’t seem to find the time and energy to take some time to write something interesting.</p>

<p>Yes, I know one of the first rules in writing blogs is not to apologize for not writing. But anyway, I’ve decided I should write something more regularly but deliver it in smaller packages. This way writing shouldn’t look so intimidating and it should make it easier for me to write.</p>

<h2>How’s Maperitive</h2>

<p>There has been a lot going on behind the scenes in Maperitive. I’ve been opening many different fronts, but I’ve mostly worked on improving the GUI. Maperitive started out as a (more or less) command line application and now I’m slowly trying to <a href="http://igorbrejc.net/openstreetmap/maperitive-has-menus" target="_blank">improve its usability</a>. Right now the GUI is still too intimidating for a non-technical user and a lot of work is still needed to improve this.</p>

<p>Like the most of other code in Maperitive, the GUI framework has been written mostly from scratch, with some reusing of the existing code of Kosmos. I had to reinvent the wheel on each step, since there aren’t many good WinForms GUI frameworks out there (in fact <a href="http://msdn.microsoft.com/en-us/library/ff648747.aspx" target="_blank">I only know of one</a> which is a beast and I didn’t feel the urge to invest a huge amount of time to try to learn it). The advantage of this is that it forced me to get to know the problems I’m trying to solve and not just sweep them under the rug using some 3rd party library.</p>

<p>All in all I’m quite satisfied with the new architecture. One of the main reasons I decided to pull the plug on Kosmos and start with clean code was to ensure the new architecture allows me to add new features more easily and to make the whole code base more manageable. I think I’ve achieved this, mostly by sticking to <a href="http://en.wikipedia.org/wiki/Dependency_injection" target="_blank">dependency injection</a> and using <a href="http://www.castleproject.org/container/gettingstarted/index.html" target="_blank">Windsor Castle</a>, an inversion of control container. </p>

<p>The application framework being built for Maperitive is generic enough to be reusable for other desktop applications, which could come in handy if I find the time to work on anything else. But right now I have so many ideas for new features in Maperitive that I doubt I’ll run out of work in the next year (or more). </p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/random-thoughts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Windsor Castle: Strange Resolving Behavior</title>
		<link>http://igorbrejc.net/development/c/windsor-castle-strange-resolving-behavior</link>
		<comments>http://igorbrejc.net/development/c/windsor-castle-strange-resolving-behavior#comments</comments>
		<pubDate>Tue, 24 Aug 2010 05:43:38 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[Windsor Castle]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/?p=1250</guid>
		<description><![CDATA[A user reported a bug in Maperitive – it throws Castle.MicroKernel.Resolvers.DependencyResolverException: Could not resolve non-optional dependency for &#8216;Karta.DataSources.OsmFileMapDataSource&#8217; (Karta.DataSources.OsmFileMapDataSource). Parameter &#8216;fileName&#8217; type &#8216;System.String&#8217; I tried to reproduce this behavior using a simple unit test, but I couldn’t, so I’m posting the actual code. This is where the exception occurs: And this is how OsmFileMapDataSource constructors [...]]]></description>
			<content:encoded><![CDATA[<p>A user reported a bug in Maperitive – it throws </p>

<blockquote>   <p>Castle.MicroKernel.Resolvers.DependencyResolverException: Could not resolve non-optional dependency for &#8216;Karta.DataSources.OsmFileMapDataSource&#8217; (Karta.DataSources.OsmFileMapDataSource). Parameter &#8216;fileName&#8217; type &#8216;System.String&#8217;</p> </blockquote>

<p><font color="#666666">I tried to reproduce this behavior using a simple unit test, but I couldn’t, so I’m posting the actual code. This is where the exception occurs:</font></p>

<p>
<pre class="brush: csharp; title: ; notranslate">return windsorContainer.Resolve&lt;OsmFileMapDataSource&gt;();</pre></p>

<p><font color="#666666">And this is how <strong>OsmFileMapDataSource</strong> constructors look like:</font></p>

<p><pre class="brush: csharp; title: ; notranslate">
        public OsmFileMapDataSource(
            string fileName,
            IFileSystem fileSystem,
            IMapDataLayerFactory layerFactory)
        {
            ...
        }

        public OsmFileMapDataSource(IMapDataLayerFactory layerFactory)
        {
           ...
        }
</pre></p>

<p><font color="#666666">Needless to say, both <strong>IFileSystem</strong> and <strong>IMapDataLayerFactory</strong> are registered in the container (<strong>IMapDataLayerFactory</strong> is registered as a typed factory, by the way). <strong>OsmFileMapDataSource</strong> is also registered as an implementation of itself. And I’m using version 2.1.0.6655 of the library.</font></p>

<p><font color="#666666">What’s strange about this is that <strong>if I move the second constructor in front of the first one, the component is resolved without problems</strong>. I’m not sure if this is intended behavior, but I doubt the order of constructors should be a determining factor on how components are resolved.</font></p>

<p><font color="#666666">But as I said, I couldn’t reproduce this behavior using a simplified test code, so I guess I should start debugging it instead.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/c/windsor-castle-strange-resolving-behavior/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
	</item>
		<item>
		<title>Maperitive: Enhanced Usability &amp; Scripting Support</title>
		<link>http://igorbrejc.net/development/c/maperitive-enhanced-usability-scripting-support</link>
		<comments>http://igorbrejc.net/development/c/maperitive-enhanced-usability-scripting-support#comments</comments>
		<pubDate>Fri, 06 Aug 2010 19:10:43 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Maperitive]]></category>
		<category><![CDATA[OpenStreetMap]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/c/maperitive-enhanced-usability-scripting-support</guid>
		<description><![CDATA[For the last week or so I’ve been busting my fingers with one of the harder things to implement in a desktop GUI: application responsiveness when executing longer-running tasks. By longer-running I mean something that takes more than a couple of seconds. Simple desktop applications tend to run everything synchronously: when the user presses a [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Maperitive running scripts" href="http://www.flickr.com/photos/28786233@N03/4866209357/"><img border="0" alt="Maperitive running scripts" src="http://farm5.static.flickr.com/4122/4866209357_b95edd0f2e_b.jpg" width="659" height="453" /></a></p>

<p>For the last week or so I’ve been busting my fingers with one of the harder things to implement in a desktop GUI: application responsiveness when executing longer-running tasks. By longer-running I mean something that takes more than a couple of seconds.</p>

<p>Simple desktop applications tend to run everything synchronously: when the user presses a button, the action gets run. After the action finishes, the control is given back to the user. Simple, but totally crappy. The problem is that the action gets run on the same thread that services the GUI, so until the action finishes, the application will not be able even to refresh itself or respond in any meaningful way to user clicks or key presses. And since there is no refresh, you cannot show any progress indicators to the user. I know I wouldn’t want to wait half an hour for something to finish without some reassurance that the application is still alive and not waiting for the electricity to run out.</p>

<p>Maperitive already had a lot of responsiveness code implemented, but it was still an “under the construction” design. The additional complication was the fact I want Maperitive to have a good script runner and scripts can take a very long time (downloading OSM data, generating tiles etc.). After a lot of trials and errors I finally managed to implement the whole thing in a consistent package. And believe me when I say it was not easy.</p>

<p>So what is new:</p>

<ul>   <li>When running scripts (or longer tasks), Maperitive draws an indicator on the map (see the screenshot above) and launches a “sort of <a href="http://en.wikipedia.org/wiki/Modal_window">modal</a>” mode – most of GUI controls are disabled so the script doesn’t get confused by some inadvertent user action. However, the application is still responsive: you can view the progress of the script in the command log.</li>    <li>Aborting scripts: as the indicator says, you can press the <a href="http://en.wikipedia.org/wiki/Esc_key">escape key</a> to abort the script. If you prefer torturing your mouse instead of your keyboard, there’s an “Abort task” button in the bottom right corner which does the same thing.</li> </ul>

<p>Not all of running tasks have been switched to the new system. Loading OSM files is one example of a task that will still block the GUI, but I will gradually improve these things.</p>

<p>You can download the latest release at <a href="http://maperitive.net/download/">http://maperitive.net/download/</a></p>

<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/c/maperitive-enhanced-usability-scripting-support/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://farm5.static.flickr.com/4122/4866209357_b95edd0f2e_b.jpg" />
		<media:content url="http://farm5.static.flickr.com/4122/4866209357_b95edd0f2e_b.jpg" medium="image">
			<media:title type="html">Maperitive running scripts</media:title>
		</media:content>
	</item>
		<item>
		<title>Too Much Version Control?</title>
		<link>http://igorbrejc.net/development/too-much-version-control</link>
		<comments>http://igorbrejc.net/development/too-much-version-control#comments</comments>
		<pubDate>Wed, 21 Jul 2010 08:03:02 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/too-much-version-control</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a title="Too much version control?" href="http://www.flickr.com/photos/28786233@N03/4814879806/"><img border="0" alt="Too much version control?" src="http://farm5.static.flickr.com/4096/4814879806_97ecefdb26_b.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/too-much-version-control/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://farm5.static.flickr.com/4096/4814879806_97ecefdb26_b.jpg" />
		<media:content url="http://farm5.static.flickr.com/4096/4814879806_97ecefdb26_b.jpg" medium="image">
			<media:title type="html">Too much version control?</media:title>
		</media:content>
	</item>
		<item>
		<title>Uri Class Cheat Sheet</title>
		<link>http://igorbrejc.net/development/c/uri-class-cheat-sheet</link>
		<comments>http://igorbrejc.net/development/c/uri-class-cheat-sheet#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:15:57 +0000</pubDate>
		<dc:creator>breki</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://igorbrejc.net/development/c/uri-class-cheat-sheet</guid>
		<description><![CDATA[Another reference post, this time covering usage of .NET Uri class. Example URL: http://somewhere.else.com:9999/service/packages?page=2#fragment The table below contains values for various properties of Uri for that example URL: AbsolutePath /service/packages AbsoluteUri http://somewhere.else.com:9999/service/packages?page=2#fragment Authority somewhere.else.com:9999 DnsSafeHost somewhere.else.com Fragment #fragment Host somewhere.else.com HostNameType Dns IsAbsoluteUri true IsDefaultPort false IsFile false IsLoopback false IsUnc false LocalPath /service/packages OriginalString [...]]]></description>
			<content:encoded><![CDATA[<p>Another reference post, this time covering usage of .NET <a href="http://msdn.microsoft.com/en-us/library/system.uri.aspx" target="_blank">Uri</a> class. </p>

<p>Example URL: http://somewhere.else.com:9999/service/packages?page=2#fragment</p>

<p>The table below contains values for various properties of Uri for that example URL:</p>

<table border="1" cellspacing="0" cellpadding="5" width="622"><tbody>     <tr>       <td valign="top" width="158">AbsolutePath</td>        <td valign="top" width="462">/service/packages</td>     </tr>      <tr>       <td valign="top" width="158">AbsoluteUri</td>        <td valign="top" width="462">http://somewhere.else.com:9999/service/packages?page=2#fragment</td>     </tr>      <tr>       <td valign="top" width="158">Authority</td>        <td valign="top" width="462">somewhere.else.com:9999</td>     </tr>      <tr>       <td valign="top" width="158">DnsSafeHost</td>        <td valign="top" width="462">somewhere.else.com</td>     </tr>      <tr>       <td valign="top" width="158">Fragment</td>        <td valign="top" width="462">#fragment</td>     </tr>      <tr>       <td valign="top" width="158">Host</td>        <td valign="top" width="462">somewhere.else.com</td>     </tr>      <tr>       <td valign="top" width="158">HostNameType</td>        <td valign="top" width="462">Dns</td>     </tr>      <tr>       <td valign="top" width="158">IsAbsoluteUri</td>        <td valign="top" width="462">true</td>     </tr>      <tr>       <td valign="top" width="158">IsDefaultPort</td>        <td valign="top" width="462">false</td>     </tr>      <tr>       <td valign="top" width="158">IsFile</td>        <td valign="top" width="462">false</td>     </tr>      <tr>       <td valign="top" width="158">IsLoopback</td>        <td valign="top" width="462">false</td>     </tr>      <tr>       <td valign="top" width="158">IsUnc</td>        <td valign="top" width="462">false</td>     </tr>      <tr>       <td valign="top" width="158">LocalPath</td>        <td valign="top" width="462">/service/packages</td>     </tr>      <tr>       <td valign="top" width="158">OriginalString</td>        <td valign="top" width="462">http://somewhere.else.com:9999/service/packages?page=2#fragment</td>     </tr>      <tr>       <td valign="top" width="158">PathAndQuery</td>        <td valign="top" width="462">/service/packages?page=2</td>     </tr>      <tr>       <td valign="top" width="158">Port</td>        <td valign="top" width="462">9999</td>     </tr>      <tr>       <td valign="top" width="158">Query</td>        <td valign="top" width="462">?page=2</td>     </tr>      <tr>       <td valign="top" width="158">Scheme</td>        <td valign="top" width="462">http</td>     </tr>      <tr>       <td valign="top" width="158">Segments</td>        <td valign="top" width="462">array: “/”, “service/”, “packages”</td>     </tr>      <tr>       <td valign="top" width="158">UserEscaped</td>        <td valign="top" width="462">false</td>     </tr>      <tr>       <td valign="top" width="158">UserInfo</td>        <td valign="top" width="462">“” (empty string)</td>     </tr>   </tbody></table>
]]></content:encoded>
			<wfw:commentRss>http://igorbrejc.net/development/c/uri-class-cheat-sheet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
	</channel>
</rss>

