<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Not Rocket Science &#187; My Tools</title>
	<atom:link href="http://www.stum.de/category/mytools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stum.de</link>
	<description>Random thoughts of neat disorder</description>
	<lastBuildDate>Thu, 05 Jan 2012 20:42:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A few more thoughts about SWiki</title>
		<link>http://www.stum.de/2010/07/01/a-few-more-thoughts-about-swiki/</link>
		<comments>http://www.stum.de/2010/07/01/a-few-more-thoughts-about-swiki/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 02:36:28 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[My Tools]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=866</guid>
		<description><![CDATA[It's been some time since I wrote a post about me re-thinking SWiki. In the meantime, I have experimented a bit with several approaches, and the recent announcements of IIS Express and SQL CE 4 sparked some new interest in this project. As I said earlier, my problem was that I can't display Images that [...]]]></description>
			<content:encoded><![CDATA[<p>It's been some time since I wrote a post about me <a href="http://www.stum.de/2010/02/01/re-thinking-swiki/">re-thinking SWiki</a>. In the meantime, I have experimented a bit with several approaches, and the recent announcements of <a href="http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx">IIS Express</a> and <a href="http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx">SQL CE 4</a> sparked some new interest in this project.</p>
<p>As I said earlier, my problem was that I can't display Images that don't have a URL in the hosted Internet Explorer, but that I wanted to keep HTML-compatible pages. The first approach is to have a local web server that delivers the pages. There is however a second approach, which involves actually having the images in the file system. I could either store them in the database and "extract" them to a temporary directory when SWiki starts, or I could keep them externally and only "register" them in the database.</p>
<p>I think I like that approach as well, because it solves any corporate networking concerns (IT usually isn't too happy with people running their own rogue web servers within a corporate network...).</p>
<p>I'm busy with some other projects and I have to find a new name for SWiki (<a href="http://wiki.squeak.org/swiki/">someone else</a> had the name before <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), but I do now have a good idea on what I want to do with it and how to achieve that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2010/07/01/a-few-more-thoughts-about-swiki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TimeSpan.js Version 1.2 released</title>
		<link>http://www.stum.de/2010/03/05/timespan-js-version-1-2-released/</link>
		<comments>http://www.stum.de/2010/03/05/timespan-js-version-1-2-released/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 07:42:48 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=770</guid>
		<description><![CDATA[I've just pushed a new Version of my TimeSpan Library to GitHub. Version 1.2 contains a new "static" constructor TimeSpan.FromDates which takes two dates and returns the difference between them as a TimeSpan. If the second date is earlier than the first date, the TimeSpan will be negative. Pass true as third parameter to force [...]]]></description>
			<content:encoded><![CDATA[<p>I've just pushed a new Version of my <a href="http://github.com/mstum/TimeSpan.js/downloads">TimeSpan Library to GitHub</a>. Version 1.2 contains a new "static" constructor TimeSpan.FromDates which takes two dates and returns the difference between them as a TimeSpan. If the second date is earlier than the first date, the TimeSpan will be negative. Pass true as third parameter to force it to be positive.</p>
<p>Usage example:</p>
<pre class="prettyprint lang-js">
var date1 = new Date(2010, 3, 1, 10, 10, 5, 0);
var date2 = new Date(2010, 3, 1, 10, 10, 10, 0);
var ts = TimeSpan.FromDates(date2, date1);
var ts2 = TimeSpan.FromDates(date2, date1, true);
alert(ts.totalSeconds()); // -5, because we put the later date first
alert(ts2.totalSeconds()); // 5, because we passed true as third parameter
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2010/03/05/timespan-js-version-1-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple .ini File parser for C#</title>
		<link>http://www.stum.de/2009/08/15/a-simple-ini-file-parser-for-c/</link>
		<comments>http://www.stum.de/2009/08/15/a-simple-ini-file-parser-for-c/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 02:28:57 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=532</guid>
		<description><![CDATA[Okay, so back in the old days, we had INI Files to store settings in. Those files are very simple: [Section] Key=Value SomeOtherKey=SomeOtherValue [AnotherSection] Hello=World Hardly exciting, but it gets the job done very well. Today I wanted to work with INI Files in my C# Application, both for reading and writing. But as I [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so back in the old days, we had INI Files to store settings in. Those files are very simple:</p>
<blockquote><p>[Section]<br />
Key=Value<br />
SomeOtherKey=SomeOtherValue</p>
<p>[AnotherSection]<br />
Hello=World</p></blockquote>
<p>Hardly exciting, but it gets the job done very well. Today I wanted to work with INI Files in my C# Application, both for reading and writing. But as I just found out, <strong>.net does not have built in functions for working with .ini files</strong>. It looks like they want everyone to work with XML Files now. Well, apart from the fact that XML looks like my keyboard puked on my hard drive and that the format is unneccesarily complicated for this purpose, I also found that reading and writing them is rather complicated, especially since the XmlSerializer has some stupid restrictions (one being that the class needs to be public - have they never heard of reflection?).</p>
<p>It's great that the .net Framework is so powerful - I believe I can write a function that downloads an MP3 off the internet and uses it to generate a gradient in an image which then gets encrypted and sent per e-Mail in maybe 5 lines or so, but when it comes to something simple as saving some Key/Value Pairs, I still need a crapton of code. So I binged the internets a bit and found some code that uses P/Invoke to call Kernel functions to handle ini files, but I want to avoid P/Invoke at all costs. So in the end I simply wrote a class to Load/Save Ini Files.</p>
<p>It's a simple class to interact with a simple file format that was created to store Key/Value pairs and that just works. Seriously, don't change what isn't broken. The class is licensed under <a href="http://sam.zoy.org/wtfpl/">WTFPL</a> and can be downloaded <a href="http://www.stum.de/wp-content/uploads/2009/08/IniFile.cs">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/15/a-simple-ini-file-parser-for-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SWiki 0.12 released</title>
		<link>http://www.stum.de/2009/08/13/swiki-0-12-released/</link>
		<comments>http://www.stum.de/2009/08/13/swiki-0-12-released/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 20:48:19 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[SWiki]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=530</guid>
		<description><![CDATA[Okay, a little change of plans. Originally, I wanted SWiki 0.12 to be localizable, but due to the fact that I'm not satisfied with the built-in features of Visual Studio I'm rolling my own framework now. This will however take a little longer. Also, because SWiki is still under heavy development, I would have to [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, a little change of plans. Originally, I wanted SWiki 0.12 to be localizable, but due to the fact that I'm not satisfied with the built-in features of Visual Studio I'm <a href="http://www.stum.de/2009/08/10/reinventing-the-wheel-this-time-its-a-localization-framework/">rolling my own framework</a> now. This will however take a little longer.</p>
<p>Also, because SWiki is still under heavy development, I would have to chase translations first before I can release. So for the time being, I moved it to a later version in the <a href="http://swiki.codeplex.com/Wiki/View.aspx?title=Road%20Map">road map</a>.</p>
<p>Instead, I have added a feature to 0.12 that I really needed now that I'm actually using SWiki to create some documents, and that is re-parenting of pages. This allows you to move pages within the tree to other pages. You can not turn a page into a root page at the moment (that was an oversight, to be fixed in 0.13).</p>
<p>Additionally, the Page view now allows copying text through CTRL-C or Right Click => Copy, and in the navigation tree on the left, the Main Page will always be the first page. You can download SWiki 0.12 on the <a href="http://swiki.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31513">CodePlex Download Page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/13/swiki-0-12-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reinventing The Wheel, this time it&#8217;s a localization framework</title>
		<link>http://www.stum.de/2009/08/10/reinventing-the-wheel-this-time-its-a-localization-framework/</link>
		<comments>http://www.stum.de/2009/08/10/reinventing-the-wheel-this-time-its-a-localization-framework/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 12:01:00 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=527</guid>
		<description><![CDATA[If you look at the SWiki Roadmap, you will see that translated versions are planned for Version 0.12, which is incidentially the next version of SWiki. SWiki is intended to be just a bit outside of my reach, so that I can learn and grow from it. As I have no experience with creating a [...]]]></description>
			<content:encoded><![CDATA[<p>If you look at the <a href="http://swiki.codeplex.com/Wiki/View.aspx?title=Road%20Map">SWiki Roadmap</a>, you will see that translated versions are planned for Version 0.12, which is incidentially the next version of SWiki. SWiki is intended to be just a bit outside of my reach, so that I can learn and grow from it. As I have no experience with creating a localized WinForms application, that allows me to learn how to do it <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Unfortunately, Localization support in Visual Studio 2008 left me somewhat unimpressed. So I set the "Localizable" property of my Form to true and then automagically it creates the resources I need and allows me to change any form settings, including Text, Position, Size etc. That is so far a great idea and works very well, but it has several drawbacks:</p>
<ul>
<li>One resx file per form and language means exponential growth of files</li>
<li>The resx files are tied to the form - which means I cannot just put them in a "Localized" Folder</li>
<li>While it's great that Forms are supported, I still have to find another way for my Exceptions and other Non-Form Code</li>
<li>Translations are stored in satellite assemblies. The Goal of SWiki is to have as few files as possible, preferably only one.</li>
<li>No way to share strings between different parts</li>
</ul>
<p>In short: The built in support is unsuitable for SWiki. I have put my requirements in a <a href="http://stackoverflow.com/questions/1251225/">StackOverflow question</a>, but the answers were somewhat discouraging. I have looked around a bit and naturally also ended up at <a href="http://en.wikipedia.org/wiki/Gettext">GNU Gettext</a> which handles strings, but does not solve the problem of a) non-string content (Images, Location/Sizes of Controls) and b) the actual application of resources to the target.</p>
<p>One of the main issues is that the InitializeComponent() function is somewhat untouchable, as the designer will break if you change it too much and will replace your code with it's own anyway. Visual Studio is certainly not lying when it tells you to not mess with the function.</p>
<p>So anyway, I have just decided to build my own localization framework for use with the SWiki UI. Finding a name was reasonably easy, I just called it "The Wheel". I don't know if it's going to be much use, but just in case, it's going to be licensed under Microsoft Reciprocal License (Ms-RL). Release Date? I don't know, I hope by the end of the week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/10/reinventing-the-wheel-this-time-its-a-localization-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SWiki 0.11 released</title>
		<link>http://www.stum.de/2009/08/09/swiki-0-11-released/</link>
		<comments>http://www.stum.de/2009/08/09/swiki-0-11-released/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 08:23:42 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[SWiki]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=519</guid>
		<description><![CDATA[Another blog post - another SWiki update. That's the good thing about starting with a small feature set, it allows for rapid expansion Along with many smaller fixes, there are two big points in this release. Export Wiki into HTML Files Using the now-functional export button in the button bar, you can export your wiki [...]]]></description>
			<content:encoded><![CDATA[<p>Another blog post - another SWiki update. That's the good thing about starting with a small feature set, it allows for rapid expansion <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Along with many smaller fixes, there are two big points in this release.</p>
<p><strong>Export Wiki into HTML Files</strong><br />
Using the now-functional export button in the button bar, you can export your wiki to HTML files. This will generate one file per page, complete with navigation.</p>
<p><strong>Diff between Revisions</strong><br />
There is now a new "Diff" Tab on the main screen. This allows you to pick any two revisions of a page and quickly compare them.</p>
<p><a href="http://swiki.codeplex.com/"><img src="http://www.stum.de/wp-content/uploads/2009/08/SWikiDiff.jpg" alt="SWikiDiff" title="SWikiDiff" width="600" height="209" class="aligncenter size-full wp-image-522" /></a></p>
<p><strong>Other changes</strong><br />
Apart from these two big points, there are some other changes. In the doc folder, you will find a more elaborate user manual in .swk format. The navigation menu on the left has a context menu now to add new pages. The Syntax Help window should no longer open outside of the screen if the SWiki window is too close to the edge.</p>
<p>Download SWiki for free on <a href="http://swiki.codeplex.com/">http://swiki.codeplex.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/09/swiki-0-11-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWiki 0.10 released</title>
		<link>http://www.stum.de/2009/08/06/swiki-0-10-released/</link>
		<comments>http://www.stum.de/2009/08/06/swiki-0-10-released/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 23:15:26 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[SWiki]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=516</guid>
		<description><![CDATA[Development continues at a rapid pace, and SWiki 0.10 got a significant amount of changes. First of all, it accepts the filename of the database as a command line parameter. That means that you can have multiple wiki databases (for example, separate wikis for multiple projects you're working on) but only need one SWiki.exe. Of [...]]]></description>
			<content:encoded><![CDATA[<p>Development continues at a rapid pace, and <a href="http://swiki.codeplex.com/">SWiki 0.10</a> got a significant amount of changes. First of all, it accepts the filename of the database as a command line parameter. That means that you can have multiple wiki databases (for example, separate wikis for multiple projects you're working on) but only need one SWiki.exe. Of course, it will still work if you do not specify a filename, in which case it uses "swikidb.swk" in the folder of SWiki.exe.</p>
<p>You can give a Title to each database now. To do that, simply click on the settings button (the cogwheel in the lower left button bar) and type in a title. The new Title will be reflected on the title bar as well, which is useful if you have multiple SWiki instances open.</p>
<p>There is a new Macro that you can use in your wiki pages to change the color of text: [color:ff0000|Your Text] will display the text in red. You can of course combine this with other format specifiers, for example *[color:0000ff|Your Text]* for bold blue text.</p>
<p>Also, there are a few UI Bug Fixes. The tab order should make sense in every window, and you can actually press return in the "New Page" dialog. Users of Version 0.9 will have to convert their database into the new format, as 0.10 changed the schema. To do that, there is an Upgrade tool included.</p>
<p><a href="http://swiki.codeplex.com/">Download it for free from CodePlex now</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/06/swiki-0-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWiki 0.9 released</title>
		<link>http://www.stum.de/2009/08/02/swiki-0-9-released/</link>
		<comments>http://www.stum.de/2009/08/02/swiki-0-9-released/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:42:40 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[SWiki]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=511</guid>
		<description><![CDATA[Okay, that was quick. I've just released 0.8 a few hours ago, but there was one feature I really wanted to have in a wiki that 0.8 does not have, and that is linking between articles in the wiki. As I am using the WebBrowser Control, I wasn't sure if there is a way to [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, that was quick. I've just released 0.8 a few hours ago, but there was one feature I really wanted to have in a wiki that 0.8 does not have, and that is linking between articles in the wiki. As I am using the WebBrowser Control, I wasn't sure if there is a way to interact with my C# Application from within the browser. As it turns out, you can easily interact through JavaScript! The WebBrowser supports the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx">ObjectForScripting</a> property, which allows to specify a (Com-Visible) Class to interact with. I just pass in "this" to make the Browser interact with my Main Form.</p>
<pre class="prettyprint lang-cs">
    this.browser.ObjectForScripting = this;
</pre>
<p>The next step was to create a function in my Form that can be called:</p>
<pre class="prettyprint lang-cs">
    public void BrowserInternalLink(int targetPageId)
    {
        ChangePage(targetPageId,null);
    }
</pre>
<p>I've created some code for testing that illustrates how to call it:</p>
<pre class="prettyprint lang-cs">
    sb.Append("&lt;a href=\"javascript:window.external.BrowserInternalLink(1)\">Test&lt;/a>");
</pre>
<p>So this would call my BrowserInternalLink Function with the Parameter 1. Pretty neat, but still useless as it's hardcoded <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The next step is to add support to the [wiki:PageId|Description] syntax to WikiPlex. Here, two articles are really important: <a href="http://blog.eworldui.net/post/2009/07/Extending-WikiPlex-with-Custom-Macros.aspx">Extending WikiPlex with Custom Macros</a> and <a href="http://blog.eworldui.net/post/2009/07/Extending-WikiPlex-with-Custom-Renderers.aspx">Extending WikiPlex with Custom Renderers</a>.</p>
<p>If you want to add your own Tags to WikiPlex, you may need both usually. A Macro is some RegEx that tells WikiPlex to search for certain tokens and how to interpret them (For example, you can tell WikiPlex that you want to discard a part of the token, but pass other parts into a renderer). A renderer takes the Input and outputs some HTML. As said, your Macro is split into multiple parts (depending on your RegEx) and in theory you can pass every part into a different Renderer.</p>
<p>Have a look at WikiPlexExtensions.cs in the <a href="http://swiki.codeplex.com/SourceControl/ListDownloadableCommits.aspx">SWiki Source Code</a> to see my implementation. The main downside of this whole approach is that it requires FullTrust, but so far I don't know a better alternative. There is a <a href="http://www.codeproject.com/KB/GDI-plus/HtmlRenderer.aspx">GDI+ HtmlRenderer</a> on CodeProject, but that sadly renders out images, which means: No links, no Copy/Paste, just look but don't touch. The Mono Project seems to have a <a href="http://www.mono-project.com/WebBrowser">very interesting approach</a>, but "Replacing the Browser" is currently low priority, especially since Windows 7 E will not happen <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (By the Way: SWiki is of course compatible with Windows 7)</p>
<p>I really like WikiPlex so far, as it is a very clean and extensible Wiki Parser, and I think I will have a lot of fun with it <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>SWiki 0.9 also allows you to print out pages now, simply click the new Printer-Button on the lower left toolbar.</p>
<p><a href="http://swiki.codeplex.com/">Grab it from CodePlex now</a> <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/02/swiki-0-9-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWiki, a simple standalone wiki</title>
		<link>http://www.stum.de/2009/08/02/swiki-a-simple-standalone-wiki/</link>
		<comments>http://www.stum.de/2009/08/02/swiki-a-simple-standalone-wiki/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 17:14:28 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[SWiki]]></category>
		<category><![CDATA[swiki]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=506</guid>
		<description><![CDATA[So yesterday evening I wanted to write some technical/design documentation for a little pet project of mine. However, I did not really know what to choose. On one side, I want something like a Word document that offers formatting and some references/Table of Contents. On the other hand, long Word documents tend to become messy [...]]]></description>
			<content:encoded><![CDATA[<p>So yesterday evening I wanted to write some technical/design documentation for a little pet project of mine. However, I did not really know what to choose. On one side, I want something like a Word document that offers formatting and some references/Table of Contents. On the other hand, long Word documents tend to become messy and sometimes a bit hard to maintain, especially since Word has all those nice little Helpers that just love to mess up formatting in my document (Funny but unrelated sidenote: If you happen to have a german Windows 2000 Server manual at hand, witness how they are constantly talking about DIE Controllers instead of IDE Controllers thanks to Words Auto-Correction).</p>
<p>So ideally I want something like a Wiki: Rudimentary but solid and easy formatting, no black auto-correction magic that gets in my way, and a nice document outline. The problem with MediaWiki is that it requires a webserver and MySQL database, which is a bit heavyweight. I looked at alternatives and found <a href="http://www.screwturn.eu/DesktopEdition.ashx">ScrewTurn Wiki Desktop Edition</a> which sadly requires installation, and <a href="http://www.tiddlywiki.com/">TiddlyWiki</a> which looks great at first, but somehow I've lost my data twice, possibly by not saving even though AutoSave is ticked. I don't know, maybe I am just not smart enough to use it, but I did not like it.</p>
<p>At the end, I decided to roll my own thing, called SWiki. SWiki is a simple, standalone wiki. At it's core, it's a <a href="http://sqlite.phxsoftware.com/">SQLite</a> database, using <a href="http://wikiplex.codeplex.com/">WikiPlex</a> as it's WikiParser and the C# WebBrowser Control as an integrated Browser. No installation required, only <a href="http://www.microsoft.com/net/">.net Framework 3.5 SP1</a> needs to be installed. It's Open Source and Version 0.8 <a href="http://swiki.codeplex.com/">can be downloaded on CodePlex</a>.</p>
<p>It may not be the most impressive software ever written, but hey, I've written this for me after all <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="attachment_509" class="wp-caption aligncenter" style="width: 610px"><a href="http://swiki.codeplex.com/"><img class="size-full wp-image-509" title="SWiki 0.8 Screenshot" src="http://www.stum.de/wp-content/uploads/2009/08/SWiki.jpg" alt="SWiki 0.8" width="600" height="411" /></a><p class="wp-caption-text">SWiki 0.8</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/08/02/swiki-a-simple-standalone-wiki/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CommandLine Tools Version 1.0.5 released</title>
		<link>http://www.stum.de/2009/05/09/commandline-tools-version-105-released/</link>
		<comments>http://www.stum.de/2009/05/09/commandline-tools-version-105-released/#comments</comments>
		<pubDate>Sat, 09 May 2009 20:44:58 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[My Tools]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=476</guid>
		<description><![CDATA[A new version of the CommandLine tools has just been released and is available for download at CodePlex. Changes in this Version: Version 1.0.5 (2009-05-09) cmdhashgen Supports CRC32 hash Gracefully handling error if you try to hash a file you don't have access to cmdnetsendmail Ability to embed text files instead of attaching them]]></description>
			<content:encoded><![CDATA[<p>A new version of the <a href="http://www.stum.de/cmdtools/">CommandLine tools</a> has just been released and is available for <a href="http://cmdtools.codeplex.com/">download at CodePlex</a>.</p>
<p>Changes in this Version:</p>
<p><em><span style="text-decoration: underline;"><strong>Version 1.0.5 (2009-05-09)</strong></span></em><br />
<span style="text-decoration: underline;">cmdhashgen</span></p>
<ul>
<li>Supports CRC32 hash</li>
<li>Gracefully handling error if you try to hash a file you don't have access to</li>
</ul>
<p><span style="text-decoration: underline;">cmdnetsendmail</span></p>
<ul>
<li>Ability to embed text files instead of attaching them</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/05/09/commandline-tools-version-105-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog Software in the .net world &#8211; still sad</title>
		<link>http://www.stum.de/2009/04/29/blog-software-in-the-net-world-still-sad/</link>
		<comments>http://www.stum.de/2009/04/29/blog-software-in-the-net-world-still-sad/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 19:11:10 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=471</guid>
		<description><![CDATA[I blogged in November 2007 about Open Source and .net, also talking about blog software. While I am happy to report that the general landscape looks a lot nicer now in April 2009, I am still sad by the state of blog software. Back in 2007, I complained about complicated setup processes, the inability to [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://www.stum.de/2007/11/21/open-source-and-net-not-really-an-ideal-partnership/">blogged in November 2007</a> about Open Source and .net, also talking about blog software. While I am happy to report that the general landscape looks a lot nicer now in April 2009, I am still sad by the state of blog software.<br />
Back in 2007, I complained about complicated setup processes, the inability to run in common configurations (aka. "Medium Trust") and generally low quality. 3 Weeks ago, I've had to setup another .net blog, so I looked at the landscape again.</p>
<p>It has improved. But not that much. Software like WordPress is still miles ahead, and I am not even talking that much about functionality here. I'm talking about some fundamental things like ease of installation. Or about the fact that Settings in the WordPress Control Panel are actually *explained*. Or the fact that I can put in RAW HTML into my postings WITHOUT WordPress destroying it. Sure, if I switch between WYSIWYG and HTML View, there may be a breaking conversations when using funky HTML, but if I stay in HTML, it just works. If I put in Garbage, then WP will output garbage.</p>
<p>I'm not even talking about the Theme and Plugin momentum that WordPress has. I am really just talking about a Software that is easy to install, runs on my hosted server and allows pushing of some Content. Is that asked too much? Sadly, yes. I don't want to be too harsh, hence I will not name the tools I've tried (there were 4). I don't want to blame developers who are really trying to do something for issues that lie within the framework. The ASP.net infrastructure has a lot of advantages over PHP, but as good as stuff like Web.config, Medium Trust and SQL Connection Strings is, it's adding more complexity that developers seem to not try to take away from the end user.</p>
<p>I don't know if this is the fault of the ASP.net Webforms model or if the .net OSS Community is smaller or whatever. I've now decided to tackle something that I have on my ToDo-List since writing that post in November 2007, I've decided to write my own blog software. I want to encounter the problems that the people who are creating it have, I want to run it in a production environment (Dogfooding, so to say). The recent release of <a href="http://www.asp.net/mvc/">ASP.net MVC</a> was the final bit that removed all excuses for not doing it.</p>
<p>I will run into a lot of issues. I want to learn and use <a href="http://en.wikipedia.org/wiki/Test-driven_development">TDD</a>, <a href="http://en.wikipedia.org/wiki/Dependency_Injection">DI</a> and <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a>, and I have experience in none. I will do a lot of refactoring, and a lot of breaking changes and braindead mistakes. But I don't want to be a complainer anymore when I have the opportunity to change it.</p>
<p>I don't want to announce too much because it's still in the early stages, but it will be open source (<a href="http://www.opensource.org/licenses/ms-pl.html">Ms-PL</a>) and hosted on <a href="http://www.codeplex.com/">Codeplex</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2009/04/29/blog-software-in-the-net-world-still-sad/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rick Version 02 &#8211; Building a custom ActionResult to perform a HTTP 301 redirect</title>
		<link>http://www.stum.de/2008/12/14/rick-version-02-building-a-custom-actionresult-to-perform-a-http-301-redirect/</link>
		<comments>http://www.stum.de/2008/12/14/rick-version-02-building-a-custom-actionresult-to-perform-a-http-301-redirect/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 19:13:56 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[Rick]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=380</guid>
		<description><![CDATA[Yesterday I've made the very first version of Rick, a URL Shortening Service in ASP.net MVC, and today I've made the first addition. In Version 02 of Rick, I have added a custom ActionResult to perform a HTTP 301 redirect instead of the default HTTP 302 one. You can get the Source Code on http://www.codeplex.com/rick, [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I've made the <a href="http://www.stum.de/2008/12/14/rick-url-shortening-service-an-aspnet-mvc-learning-project/">very first version of Rick</a>, a URL Shortening Service in ASP.net MVC, and today I've made the first addition.</p>
<p>In Version 02 of Rick, I have added a custom ActionResult to perform a HTTP 301 redirect instead of the default HTTP 302 one. You can get the Source Code on <a href="http://www.codeplex.com/rick">http://www.codeplex.com/rick</a>, and you can watch the tutorial video on Vimeo. Topics include a short overview of HTTP 301 vs. 302 and how to actually create a custom ActionResult.</p>
<p><object width="640" height="483" data="http://vimeo.com/moogaloop.swf?clip_id=2524188&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=2524188&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/2524188?pg=embed&amp;sec=2524188">Rick Version 02 - Building a custom ActionResult to perform a HTTP 301 redirect</a> from <a href="http://vimeo.com/user894920?pg=embed&amp;sec=2524188">Michael Stum</a> on <a href="http://vimeo.com?pg=embed&amp;sec=2524188">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2008/12/14/rick-version-02-building-a-custom-actionresult-to-perform-a-http-301-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rick URL Shortening Service &#8211; an ASP.net MVC learning project</title>
		<link>http://www.stum.de/2008/12/14/rick-url-shortening-service-an-aspnet-mvc-learning-project/</link>
		<comments>http://www.stum.de/2008/12/14/rick-url-shortening-service-an-aspnet-mvc-learning-project/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 02:56:15 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[Rick]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=377</guid>
		<description><![CDATA[All right, I said I wanted to start learning ASP.net MVC, and I did make some progress A few weeks ago, I was talking about creating a project called Écriture, a Twitter clone that companies can deploy internally. That project is still in the plans, and when I was creating the "Wishlist" (Or Product Backlog, [...]]]></description>
			<content:encoded><![CDATA[<p>All right, I said I wanted to start learning ASP.net MVC, and I did make some progress <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  A few weeks ago, I was talking about creating a project called <a href="http://www.stum.de/2008/10/19/ecriture-a-new-way-of-company-wide-instant-messaging/">Écriture</a>, a Twitter clone that companies can deploy internally. That project is still in the plans, and when I was creating the "Wishlist" (Or Product Backlog, as the SCRUM guys like to call it) for Écriture, eventually I realized that I wanted a URL Shortening service as well, since in many corporate intranets, URLs can be really long, and using tinyurl, is.gd and all the other services have some confidentiality concerns (hint: Using tinyurl to shorten "company.internal/documents/marketing/unaccouncedproduct.htm" is possibly not very smart).</p>
<p>I wanted to kill three birds with one stone, so I decided to make this a standalone project. The three birds are 1. the actual URL shortening Service, 2. a project where I can play with all the newest technologies, 3. a project that allows me to create some tutorial videos.</p>
<p>The name of the Project is "Rick", and it's source code is hosted on CodePlex, at <a href="http://www.codeplex.com/rick">http://www.codeplex.com/rick</a></p>
<p>Version 01 was just released, and it actually fully works already: You can put in a long URL, get a short URL back, put that short URL in a browser, and get redirected to the original URL. And the best of all: I have created a Tutorial video for that, which you can watch online or download (download requires free registration with <a href="http://www.vimeo.com/">Vimeo</a>). Granted, Version 01 is ugly, has no error handling and lacks a lot of features, but I am actually going to improve it over the next few weeks, making it more robust and I also plan to add more technologies to it, for example Windows Azure or Silverlight.</p>
<p>For your convenience, here is the video:</p>
<p><object width="640" height="483" data="http://vimeo.com/moogaloop.swf?clip_id=2517727&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=2517727&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/2517727?pg=embed&amp;sec=2517727">Rick Version 01 - Building a URL Shortening Service in ASP.net MVC</a> from <a href="http://vimeo.com/user894920?pg=embed&amp;sec=2517727">Michael Stum</a> on <a href="http://vimeo.com?pg=embed&amp;sec=2517727">Vimeo</a>.</p>
<p>Please let me know what you think and what you would like to see in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2008/12/14/rick-url-shortening-service-an-aspnet-mvc-learning-project/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PermanentRedirectResult &#8211; a 301 HTTP Redirect for ASP.net MVC</title>
		<link>http://www.stum.de/2008/10/22/permanentredirectresult/</link>
		<comments>http://www.stum.de/2008/10/22/permanentredirectresult/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 22:46:52 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=247</guid>
		<description><![CDATA[For a little project to learn ASP.net MVC, I needed my Controller to return a HTTP 301 Redirect. Unfortunately, just calling "return Redirect(url)" returns a HTTP 302 instead of a 301. After checking on the MVC Forums, there seems to be no "official" way to perform a 301 Redirect in a Controller. Of course, you [...]]]></description>
			<content:encoded><![CDATA[<p>For a little project to learn ASP.net MVC, I needed my Controller to return a <a href="http://en.wikipedia.org/wiki/HTTP_301">HTTP 301 Redirect</a>. Unfortunately, just calling "return Redirect(url)" returns a <a href="http://en.wikipedia.org/wiki/HTTP_302">HTTP 302</a> instead of a 301. After checking on the <a href="http://forums.asp.net/p/1337938/2700733.aspx">MVC Forums</a>, there seems to be no "official" way to perform a 301 Redirect in a Controller. Of course, you can always modify the Response directly, but I decided that returning an ActionResult would be cleaner (and I think that makes it easier to unit test), even though it is essentially doing exactly that, setting a custom Status Code and Redirect Location.</p>
<p>So here is my little PermanentRedirectResult:</p>
<pre class="prettyprint lang-cs">
public class PermanentRedirectResult : ActionResult
{
    public string Url { get; set; }

    public PermanentRedirectResult(string url)
    {
        if (string.IsNullOrEmpty(url))
        {
            throw new ArgumentException("url is null or empty", "url");
        }
        this.Url = url;
    }

    public override void ExecuteResult(ControllerContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }
        context.HttpContext.Response.StatusCode = 301;
        context.HttpContext.Response.RedirectLocation = Url;
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2008/10/22/permanentredirectresult/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Making the Songlist sortable by using IComparer and IComparable</title>
		<link>http://www.stum.de/2008/10/19/making-the-songlist-sortable-by-using-icomparer-and-icomparable/</link>
		<comments>http://www.stum.de/2008/10/19/making-the-songlist-sortable-by-using-icomparer-and-icomparable/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 15:26:54 +0000</pubDate>
		<dc:creator>mstum</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[My Tools]]></category>
		<category><![CDATA[itunes]]></category>

		<guid isPermaLink="false">http://www.stum.de/?p=223</guid>
		<description><![CDATA[Yesterday we've looked at a way to access iTunes from C# to get a list of recently played tracks. Today, we want to extend this solution a little bit, by making the list sortable in any way we'd like. If you have a look at the sidebar, you will find a "Recently Played Songs" near [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday we've looked at a way to access iTunes from C# to get a list of recently played tracks. Today, we want to extend this solution a little bit, by making the list sortable in any way we'd like.</p>
<p>If you have a look at the sidebar, you will find a "Recently Played Songs" near the bottom. Achieving this is the ultimate goal of this small article series, and I'll walk you through the steps needed to achieve this automatically.</p>
<p>The Series of Articles will include:</p>
<ol>
<li><a href="http://www.stum.de/2008/10/18/reading-itunes-playlists-using-c/">Grab the contents of a Playlist from iTunes</a></li>
<li><b>Making the Songlist sortable by using IComparer and IComparable</b></li>
<li>Create a XML File</li>
<li>Upload this file via FTP to this Server</li>
<li>Write a PHP Script that performs an XSL Transformation (XSLT) on the Xml File and Call this file from Sidebar.php within WordPress</li>
</ol>
<p>Of course, the last step applies to PHP and WordPress, but if you have an ASP.net, a Ruby on Rails, a Python or whatever Web Server, you can still follow the base concepts if you'd like.</p>
<p>Let's get started. Yesterday, we created a Class called "Song" which essentially represents all the data about a song that we're interested in and a custom Comparator to be able to sort it. Now, we extend this class a little:</p>
<pre class="prettyprint lang-cs">
[Serializable()]
public class Song : IComparable&lt;Song>
{
    public string Title { get; set; }
    public string Artist { get; set; }
    public string Album { get; set; }
    public int Year { get; set; }
    public int Length { get; set; }
    public int PlayCount { get; set; }
    public DateTime LastPlayed { get; set; }

    public string LengthAsString
    {
        get
        {
            TimeSpan ts = TimeSpan.FromSeconds(this.Length);
            if (ts.Hours > 0)
            {
                return string.Format("{0}:{1:00}:{2:00}", ts.Hours,
                                              ts.Minutes, ts.Seconds);
            }
            else
            {
                return string.Format("{0:00}:{1:00}", ts.Minutes, ts.Seconds);
            }
        }
    }

    public override string ToString()
    {
        return
        string.Format("{0} - {1} ({2}, {3}) [{4}] {{Last Played: {5:dd/MM/yyyy HH:mm}, Total: {6}}}"
        , Artist, Title, Album, Year, LengthAsString,LastPlayed,PlayCount);
    }

    #region IComparable&lt;Song> Members

    public int CompareTo(Song other)
    {
        return this.LastPlayed.CompareTo(other.LastPlayed);
    }
    #endregion

    public int CompareTo(Song other, SongComparer.SortField field, bool sortDescending)
    {
        int result = 0;
        switch (field)
        {
            case SongComparer.SortField.Album:
                result = this.Album.CompareTo(other.Album);
                break;
            case SongComparer.SortField.Artist:
                result = this.Album.CompareTo(other.Artist);
                break;
            case SongComparer.SortField.Title:
                result = this.Title.CompareTo(other.Title);
                break;
            case SongComparer.SortField.Year:
                result = this.Year.CompareTo(other.Year);
                break;
            case SongComparer.SortField.PlayCount:
                result = this.PlayCount.CompareTo(other.PlayCount);
                break;
            case SongComparer.SortField.Length:
                result = this.Length.CompareTo(other.Length);
                break;
            case SongComparer.SortField.LastPlayed:
                result = this.LastPlayed.CompareTo(other.LastPlayed);
                break;
        }
        if (sortDescending) result = result * -1;
        return result;
    }
}
</pre>
<p>Compared to yesterfay, the CompareTo function was modified and overloaded. Yesterday, the function was always trying to sort by LastPlayed date, descending. Now, I have added an Overload which takes two additional parameters to determine a field to sort by and whether or not to sort in descending order. Also note that we are not coding the actual comparison logic ourselfes. Yesterday i've done it to illustrate the 3 return values, but here we are just calling the CompareTo-function that many .net Types already implement, hence no need for extra logic on our side.</p>
<p>For our Overload to work, we need to create a class that implements IComparer<Song>. Notice the difference between IComparable and IComparer. IComparable indicates that the Object which implements it can be compared to other objects of it's type, whereas IComparer is a "stand-alone" class that can be used against different objects. Also have a look at two blog articles about <a href="http://codebetter.com/blogs/david.hayden/archive/2005/02/27/56099.aspx">IComparable</a> and <a href="http://codebetter.com/blogs/david.hayden/archive/2005/03/06/56584.aspx">IComparer</a>. So here is a new class, the SongComparer:</p>
<pre class="prettyprint lang-cs">
public class SongComparer : IComparer&lt;Song>
{
    public enum SortField
    {
        Title,
        Artist,
        Album,
        Year,
        Length,
        PlayCount,
        LastPlayed
    }

    public SortField Field { get; set; }
    public bool SortDescending { get; set; }

    public SongComparer()
    {
        SortDescending = true;
        Field = SortField.LastPlayed;
    }

    #region IComparer&lt;Song> Members

    public int Compare(Song x, Song y)
    {
        return x.CompareTo(y, Field, SortDescending);
    }

    #endregion
}
</pre>
<p>This class starts out with an enum that defines the various fields that one can sort by. Now, using an enum is simple but if you add a field to the Song class, you have to extend the enum as well. There are other solutions to that (i.e. using Reflections), but again, for the sake of simplicity an enum works. We have then defined a class property to hold the selected field, and a boolean that indicates whether or not we want to sort descending. Our constructor just sets some default values (LastPlayed, descending). The important function is the Compare function. This takes two objects, and is then supposed to return one of the 3 return values that IComparable.CompareTo also returns. So in this case, it calls our overloaded Song.CompareTo() function. If you have a look at this function again, you see that it will now just look at the field and if the sort should be descending, it will just invert the result (through * -1).</p>
<p>The concept of IComparable and IComparer is quite simple, yet a bit tricky to grasp at first. The biggest issue is the compare order: You <b>always</b> compare the first object to the second object (first.CompareTo(second) or this.CompareTo(other)), otherwise the result will be in the wrong order.</p>
<p>So now that we have our custom IComparer, how do we use it? You can create an instance of the SortComparer class and then just pass it into List.Sort():</p>
<pre class="prettyprint lang-cs">
comparer = new SongComparer();
comparer.Field = SongComparer.SortField.PlayCount;
comparer.SortDescending = true;
List&lt;Song> result = new List&lt;Song>();
// fill the List...
result.Sort(comparer);
</pre>
<p>The List will now be sorted descending by PlayCount instead of LastPlayed. So now that we have made the Song class generic enough to sort by whatever field we like, the next step is to turn it into Xml. We will tackle that in an upcoming blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stum.de/2008/10/19/making-the-songlist-sortable-by-using-icomparer-and-icomparable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

