<?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>illdata.com</title>
	<atom:link href="http://illdata.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://illdata.com/blog</link>
	<description>(Weblog)Duckworth.ToString()</description>
	<lastBuildDate>Fri, 15 Jan 2010 17:17:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL Server Batch Inserts of Parent/Child Data with iBATIS</title>
		<link>http://illdata.com/blog/2010/01/13/sql-server-batch-inserts-of-parentchild-data-with-ibatis/</link>
		<comments>http://illdata.com/blog/2010/01/13/sql-server-batch-inserts-of-parentchild-data-with-ibatis/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 04:24:20 +0000</pubDate>
		<dc:creator>duckworth</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[iBATIS]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[SqlServer]]></category>

		<guid isPermaLink="false">http://illdata.com/blog/?p=81</guid>
		<description><![CDATA[The common pattern for persistence of our domain classes to the Database is through the use of an ORM layer with support for your standard CRUD operations. Many ORM's have mechanisms for optimizing Selects, N + 1 Selects, lazy loading etc., but often don't have mechanisms for batching insertions. Very often when optimizing database calls [...]]]></description>
			<content:encoded><![CDATA[<p>The common pattern for persistence of our domain classes to the Database is through the use of an <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> layer with support for your standard CRUD operations. Many ORM's have mechanisms for optimizing Selects, N + 1 Selects, lazy loading etc., but often don't have mechanisms for batching insertions. Very often when optimizing database calls and eliminating unnecessary round-trips to the Database servers, I come across the scenario where I need to insert many Parent objects and their Child objects in a single batch. The Parent objects primary key is the foreign key for the Child objects so the Parent objects need to be persisted first, and you need to get the Identity of each Parent before inserting the Client. In SQL Server 2008 they introduced the <a href="http://technet.microsoft.com/en-us/library/bb510625.aspx">MERGE</a> statement which can be used for this purpose, however I needed this to work in SQL 2005 as well as 2008. Luckily, SQL Server 2005 introduced the <a href="http://technet.microsoft.com/en-us/library/ms177564.aspx">OUTPUT</a> clause, which, when combined with a second surrogate key, can be used to batch insert all the Parent Objects at once, OUTPUT all the Identity's of the Parent objects and then batch insert all the Child Objects.</p>
<p>In my scenario I am using <a href="http://ibatis.apache.org">iBATIS</a>, which is a lightweight and flexible ORM that provides some easy mechanisms for handling these edge cases. If you were using standard ADO.NET you could also leverage the new Table-Valued Parameters to pass in the sets of Parent and Child data.</p>
<p>For the example I will use two tables, Parent and Child:</p>
<pre class="tsql">&nbsp;
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> Parent<span style="color: #808080;">&#40;</span>
      Id <span style="color: #0000FF;">INT</span> NOT NULL <span style="color: #0000FF;">IDENTITY</span><span style="color: #808080;">&#40;</span><span style="color: #000;">1</span>,<span style="color: #000;">1</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span>,
      Name <span style="color: #0000FF;">VARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">255</span><span style="color: #808080;">&#41;</span> NOT NULL,
      SequenceNumber <span style="color: #0000FF;">INT</span> NOT NULL<span style="color: #808080;">&#41;</span>
&nbsp;
GO 
&nbsp;
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> Child<span style="color: #808080;">&#40;</span>
      Id <span style="color: #0000FF;">INT</span> NOT NULL <span style="color: #0000FF;">IDENTITY</span><span style="color: #808080;">&#40;</span><span style="color: #000;">1</span>,<span style="color: #000;">1</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span>,
      ParentId <span style="color: #0000FF;">INT</span> NOT NULL <span style="color: #0000FF;">REFERENCES</span> Parent<span style="color: #808080;">&#40;</span>ParentID<span style="color: #808080;">&#41;</span>,
      Name VARCHAR255<span style="color: #808080;">&#41;</span> NOT NULL<span style="color: #808080;">&#41;</span>
GO
&nbsp;</pre>
<p>I have corresponding Parent and Child classes:</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Parent
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Id <span style="color: #000000;">&#123;</span> get; set;<span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> IList&lt;Child&gt; Children <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Child
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Id <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>The SequenceNumber in the Parent table is just a surrogate key used to match the Parents in the batch back to the Children in that same batch, but I don't want it to pollute my Domain classes, so I will merely create a sequence number right before I send it to the iBATIS map using linq and anonymous types:</p>
<pre class="csharp">&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">int</span> InsertBatch<span style="color: #000000;">&#40;</span>IList&lt;Parent&gt; parentList<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    var sequencedParents = parentList.<span style="color: #0000FF;">Select</span><span style="color: #000000;">&#40;</span>
        <span style="color: #000000;">&#40;</span>parent, index<span style="color: #000000;">&#41;</span> =&gt;
        <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a>
            <span style="color: #000000;">&#123;</span>
                SequenceNumber = index,
                Parent = parent,
                Children = parent.<span style="color: #0000FF;">Children</span>.<span style="color: #0000FF;">Select</span><span style="color: #000000;">&#40;</span>
                child =&gt;
                <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a>
                    <span style="color: #000000;">&#123;</span>
                        SequenceNumber = index,
                        Child = child
                     <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToList</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    var sequencedChildren = sequencedParents.<span style="color: #0000FF;">Select</span><span style="color: #000000;">&#40;</span>p =&gt; p.<span style="color: #0000FF;">Children</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    var args = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Hashtable
                       <span style="color: #000000;">&#123;</span>
                           <span style="color: #000000;">&#123;</span><span style="color: #808080;">&quot;Parents&quot;</span>, sequencedParents<span style="color: #000000;">&#125;</span>,
                           <span style="color: #000000;">&#123;</span><span style="color: #808080;">&quot;Children&quot;</span>, sequencedChildren<span style="color: #000000;">&#125;</span>
                       <span style="color: #000000;">&#125;</span>;
&nbsp;
    <span style="color: #0600FF;">return</span> Mapper.<span style="color: #0000FF;">Instance</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;InsertParentBatch&quot;</span>, args<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>The InsertBatch method is sending two separate lists to the iBATIS Mapped Statement, the list of Parents and the list of Children, which are associated by the sequence number we assigned which is unique for each Parent in this batch. We will use this to join them when we build the SQL in the following iBATIS map:</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;statement</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;InsertParentBatch&quot;</span> <span style="color: #000066;">parameterClass</span>=<span style="color: #ff0000;">&quot;map&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
	DECLARE @Inserted TABLE (
	  ID int,
	  SequenceNumber int
	)
&nbsp;
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;isNotEmpty</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;Parents&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		INSERT INTO Parent
		(
			Name,
			SequenceNumber
		)
		OUTPUT INSERTED.Id, INSERTED.SequenceNumber INTO @Inserted
		SELECT Name, SequenceNumber FROM (
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;iterate</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;Parents&quot;</span> <span style="color: #000066;">conjunction</span>=<span style="color: #ff0000;">&quot; UNION ALL&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		  SELECT
		  #Parents[].Parent.Name# Name,
		  #Parents[].SequenceNumber# SequenceNumber
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/iterate<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		) P
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/isNotEmpty<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;isNotEmpty</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;Children&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		INSERT INTO Children (ParentId, Name)
		SELECT
			INS.Id,
			C.Name
		FROM
		(
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;iterate</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;Children&quot;</span> <span style="color: #000066;">conjunction</span>=<span style="color: #ff0000;">&quot; UNION &quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
		SELECT
		#Children[].Child.Name# Name,
		#Children[].SequenceNumber# SequenceNumber
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/iterate<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		) C
		INNER JOIN @Inserted INS ON
		INS.SequenceNumber = C.SequenceNumber
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/isNotEmpty<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/statement<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>The above map generates a single SQL Server statement that declares a SQL table variable to store the inserted Id's and the corresponding Sequence Numbers that the OUTPUT clause is returning back from our insert Parents statement. The iBATIS iterate property is simply iterating the list of Parents we sent to the map and doing an inline UNION ALL so we can insert them in one step. The insert into Children statement joins back to the @Inserted table variable on the Sequence number to get the Id for it's Parent.</p>
<p>Although the solution requires the addition of the SequenceNumber column which is only used for this purpose and un-related to our data model, it can be worth the performance increase if you are facing a situation where you have high volumes of data being submitted to your application in batches. By using the anonymous types in the persistence layer and keeping the SequenceNumber out of our domain model we can limit it to an edge case performance optimization that should be well encapsulated.</p>
]]></content:encoded>
			<wfw:commentRss>http://illdata.com/blog/2010/01/13/sql-server-batch-inserts-of-parentchild-data-with-ibatis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extension Method Round Up</title>
		<link>http://illdata.com/blog/2009/04/21/extension-method-round-up/</link>
		<comments>http://illdata.com/blog/2009/04/21/extension-method-round-up/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 01:53:52 +0000</pubDate>
		<dc:creator>duckworth</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Extension Methods]]></category>

		<guid isPermaLink="false">http://illdata.com/blog/?p=58</guid>
		<description><![CDATA[Extension methods in c# have definitely changed my day to day development in a positive way, as they can easily add functionality that may be missing in the base class library or provide easy access to routines that you may use frequently. Many times they can just make a snippet of code more terse or [...]]]></description>
			<content:encoded><![CDATA[<p>Extension methods in c# have definitely changed my day to day development in a positive way, as they can easily add functionality that may be missing in the base class library or provide easy access to routines that you may use frequently. Many times they can just make a snippet of code more terse or readable. Here are two extension methods I came across on <a href="http://StackOverflow.com" target="_blank">StackOverflow</a> that come in handy for firing events:</p>
<pre class="csharp"><span style="color: #0600FF;">static</span> <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> RaiseEvent<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> EventHandler theEvent, <span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>theEvent != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        theEvent<span style="color: #000000;">&#40;</span>sender, e<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">static</span> <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> RaiseEvent&lt;T&gt;<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> EventHandler&lt;T&gt; theEvent, <span style="color: #FF0000;">object</span> sender, T e<span style="color: #000000;">&#41;</span>
    where T : EventArgs
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>theEvent != <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        theEvent<span style="color: #000000;">&#40;</span>sender, e<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>which can be used like such:</p>
<pre class="csharp">SomthingHappenedEvent.<span style="color: #0000FF;">RaiseEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> EventArgs<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre>
<p>another useful extension method for passing in a property name without using hardcoded strings:</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> GetPropertyName&lt;T, S&gt;<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> T obj, Expression&lt;Func&lt;T, S&gt;&gt; expr<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>MemberExpression<span style="color: #000000;">&#41;</span>expr.<span style="color: #0000FF;">Body</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Member</span>.<span style="color: #0000FF;">Name</span>;
<span style="color: #000000;">&#125;</span></pre>
<p>which can be used as such:</p>
<pre class="csharp">var ob = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #000000;">&#123;</span> SomeProp = <span style="color: #808080;">&quot;abc&quot;</span><span style="color: #000000;">&#125;</span>;
<span style="color: #FF0000;">string</span> propName = ob.<span style="color: #0000FF;">GetPropertyName</span><span style="color: #000000;">&#40;</span>a =&gt; a.<span style="color: #0000FF;">SomeProp</span><span style="color: #000000;">&#41;</span>;</pre>
<p>and finally, another handy set for quickly serializing any object to JSON:</p>
<pre class="csharp">﻿<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> ToJson<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> <span style="color: #FF0000;">object</span> obj<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    var serializer = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> JavaScriptSerializer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0600FF;">return</span> serializer.<span style="color: #0000FF;">Serialize</span><span style="color: #000000;">&#40;</span>obj<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> ToJson<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> <span style="color: #FF0000;">object</span> obj, <span style="color: #FF0000;">int</span> recursonDepth<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    var serializer = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> JavaScriptSerializer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    serializer.<span style="color: #0000FF;">RecursionLimit</span> = recursonDepth;
    <span style="color: #0600FF;">return</span> serializer.<span style="color: #0000FF;">Serialize</span><span style="color: #000000;">&#40;</span>obj<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://illdata.com/blog/2009/04/21/extension-method-round-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>101 Design Patterns &amp; Tips for Developers</title>
		<link>http://illdata.com/blog/2008/02/01/101-design-patterns-tips-for-developers/</link>
		<comments>http://illdata.com/blog/2008/02/01/101-design-patterns-tips-for-developers/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 17:10:40 +0000</pubDate>
		<dc:creator>duckworth</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://illdata.com/blog/2008/02/01/101-design-patterns-tips-for-developers/</guid>
		<description><![CDATA[Here is a great page to bookmark...
 http://sourcemaking.com/design-patterns-and-tips
It contains an assortment/reference of design patterns, refactorings and other useful programming tips.
]]></description>
			<content:encoded><![CDATA[<p>Here is a great page to bookmark...</p>
<p><a href="http://sourcemaking.com/design-patterns-and-tips" target="_blank" title="101 Design Patterns &amp; Tips for Developers"> http://sourcemaking.com/design-patterns-and-tips</a></p>
<p>It contains an assortment/reference of design patterns, refactorings and other useful programming tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://illdata.com/blog/2008/02/01/101-design-patterns-tips-for-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Last.fm</title>
		<link>http://illdata.com/blog/2007/12/20/lastfm/</link>
		<comments>http://illdata.com/blog/2007/12/20/lastfm/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 04:36:20 +0000</pubDate>
		<dc:creator>duckworth</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[radio]]></category>

		<guid isPermaLink="false">http://new.illdata.com/blog/2008/01/24/lastfm/</guid>
		<description><![CDATA[What I've been listening to lately...
























]]></description>
			<content:encoded><![CDATA[<p>What I've been listening to lately...</p>
<p><!-- table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 td {margin:0 !important;padding:0 !important;border:0 !important;}table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 tr.lfmHead a:hover {background:url(http://cdn.last.fm/widgets/images/en/header/quilt/album_horizontal_grey.png) no-repeat 0 0 !important;}table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 tr.lfmEmbed object {float:left;}table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 tr.lfmFoot td.lfmConfig a:hover {background:url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat 0px 0 !important;;}table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 tr.lfmFoot td.lfmView a:hover {background:url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat -85px 0 !important;}table.lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106 tr.lfmFoot td.lfmPopup a:hover {background:url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat -159px 0 !important;} --></p>
<table class="lfmWidgetquilt_f942bfaa87dacb749f69d2f68e16e106" style="width: 460px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="lfmHead">
<td><a style="border: 0pt none; background: transparent url(http://cdn.last.fm/widgets/images/en/header/quilt/album_horizontal_grey.png) no-repeat scroll 0pt -20px; overflow: hidden; display: block; height: 20px; width: 460px; text-decoration: none;" title="Top albums" href="http://www.last.fm/user/duckworth/charts" target="_blank"></a></td>
</tr>
<tr class="lfmEmbed">
<td><object width="460" height="180" data="http://cdn.last.fm/widgets/quilt/13.swf" type="application/x-shockwave-flash"><param name="id" value="lfmEmbed_1196203296" /><param name="flashvars" value="type=user&amp;variable=duckworth&amp;file=topalbums&amp;bgColor=grey&amp;theme=grey&amp;lang=en&amp;widget_id=quilt_f942bfaa87dacb749f69d2f68e16e106" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="999999" /><param name="wmode" value="transparent" /><param name="menu" value="true" /><param name="src" value="http://cdn.last.fm/widgets/quilt/13.swf" /></object></td>
</tr>
<tr class="lfmFoot">
<td style="background:url(http://cdn.last.fm/widgets/images/footer_bg/grey.png) repeat-x 0 0;text-align:right;">
<table style="width: 460px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="lfmConfig"><a style="border: 0pt none; background: transparent url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat scroll 0px -20px; overflow: hidden; display: block; width: 85px; height: 20px; float: right; text-decoration: none;" title="Get your own widget" href="http://www.last.fm/widgets/?url=user%2Fduckworth%2Fpersonal&amp;colour=grey&amp;quiltType=album&amp;orient=horizontal&amp;height=medium&amp;from=code&amp;widget=quilt" target="_blank"></a></td>
<td class="lfmView" style="width: 74px;"><a style="border: 0pt none; background: transparent url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat scroll -85px -20px; overflow: hidden; display: block; width: 74px; height: 20px; text-decoration: none;" title="View duckworth's profile" href="http://www.last.fm/user/duckworth" target="_blank"></a></td>
<td class="lfmPopup" style="width: 25px;"><a style="border: 0pt none; background: transparent url(http://cdn.last.fm/widgets/images/en/footer/grey.png) no-repeat scroll -159px -20px; overflow: hidden; display: block; width: 25px; height: 20px; text-decoration: none;" title="Load this quilt in a pop up" onclick="window.open(this.href + '&amp;resize=0','lfm_popup','height=280,width=510,resizable=yes,scrollbars=yes'); return false;" href="http://www.last.fm/widgets/popup/?url=user%2Fduckworth%2Fpersonal&amp;colour=grey&amp;quiltType=album&amp;orient=horizontal&amp;height=medium&amp;from=code&amp;widget=quilt&amp;resize=1" target="_blank"></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://illdata.com/blog/2007/12/20/lastfm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting an SSL Certificate from IIS to use in FileZilla FTP Server</title>
		<link>http://illdata.com/blog/2007/01/23/exporting-an-ssl-certificate-from-iis-to-use-in-filezilla-ftp-server/</link>
		<comments>http://illdata.com/blog/2007/01/23/exporting-an-ssl-certificate-from-iis-to-use-in-filezilla-ftp-server/#comments</comments>
		<pubDate>Tue, 23 Jan 2007 14:38:30 +0000</pubDate>
		<dc:creator>duckworth</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://new.illdata.com/2007/01/23/exporting-an-ssl-certificate-from-iis-to-use-in-filezilla-ftp-server/</guid>
		<description><![CDATA[FileZilla is a free, open source FTP
server (there is also a client) with SSL/TLS support.
I wanted to use my real SSL Certificate that I had for my website to secure the communication
to my FTP Server and couldn't find any instructions on how to do so. After a little
searching and some trial and error this is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://filezilla.sourceforge.net/">FileZilla</a> is a free, open source FTP<br />
server (there is also a client) with SSL/TLS support.</p>
<p>I wanted to use my real SSL Certificate that I had for my website to secure the communication<br />
to my FTP Server and couldn't find any instructions on how to do so. After a little<br />
searching and some trial and error this is the solution I have come up with, I hope<br />
someone finds this useful.<span id="more-5"></span></p>
<p>The real certificate was set up and installed in IIS6, so the first step is to export<br />
the cert from IIS. The Directory Security tab in the properties section of your website<br />
in IIS has a button labelled "Server Certificate" which will launch the Web Server<br />
Certificate wizard. Once the wizard launches, click next and choose the option "Export<br />
the current certificate to a .pfx file:</p>
<p><img src="http://illdata.com/binary/IISExport1.png" border="0" /></p>
<p>Enter the name and the path of the file and click next. Choose a password to encrypt<br />
the exported file with and click next, then finish.</p>
<p>The program I used to convert the certificate is called <a href="http://www.hohnstaedt.de/xca.html">XCA</a> and<br />
can be downloaded from <a href="http://sourceforge.net/projects/xca">SourceForge</a>.<br />
Once you have XCA installed launch the application, and under the certificates tab<br />
select "Import PKCS#12" and browse to the .pfx file that was exported from IIS:</p>
<p><img src="http://illdata.com/binary/XCAImport.png" border="0" /></p>
<p>It will prompt you for the password to decrypt the .pfx file and you will need to<br />
use the password chosen when you exported it from IIS. In the next dialog, chose "import<br />
all".<br />
You should now see an entry under the keys tab named "unnamed" and an entry under<br />
the certificates for your imported certificate.</p>
<p>Now we are going to export the Key file and certificate file required by FileZilla.<br />
To export the key select the "unnamed" key and chose export, check off option to Encrypt<br />
the key with a password, the format will be PEM:</p>
<p><img src="http://illdata.com/binary/keyExport1.png" border="0" /></p>
<p>Then export the certificate in the PEM format also:</p>
<p><img src="http://illdata.com/binary/certExport.png" border="0" /></p>
<p>The final step is to configure FileZilla to use your key and certificate. Browse to<br />
the key and certificate files and enter the password you used to encrypt your key:</p>
<p><img src="http://illdata.com/binary/FilezillaWindow1.png" border="0" /></p>
<p>FileZilla will now use your real SSL Certificate and you will be able to secure your<br />
FTP communications to your server!</p>
]]></content:encoded>
			<wfw:commentRss>http://illdata.com/blog/2007/01/23/exporting-an-ssl-certificate-from-iis-to-use-in-filezilla-ftp-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
