<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Knowledge Base</title>
        <link>https://farmcode.org/</link>
        <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
        <generator>Simon Antony Limited</generator>
        <description>Find solutions to your Umbraco, XSLT, UserControl, Razor and general Microsoft or IT Related issues with the Simon Antony Umbraco Knowledgebase.</description>
        <language>en-GB</language>
        <atom:link href="https://farmcode.org/" rel="self" type="application/rss+xml"/>
            <item>
                <title>Linq to Umbraco</title>
                <link>https://farmcode.org/articles/linq-to-umbraco/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:16 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/linq-to-umbraco/</guid>
                <description><![CDATA[We've been working on 3 larger Umbraco sites in which we've implemented our own Linq to Umbraco strategy. It's a fairly simple strategy, it doesn't involve custom expression trees or anything]]></description>
                <content:encoded><![CDATA[<h2>Intro</h2>
<p>We've been working on 3 larger Umbraco sites in which we've implemented our own Linq to Umbraco strategy. It's a fairly simple strategy, it doesn't involve custom expression trees or anything, it simply leverages Linq to Xml, IEnumerable&lt;T&gt; and extension methods. In simple terms, we basically convert Xml nodes into our own objects which we can then run typed Linq queries against. Since the performance of deserialization of this Xml into objects was one of our concerns, we implemented Microsoft's Policy Injection framework to handle the caching of our Umbraco objects which works really well (more on this later). Here's a quick example of what this allows you to do with Umbraco data (in this case Umbraco is storing information about events, such as festivals, etc...)</p>
<pre class="prettyprint"><span class="kwd">var</span><span class="pln"> todayEvents </span><span class="pun">=</span><span class="pun">(</span><span class="kwd">from</span><span class="pln"> e </span><span class="kwd">in</span><span class="typ">GetEvents</span><span class="pun">()</span><span class="pln"><br />                   </span><span class="kwd">where</span><span class="pln"> e</span><span class="pun">.</span><span class="typ">FromDate</span><span class="pun">.</span><span class="typ">Date</span><span class="pun">==</span><span class="typ">DateTime</span><span class="pun">.</span><span class="typ">Now</span><span class="pun">.</span><span class="typ">Date</span><span class="pln"><br />                   </span><span class="kwd">select</span><span class="pln"> e</span><span class="pun">).</span><span class="typ">ToList</span><span class="pun">();</span></pre>
<h2>Background</h2>
<p>In order for this to work, there is a bit of setup involved. The way that we've gone about this implementation is by defining a data model for each Document Type that you want to be able to use in this framework. In this example, Umbraco will need to be setup with a few Document Types: Event, EventComment, EventOrganizer, EventsContainer. I've included the definitions of these doc types in the source code so you can easily import them. For an event model, we would create an interface:</p>
<pre class="prettyprint"><span class="kwd">public </span><span class="kwd">interface </span><span class="typ">IUmbEvent</span><span class="pun">:</span><span class="typ">IUmbracoItem</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Collections</span><span class="pun">.</span><span class="typ">Generic</span><span class="pun">.</span><span class="typ">List</span><span class="typ">EventComments</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">} </span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">EventTitle</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="typ">DateTime </span><span class="typ">FromDate</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">FullDescription</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">ShortDescription</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">bool </span><span class="typ">ShowInListing</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="typ">DateTime</span><span class="pun">? </span><span class="typ">ToDate</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br /></span><span class="pun">}</span></pre>
<p>You'll notice this interface extends IUmbracoItem which I've defined in our code library. It contains all of the basic properties of an Umbraco node:</p>
<pre class="prettyprint"><span class="kwd">public </span><span class="kwd">interface </span><span class="typ">IUmbracoItem</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="typ">DateTime </span><span class="typ">CreatedDate </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">CreatorId </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">CreatorName </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">Id </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">Level </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Collections</span><span class="pun">.</span><span class="typ">Generic</span><span class="pun">.</span><span class="typ">Dictionary</span><span class="typ">NodeData </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">NodeName</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">NodeType</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">;</span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">NodeTypeAlias</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">ParentId </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">Path</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int </span><span class="typ">SortOrder </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">int</span><span class="pun">? </span><span class="typ">Template </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="typ">DateTime </span><span class="typ">UpdateDate</span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">; </span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">UrlName </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">Version </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">; </span><span class="kwd">set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br />    </span><span class="kwd">string </span><span class="typ">WriterName </span><span class="pun">{ </span><span class="kwd">get</span><span class="pun">;</span><span class="kwd"> set</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br /></span><span class="pun">}</span></pre>
<p>Next I've created a class that implements this interface called UmbEvent which extends UmbracoItem(which in turn implements IUmbracoItem). The constructor function of these objects are what does the deserialization:</p>
<pre class="prettyprint"><span class="kwd">public </span><span class="typ">UmbEvent</span><span class="pun">(</span><span class="typ">XElement</span><span class="pln"> x</span><span class="pun">)</span><span class="pln"> <br />            </span><span class="pun">:</span><span class="kwd">base</span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="com">//Get the from date and use the DateConverter to convert it. </span><span class="pln"><br />    </span><span class="com">//If the returned date is MinValue, then the value in Umbraco has not actually </span><span class="pln"><br />    </span><span class="com">//been set and since it is mandatory, we'll throw an Exception. </span><span class="pln"><br />    </span><span class="typ">FromDate </span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"FromDate"</span><span class="pun">,</span><span class="typ">DateConverter</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="kwd">if</span><span class="pun">(</span><span class="typ">FromDate </span><span class="pun">== </span><span class="typ">DateTime</span><span class="pun">.</span><span class="typ">MinValue</span><span class="pun">)</span><span class="pln"> <br />        </span><span class="kwd">throw </span><span class="kwd">new </span><span class="typ">Exception</span><span class="pun">(</span><span class="kwd">string</span><span class="pun">.</span><span class="typ">Format</span><span class="pun">(</span><span class="pln"><br />                </span><span class="str">"The node with id {0} does not have a start date set"</span><span class="pun">,</span><span class="pln"> <br />                </span><span class="kwd">this</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">()));</span><span class="pln"> <br /><br />    </span><span class="com">//Get the ToDate using a NullableDateTimeConverter </span><span class="pln"><br />    </span><span class="typ">ToDate</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"ToDate"</span><span class="pun">,</span><span class="typ">NullableDateTimeConverter</span><span class="pun">);</span><span class="pln"> <br /><br />    </span><span class="typ">EventTitle</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"EventTitle"</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="typ">ShortDescription</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"ShortDescription"</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="typ">FullDescription</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"FullDescription"</span><span class="pun">);</span><span class="pln"> <br />    <br />    </span><span class="com">//Get the ShowInListing using the IntConverter since the value stored in Umbraco is </span><span class="pln"><br />    </span><span class="com">//an integer, not a boolean. </span><span class="pln"><br />    </span><span class="typ">ShowInListing</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectDataValue</span><span class="pun">(</span><span class="str">"ShowInListing"</span><span class="pun">,</span><span class="typ">IntConverter</span><span class="pun">)</span><span class="pun">==</span><span class="lit">1</span><span class="pun">;</span><span class="pln">            <br />    <br />    </span><span class="com">//Select all child "node" nodes that have a node type alias </span><span class="pln"><br />    </span><span class="com">//of "Event Comment" from the current element, deserialize them </span><span class="pln"><br />    </span><span class="com">//to UmbEventComment objects, and store them in our List property. </span><span class="pln"><br />    </span><span class="typ">EventComments</span><span class="pun">=</span><span class="pln"> x</span><span class="pun">.</span><span class="typ">UmbSelectNodes</span><span class="pun">()</span><span class="pln"> <br />        </span><span class="pun">.</span><span class="typ">UmbSelectNodesWhereNodeTypeAlias</span><span class="pun">(</span><span class="str">"EventComment"</span><span class="pun">)</span><span class="pln"> <br />        </span><span class="pun">.</span><span class="typ">Select</span><span class="pun">(</span><span class="pln">n </span><span class="pun">=&gt;</span><span class="kwd">new</span><span class="typ">UmbEventComment</span><span class="pun">(</span><span class="pln">n</span><span class="pun">))</span><span class="pln"> <br />        </span><span class="pun">.</span><span class="typ">ToList</span><span class="pun">();</span><span class="pln">            <br /></span><span class="pun">}</span></pre>
<p>In the code for the UmbracoItem class are some helper methods for data conversion so exceptions are not thrown and that data is converted properly. </p>
<p>The next step is to setup the data service layer. I generally create a different service class for each model and in this example we'll have IUmbEventService interface with an UmbEventService class defined as:</p>
<pre class="prettyprint"><span class="kwd">public </span><span class="kwd">interface </span><span class="typ">IUmbEventService</span><span class="pun">:</span><span class="typ">IUmbracoService</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="kwd">int</span><span class="typ">CreateEvent</span><span class="pun">(</span><span class="typ">IUmbEvent</span><span class="pln"> cqEvent</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="kwd">void</span><span class="typ">UpdateEvent</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> eventId</span><span class="pun">,</span><span class="typ">IUmbEvent</span><span class="pln"> e</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="typ">List</span><span class="typ">GetEvents</span><span class="pun">();</span><span class="pln"> <br />    </span><span class="typ">IUmbEvent</span><span class="typ">GetEvent</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> eventId</span><span class="pun">);</span><span class="pln"> <br />    </span><span class="typ">DateTime</span><span class="typ">LastEventDate</span><span class="pun">{</span><span class="kwd">get</span><span class="pun">;</span><span class="pun">}</span><span class="pln"> <br /></span><span class="pun">}</span></pre>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco Examine v4x Powerful Umbraco Indexing</title>
                <link>https://farmcode.org/articles/umbraco-examine-v4x-powerful-umbraco-indexing/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:16 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-examine-v4x-powerful-umbraco-indexing/</guid>
                <description><![CDATA[This post is outdated. For the latest information on Examine please refer to either the Examine page on our site or the Examine CodePlex project home.]]></description>
                <content:encoded><![CDATA[<p><em><span class="Apple-style-span">This post it outdated. For the latest information on Examine please refer to either the </span></em><a href="/articles/examine-and-umbraco-examine-specifically/"><span class="Apple-style-span">Examine page on our site</span></a><span class="Apple-style-span"> or the </span><a href="http://examine.codeplex.com/"><span class="Apple-style-span">Examine CodePlex project home</span></a><span class="Apple-style-span">. </span></p>
<p><strong>Umbraco Examine</strong> is a powerful, fully configurable, and extensible library used for indexing Umbraco content to allow for fast and easy content searching. It utilizes the Lucene.Net library which is included in the Umbraco installation (v2.x). It is extremely easy to setup and caters for simple indexing/searching to very complex index/searching by utilizing it's fully extensible codebase and it's event model. The library was built with .Net 3.5 SP1 and has not been tested with previous versions of .Net.</p>
<ul>
<li>Binaries:  <a href="/media/sourcecode/UmbracoExaminev4.zip">UmbracoExaminev4.zip (23.36 kb)</a>
<ul>
<li><em>Read the Readme.txt file for basic setup instructions</em></li>
</ul>
</li>
<li>Source code @ CodePlex: <a rel="noopener noreferrer" href="http://umbracoexamine.codeplex.com/" target="_blank" title="Umbraco Examine Source Code">http://umbracoexamine.codeplex.com/</a></li>
<li>Documentation
<ul>
<li><a href="#BasicSetup">Basic Setup</a></li>
<li><a href="#BasicSearch">Basic Search</a></li>
<li><a href="#AdvancedSetup">Advanced Setup</a></li>
<li><a href="#AdvancedSearch">Advanced Search</a></li>
<li>Using the event model (coming soon...)</li>
<li>Extending Umbraco Examine (coming soon...)</li>
<li>Re-indexing dashboard plugin (coming soon...)</li>
</ul>
</li>
</ul>
<p><a name="BasicSetup" title="BasicSetup"></a></p>
<h2>Basic Setup</h2>
<ul>
<li>Copy the DLL files to the bin folder</li>
<li>Add the following to the &lt;configSections&gt; portion of your Web.config file:</li>
</ul>
<pre>&lt;section name="UmbLuceneIndex" <br />	type="TheFarm.Umbraco.Lucene.Configuration.IndexSets, TheFarm.Umbraco.Lucene" /&gt;</pre>
<ul>
<li>For the most basic setup, add the following to the configuration in your Web.config (Also see the readme.txt and app.config files in the binaries download!):</li>
</ul>
<pre>&lt;UmbLuceneIndex DefaultIndexSet="MyIndexSet" EnableDefaultActionHandler="true"&gt;<br />    &lt;IndexSet SetName="MyIndexSet" IndexPath="~/data/UmbracoExamine/" MaxResults="100"&gt;<br />        &lt;IndexUmbracoFields&gt;<br />            &lt;add Name="id" /&gt; &lt;!-- REQUIRED --&gt;<br />            &lt;add Name="nodeName" /&gt; &lt;!-- REQUIRED --&gt;<br />            &lt;add Name="updateDate" /&gt;<br />            &lt;add Name="writerName" /&gt;<br />            &lt;add Name="path" /&gt;<br />            &lt;add Name="nodeTypeAlias" /&gt; &lt;!-- REQUIRED --&gt;<br />        &lt;/IndexUmbracoFields&gt;<br />        &lt;IndexUserFields&gt;<br />            &lt;add Name="PageTitle"/&gt;<br />            &lt;add Name="PageContent"/&gt;<br />        &lt;/IndexUserFields&gt;<br />        &lt;IncludeNodeTypes /&gt;<br />        &lt;ExcludeNodeTypes /&gt;<br />    &lt;/IndexSet&gt;<br />&lt;/UmbLuceneIndex&gt;</pre>
<ul>
<li>Create the folder: ~/data/UmbracoExamine/ since this is what has been specified for the index path above. 
<ul>
<li>Ensure that the IIS user has full control on this folder.</li>
</ul>
</li>
<li>Since EnableDefaultActionHandler is set to true, each time a node is published, it will be indexed based on the rules suplied in the configuration. When a node is unpublished, it will automatically be removed from the index.</li>
<li>Log into Umbraco, publish a node and verify that files have been created in the index path as specified above.</li>
</ul>
<p><a name="BasicSearch" title="BasicSearch"></a></p>
<h2>Basic Search</h2>
<ul>
<li>To perform a search:</li>
</ul>
<pre>UmbracoIndexer examine = new UmbracoIndexer();<br />List&lt;SearchResult&gt; results = examine.Search("find this", true);</pre>
<ul>
<li>The returned structure is simple, containing 3 properties: Id, Score and Fields:</li>
</ul>
<pre>public int Id { get; set; }<br />public float Score { get; set; }<br />public Dictionary&lt;string, string&gt; Fields { get; set; }</pre>
<ul>
<li>The Fields property contains all of the field data that has been configured in the web.config file.</li>
</ul>
<p><a name="AdvancedSetup" title="AdvancedSetup"></a></p>
<h2>Advanced Setup</h2>
<p>You can create multiple indexes depending on your needs. For example, you may want to have different indexes for different portal sites in your content tree, or different indexes to separate the type of content being indexed such as one for News and one for Forum, as an example. Creating different indexes if easy:</p>
<pre>&lt;UmbLuceneIndex DefaultIndexSet="Site1" EnableDefaultActionHandler="true"&gt; <br />&lt;!-- Create an index for a site called 'Site1' which has a starting parent <br />node in the content tree of 1234. Only nodes that have the Id, or are children of node 1234 will be indexed. --&gt; <br />&lt;IndexSet SetName="Site1" IndexPath="~/data/indexes/site1/" MaxResults="100" IndexParentId="1234"&gt;<br /> &lt;IndexUmbracoFields&gt; <br /> &lt;add Name="id" /&gt; &lt;!-- REQUIRED --&gt; <br /> &lt;add Name="nodeName" /&gt; &lt;!-- REQUIRED --&gt; <br /> &lt;add Name="updateDate" /&gt; <br /> &lt;add Name="writerName" /&gt; <br /> &lt;add Name="path" /&gt; <br /> &lt;add Name="nodeTypeAlias" /&gt; &lt;!-- REQUIRED --&gt; <br /> &lt;add Name="parentID"/&gt; <br /> &lt;/IndexUmbracoFields&gt; <br /> &lt;IndexUserFields&gt;<br /> &lt;add Name="PageTitle"/&gt; <br /> &lt;add Name="PageContent"/&gt; <br /> &lt;add Name="CommentText"/&gt; <br /> &lt;add Name="CommentUser"/&gt; <br /> &lt;add Name="umbracoNaviHide"/&gt; <br />&lt;/IndexUserFields&gt; <br />&lt;IncludeNodeTypes&gt; <br /> &lt;add Name="HomePage" /&gt; <br /> &lt;add Name="BasicPage" /&gt; <br /> &lt;add Name="Comment" /&gt; <br />&lt;/IncludeNodeTypes&gt; <br />&lt;ExcludeNodeTypes /&gt; <br />&lt;/IndexSet&gt; &lt;!-- Create an index for a site called 'Site2' which has a starting parent node in the <br />content tree of 4567. Only nodes that have the Id, or are children of node 4567 will be indexed. --&gt; <br /><br />&lt;IndexSet SetName="Site2" IndexPath="~/data/indexes/site2/" MaxResults="100" IndexParentId="4567"&gt; <br /> &lt;IndexUmbracoFields&gt; <br /> &lt;add Name="id" /&gt; &lt;!-- REQUIRED --&gt; <br /> &lt;add Name="nodeName" /&gt; &lt;!-- REQUIRED --&gt; <br /> &lt;add Name="updateDate" /&gt; <br /> &lt;add Name="writerName" /&gt; <br /> &lt;add Name="path" /&gt; <br /> &lt;add Name="nodeTypeAlias" /&gt; <br /> &lt;!-- REQUIRED --&gt; <br /> &lt;/IndexUmbracoFields&gt; <br /> &lt;IndexUserFields&gt; <br /> &lt;add Name="PageTitle"/&gt; <br /> &lt;add Name="PageContent"/&gt; <br /> &lt;add Name="umbracoNaviHide"/&gt;&lt;!-- You can add as many user fields here that you would like to be indexed... --&gt;<br /> &lt;/IndexUserFields&gt; <br /> &lt;IncludeNodeTypes /&gt; <br /> &lt;ExcludeNodeTypes&gt;&lt;!-- Index everything except for document types of 'UserNotes' --&gt; <br /> &lt;add Name="UserNotes" /&gt; <br /> &lt;/ExcludeNodeTypes&gt;<br /> &lt;/IndexSet&gt;<br />&lt;/UmbLuceneIndex&gt;</pre>
<h2>Advanced Search</h2>
<p>There are a few overriden search methods you can use to perform different types of searches, all depends on what kind of results you want to acheive:</p>
<pre>//This will create a new examiner to search in Site1 since Site 1 is 
//listed as the default Index in the configuration. <br /><br />UmbracoIndexer examine = new UmbracoIndexer(); <br />List&lt;SearchResult&gt; results = examine.Search("find this in Site1", true);  <br />
//This will create a new examiner to search in Site2 UmbracoIndexer examine2 = new UmbracoIndexer("Site2"); List&lt;SearchResult&gt; results2 = examine2.Search("find this in Site2", true);  <br />//disables wild card searching <br /><br />List&lt;SearchResult&gt; results3 = examine2.Search("find exact matches in Site2", false);  <br /><br />//searches site 2 but only in NewsArticle document types<br /><br />List&lt;SearchResult&gt; results4 = examine2.Search("find news in Site2",  	"NewsArticle", true, null);  <br /><br />//searches site 2 but only for nodes that are children of the node with ID 4999 <br /><br />List&lt;SearchResult&gt; results5 = examine2.Search("find something in Site2", "", true, 4999);  <br />//searches site 1, in all of it's defined doc types to be searched but only in  <br />//the properties: PageTitle and PageContent and will only return a maximum  <br />//of 10 results. <br /><br />List&lt;SearchResult&gt; results6 = <br />examine.Search("find in Site1", "", true, null, new string[] {"PageTitle","PageContent"}, 10);</pre>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>Examine and Umbraco Examine specifically</title>
                <link>https://farmcode.org/articles/examine-and-umbraco-examine-specifically/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:16 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/examine-and-umbraco-examine-specifically/</guid>
                <description><![CDATA[Examine is a provider based, config driven search and indexer framework. Examine provides all the methods required for indexing and searching any data source you want to use. It is agnostic of the indexer/ searcher API, as well as the data source. It's provider model driven so indexers and searchers for any type of data can be plugged in.]]></description>
                <content:encoded><![CDATA[<h2>Examine</h2>
<p><span>... is a provider based, config driven search and indexer framework. Examine provides all the methods required for indexing and searching any data source you want to use. It is agnostic of the indexer/ searcher API, as well as the data source. It's provider model driven so indexers and searchers for any type of data can be plugged in.</span></p>
<h2>Umbraco Examine</h2>
<p><span>... is a combination of Examine, Umbraco and Lucene.Net to make one powerful, flexible, extensible, and very fast search engine for Umbraco 4.x. </span><em>Umbraco Examine</em><span> is a Lucene.Net implementation of Examine using Umbraco as the data source. Umbraco Examine is very easy to setup and start working with and it's fully configurable by a .Net configuration section. Since each Umbraco installation is different, Umbraco Examine generally needs to be configured differently per instance.</span></p>
<h2>Features</h2>
<ul>
<li>Examine is a framework using a provider model, so the sky is the limit with regards to functionality if you need to build it.</li>
<li>The base index providers in Examine have tons of handy events which gives you complete control over the entire indexing process without having to write your own provider. This makes it extremely easy to add custom data to indexes, intercept the data going into the index, and all sorts of other fun stuff.</li>
<li>Out of the box, Examine has a fluent .Net querying language (it also obviously supports a simple free text string search too!) Example: <br />
<pre>searchCriteria<br />.Id(1080)     <br />.Or()     <br />.Field("headerText", "umb".Fuzzy())     <br />.And()     <br />.NodeTypeAlias("cws".MultipleCharacterWildcard())     <br />.Not()     <br />.NodeName("home");</pre>
</li>
</ul>
<ul>
<li>Umbraco Examine, has loads of features!
<ul>
<li>Hugely extensible through events</li>
<li>FAST.... VERY FAST!</li>
<li>Load balancing support</li>
<li>Multiple indexes. You can create as many different indexes as you want which is handy for things like multilingual websites, portal sites, etc...</li>
<li>Targetted indexing. You can specify via configuration as to what node types, properties, and node subsets (based on parent node) that you want included in your index.</li>
<li>If you're a Lucene fanatic, you can specify any type of Analzers you want to use for your indexing or searching via configuration.</li>
<li>Support for indexing any combination of: Published, Unpublished and Protected content via configuration.</li>
</ul>
</li>
</ul>
<p> <em>Umbraco Examine</em> is bundled into the Umbraco 4.1 core and is now used as the internal back-office search engine. So what are you waiting for? Let the search begin!</p>
<p>Visit the links below for the binaries, source code and documentation.</p>
<ul>
<li>RC 2 Released @ CodePlex: <a href="http://examine.codeplex.com/releases/view/43765">http://examine.codeplex.com/releases/view/43765</a>
<ul>
<li>The source also contains a test/demo project for a reference to configuration settings and how to use the codebase. You can download the source from the source control tab.</li>
</ul>
</li>
<li>Issue Tracker @ CodePlex: <a rel="noopener noreferrer" href="http://umbracoexamine.codeplex.com/WorkItem/List.aspx" target="_blank" title="Umbraco Examine Bug List">http://umbracoexamine.codeplex.com/WorkItem/List.aspx</a></li>
<li>Discussions @ CodePlex: <a rel="noopener noreferrer" href="http://umbracoexamine.codeplex.com/Thread/List.aspx" target="_blank" title="Umbraco Examine Discussions">http://umbracoexamine.codeplex.com/Thread/List.aspx</a></li>
<li>Documentation and downloads:
<ul>
<li><a href="http://examine.codeplex.com/documentation">http://examine.codeplex.com/documentation</a></li>
</ul>
</li>
</ul>]]></content:encoded>
            </item>
            <item>
                <title>Fast 2D Bezier Library for ActionScript 3</title>
                <link>https://farmcode.org/articles/fast-2d-bezier-library-for-actionscript-3/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:16 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/fast-2d-bezier-library-for-actionscript-3/</guid>
                <description><![CDATA[Originally from The Farm Digital Agency, Australia]]></description>
                <content:encoded><![CDATA[<p>Recently we needed to do some animated curves in AS3, and after searching around for some time we found several libraries for easily drawing bezier paths. The problem was they were all very slow, this being a result of them using the lineTo method for drawing (resulting in a curve made up of many tiny straight lines).</p>
<p>The benefits of the lineTo method (over the curveTo method) are that the resulting drawing can be very accurate, and that the maths used is simpler, neither of these were necessary for what we were doing.</p>
<p>We wrote our library with some goals, firstly, that it used the curveTo for all of it’s drawing. We also wanted to be able to construct paths without specifying control points, just the main points that the path passed through and a “tension” to describe the curve that gets drawn between.</p>
<p>The code for the bezier library is part of our <a rel="noopener noreferrer" href="https://code.google.com/p/farmcode/" target="_blank">Open Source Library</a></p>
<p>Here’s an example of the kind of thing that can be done easily with the library.</p>
<p>Here's the source:</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">Sprite</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">StageAlign</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">StageScaleMode</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">Event</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">MouseEvent</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">geom</span><span class="pun">.</span><span class="typ">Point</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">bezier</span><span class="pun">.</span><span class="typ">BezierPoint</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">bezier</span><span class="pun">.</span><span class="typ">Path</span><span class="pun">;</span><span class="pln"><br />        <br />    </span><span class="pun">[</span><span class="pln">SWF</span><span class="pun">(</span><span class="pln">backgroundColor</span><span class="pun">=</span><span class="str">"#dfdfdd"</span><span class="pun">,</span><span class="pln"> frameRate</span><span class="pun">=</span><span class="str">"25"</span><span class="pun">,</span><span class="pln"> width</span><span class="pun">=</span><span class="str">"700"</span><span class="pun">,</span><span class="pln"> height</span><span class="pun">=</span><span class="str">"400"</span><span class="pun">)]</span><span class="pln"><br />    </span><span class="kwd">public</span> <span class="kwd">class</span> <span class="typ">WaveTest</span><span class="kwd">extends</span> <span class="typ">Sprite</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />                        </span><span class="com">//Math</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> theta</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> buffer</span><span class="pun">:</span><span class="typ">Array</span><span class="pun">=</span><span class="kwd">new</span><span class="typ">Array</span><span class="pun">();</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> renderBuffer</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> k1</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">;</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> k2</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">;</span><span class="pln"><br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> k3</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">;</span><span class="pln"><br />            <br />            </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> path</span><span class="pun">:</span><span class="typ">Path</span><span class="pun">;</span><span class="pln"><br />                        <br />                        </span><span class="com">//Common</span><span class="pln"><br />                        </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> spacing</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">70</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> waterSegsX</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> waterSegsXreal</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> waterXcenter</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">private</span><span class="kwd">var</span><span class="pln"> isPause</span><span class="pun">:</span><span class="typ">Boolean</span><span class="pun">=</span><span class="kwd">false</span><span class="pun">;</span><span class="pln"><br />                        <br />        </span><span class="kwd">public </span><span class="kwd">function </span><span class="typ">WaveTest</span><span class="pun">(){</span><span class="pln"><br />                path </span><span class="pun">= </span><span class="kwd">new</span><span class="typ">Path</span><span class="pun">();</span><span class="pln"><br />                        path</span><span class="pun">.</span><span class="pln">autoFillTension </span><span class="pun">=</span><span class="lit">0.2</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="com">//path.closed = true;</span><span class="pln"><br />                        <br />                        stage</span><span class="pun">.</span><span class="pln">scaleMode </span><span class="pun">=</span><span class="typ">StageScaleMode</span><span class="pun">.</span><span class="pln">NO_SCALE</span><span class="pun">;</span><span class="pln"><br />                        stage</span><span class="pun">.</span><span class="pln">align </span><span class="pun">=</span><span class="typ">StageAlign</span><span class="pun">.</span><span class="pln">TOP_LEFT</span><span class="pun">;</span><span class="pln"><br />                <br />                        prepareMath</span><span class="pun">();</span><span class="pln"><br />                        populateBuffer</span><span class="pun">();</span><span class="pln"><br /><br />                        addEventListener</span><span class="pun">(</span><span class="typ">Event</span><span class="pun">.</span><span class="pln">ENTER_FRAME</span><span class="pun">,</span><span class="pln"> onEnterFrame</span><span class="pun">);</span><span class="pln"><br />                        stage</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">CLICK</span><span class="pun">,</span><span class="pln"> onMouseClick</span><span class="pun">);</span><span class="pln"><br />                        <br />        </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">Event</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        makeSplash</span><span class="pun">(((</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageHeight</span><span class="pun">/</span><span class="lit">2</span><span class="pun">)-</span><span class="pln">mouseY</span><span class="pun">)/</span><span class="lit">2</span><span class="pun">,</span><span class="pln"> mouseX</span><span class="pun">/</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageWidth</span><span class="pun">);</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="kwd">function</span><span class="pln"> makeSplash</span><span class="pun">(</span><span class="pln">impact</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">,</span><span class="pln"> fract</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> index</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="typ">Math</span><span class="pun">.</span><span class="pln">floor</span><span class="pun">(</span><span class="pln">fract</span><span class="pun">*</span><span class="pln">waterSegsXreal</span><span class="pun">);</span><span class="pln"><br />                        </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">index</span><span class="pun">==</span><span class="pln">waterSegsXreal</span><span class="pun">)</span><span class="pln">index </span><span class="pun">=</span><span class="pln"> waterSegsX</span><span class="pun">;</span><span class="pln"><br />                        buffer</span><span class="pun">[</span><span class="pln">renderBuffer</span><span class="pun">][</span><span class="pln">index</span><span class="pun">].</span><span class="pln">y </span><span class="pun">+=</span><span class="pln"> impact</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="kwd">function</span><span class="pln"> prepareMath</span><span class="pun">():</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        waterSegsX </span><span class="pun">=</span><span class="typ">Math</span><span class="pun">.</span><span class="pln">round</span><span class="pun">(</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageWidth</span><span class="pun">/</span><span class="pln">spacing</span><span class="pun">);</span><span class="pln"><br />                        waterSegsXreal </span><span class="pun">=</span><span class="pln"> waterSegsX</span><span class="pun">+</span><span class="lit">1</span><span class="pun">;</span><span class="pln"><br />                        waterXcenter </span><span class="pun">=</span><span class="pln"> waterSegsX</span><span class="pun">/</span><span class="lit">2</span><span class="pun">;</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> weight</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">10</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> t</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">0.3</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> speedPerFrequency</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">6</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> decreaseRate</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">0.1</span><span class="pun">;</span><span class="pln"><br /><br />                        </span><span class="kwd">var</span><span class="pln"> f1</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="pln"> speedPerFrequency</span><span class="pun">*</span><span class="pln">speedPerFrequency</span><span class="pun">*</span><span class="pln">t</span><span class="pun">*</span><span class="pln">t</span><span class="pun">/(</span><span class="pln">weight</span><span class="pun">*</span><span class="pln">weight</span><span class="pun">);</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> f2</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="lit">1</span><span class="pun">/(</span><span class="pln">decreaseRate</span><span class="pun">*</span><span class="pln">t</span><span class="pun">+</span><span class="lit">2</span><span class="pun">);</span><span class="pln"><br /><br />                        k1 </span><span class="pun">=</span><span class="pun">(</span><span class="lit">4</span><span class="pun">-</span><span class="lit">8</span><span class="pun">*</span><span class="pln">f1</span><span class="pun">)*</span><span class="pln">f2</span><span class="pun">;</span><span class="pln"><br />                        k2 </span><span class="pun">=</span><span class="pun">(</span><span class="pln">decreaseRate</span><span class="pun">*</span><span class="pln">t</span><span class="pun">-</span><span class="lit">2</span><span class="pun">)*</span><span class="pln">f2</span><span class="pun">;</span><span class="pln"><br />                        k3 </span><span class="pun">=</span><span class="lit">2</span><span class="pun">*</span><span class="pln"> f1 </span><span class="pun">*</span><span class="pln"> f2</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="kwd">function</span><span class="pln"> populateBuffer</span><span class="pun">():</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> x</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">,</span><span class="pln">y</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">,</span><span class="pln">z</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="lit">2</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++){</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> a</span><span class="pun">:</span><span class="typ">Array</span><span class="pun">=</span><span class="kwd">new</span><span class="typ">Array</span><span class="pun">();</span><span class="pln"><br />                                </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> k</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"> k </span><span class="pun">&lt;</span><span class="pln"> waterSegsXreal</span><span class="pun">;</span><span class="pln"> k</span><span class="pun">++)</span><span class="pln"><br />                                        a</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="kwd">new</span><span class="typ">Point</span><span class="pun">(</span><span class="pln">k</span><span class="pun">,</span><span class="lit">0</span><span class="pun">));</span><span class="pln"><br />                                        <br />                                buffer</span><span class="pun">[</span><span class="pln">i</span><span class="pun">]</span><span class="pun">=</span><span class="pln"> a</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br />                </span><span class="kwd">private</span><span class="kwd">function</span><span class="pln"> evaluate</span><span class="pun">():</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> crnt</span><span class="pun">:</span><span class="typ">Array</span><span class="pun">=</span><span class="pln"> buffer</span><span class="pun">[</span><span class="pln">renderBuffer</span><span class="pun">];</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> prev</span><span class="pun">:</span><span class="typ">Array</span><span class="pun">=</span><span class="pln"> buffer</span><span class="pun">[</span><span class="lit">1</span><span class="pun">-</span><span class="pln">renderBuffer</span><span class="pun">];</span><span class="pln"><br />                        </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> waterSegsXreal</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pun">{</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> currentP</span><span class="pun">:</span><span class="typ">Point</span><span class="pun">=</span><span class="pun">(</span><span class="typ">Point</span><span class="pun">)(</span><span class="pln">buffer</span><span class="pun">[</span><span class="pln">renderBuffer</span><span class="pun">][</span><span class="pln">i</span><span class="pun">]);</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> prevPoint</span><span class="pun">:</span><span class="typ">Point</span><span class="pun">=</span><span class="pln"> prev</span><span class="pun">[</span><span class="pln">i</span><span class="pun">]</span><span class="kwd">as</span><span class="typ">Point</span><span class="pun">;</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> beforePoint</span><span class="pun">:</span><span class="typ">Point</span><span class="pun">=</span><span class="pln"> crnt</span><span class="pun">[</span><span class="pln">i</span><span class="pun">-</span><span class="lit">1</span><span class="pun">];</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> afterPoint</span><span class="pun">:</span><span class="typ">Point</span><span class="pun">=</span><span class="pln"> crnt</span><span class="pun">[</span><span class="pln">i</span><span class="pun">+</span><span class="lit">1</span><span class="pun">];</span><span class="pln"><br />                                prevPoint</span><span class="pun">.</span><span class="pln">y </span><span class="pun">=</span><span class="pln"> <br />                                        k1</span><span class="pun">*((</span><span class="typ">Point</span><span class="pun">)(</span><span class="pln">crnt</span><span class="pun">[</span><span class="pln">i</span><span class="pun">])).</span><span class="pln">y </span><span class="pun">+</span><span class="pln"> k2</span><span class="pun">*</span><span class="pln">prevPoint</span><span class="pun">.</span><span class="pln">y </span><span class="pun">+</span><span class="pln"> <br />                                        k3</span><span class="pun">*((</span><span class="pln">afterPoint</span><span class="pun">?</span><span class="pln">afterPoint</span><span class="pun">.</span><span class="pln">y</span><span class="pun">:</span><span class="lit">0</span><span class="pun">)</span><span class="pun">+</span><span class="pun">(</span><span class="pln">beforePoint</span><span class="pun">?</span><span class="pln">beforePoint</span><span class="pun">.</span><span class="pln">y</span><span class="pun">:</span><span class="lit">0</span><span class="pun">)</span><span class="pun">+</span><span class="pln"> currentP</span><span class="pun">.</span><span class="pln">y</span><span class="pun">);</span><span class="pln"><br />                        </span><span class="pun">}</span><span class="pln"><br />                        renderBuffer </span><span class="pun">=</span><span class="lit">1</span><span class="pun">-</span><span class="pln">renderBuffer</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br /><br />        </span><span class="kwd">private</span><span class="kwd">function</span><span class="pln"> onEnterFrame</span><span class="pun">(</span><span class="kwd">event</span><span class="pun">:</span><span class="typ">Event</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />            </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">isPause</span><span class="pun">){</span><span class="pln"><br />                                theta </span><span class="pun">+=</span><span class="lit">0.05</span><span class="pun">;</span><span class="pln"><br />                                </span><span class="kwd">var</span><span class="pln"> verCounter</span><span class="pun">:</span><span class="kwd">uint</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />                graphics</span><span class="pun">.</span><span class="pln">clear</span><span class="pun">();</span><span class="pln"><br />                graphics</span><span class="pun">.</span><span class="pln">beginFill</span><span class="pun">(</span><span class="lit">0x111120</span><span class="pun">);</span><span class="pln"><br />                <br />                                </span><span class="kwd">var</span><span class="pln"> points</span><span class="pun">:</span><span class="typ">Array</span><span class="pun">=</span><span class="pun">[];</span><span class="pln"><br />                                graphics</span><span class="pun">.</span><span class="pln">moveTo</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageHeight</span><span class="pun">/</span><span class="lit">2</span><span class="pun">);</span><span class="pln"><br />                <br />                </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> x</span><span class="pun">:</span><span class="kwd">int</span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"> x </span><span class="pun">&lt;</span><span class="pln"> waterSegsXreal </span><span class="pun">;</span><span class="pln"> x</span><span class="pun">++){</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> y</span><span class="pun">:</span><span class="typ">Number</span><span class="pun">=</span><span class="pln"> buffer</span><span class="pun">[</span><span class="pln">renderBuffer</span><span class="pun">][</span><span class="pln">x</span><span class="pun">].</span><span class="pln">y</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> point</span><span class="pun">:</span><span class="typ">BezierPoint</span><span class="pun">=</span><span class="kwd">new</span><span class="typ">BezierPoint</span><span class="pun">((</span><span class="pln">x</span><span class="pun">/(</span><span class="pln">waterSegsXreal</span><span class="pun">-</span><span class="lit">1</span><span class="pun">))*</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageWidth</span><span class="pun">,(</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageHeight</span><span class="pun">/</span><span class="lit">2</span><span class="pun">)+</span><span class="pln">y</span><span class="pun">);</span><span class="pln"><br />                                        </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">x</span><span class="pun">==</span><span class="lit">0</span><span class="pun">){</span><span class="pln"><br />                                                point</span><span class="pun">.</span><span class="pln">backwardDistance </span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />                                                point</span><span class="pun">.</span><span class="pln">backwardAngle </span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />                                        </span><span class="pun">}</span><span class="kwd">else</span><span class="kwd">if</span><span class="pun">(</span><span class="pln">x </span><span class="pun">==</span><span class="pln"> waterSegsXreal</span><span class="pun">-</span><span class="lit">1</span><span class="pun">){</span><span class="pln"><br />                                                point</span><span class="pun">.</span><span class="pln">forwardDistance </span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />                                                point</span><span class="pun">.</span><span class="pln">forwardAngle </span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />                                        </span><span class="pun">}</span><span class="pln"><br />                                        points</span><span class="pun">.</span><span class="pln">push</span><span class="pun">(</span><span class="pln">point</span><span class="pun">);</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                                <br />                                path</span><span class="pun">.</span><span class="pln">points </span><span class="pun">=</span><span class="pln"> points</span><span class="pun">;</span><span class="pln"><br />                                path</span><span class="pun">.</span><span class="pln">drawInto</span><span class="pun">(</span><span class="pln">graphics</span><span class="pun">);</span><span class="pln"><br />                                <br />                                graphics</span><span class="pun">.</span><span class="pln">lineTo</span><span class="pun">(</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageWidth</span><span class="pun">,</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageHeight</span><span class="pun">);</span><span class="pln"><br />                                graphics</span><span class="pun">.</span><span class="pln">lineTo</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln">stage</span><span class="pun">.</span><span class="pln">stageHeight</span><span class="pun">);</span><span class="pln"><br />                                graphics</span><span class="pun">.</span><span class="pln">endFill</span><span class="pun">();</span><span class="pln"><br />                                <br />                                evaluate</span><span class="pun">();</span><span class="pln"><br />                <br />                        </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p><span class="pun"> </span></p>]]></content:encoded>
            </item>
            <item>
                <title>The Simplest Store Package</title>
                <link>https://farmcode.org/articles/the-simplest-store-package/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:14:46 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/the-simplest-store-package/</guid>
                <description><![CDATA[One of the main problems I have always faced as an Umbraco Developer (or .net developer in general) is to find Umbraco and nuget packages that are made to fit any kind of client requirements without having to change or tweak a lot of things, like a “1 size fits all”.]]></description>
                <content:encoded><![CDATA[<p>The simplest store package</p>
<p><img style="width: 100%;" src="/media/1256/635561768996728031_checkout-simpleststorepng.png" alt="" data-udi="umb://media/0f59a241973b46d29d152aaaaaa58ec8" /></p>
<p>One of the main problems I have always faced as an <a rel="noopener noreferrer" href="https://www.simonantony.net" target="_blank" title="Umbraco Developer">Umbraco Developer</a> (or .net developer in general) is to find Umbraco and nuget packages that are made to fit any kind of client requirements without having to change or tweak a lot of things, like a “1 size fits all”.</p>
<p>This is the classic case with most if not all E-Commerce packages that are available for Umbraco, and because the guys are trying to build something that has got everything and fits any kind of business plan or customer, we end up with complicated solutions with a lot of functionality that you wouldn’t necessarily use for all clients. The big problem being that clients (and their respective websites) require different functionality, options and features.</p>
<p>Take the classic example of two clients on different ends of the business scale, we’ve got Mr EBay and Mr Tom Shoes. Mr EBay wants his E-Commerce platform to have all the bells and whistles e.g. multinational shops with all the different VAT and Shipping options and millions of products with all different variations and all sorts. Now the “heavy weight” E-Commerce packages we have in Umbraco e.g. Merchello, Tea Commerce, uCommerce etc. would be perfect for Mr EBay (and I suggest using them for this scenario) except the small pain of setting and configuring them up initially.</p>
<p>Mr Tom Shoes however is a small business dude who you have managed to convince that he can turn his EBay shop into a small website and sell his shoes. All he wants is to put a price on a shoe page on his site and be notified somehow when someone has paid for them.</p>
<p>Now you can use the “heavy weight” packages for Mr Tom Shoes but other than the problem of the licences (which can be prohibitively expensive), you are going to have to strip down a lot of the rich functionality of these to allow these to work with Mr Tom Shoes websites, which to some extend you might not actually be able to as you would need to remove about 95% of the functionality available on these packages – bit of a waste!</p>
<p>This got me thinking, as much we all love working with big clients (Actually at <a rel="noopener noreferrer" href="https://www.simonantony.net" target="_blank" title="Simon Antony">Simon Antony</a>, we like working with big and small clients) and most websites have got some E-Commerce solution of some kind, we are kind of stuck in a situation where all these small clients are not being catered for in favour of the big clients. Unfortunately more than half of the business in the world are these small business and we do need to build some solutions aimed at these markets. This is what gave birth to “The Simplest Store Package”.</p>
<p>So I sat down and after a lot of thinking, discovered that our problem with E-Commerce packages is they are too big and complex for small clients, so instead of trying to shoe horn these into very small websites, why not create a very simple E-Commerce package that can be made to fit any client scenario big or small.</p>
<p>The main thing with any E-Commerce solution is a dynamic shopping cart/basket that you can add products to and a way of setting up the product pages i.e. put a price on a page. So with that in mind I have worked on just exactly that and because Mr Tom Shoes isn’t going to understand all the hoo-ha of setting up products in some section so all he need to do is to create a normal product page and put a price on it, THAT IS IT.</p>
<p>The Package I made does exactly that, and has got the option to extend it as big n complex as you want. Currently out of the box you can add optional / none optional extras to a product and this can be extended depending on what Mr Tom Shoes or Mr EBay wants.</p>
<p>The checkout page is open to further development as initial you will not have a clue as to what Mr Tom Shoes or Mr EBay want to use to get his payments from could be PayPal, Stripe, World pay whatever this can be hooked onto the checkout page. So what we have now is an E-Commerce package that is fit for any scenario and any client, ladies and gentlemen <a href="https://our.umbraco.org/projects/website-utilities/simplest-store">I give you the simplest store package</a>.</p>]]></content:encoded>
            </item>
            <item>
                <title>iCloud Password Hacking Brute Force Tool iDict</title>
                <link>https://farmcode.org/articles/icloud-password-hacking-brute-force-tool-idict/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/icloud-password-hacking-brute-force-tool-idict/</guid>
                <description><![CDATA[On New Years, a password hacking tool going by the name of iDict was posted online to Github by someone identifying themselves as “Pr0x13” (Proxie).]]></description>
                <content:encoded><![CDATA[<p><img style="width: 471px; height: 229px;" src="/media/1254/idict.jpg?width=471&amp;height=229" alt="" data-udi="umb://media/7bd2fba0e8c542c0ab685d9d022c9ec8" /></p>
<p>On New Years Day, a password hacking tool going by the name of iDict was posted online to Github by someone identifying themselves as “Pr0x13” (Proxie). iDict apparently uses a brute force attack to obtain access to iCloud accounts easily, even managing to get through Apple's rate-limiting and two-factor authentication security that's supposed to prevent these types of brute force attacks. In Pr0x13’s own words (found here on Github:)</p>
<blockquote><em>“This bug is painfully obvious and was only a matter of time before it was<span> </span></em><em>privately used for malicious or nefarious activities, I publicly disclosed it so apple will patch it.”</em></blockquote>
<p>However, thankfully, it’s not all bad, within just 24 hours on the 2nd of January, Apple had already responded by patching their systems, when Pr0x13 put out the following tweet<span> </span><a rel="nofollow" href="https://twitter.com/pr0x13/status/551119230070833153">https://twitter.com/pr0x13/status/551119230070833153</a><span> </span>indicating the tool would no longer be effective:</p>
<p><img id="__mcenew" src="/media/1255/patched.jpg" alt="" data-udi="umb://media/7f185602abdb4b67a87caa24782dc114" /><br />As with most brute force attacks, the capabilities of this tool are limited by the dictionary used with it, so as long as your password isn’t incredibly simple, you should be safe. The tool comes with a dictionary of roughly 500 of the most commonly used password, here’s a few examples;</p>
<ul>
<li>Password1</li>
<li>P@ssw0rd</li>
<li>Passw0rd</li>
<li>Pa55word</li>
<li>Password123</li>
<li>ABCabc123</li>
<li>Devil666</li>
<li>Loveyou2</li>
<li>ILoveYou2</li>
<li>Blink182</li>
</ul>
<p>so clearly, if you are using one of these passwords then, well… don’t. Sadly, all of the passwords on this list meet the minimum criteria for an iCloud password.</p>
<p>As well as the clear dictionary restrictions, another major hindrance to the effectiveness of this tool is the level of skill required to use the tool itself. The developer behind the tool isn't a friend to script-kiddies, he's trying to prove a point: Despite security updates since the brute force attack that gave hackers access to countless celebrities' nude photos, iCloud still isn't completely secure. However, the silver lining on this iCloud incident is that Apples security may just be a bit better than it was before this tool was made publicly available.</p>
<p><strong>How Do You Create a STRONG Password?</strong></p>
<p>By taking some simple precautions, you can protect yourselves from these types of attack - and we wanted to take the time to detail what you should look for:</p>
<ul>
<li><strong>As Long As Possible</strong><span> </span>- The longer your password, the less likely someone is to ‘guess it’ - and the more combinations machines will need to try before attempting to use the correct password. We recommend a very minumum of 8 letters - though ideally as many as possible.</li>
<li><strong>Use a Letters, Numbers &amp; Extended Chars</strong><span> </span>- don’t just stick to letters - be sure to include numbers and also extended characters such as ! or % or @ etc. Less directed types of brute force attacks will try each possible letter combination - there are 26 letters in the alphabet, but if you start using the other characters, this is nearer 128 - massively increasing the space an attacker needs to brute force in order to find the right combination.</li>
<li><strong>Do Not Repeat</strong><span> </span>- Many dictionary based attacks will also try repetitions of known words, so do not repeat a simple word twice and expect it to be just as secure as a longer password. </li>
<li><strong>Avoid Names, Use Non-Words</strong><span> </span>- Most brute force attacks are highly inefficient and to combat this, many will use dictionary and keyword lists as this one did - if you use common words or phrases, or even names, it is much more likely your chosen words will appear in a dictionary list, and this puts you at much greater risk from tools like this which use a dictionary-type attack.</li>
<li><strong>Do Not Re-Use Passwords</strong><span> </span>- The risk here may not be so apparent; but each time you re-use a password, you increase the chances of one of them being compromised - as there are more instances of the same password out there. What’s worse, many websites and services will use different hashing algorithms (some use none at all!) increasing the likelihood that eventually, it will become known.</li>
</ul>
<p><strong>Fun With Randomness!</strong></p>
<p>If you have trouble thinking up a good password, there are some good tools which can generate one for you. However, be careful! Computers cannot generate random numbers, since they run code, and machine code instructions will always execute the same way when given exactly the same input every time - how would you write a function that returns a random number? To get around this, several techniques are usually employed (often involving some a large-ish random seed input and some clever maths before attempting to generate a number) - but even this would not be totally random and it would be possible to reverse engineer any technique used in code if an attacker were to know everything about the system.</p>]]></content:encoded>
            </item>
            <item>
                <title>XSLT Time Saver Functions</title>
                <link>https://farmcode.org/articles/various-xslt-time-saver-functions/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/various-xslt-time-saver-functions/</guid>
                <description><![CDATA[We've collated a number of time saving but basic XSLT functions that we find new Umbraco users often call out for. Here is a selection of some we use on a regular basis that should help you out in your development efforts.]]></description>
                <content:encoded><![CDATA[<p>Working with Umbraco for as long as we have, we've collated a number of time saving but basic XSLT functions that we find new users often call out for. Here is a selection of some we use on a regular basis that should help you out in your development efforts.</p>
<p>Finding a node by it's ID:</p>
<pre>&lt;xsl:variable name="node1" select="$currentPage/ancestor::root//*[@id = 1234]" /&gt;
&lt;xsl:variable name="node2" select="umbraco.library:GetXmlNodeById(1234)" /&gt;
</pre>
<p>Using XPath you can trim down the amount of nodes searched by adding anything you know about the location of the node</p>
<p>you're looking for, e.g.:</p>
<pre>&lt;!-- Reference to root of site --&gt;
&lt;xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" /&gt;
&lt;!-- I want a NewsItem node that is a direct child node of the News node that is at the root of the site --&gt;
&lt;xsl:variable name="breakingNews" select="$siteRoot/News/NewsItem[@id = 1234]" /&gt;
</pre>
<p>Hopefully this will go some way to helping you with your daily development. Let us know if there is anything specific you need to know.</p>]]></content:encoded>
            </item>
            <item>
                <title>Random Messages with XSLT</title>
                <link>https://farmcode.org/articles/random-messages-with-xslt/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/random-messages-with-xslt/</guid>
                <description><![CDATA[So you want to display random messages on your Umbraco site but are not sure how to do it?]]></description>
                <content:encoded><![CDATA[<p>So you want to display random messages on your Umbraco site but are not sure how to do it?</p>
<p>The following XSLT code will take in a node (in this case 1305) and look at the content randomly choosing one to display. You can easily pass in the node to search by using a Content Picker assigned to an alias of source in the macro parameters. Then simply add the following lines to the xslt below before the &lt;xsl:template match="/"&gt; line.</p>
<pre>&lt;xsl:variable name="feed" select="/macro/source"/&gt;</pre>
<p>Then change the node id 1305 to $source. Now when you add the macro to a page, you will be prompted to select the parent node to search from.</p>
<pre>&lt;xsl:param name="currentPage"/&gt;
&lt;xsl:template match="/"&gt;
&lt;xsl:variable name="numberOfArticleNodes" select="count(umbraco.library:GetXmlNodeById(1305)/* [@isDoc])"/&gt;<br /> &lt;xsl:variable name="randomArticlePosition" select="floor(Exslt.ExsltMath:random() * $numberOfArticleNodes) + 1"/&gt;<br /> &lt;xsl:variable name="randomArticleNode" select="umbraco.library:GetXmlNodeById(1305)/* [@isDoc] [position() = $randomArticlePosition]"/&gt;<br /> <br />&lt;!-- start writing XSLT --&gt;<br /> &lt;div class="cta-text"&gt;<br /> &lt;h3&gt;&lt;xsl:value-of select="$randomArticleNode/straplineMessage" /&gt;&lt;/h3&gt;<br /> &lt;p&gt;&lt;xsl:value-of select="$randomArticleNode/straplineSubMessage" /&gt;.&lt;/p&gt; <br /> &lt;/div&gt; <br /> <br />&lt;/xsl:template&gt;</pre>
<p>&lt;/xsl:stylesheet&gt;</p>]]></content:encoded>
            </item>
            <item>
                <title>How to use umbraco.library GetMedia in XSLT for Umbraco v4.5</title>
                <link>https://farmcode.org/articles/how-to-use-umbracolibrary-getmedia-in-xslt-for-umbraco-v45/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-to-use-umbracolibrary-getmedia-in-xslt-for-umbraco-v45/</guid>
                <description><![CDATA[Umbraco MVP Lee Kelleher tells us how to use GetMedia properly.

This is a quick follow-up on my blog post: "How to use umbraco.library GetMedia in XSLT". At the request of fellow Umbraco South-West UK developer, Dan, that I should update the code snippets for the new XML schema in Umbraco v4.5+]]></description>
                <content:encoded><![CDATA[<p>Umbraco MVP Lee Kelleher tells us how to use GetMedia properly.</p>
<p>This is a quick follow-up on my blog post: "How to use umbraco.library GetMedia in XSLT". At the request of fellow Umbraco South-West UK developer, Dan, that I should update the code snippets for the new XML schema in Umbraco v4.5+</p>
<p>First a quick notice; if you are using v4.5.0, then please upgrade to v4.5.1, as there was a tiny bug in GetMedia that caused great confusion and headaches - you have been advised!</p>
<p>Without further ado, the updated XSLT snippet that you came here for…</p>
<pre>&lt;xsl:template match="/"&gt;
&lt;xsl:variable name="mediaId" select="number($currentPage/mediaId)" /&gt;
&lt;xsl:if test="$mediaId &gt; 0"&gt;
&lt;xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /&gt;
&lt;xsl:if test="$mediaNode/umbracoFile"&gt;
&lt;img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" /&gt;
&lt;/xsl:if&gt;
&lt;/xsl:if&gt;
&lt;/xsl:template&gt;</pre>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>IIS HTTP Error 500.19 - Internal Server Error with Error Code 0x8007000d</title>
                <link>https://farmcode.org/articles/iis-http-error-50019-internal-server-error-with-error-code-0x8007000d/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/iis-http-error-50019-internal-server-error-with-error-code-0x8007000d/</guid>
                <description><![CDATA[A slightly less obvious error encountered while using IIS on a specific site, where all pages give the following error:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.]]></description>
                <content:encoded><![CDATA[<p>IIS 7.0 or 7.5 gives error <strong>Error 500.19</strong> Internal Server Error for all pages, with Error Code 0x8007000d</p>
<p>A slightly less obvious error encountered while using IIS on a specific site, where all pages give the following error:</p>
<pre>HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed <br />because the related configuration data for the page is invalid.

Detailed Error Information
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d

</pre>
<p>The solution isn'timmediately obvious, because no specific error is returned besides the above codes.</p>
<p>Cause: IIS does not have the URL Rewriting module installed, so thesection of the web.config will cause IIS to give HTTP Error 500.19 with error code 0x800700d for any page.</p>
<p>Simply resolve this, simply install the URL Rewriting module, which can be downloaded here</p>
<p>(this may require a restart of IIS or your machine) and will resolve the issue).</p>]]></content:encoded>
            </item>
            <item>
                <title>Browsing your asp.net website on an iPhone using Chrome does not work</title>
                <link>https://farmcode.org/articles/browsing-your-aspnet-website-on-an-iphone-using-chrome-does-not-work/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/browsing-your-aspnet-website-on-an-iphone-using-chrome-does-not-work/</guid>
                <description><![CDATA[You have an Asp.Net 4.0 website that uses cookies. You are also using your iPhone and the new Chrome browser to access the website and you cannot login to the site correctly or navigate around it without bouncing back to the login page]]></description>
                <content:encoded><![CDATA[<p>You have an Asp.Net 4.0 website that uses cookies. You are also using your iPhone and the new Chrome browser to access the website and you cannot login to the site correctly or navigate around it without bouncing back to the login page</p>
<p>Google has just released its new iPhone Chrome browser - it's really good, you should check it out although there is a slight problem when using it on your Asp.Net 4.0 websites that use cookies or have login functionality.</p>
<p>You will notice that when you browse to your site and say login, the cookie session id is now contained within the URL - wtf? Well this is basically because the User Agent string that Chrome is sending is not recognised by your website and by default, Asp.Net 4.0 is set to downgrade the browser to the lowest it knows about so assumes you cannot support cookies - this is why you see the cookie id in the url.</p>
<p>This has been recognised as a bug in Asp.Net 4.0 and is fixed in 4.5 where all browsers are now assumed to support cookies.</p>
<p>The fix is very simple, follow these steps to restore functionality to your sites:</p>
<p>Add a folder in your web project named App_Browsers (right-click the project, choose: Add &gt; Add ASP.NET Folder &gt; App_Browsers)<br />Add a file in that folder (right-click, choose: Add &gt; New Item). The file can have any name, but must have the .browser ending. Usually there is a Form.browser in there so just modify that one<br />Add the following lines inside the &lt;browser&gt; element:</p>
<pre>&lt;capabilities&gt;
&lt;capability name="cookies" value="true" /&gt;
&lt;/capabilities&gt;</pre>
<p>Save and browse using your iphone - you should now see the site working as before</p>
<p>Credits for the above fixes go to the following urls where you can find more information about the browser files and how to use them:</p>
<p><a rel="nofolow noopener noreferrer" href="http://msdn.microsoft.com/en-us/library/ms228122.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms228122.aspx</a></p>
<p><a rel="nofolow noopener noreferrer" href="http://stackoverflow.com/questions/4158550/problem-with-asp-net-forms-authentication-when-using-iphone-uiwebview" target="_blank">http://stackoverflow.com/questions/4158550/problem-with-asp-net-forms-authentication-when-using-iphone-uiwebview</a></p>
<p><a rel="nofolow noopener noreferrer" href="http://stackoverflow.com/questions/11324835/ipad-iphone-chrome-auth-cookie-not-setting-over-jquery-post-ajax-mvc-3" target="_blank">http://stackoverflow.com/questions/11324835/ipad-iphone-chrome-auth-cookie-not-setting-over-jquery-post-ajax-mvc-3</a></p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco 'Error Handling Action' problem when deleting template</title>
                <link>https://farmcode.org/articles/umbraco-error-handling-action-problem-when-deleting-template/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-error-handling-action-problem-when-deleting-template/</guid>
                <description><![CDATA[Error handling action,Umbraco Exception (Datalayer),SQL helper exception in ExecuteNonQuery]]></description>
                <content:encoded><![CDATA[<p>This is quite a common problem that is reported in Umbraco versions up to and including 4.7.2 - it's unknown at this time if Umbraco 4.8 fixes this issue.</p>
<p>When you try and delete a template in the back office, you get the error:</p>
<p>Error handling action</p>
<p>Umbraco Exception (Datalayer):</p>
<p>SQL helper exception in ExecuteNonQuery</p>
<p><img style="width: 283px; height: 206px;" src="/media/1249/template_delete_umbraco_error.jpg?width=283&amp;height=206" alt="" data-udi="umb://media/52871ae808d34193bef8110a8097f3ff" /></p>
<p>Simply assign the template to any document type (does not matter which) and save the doc type. When you now try and delete the template, it will dissapear.</p>]]></content:encoded>
            </item>
            <item>
                <title>How to setup a 404 error page on your Umbraco site</title>
                <link>https://farmcode.org/articles/how-to-setup-a-404-error-page-on-your-umbraco-site/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-to-setup-a-404-error-page-on-your-umbraco-site/</guid>
                <description><![CDATA[So exactly how do I setup a 404 error page on my site?

It's good practice to use 404 error pages on your site instead of relying upon the built in IIS error handling mechanism and it's not that obvious how to set it up.]]></description>
                <content:encoded><![CDATA[<p>So exactly how do I setup a 404 error page on my site?</p>
<p>It's good practice to use 404 error pages on your site instead of relying upon the built in IIS error handling mechanism and it's not that obvious how to set it up.</p>
<p>Simply follow these steps:</p>
<p>Create a new template on your site and link to for instance a standard text page document type<br />Create the new 404 page in the content area, be sure to use the correct template - publish it and make a note of the Node ID<br />Goto umbracoSettings.Config and find the &lt;errors&gt; section.<br />For the &lt;error404&gt; node, replace the number 1 with the id of your new 404 page. Save this file.<br />&lt;errors&gt;<br /> &lt;!-- the id of the page that should be shown if the page is not found --&gt;<br /> &lt;!-- &lt;errorPage culture="default"&gt;1&lt;/errorPage&gt;--&gt;<br /> &lt;!-- &lt;errorPage culture="en-US"&gt;200&lt;/errorPage&gt;--&gt;<br /> &lt;error404&gt;12345&lt;/error404&gt;<br />&lt;/errors&gt;</p>
<p> </p>
<p>That sorts out Umbraco but you will notice that any duff url's you add will still not show your shiny new page. This is because IIS is still handling these errors so we need to tell it to bog off and let Umbraco handle it instead.</p>
<p>Open up web.config and goto the &lt;system.webServer&gt; section<br />After that, add the following lines &lt;httpErrors existingResponse="PassThrough" /&gt;<br />Save the file.<br />Now if you goto a duff url, IIS should pass your user through to your shiny new page.</p>
<p>You can also support multi-lingual sites, see the &lt;errors&gt; node for further information on how to do this.</p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco error: Domain 'xxyyzz...' has already been assigned</title>
                <link>https://farmcode.org/articles/umbraco-error-domain-xxyyzz-has-already-been-assigned/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-error-domain-xxyyzz-has-already-been-assigned/</guid>
                <description><![CDATA[When attempting to set the hostname for your site in the Umbraco content tree, Umbraco gives the error: Domain 'xxyyzz' has already been assigned]]></description>
                <content:encoded><![CDATA[<p>When attempting to set the hostname for your site in the Umbraco content tree, Umbraco gives the error:</p>
<pre>Domain 'xxyyzz' has already been assigned</pre>
<p>Even when you cannot see a node in the content tree with this domain assigned to it.</p>
<p>This can happen if a node has been deleted which has the same hostname set.  The domain name stays assigned to the deleted node and cannot be used elsewhere in the site.</p>
<p>To resolve this issue, simply undelete the node from the recycle bin, click 'manage hostnames' and delete the domain. You can now safely re-delete the node and use the domain elsewhere.</p>
<p>Another way to resolve this would be to open the database and manually remove the corresponding entry from the 'umbracoDomains' table. You may need to do this If you have emptied the recycle bin. Be sure to take a backup of the database before attempting to do this.</p>]]></content:encoded>
            </item>
            <item>
                <title>Using the uComponents CheckBoxTree in Umbraco</title>
                <link>https://farmcode.org/articles/using-the-ucomponents-checkboxtree/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/using-the-ucomponents-checkboxtree/</guid>
                <description><![CDATA[How to use the uComponents datatype CheckBoxTree]]></description>
                <content:encoded><![CDATA[<p>The uComponents suite for Umbraco is great but there is little in the way of documentation for a lot of the controls. </p>
<p>The CheckBoxTree is one such control and at a recent job, I needed to implement this functionality to give the user the ability to add their own Accomodation Types and then select them in a content page.</p>
<p>This was performed on Umbraco 4.7.2 with uComponents installed direct from the Package Repository:</p>
<ol>
<li>Create a couple of Document Types, one called Settings (or similar), another called Accomodation Types and a third called Types.</li>
<li>In the content tree, setup the content area to have a structure similar to the following, using the Document Types you just created</li>
<li>You will see here the Settings/Accomodation Types/Type structure. Create as many types as you need. Make a note of the nodeID of the Accomodation Type as you will need this for the DataType.</li>
<li>Now create a new data type, select uComponemts:CheckBoxTree and click the save icon on the toolbar.</li>
<li>Once it's saved, set the properties as follows (replace 1116 with the nodeID you took in step 2) The key here is the XPATH Start Node which in our case is //*[@isDoc and @id = '1121']. We then use the xPath Filter to restrict the types we need to see.</li>
<li>Now add a new Document Type Property to your homepage or other content page where this will be used. For the type of control, select the Accomodation Datatype we just created. When you click on your page, you should now see something like the following</li>
</ol>
<p>Thats it, simple - you can now use XSLT or Razor or whatever you fancy to retrieve your property values and process in the normal way</p>]]></content:encoded>
            </item>
            <item>
                <title>Value Cannot Be Null, Error in Umbraco When Publishing Node</title>
                <link>https://farmcode.org/articles/value-cannot-be-null-parameter-name-attribute-error-in-umbraco/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/value-cannot-be-null-parameter-name-attribute-error-in-umbraco/</guid>
                <description><![CDATA[Publishing nodes in Umbraco can sometimes give: Value Cannot Be Null, Parameter Name: Attribute exceptions, here is the solution.]]></description>
                <content:encoded><![CDATA[<p>Umbraco 4, while publishing content from the admin control panel.</p>
<p>Sometimes, when publishing a node in Umbraco, we were experiencing the odd error: "Value Cannot Be Null, Parameter Name: Attribute" as shown below:</p>
<p>Value cannot be null.<br />Parameter name: attribute<br />Description: An unhandled exception occurred during the execution of the current web request. <br />Please review the stack trace for more information about the error and where it originated in the code.</p>
<p>Exception Details: System.ArgumentNullException: Value cannot be null.<br />Parameter name: attribute</p>
<p>Source Error:</p>
<p>An unhandled exception was generated during the execution of the current web request. Information <br />regarding the origin and location of the exception can be identified using the exception stack trace <br />below.</p>
<p>Stack Trace:</p>
<p>[ArgumentNullException: Value cannot be null.<br />Parameter name: attribute]<br /> System.Xml.Linq.XAttribute.op_Explicit(XAttribute attribute) +163158<br /> UmbracoExamine.UmbracoContentIndexer.ReIndexNode(XElement node, String type) +193<br /> Examine.ExamineManager._ReIndexNode(XElement node, String type, IEnumerable`1 providers) +93<br /> umbraco.DocumentCacheEventHandler.Invoke(Document sender, DocumentCacheEventArgs e) +0<br /> umbraco.content.UpdateDocumentCache(Document d) +1064<br /> umbraco.library.UpdateDocumentCache(Int32 DocumentId) +122<br /> umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e) +541<br /> System.EventHandler.Invoke(Object sender, EventArgs e) +0<br /> System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +187<br /> System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +165<br /> System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,<br /> Boolean includeStagesAfterAsyncPoint) +3707</p>
<p>This is caused by the XML cache being out of sync with the database. In most cases, simply unpublishing and republishing the website or node will solve this issue and bring everything into step. In some rare cases (as we were experiencing), this may still give you the error, in which case you can rebuild the entire XML cache by accessing the following URL on your website:</p>
<p>/umbraco/dialogs/republish.aspx?xml=true</p>
<p>This will cause Umbraco to rebuild the entire XML cache and should solve the problem (But beware! This can take some time, particularly for large websites). For instance, a website with tens of thousands of nodes this could over 30 minutes in some cases!</p>]]></content:encoded>
            </item>
            <item>
                <title>Fixing Error "ADDING TO SITEMAPPROVIDER IN LOAD NODES()"</title>
                <link>https://farmcode.org/articles/how-to-fix-the-error-adding-to-sitemapprovider-in-load-nodes-umbraco/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-to-fix-the-error-adding-to-sitemapprovider-in-load-nodes-umbraco/</guid>
                <description><![CDATA[Fixing errors in Umbraco related to the SiteMapProvider in the load nodes. Solutions on how to fix this error are related here.]]></description>
                <content:encoded><![CDATA[<p>In Umbraco 4.9, we found our Sql database increasing in size rapidly.</p>
<p>We got an error stating -</p>
<p>"Error adding to SiteMapProvider in loadNodes(): System.Web.HttpException (0x80004005): 'http://mydomain.net/' is not a valid virtual path. at System.Web.Util.UrlPath.CheckValidVirtualPath(String path) at System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) at System.Web.StaticSiteMapProvider.AddNode(SiteMapNode node, SiteMapNode parentNode) at umbraco.presentation.nodeFactory.UmbracoSiteMapProvider.loadNodes(String parentId, SiteMapNode parentNode)"</p>
<p>We solved this by removing the sitemap configuration section from the web.config</p>
<p>&lt;siteMap defaultProvider="UmbracoSiteMapProvider" enabled="true"&gt;</p>
<p>&lt;providers&gt;</p>
<p>&lt;clear /&gt;</p>
<p>&lt;add name="UmbracoSiteMapProvider" type="umbraco.presentation.nodeFactory.UmbracoSiteMapProvider" defaultDescriptionAlias="description" securityTrimmingEnabled="true" /&gt;</p>
<p>&lt;/providers&gt;</p>
<p>&lt;/siteMap&gt;<br />We also deleted all the old log files to free up the data taken over by the error</p>]]></content:encoded>
            </item>
            <item>
                <title>Deleting Duplicated Rows in SQL Server Without Primary Key</title>
                <link>https://farmcode.org/articles/deleting-duplicated-rows-in-sql-server-database/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/deleting-duplicated-rows-in-sql-server-database/</guid>
                <description><![CDATA[How to safely delete duplicated rows in SQL Server database without a primary key]]></description>
                <content:encoded><![CDATA[<p>When using Microsoft SQL Server, if your table does not include a primary key, it is possible to insert duplicated rows of data.  Removing these duplicated row(s) can then become a quite a problem ... with no easy way of selecting just one of these duplicates </p>
<p>Consider the following example: first we create a simple database with a single table for membership that contains: a Member's ID, Membership Type, Firstname, Lastname and Birthday:</p>
<p>CREATE TABLE [dbo].[Membership](<br />[MemberID] [varchar](20) NOT NULL,<br />[MemberType] [int] NOT NULL,<br />[Firstname] [varchar](80) NOT NULL,<br />[Lastname] [varchar](80) NOT NULL,<br />[Birthday] [date] NOT NULL<br />) ON [PRIMARY]</p>
<p>If we then insert the following rows into this table:</p>
<p>INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES<br />('001', 'Fred', 'Bloggs', 1, convert(datetime, '10/23/1995', 0))</p>
<p>INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES<br />('002', 'Joe', 'Bloggs', 1, convert(datetime, '05/10/1973', 0))</p>
<p>INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES<br />('002', 'Joe', 'Bloggs', 1, convert(datetime, '05/10/1973', 0))</p>
<p>INSERT INTO dbo.Membership (MemberID, Firstname, Lastname, MemberType, Birthday) VALUES<br />('003', 'Fannie', 'Mae', 1, convert(datetime, '02/14/1983', 0))</p>
<p>We now have duplicated Joe Blogg's entry (MemberID 2), with no obviously safe way of removing the duplicate, while leaving at least one entry intact. Now imagine if you had an entire database of data with hundreds or thousands of duplicates - fixing this by hand quickly becomes an impossible task!</p>
<p>To solve this, first we can add an column using the IDENTITY keyword so we now have a unique way of addressing each row:</p>
<p>ALTER TABLE dbo.Membership ADD AUTOID INT IDENTITY(1,1)</p>
<p>We can then we can use:</p>
<p>SELECT * FROM dbo.Membership WHERE AUTOID NOT IN (SELECT MIN(AUTOID) _<br />FROM dbo.Membership GROUP BY MemberID)</p>
<p>Which will correctly select all duplicated records in our database (always worth checking before running the delete query!). Once we are happy this is working for us, we can then run the delete query:</p>
<p>DELETE FROM dbo.Membership WHERE AUTOID NOT IN (SELECT MIN(AUTOID) _<br />FROM dbo.Membership GROUP BY MemberID)</p>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco.config not updating - Error Republishing: System.Xml.XmlException:, hexadecimal value 0x01, is an invalid character.</title>
                <link>https://farmcode.org/articles/error-republishing-systemxmlxmlexception-hexadecimal-value-0x01-is-an-invalid-character/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/error-republishing-systemxmlxmlexception-hexadecimal-value-0x01-is-an-invalid-character/</guid>
                <description><![CDATA[Recently we experienced issues where the Umbraco.Config file was not being updated with published content - this had a knock on effect within the API calls we were making to create new nodes if they did not already exist.]]></description>
                <content:encoded><![CDATA[<p>Recently we experienced issues where the Umbraco.Config file was not being updated with published content - this had a knock on effect within the API calls we were making to create new nodes if they did not already exist.</p>
<p>I noticed that after republishing the umbraco.config file that nodes were not updating the data within it, nor when this file was deleted, it was not getting recreated.</p>
<p>First port of call was to look at the UmbracoLog table. This is the central error reporting mechanism for any Internal Umbraco errors.</p>
<p>Fire up SQL Management Studio and run the following query</p>
<p>SELECT * from [umbracoLog] where logComment like '%Error Republishing: System.Xml.XmlException%'</p>
<p>You should then get a list of records similar to the screenshot below (this one is filtered to show just one record)</p>
<p><img style="width: 500px; height: 58.125px;" src="/media/1250/sql_select_800x93.jpg?width=500&amp;height=58.125" alt="" data-udi="umb://media/1ebcfb49aa4c424388872a4ce9edd7b9" /></p>
<p>Note that we have publishing errors due to invalid characters in the XML stream - this should never happen but unfortunately Umbraco does not sanitise the input data when creating the XML.</p>
<p>The actual error displayed is:</p>
<p>Error Republishing: System.Xml.XmlException: '', hexadecimal value 0x01, is an invalid character. Line 4, position 5. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos) at System.Xml.XmlTextReaderImpl.ParseCDataOrComment(XmlNodeType type, Int32&amp; outStartPos, Int32&amp; outEndPos) at System.Xml.XmlTextReaderImpl.ParseCDataOrComment(XmlNodeType type) at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at umbraco.content.LoadContentFromDatabase()</p>
<p>Now we know why the umbraco.config file is not being updated, we now need to track down the node(s) that are causing the errors and remove the dodgy characters!</p>
<p> </p>
<p>Content XML in Umbraco is stored within the cmsContentXml table. So what we need to do is run a query against this table to find the rogue nodes.</p>
<p>Run the following SQL statement in Management Studio:</p>
<p><img src="/media/1251/content_select_500x33.jpg?width=500&amp;height=33" alt="" data-udi="umb://media/84a89dfed40e4766a0432a74cb9854a3" /></p>
<p>Where your dodgy character you are searching for is within the %% tags. You can get this from your original SQL results</p>
<p>You should then get a node or list of nodes that have the dodgy characters in. It's now a simple case of removing these characters and resaving the data back to the db.</p>
<p><img style="width: 500px; height: 52.697616060225855px;" src="/media/1252/content_select_results_797x84.jpg?width=500&amp;height=52.697616060225855" alt="" data-udi="umb://media/ea86ff992f1144c486e8fe74c26f5744" /></p>
<p>How we did it using Notepad++;</p>
<p>Notepad++ is a great developer tool, if you don't already use it, download now, it's free and open source and just well great!</p>
<p>Ok what we did was to open up the rogue node in the Content area in Umbraco, in our case a node called Winter League and find the body text (most likely it's an RTF control that has saved the bad code).</p>
<p>We then viewed this source in HTML mode, selected it all, copied and pasted into Notepad++ where you can clearly see the SOH character:</p>
<p><img style="width: 498px; height: 440px;" src="/media/1253/notepad_view_498x440.jpg?width=498&amp;height=440" alt="" data-udi="umb://media/db6796065c7640708fff81030e25bccf" /></p>
<p>Simply delete it, paste the code back into Umbraco and republish. Your umbraco.config file should now instantly be rebuilt.</p>
<p>On my development machine, the original file was 9meg, after this fix it was 74meg (large site!).</p>
<p>This has caused me so much pain in the last few days, especially with duplicate nodes being created via the API (Node uses published XML to see if it exists, was not in the published xml so duplicates were created) and performance issues at the front end.</p>
<p>It's looking like the character got into the RTF editor by the user pasting from another source i.e. pdf document. This is apparently a known issue in Umbraco, just wish that someone would sanitise the input when it's saved so this does not happen at all!</p>
<p> </p>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>No Document Exists With Version Umbraco Error and Orphan Revisions</title>
                <link>https://farmcode.org/articles/no-document-exists-with-version-error-orphaned-umbraco-page-revisions/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/no-document-exists-with-version-error-orphaned-umbraco-page-revisions/</guid>
                <description><![CDATA[No document exists with version error in Umbraco can be caused by orphan revisions in the cmsContentVersion table that are not in the cmsDocument table.]]></description>
                <content:encoded><![CDATA[<p>We came across a strange issue while publishing pages in Umbraco, each time we viewed the pages, we were getting the following error:</p>
<pre>"No Document exists with Version xxxxxx"</pre>
<p>Although there may be other causes of this error, we found our problem were entries in Umbraco's cmsContentVersion table, which did not have a corresponding entry in the cmsDocument table.  This created an orphaned revision which was causing the error.</p>
<p>Luckily, you can easily identify orphan revisions with the following SQL query:</p>
<pre>SELECT * FROM cmsContentVersion<br />WHERE<br />cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND<br />cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)</pre>
<p>Once you are happy and can confirm these are the revisions that need to be deleted, you can go ahead and delete them with:</p>
<pre>DELETE FROM cmsContentVersion<br />WHERE<br />cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND<br />cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)</pre>
<p>This is very quick to run and sorted out our problem instantly. It should be noted that there are other causes of this error, and it's worth investigating using the SELECT SQL Query first before making any updates.</p>]]></content:encoded>
            </item>
            <item>
                <title>Grouping nodes in Umbraco Razor</title>
                <link>https://farmcode.org/articles/grouping-nodes-in-umbraco-razor/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/grouping-nodes-in-umbraco-razor/</guid>
                <description><![CDATA[Have you ever been in the situation where you need to loop through a list of nodes but arange them in groups of 2, 4, 6 etc

You want to have a fluid layout and display your nodes in groups of two repeating down the page:]]></description>
                <content:encoded><![CDATA[<p>Have you ever been in the situation where you need to loop through a list of nodes but arange them in groups of 2, 4, 6 etc</p>
<p>You want to have a fluid layout and display your nodes in groups of two repeating down the page:</p>
<p> </p>
<pre>&lt;div class="row-fluid"&gt;
&lt;div class="span6"&gt;
&lt;img src="/image.png&gt;
&lt;h3&gt;&lt;a href="#"&gt;Link to page&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="span6"&gt;
&lt;img src="/image.png&gt;
&lt;h3&gt;&lt;a href="#"&gt;Link to page&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<p> </p>
<p>The problem is if you use a standard foreach loop, you will get repeating content for each span6 element - not what you want. Ideally you need to group them but not sure how - see the solution below.</p>
<pre>@using Umbraco.Core
@using umbraco.MacroEngines
@inherits DynamicNodeContext
@{
var r = new Random();
constintnumberOfItems = 6;
var startNode = new DynamicNode(Model.Id).Descendants("StandardPage")<br />.Items.Where(x =&gt; x.Visible).OrderBy(x =&gt; r.Next()).Take(numberOfItems).ToList();<br />}</pre>
<p> </p>
<pre>&lt;h2 class="page"&gt;Section Title&lt;/h2&gt;<br /> @foreach (var page in startNode.InGroupsOf(2))<br /> {<br /> &lt;div class="row-fluid"&gt;<br /> @foreach (var item inpage)<br /> {<br /> &lt;div class="span6"&gt;<br /> &lt;img src="/empty.png" alt="@item.Name" /&gt;<br /> &lt;h3&gt;&lt;a href="@item.Url"&gt;@item.Name&lt;/a&gt;&lt;/h3&gt;<br /> &lt;/div&gt;<br /> }<br /> &lt;/div&gt;<br /> }<br />&lt;/div&gt;</pre>]]></content:encoded>
            </item>
            <item>
                <title>Submit HTML 4.01 tags no longer supported in HTML5</title>
                <link>https://farmcode.org/articles/submit-html-401-tags-no-longer-supported-in-html5/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/submit-html-401-tags-no-longer-supported-in-html5/</guid>
                <description><![CDATA[The following article is about Web Development and how the new HTML5 has brought in new changes from HTML 4.01.]]></description>
                <content:encoded><![CDATA[<p>The following document is about Web Development and how the new HTML5 has brought in new changes from HTML 4.01.</p>
<p>See the following 7 deprecated HTML 4.01 tags.</p>
<p>&lt;center&gt; tag is no longer supported in HTML5. Use CSS instead.</p>
<p>Defines centered text.</p>
<p>Solution:</p>
<p>h1 {<br /> text-align: center;<br /> }</p>
<p>_______________________________________________________</p>
<p>The &lt;acronym&gt; tag is no longer supported in HTML5.</p>
<p>defines an acronym.</p>
<p>Solution:</p>
<p>use the HTML tag &lt;abbr&gt; instead.</p>
<p>_______________________________________________________</p>
<p>The &lt;applet&gt; tag is no longer supported for HTML5.</p>
<p>Defines an embedded applet.</p>
<p>Solution:</p>
<p>use the HTML tag &lt;object&gt; instead.</p>
<p>_______________________________________________________</p>
<p>The &lt;big&gt; tag is no longer supported I'm HTML5. Use CSS instead.</p>
<p>Defines big text</p>
<p>Solution:</p>
<p>h1 {<br /> text-size: large;<br /> }</p>
<p>p {<br /> text-size: large;<br /> }</p>
<p>______________________________________________________</p>
<p>The &lt;dir&gt; tag is no longer supported in HTML5. Use CSS instead.</p>
<p>Defines a directory list.</p>
<p>Solution:</p>
<p>Use the HTML tag &lt;ul&gt; instead.</p>
<p>______________________________________________________</p>
<p>The &lt;frame&gt; tag is no longer supported in HTML5.</p>
<p>Defines a window (a frame) in a frameset.</p>
<p>The &lt;frameset&gt; tag is no longer supported by HTML5.</p>
<p>Defines a set of frames.</p>
<p>The &lt;noframes&gt; tag is no longer supported in HTML5.</p>
<p>Defines an alternate content for users that do not support frames.</p>
<p>______________________________________________________</p>
<p>The &lt;basefont&gt; tag is no longer supported in HTML5. Use CSS instead.</p>
<p>Specifies a default color, size, and font for all text in a document.</p>
<p>Solution:</p>
<p>body {<br /> color: red;<br /> font: Georgia;<br /> font-size: large;<br />}</p>
<p>p {<br /> color: red;<br /> font: Georgia;<br /> font-size: large; }</p>
<p>h1 {<br />color: red;<br /> font: Georgia;<br /> font-size: large;<br /> }</p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco 7 Template View Is Deleted When Saving Through the Backoffice Umbraco Dashboard</title>
                <link>https://farmcode.org/articles/umbraco-7-template-view-is-deleted-when-saving-through-the-backoffice-umbraco-dashboard/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-7-template-view-is-deleted-when-saving-through-the-backoffice-umbraco-dashboard/</guid>
                <description><![CDATA[When logged in to the Umbraco backoffice control panel, you attempt to make a change to a template, but clicking the &quot;Save&quot; button causes the MVC Razor Layout  View to be deleted]]></description>
                <content:encoded><![CDATA[<p>When logged in to the Umbraco backoffice control panel, you attempt to make a change to a template and click the "Save" button, but doing so causes the MVC Razor Layout template file to be deleted.  It still shows up in the template tree in the "Settings" dashboard of the Umbraco control panel, but no longer exists in the file system of the server.</p>
<p>When saving a view in Umbraco, the file is deleted, accessing a page that inherits from this view gives the following exception:</p>
<pre><strong>Server Error in '/' Application</strong>.

The layout page "~/Views/&lt;Global.cshtml&gt;" could not be found at the following path: "~/Views/&lt;Global.cshtml&gt;".
<strong>Description</strong>: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The layout page "~/Views/Global.cshtml" could not be found at the following path: "~/Views/Global.cshtml".

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[HttpException (0x80004005): The layout page "~/Views/Global.cshtml" could not be found at the following path: "~/Views/Global.cshtml".] System.Web.WebPages.WebPageBase.PopContext() +306704 Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +140 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380 System.Web.Mvc.&lt;&gt;c__DisplayClass1a.b__17() +33 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.b__22(IAsyncResult asyncResult) +240 System.Web.Mvc.&lt;&gt;c__DisplayClass1d.b__18(IAsyncResult asyncResult) +28 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.Mvc.&lt;&gt;c__DisplayClass8.b__3(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.b__3(IAsyncResult ar) +15 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248</pre>
<p>This issue is caused by including ASP.NET Masterpage controls that use the runat="server" directive in the view. Please note: this happens even if the element itself is commented out, as shown in the following code snippet:</p>
<p>@* &lt;asp:Literal ID="MyLiteral" runat="server" text="some string"/&gt; *@</p>
<p>To resolve this problem, ensure that all ASP.NET components are removed from the MVC Razor view template (including those that are commented out!)</p>
<p> </p>
<p><br />Speak to Simon Steed about any of the topics discussed this site.</p>]]></content:encoded>
            </item>
            <item>
                <title>New introduced HTML5 tags</title>
                <link>https://farmcode.org/articles/new-introduced-html5-tags/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/new-introduced-html5-tags/</guid>
                <description><![CDATA[The following document is about Web Development and all the new tags that have been introduced.]]></description>
                <content:encoded><![CDATA[<p>The following document is about Web Development and all the new tags that have been introduced.</p>
<p>Below is all the new tags that have been introduced in HTML5 and a definition of what they are.</p>
<p><strong>&lt;article&gt;</strong> - Defines an article.<br /><strong>&lt;aside&gt;</strong> - Defines content from the page content.<br /><strong>&lt;audio&gt;</strong> - Defines sound content.<br /><strong>&lt;bdi&gt;</strong> - Isolates a part of text that might be formatted in a different direction from other text outside it.<br /><strong>&lt;canvas&gt;</strong> - Used to draw graphics, on the fly, via scripting (usually JavaScript).<br /><strong>&lt;command&gt;</strong> - Defines a command button that a user can invoke.<br /><strong>&lt;datalist&gt;</strong> - Specifies a list of pre-defined options for input controls.<br /><strong>&lt;details&gt;</strong> - Defines additional details that the user can view or hide.<br /><strong>&lt;dialog&gt;</strong> - Defines a dialog box or window.<br /><strong>&lt;embed&gt;</strong> - Defines a container for an external (non-HTML) application.<br /><strong>&lt;figcaption&gt;</strong> - Defines a caption for a &lt;figure&gt; element.<br /><strong>&lt;figure&gt;</strong> - Specifies self-contained content.<br /><strong>&lt;footer&gt;</strong> - Defines a footer for a document or section.<br /><strong>&lt;header&gt;</strong> - Defines a header for a document or section.<br /><strong>&lt;hgroup&gt;</strong> - Groups heading elements.<br /><strong>&lt;keygen&gt;</strong> - Defines a key-pair generator field (for forms)<br /><strong>&lt;main&gt;</strong> - Specifies the main content of a document.<br /><strong>&lt;mark&gt;</strong> - Defines marked/highlighted text.<br /><strong>&lt;meter&gt;</strong> - Defines a scalar measurement within a known range (a gauge).<br /><strong>&lt;nav&gt;</strong> - Defines navigation links.<br /><strong>&lt;output&gt;</strong> - Defines the result of a calculation.<br /><strong>&lt;progress&gt;</strong> - Represents the progress of a task.<br /><strong>&lt;rp&gt;</strong> - Defines what to show in browsers that do not support ruby annotations.<br /><strong>&lt;rt&gt;</strong> - Defines an explanation/pronunciation of characters (for East Asian typography).<br /><strong>&lt;ruby&gt;</strong> - Defines a ruby annotation (for East Asian typography).<br /><strong>&lt;section&gt;</strong> - Defines a section in a document.<br /><strong>&lt;source&gt;</strong> - Defines multiple media resources for media elements (&lt;video&gt; and &lt;audio&gt;).<br /><strong>&lt;summary&gt;</strong> - Defines a visible heading for a &lt;details&gt; element.<br /><strong>&lt;time&gt;</strong> - Defines a date/time.<br /><strong>&lt;track&gt;</strong> - Defines text tracks for media elements (&lt;video&gt; and &lt;audio&gt;).<br /><strong>&lt;video&gt;</strong> - Defines a video or movie.<br /><strong>&lt;wbr&gt;</strong> - Defines a possible line-break.</p>]]></content:encoded>
            </item>
            <item>
                <title>HTML5 MIME Types in IIS | HTTP 404.3 File Not Found Error</title>
                <link>https://farmcode.org/articles/html5-and-css3-mime-types-in-iis-and-http-error-4043/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/html5-and-css3-mime-types-in-iis-and-http-error-4043/</guid>
                <description><![CDATA[How to add HTML5 MIME types to IIS configuration to resolve HTTP error 404.3 file not found.]]></description>
                <content:encoded><![CDATA[<p>HTML5 and CSS3 introduce some new exciting new features that will improve web design. Among other things, we can now include videos, sounds and custom fonts in a web page without the need to include any external javascript libraries or flash players to play back the media.  But in practice, you may need to modify your IIS setting to be able to serve out these new media types.</p>
<p>Some of these file types are relatively new to the web, so you will need to add the MIME types for your files to your IIS configuration. If you have trouble getting files to play and are getting:</p>
<p><strong>HTTP Error 404.3 - Not Found</strong></p>
<p>The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.</p>
<p>This is because IIS will only serve out files that are defined MIME types - so you will need to add the ones for your files manually.</p>
<p>To resolve this, add your MIME type definitions into your web.config settings under the &lt;system.webServer&gt; , &lt;staticContent&gt; section.</p>
<p>Here are entries for some of the common HTML5 MIME types:</p>
<pre>&lt;mimeMap fileExtension=".mp4" mimeType="video/mp4" /&gt;
&lt;mimeMap fileExtension=".m4v" mimeType="video/m4v" /&gt;
&lt;mimeMap fileExtension=".ogg" mimeType="video/ogg" /&gt;
&lt;mimeMap fileExtension=".ogv" mimeType="video/ogg" /&gt;
&lt;mimeMap fileExtension=".webm" mimeType="video/webm" /&gt;
&lt;mimeMap fileExtension=".oga" mimeType="audio/ogg" /&gt;
&lt;mimeMap fileExtension=".spx" mimeType="audio/ogg" /&gt;
&lt;mimeMap fileExtension=".svg" mimeType="image/svg+xml" /&gt;
&lt;mimeMap fileExtension=".svgz" mimeType="image/svg+xml" /&gt;<br />&lt;remove fileExtension=".eot" /&gt;
&lt;mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /&gt;
&lt;mimeMap fileExtension=".otf" mimeType="font/otf" /&gt;
&lt;mimeMap fileExtension=".woff" mimeType="font/x-woff" /&gt;</pre>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>Linq and Unity Framework</title>
                <link>https://farmcode.org/articles/linq-and-unity-framework/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/linq-and-unity-framework/</guid>
                <description><![CDATA[If you missed out on CodeGarden 2010 this year then you definitely missed one heck of a conference! If you want to find out about the data type I presented during the Umbraco packages competition, this post is for you!]]></description>
                <content:encoded><![CDATA[<div class="text">
<p>If you missed out on CodeGarden 2010 this year then you definitely missed one heck of a conference! This post is about the data type I presented during the Umbraco package competition (which ended up winning too! :). It’s a multi-node picker with the full tree interface to allow you to select the nodes you want. It’s also sort-able with drag/drop functionality.</p>
<p><img id="__mcenew" src="/media/1257/node-picker.png" alt="" data-udi="umb://media/70a128e1815b435f99d40ec14fe45655" /></p>
<p>It’s a very simple control but has the capability to be made into a very awesome data type which is why I’m starting up a new CodePlex project called:<span> </span>Data Types for Umbraco<span> </span>(found<span> </span><a href="http://umbdatatypes.codeplex.com/">here</a>). I’m hoping that people in the Umbraco community will want to become developers on this project so a bunch of us can collaborate to create some seriously amazing data types for Umbraco 4.5.<span> </span>Please let me know if you want to contribute to this project as i think it could have huge potential.<span> </span>Instead of everyone creating their own closed source data types and developing them all in different ways, this would help unify and standardize the way we create data types.</p>
<p>So the first thing I will put up there is the full source for this data type as it was meant to be. However, I’m not going to get around to that today, so in the meantime I’ve put the source for this control right here. Remember, this is not really the best way to make this data type but it will give you a good indication of how to use the new JavaScript tree API and how to build a simple UserControl data type.</p>
<p>Enjoy!</p>
<h2>ASCX Code</h2>
<pre class="prettyprint"><span class="pun">&lt;%</span><span class="pln">@ </span><span class="typ">Control</span><span class="pln"> </span><span class="typ">Language</span><span class="pun">=</span><span class="str">"C#"</span><span class="pln"> </span><span class="typ">AutoEventWireup</span><span class="pun">=</span><span class="str">"true"</span><span class="pln"> </span><span class="typ">CodeBehind</span><span class="pun">=</span><span class="str">"TreePicker.ascx.cs"</span><span class="pln"><br />    </span><span class="typ">Inherits</span><span class="pun">=</span><span class="str">"ExamineDemo1.usercontrols.TreePicker"</span><span class="pln"> %&gt;<br /></span><span class="pun">&lt;%</span><span class="pln">@ </span><span class="typ">Register</span><span class="pln"> </span><span class="typ">TagPrefix</span><span class="pun">=</span><span class="str">"umb"</span><span class="pln"> </span><span class="typ">TagName</span><span class="pun">=</span><span class="str">"tree"</span><span class="pln"> </span><span class="typ">Src</span><span class="pun">=</span><span class="str">"~/umbraco/controls/Tree/TreeControl.ascx"</span><span class="pln"> %&gt;<br /></span><span class="pun">&lt;</span><span class="tag">script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="com">//a reference to the hidden field</span><span class="pln"><br /></span><span class="com">//storing the selected node data</span><span class="pln"><br /></span><span class="kwd">var</span><span class="pln"> hiddenField </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=PickedNodes.ClientID%&gt;"</span><span class="pun">);</span><span class="pln"><br /><br /></span><span class="com">//create a sortable, drag/drop list and</span><span class="pln"><br /></span><span class="com">//initialize the right panel with previously</span><span class="pln"><br /></span><span class="com">//saved data.</span><span class="pln"><br />jQuery</span><span class="pun">(</span><span class="pln">document</span><span class="pun">).</span><span class="pln">ready</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">sortable</span><span class="pun">({</span><span class="pln"><br />        stop</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">event</span><span class="pun">,</span><span class="pln"> ui</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"> </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".item a.close"</span><span class="pun">).</span><span class="pln">live</span><span class="pun">(</span><span class="str">"click"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        jQuery</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">parent</span><span class="pun">().</span><span class="pln">remove</span><span class="pun">();</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br /><br />    </span><span class="com">//now rebuild the selected items</span><span class="pln"><br />    </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">var</span><span class="pln"> json </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">eval</span><span class="pun">(</span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> hiddenField</span><span class="pun">.</span><span class="pln">val</span><span class="pun">()</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pun">);</span><span class="pln"><br />        jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">html</span><span class="pun">(</span><span class="pln">unescape</span><span class="pun">(</span><span class="pln">json</span><span class="pun">.</span><span class="pln">markup</span><span class="pun">));</span><span class="pln"><br />        </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br />    </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">err</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">};</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /><br /></span><span class="com">//Add event handler to the tree API.</span><span class="pln"><br /></span><span class="com">//Bind to the window load event as the document ready event</span><span class="pln"><br /></span><span class="com">//is too early to query for the tree api object</span><span class="pln"><br />jQuery</span><span class="pun">(</span><span class="pln">window</span><span class="pun">).</span><span class="pln">load</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="com">//add a handler to the tree's nodeClicked event</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=TreePickerControl.ClientID%&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="typ">UmbracoTreeAPI</span><span class="pun">()</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">addEventHandler</span><span class="pun">(</span><span class="str">"nodeClicked"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">e</span><span class="pun">,</span><span class="pln"> node</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />            </span><span class="typ">AddToRight</span><span class="pun">(</span><span class="pln">node</span><span class="pun">);</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">AddToRight</span><span class="pun">(</span><span class="pln">node</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="com">//get the node id of the node selected</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> nodeId </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="pln">node</span><span class="pun">).</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"id"</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//check if node id already exists in the right panel</span><span class="pln"><br />    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">find</span><span class="pun">(</span><span class="str">"li[rel='"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">"']"</span><span class="pun">).</span><span class="pln">length </span><span class="pun">&gt;</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br />    </span><span class="com">//create a copy of the node clicked on the tree</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> jNode </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="pln">node</span><span class="pun">).</span><span class="pln">clone</span><span class="pun">().</span><span class="pln">find</span><span class="pun">(</span><span class="str">"a:first"</span><span class="pun">)</span><span class="pln"><br />    </span><span class="com">//remove un-needed attributes</span><span class="pln"><br />    jNode</span><span class="pun">.</span><span class="pln">removeAttr</span><span class="pun">(</span><span class="str">"href"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">removeAttr</span><span class="pun">(</span><span class="str">"umb:nodedata"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"href"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"javascript:SyncItems("</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">");"</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//build a DOM object to put in the right panel</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"&lt;div class='item'&gt;&lt;ul class='rightNode'&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"><br />            </span><span class="str">"&lt;li rel='"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">"' class='closed'&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"><br />            </span><span class="str">"&lt;/li&gt;&lt;/ul&gt;&lt;a class='close' href='javascript:void(0);'&gt;[X]&lt;/a&gt;&lt;/div&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">appendTo</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">find</span><span class="pun">(</span><span class="str">".closed"</span><span class="pun">).</span><span class="pln">append</span><span class="pun">(</span><span class="pln">jNode</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//now update the hidden field with the</span><span class="pln"><br />    </span><span class="com">//node selection</span><span class="pln"><br />    </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="com">//A method to sync the left tree to the item</span><span class="pln"><br /></span><span class="com">//selected in the right panel</span><span class="pln"><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">SyncItems</span><span class="pun">(</span><span class="pln">nodeId</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=TreePickerControl.ClientID%&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="typ">UmbracoTreeAPI</span><span class="pun">()</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">syncTree</span><span class="pun">(</span><span class="pln">nodeId</span><span class="pun">.</span><span class="kwd">toString</span><span class="pun">());</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="com">//were going to store both the node ids</span><span class="pln"><br /></span><span class="com">//and the html markup to re-render the </span><span class="pln"><br /></span><span class="com">//right hand column as JSON to be put into</span><span class="pln"><br /></span><span class="com">//the database.</span><span class="pln"><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">StorePickedNodes</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> val </span><span class="pun">=</span><span class="pln"> </span><span class="str">"["</span><span class="pun">;</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".right .item ul.rightNode li"</span><span class="pun">).</span><span class="pln">each</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        val </span><span class="pun">+=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"rel"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">","</span><span class="pun">;</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br />    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">val </span><span class="pun">!=</span><span class="pln"> </span><span class="str">"["</span><span class="pun">)</span><span class="pln"> val </span><span class="pun">=</span><span class="pln"> val</span><span class="pun">.</span><span class="pln">substr</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> val</span><span class="pun">.</span><span class="pln">length </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">);</span><span class="pln"><br />    val </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"]"</span><span class="pun">;</span><span class="pln"><br />    </span><span class="com">//append the html markup</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> obj </span><span class="pun">=</span><span class="pln"> </span><span class="str">"{ \"val\": "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> val </span><span class="pun">+</span><span class="pln"> </span><span class="str">", \"markup\": \""</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> escape</span><span class="pun">(</span><span class="pln">jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">html</span><span class="pun">())</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">"\"}"</span><span class="pun">;</span><span class="pln"><br />    hiddenField</span><span class="pun">.</span><span class="pln">val</span><span class="pun">(</span><span class="pln">obj</span><span class="pun">);</span><span class="pln">       <br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="pun">&lt;/</span><span class="tag">script</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;%--</span><span class="typ">Inline</span><span class="pln"> styles are dodgy</span><span class="pun">,</span><span class="pln"> but simple </span><span class="kwd">for</span><span class="pln"><br /></span><span class="kwd">this</span><span class="pln"> demonstration</span><span class="pun">--</span><span class="pln">%&gt;<br /><br /></span><span class="pun">&lt;</span><span class="tag">style</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/css"</span><span class="pun">&gt;</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode <br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln">left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">margin</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">          <br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode li<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">margin</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">list-style</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font</span><span class="pun">:</span><span class="pln">icon</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font-family</span><span class="pun">:</span><span class="pln">Arial</span><span class="pun">,</span><span class="pln">Lucida Grande</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font-size</span><span class="pun">:</span><span class="lit">12px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">min-height</span><span class="pun">:</span><span class="lit">20px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode li a<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">background-repeat</span><span class="pun">:</span><span class="pln">no-repeat </span><span class="kwd">!important</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">border</span><span class="pun">:</span><span class="lit">0</span><span class="pln"> none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">color</span><span class="pun">:#</span><span class="lit">2F2F2F</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">height</span><span class="pun">:</span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">line-height</span><span class="pun">:</span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">0</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">text-decoration</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item a<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln">left</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln">   <br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item a</span><span class="pun">.</span><span class="pln">close <br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">margin-left</span><span class="pun">:</span><span class="lit">5px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">cursor</span><span class="pun">:</span><span class="pln"> pointer</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="lit">100%</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">height</span><span class="pun">:</span><span class="lit">20px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">left</span><span class="pun">.</span><span class="pln">propertypane<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">clear</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">margin-right</span><span class="pun">:</span><span class="lit">10px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">right</span><span class="pun">.</span><span class="pln">propertypane<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">clear</span><span class="pun">:</span><span class="pln">right</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">5px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">header<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="lit">622px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br />   <br /></span><span class="pun">&lt;/</span><span class="tag">style</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"multiTreePicker"</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"header propertypane"</span><span class="pun">&gt;</span><span class="pln"><br />        </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln">Select items</span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"left propertypane"</span><span class="pun">&gt;</span><span class="pln">        <br />        </span><span class="pun">&lt;</span><span class="tag">umb:tree</span><span class="pln"> </span><span class="atn">runat</span><span class="pun">=</span><span class="atv">"server"</span><span class="pln"> </span><span class="atn">ID</span><span class="pun">=</span><span class="atv">"TreePickerControl"</span><span class="pln"> <br />            </span><span class="atn">CssClass</span><span class="pun">=</span><span class="atv">"myTreePicker"</span><span class="pln"> </span><span class="atn">Mode</span><span class="pun">=</span><span class="atv">"Standard"</span><span class="pln"> <br />            </span><span class="atn">DialogMode</span><span class="pun">=</span><span class="atv">"id"</span><span class="pln"> </span><span class="atn">ShowContextMenu</span><span class="pun">=</span><span class="atv">"false"</span><span class="pln"> <br />            </span><span class="atn">IsDialog</span><span class="pun">=</span><span class="atv">"true"</span><span class="pln"> </span><span class="atn">TreeType</span><span class="pun">=</span><span class="atv">"content"</span><span class="pln"> </span><span class="pun">/&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"right propertypane"</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br /></span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;</span><span class="tag">asp:HiddenField</span><span class="pln"> </span><span class="atn">runat</span><span class="pun">=</span><span class="atv">"server"</span><span class="pln"> </span><span class="atn">ID</span><span class="pun">=</span><span class="atv">"PickedNodes"</span><span class="pln"> </span><span class="pun">/&gt;</span><span class="pln"><br /></span></pre>
<h2>C# Code Behind</h2>
<pre class="prettyprint"><span class="pln"><br /></span><span class="kwd">public</span><span class="pln"> partial </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">TreePicker</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> <br />    </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Web</span><span class="pun">.</span><span class="pln">UI</span><span class="pun">.</span><span class="typ">UserControl</span><span class="pun">,</span><span class="pln"> </span><span class="typ">IUsercontrolDataEditor</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        <br /><br /><br />    </span><span class="com">#region IUsercontrolDataEditor Members</span><span class="pln"><br /><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">object</span><span class="pln"> value<br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">get</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="com">//put the node in umbraco</span><span class="pln"><br />            </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">PickedNodes</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">;</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />        </span><span class="kwd">set</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="com">//get from umbraco</span><span class="pln"><br />            </span><span class="typ">PickedNodes</span><span class="pun">.</span><span class="typ">Value</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">();</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br />    </span><span class="com">#endregion</span><span class="pln"><br /></span><span class="pun">}</span></pre>
</div>
<div class="bottom">
<div class="ratingcontainer">
<div class="rating">
<p> </p>
</div>
</div>
</div>]]></content:encoded>
            </item>
            <item>
                <title>Using Examine to index and search with ANY data source</title>
                <link>https://farmcode.org/articles/using-examine-to-index-and-search-with-any-data-source/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/using-examine-to-index-and-search-with-any-data-source/</guid>
                <description><![CDATA[Using Examine to index and search with ANY data source.]]></description>
                <content:encoded><![CDATA[<p>During CodeGarden 2010 a few people were asking how to use<span> </span><a rel="noopener noreferrer" href="/category/Examine" target="_blank" title="Examine">Examine</a><span> </span>to index and search on data from any data source such as custom database tables, etc… Previously, the only way to do this was to override the Umbraco Examine indexing provider, remove the Umbraco functionality embedded in there, and then do a lot of coding yourself.  …But now there’s some great news! As of now you can use all of the Examine goodness with it’s embedded<span> </span><a rel="nofollow noopener noreferrer" href="https://lucenenet.apache.org/" target="_blank" title="Lucene.Net">Lucene.Net</a><span> </span>with any data source and you can do it VERY easily.</p>
<p>Some things you need to know about the new version:</p>
<ol>
<li>I haven’t made a release version of this yet as it still needs some more testing, though we are putting this into a production site next week.</li>
<li>If you want to try this, currently you’ll need to get the latest source from<span> </span><a rel="noopener noreferrer" href="https://web.archive.org/web/20120223023716/http://examine.codeplex.com/" target="_blank" title="Examine @ CodePlex">Examine @ CodePlex</a></li>
<li>If you are using a previous version of Examine, there’s a few breaking changes as some of the class structures have been moved, however you config file should still work as is… HOWEVER, you should update your config file to reflect the new one with the new class names</li>
<li>There is now 3 DLLs, not just 2:
<ul>
<li>Examine.DLL
<ul>
<li>Still pretty much the same… contains the abstraction layer</li>
</ul>
</li>
<li>Examine.LuceneEngine.DLL
<ul>
<li>The new DLL to use to work with data that is not Umbraco specific</li>
</ul>
</li>
<li>UmbracoExamine.DLL
<ul>
<li>The DLL that the Umbraco providers are in</li>
</ul>
</li>
</ul>
</li>
</ol>
<p>Ok, now on to the good stuff. First, I’ve added a demo project to this post which you can download<span> </span><a rel="noopener noreferrer" href="http://farmcode.org/media/sourcecode/examinedemoapp/examinedemo.zip" target="_blank" title="Examine Demo App"><strong>HERE</strong></a>. This project is a simple console app that contains a sample XML data file that has 5 records in it. Here’s what the app does:</p>
<ol>
<li>This re-indexes all data</li>
<li>Searches the index for node id 1</li>
<li>Ensures one record is found in the index</li>
<li>Updates the dateUpdated time stamp for the data record</li>
<li>Re-indexes the record with node id 1’</li>
</ol>
<p>So assuming that you have some custom data like a custom database table, xml file, or whatever, there’s really only 3 things that you need to do to get Examine indexing your custom data:</p>
<ol>
<li>Create your own<span> </span><em>ISimpleDataService</em>
<ul>
<li>There is only 1 method to implement:<span> </span><em>IEnumerable&lt;SimpleDataSet&gt; GetAllData(string indexType)</em></li>
<li>This is the method that Examine will call to re-index your data</li>
<li>A<span> </span><em>SimpleDataSet<span> </span></em>is a simple object containing a<span> </span><em>Dictionary&lt;string, string&gt;</em><span> </span>and a<span> </span><em>IndexedNode</em>object (which consists of a Node Id and a Node Type)</li>
<li>For example, if you had a database row, your SimpleDataSet object for the row would be the dictionary of the rows values, it’s node id and type … easy.</li>
</ul>
</li>
<li>Use the<span> </span><em>ToExamineXml()</em><span> </span>extension method to re-index individual nodes/records
<ul>
<li>Examine relies on data being in the same XML structure as Umbraco (which we might change in version 2 sometime in the future… like next year) so we need to transform simple data into the XML structure. We’ve made this quite easy for you; all you have to do is get the data from your custom data source into a<span> </span><em>Dictionary&lt;string, string&gt;</em><span> </span>object and use this extension method to pass the xml structure in to Examine’s<span> </span><em>ReIndexNode</em><span> </span>method.</li>
<li>For example:<span> </span><em>ExamineManager.Instance.ReIndexNode(dataSet.ToExamineXml(dataSet["Id"], "CustomData"), "CustomData"); <span> </span></em>where dataSet is a<span> </span><em>Dictionary&lt;string, string&gt;</em><span> </span>.</li>
</ul>
</li>
<li>Update your Examine config to use the new<span> </span><em>SimpleDataIndexer</em><span> </span>index provider and the new<span> </span><em>LuceneSearcher<span> </span></em>search provider</li>
</ol>
<p>If you’re not using Umbraco at all, then you’ll only need to have the 2 Examine DLLs which don’t reference the Umbraco DLLs whatsoever so everything is decoupled.</p>
<p>I’d recommend downloading the demo app and running it as it will show you everything you need to know on how to get Examine running with custom data. However, i know that people just like to see code in blog posts, so here’s the config for the demo app:</p>
<p> </p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:18fee6e6-5c56-4986-9781-fac4483ebbbe" class="wlWriterEditableSmartContent">
<div><span>&lt;?xml version="1.0" encoding="utf-8" ?&gt;<br />&lt;configuration&gt;<br /><br /> &lt;configSections&gt;<br /> &lt;section name="Examine" type="Examine.Config.ExamineSettings, Examine"/&gt;<br /> &lt;section name="ExamineLuceneIndexSets" <br /> type="Examine.LuceneEngine.Config.IndexSets, Examine.LuceneEngine"/&gt;<br /> &lt;/configSections&gt;<br /><br /> &lt;Examine&gt;<br /> &lt;ExamineIndexProviders&gt;<br /> &lt;providers&gt;<br /><br /> &lt;!-- <br /> Define the indexer for our custom data.<br /> Since we're only indexing one type of data, there's <br /> only 1 indexType specified: 'CustomData', however<br /> if you have more than one type of index (i.e. Media, Content) <br /> then you just need to list them as a comma seperated list without spaces.<br /> <br /> The dataService is how Examine queries whatever data source you have, <br /> in this case it's a custom data service defined in this project.<br /> A custom data service only has to implement one method... very easy. <br /> --&gt;<br /> &lt;add name="CustomIndexer"<br /> type="Examine.LuceneEngine.Providers.SimpleDataIndexer, <br /> Examine.LuceneEngine"<br /> dataService="ExamineDemo.CustomDataService, ExamineDemo"<br /> indexTypes="CustomData"<br /> runAsync="false"/&gt;<br /><br /> &lt;/providers&gt;<br /> &lt;/ExamineIndexProviders&gt;<br /> &lt;ExamineSearchProviders defaultProvider="CustomSearcher"&gt;<br /> &lt;providers&gt;<br /> <br /> &lt;!-- <br /> A search provider that can query a lucene index, no other <br /> work is required here <br /> --&gt;<br /> &lt;add name="CustomSearcher"<br /> type="Examine.LuceneEngine.Providers.LuceneSearcher, <br /> Examine.LuceneEngine" /&gt;<br /><br /> &lt;/providers&gt;<br /> &lt;/ExamineSearchProviders&gt;<br /> &lt;/Examine&gt;<br /><br /> &lt;ExamineLuceneIndexSets&gt;<br /><br /> &lt;!-- Create an index set to hold the data for our index --&gt;<br /> &lt;IndexSet SetName="CustomIndexSet" <br /> IndexPath="App_Data\CustomIndexSet"&gt;<br /> &lt;IndexUserFields&gt; <br /> &lt;add Name="name" /&gt;<br /> &lt;add Name="description" /&gt;<br /> &lt;add Name="dateUpdated" /&gt;<br /> &lt;/IndexUserFields&gt;<br /> &lt;/IndexSet&gt;<br /> <br /> &lt;/ExamineLuceneIndexSets&gt;<br /><br />&lt;/configuration&gt;</span></div>
</div>]]></content:encoded>
            </item>
            <item>
                <title>Linq2Umbraco driver for LINQPad</title>
                <link>https://farmcode.org/articles/linq2umbraco-driver-for-linqpad/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:12:51 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/linq2umbraco-driver-for-linqpad/</guid>
                <description><![CDATA[LINQPad by by Joseph Albahari, is a fantastic program for querying databases. Although you can query the Umbraco website database, LINQPad can’t natively operate on an UmbracoDataContext, which is what Linq2Umbraco is using when you export the Umbracodocument types to .Net. Wouldn't it be helpful if you can use the UmbracoDataContext directly in LINQPad? Here is how!]]></description>
                <content:encoded><![CDATA[<p>Having used Linq2Umbraco for a while now to retrieve <a rel="noopener noreferrer" href="http://www.umbraco.com/" target="_blank">Umbraco</a> data in custom DALs I really needed a way to build queries and execute them against the <a rel="noopener noreferrer" href="http://www.umbraco.com/" target="_blank">Umbraco</a> web site’s data without each time compiling the application and maybe even firing up the debugger. Enter <a rel="noopener noreferrer" href="http://www.linqpad.net/" target="_blank">LINQPad</a> by by <a rel="noopener noreferrer" href="http://www.albahari.com/" target="_blank">Joseph Albahari</a>, a fantastic program which has pretty much replaced SQL Server Management Studio on my workstation for querying databases. Although you can query the Umbraco database of your web site LINQPad can’t natively operate on an UmbracoDataContext, which is what Linq2Umbraco is using when you export the <a rel="noopener noreferrer" href="http://www.umbraco.com/" target="_blank">Umbraco</a> document types to .Net and which you will be using when querying the data in the DAL. So it would be really helpful if you can use the UmbracoDataContext directly in LINQPad as you can use these queries 1:1 in your code. Thankfully LINQPad can be extended to work with custom DataContexts, all that needs to be done is to write a custom data context driver as described <a rel="noopener noreferrer" href="http://www.linqpad.net/Extensibility.aspx" target="_blank">here</a>. The documentation is exceptionally good and after a short while the first Linq2Umraco driver for LINQPad was ready and is now free to download:</p>
<p><a href="/media/sourcecode/TheFarm-Linq2UmbracoDataContextDriver-1.0.lpx">Download TheFarm Linq2Umbraco Driver for LINQPad 1.0</a> (16.08kb)</p>
<p>The driver has been compiled against LINQPad 2.31 using .Net 3.5, so it should work fine on both current versions of LINQPad (.Net 3.5 and 4). The umbraco.Linq.Core.dll, which the driver needs as it contains the UmbracoDataContext, will be dynamically loaded. The driver assumes that it exists in the same directory as the dll which contains the custom Linq2Umbraco DataContext. The dynamic loading has 2 advantages:</p>
<ul>
<li>The size of the driver is only 16kb! :) No need to pack all the dlls in there as they are all present in your <a rel="noopener noreferrer" href="http://www.umbraco.com/" target="_blank">Umbraco</a> installation anyway. And this way the driver isn’t bound to one specific <a rel="noopener noreferrer" href="http://www.umbraco.org/" target="_blank">Umbraco</a> version.</li>
<li>LINQPad requires it’s driver assemblies to be strongly signed, and .Net requires every referenced assembly to be strongly signed as well. However umbraco.Linq.Core is not strongly signed, and although I managed to strongly sign the assembly by using a little tool it did create havoc to the Umbraco installation, so dynamically loading the assembly magically resolves all that headache!</li>
</ul>
<p>Following is a quick demonstration of the driver in use. I’ve created a small test <a rel="nofollow noopener noreferrer" href="http://www.umbraco.com/" target="_blank">Umbraco</a> installation with a couple of document types and content nodes:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_doctypes.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_doctypes_thumb.png" border="0" alt="demo_doctypes" title="demo_doctypes" width="218" height="146" /></a></p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_content.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_content_thumb.png" border="0" alt="demo_content" title="demo_content" width="183" height="248" /></a></p>
<p>The doc types contain just a couple of standard fields like text string, data,  plus one Ultimate picker instance on the Products page (checkbox list, saved as comma delimited string). Now I’ll export the document types to .Net by right clicking on ‘Document Types’, the popup window will be populated like this:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_export.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_export_thumb.png" border="0" alt="demo_export" title="demo_export" width="414" height="365" /></a></p>
<p>It doesn’t matter if you choose POCO with or without abstractions. It is also very advisable to install <a rel="nofollow noopener noreferrer" href="http://our.umbraco.org/member/5518" target="_blank">Matt Brailford’s</a> fantastic <a rel="nofollow noopener noreferrer" href="http://our.umbraco.org/projects/developer-tools/autoexport2dotnet" target="_blank">AutoExport2DotNet</a> package, it will perform an export to .Net every time you modify the document types.</p>
<p>After downloading and renaming the UmbracoDataContext files I’ll include them in the custom DAL like so:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_solution_explorer.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_solution_explorer_thumb.png" border="0" alt="demo_solution_explorer" title="demo_solution_explorer" width="270" height="514" /></a></p>
<p>As you can see at the moment the DAL project doesn’t contain anything else but the two automatically generated files plus the necessary link to umbraco.Linq.Core. The Umbraco 4.6.1 test installation is showing up right next to it, I need the /App_Data/umbraco.config file from it later.</p>
<p>Now let’s start up LINQPad and add a connection using the custom driver:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_add_connecton.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_add_connecton_thumb.png" border="0" alt="demo_add_connecton" title="demo_add_connecton" width="620" height="395" /></a></p>
<p>Clicking on View more drivers… will reveal the following dialog, where Browse… let’s you select the custom LINQPad driver:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_add_driver.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_add_driver_thumb.png" border="0" alt="demo_add_driver" title="demo_add_driver" width="620" height="480" /></a></p>
<p>Opening the driver will shortly lead to the message ‘Driver successfully loaded’, the driver will now appear in the list of drivers from above:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_driver.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_driver_thumb.png" border="0" alt="demo_driver" title="demo_driver" width="630" height="169" /></a></p>
<p>After hitting ‘Next’ the following dialog will appear:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_dialog.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_dialog_thumb.png" border="0" alt="demo_dialog" title="demo_dialog" width="340" height="268" /></a></p>
<p>Here the properties for the Linq2Umbraco connection are set.</p>
<ul>
<li>Path to custom assembly: This is the assembly that contains the exported UmbracoDataContext, in this case it’s TheFarm.DAL.dll</li>
<li>Full name of custom type: A popup window will present you a list of all UmbracoDataContexts in the assembly, in 99% of the cases there will only be one and in this case it’s the TheFarmDemoDataContext as specified above</li>
<li>/Appdata/umbraco.config: The umbraco.config file of the Umbraco installation found in /App_Data.</li>
<li>Surpress lazy secondary queries: UmbracoDataContext uses the AssociationTree class to list children, e.g. the class Products will contain a list of ProductCategories. When querying Products you will most likely not want to generate a list of all ProductCategories for each Product, Surpress lazy secondary queries will tell the program to stop evaluating these expressions as well.</li>
</ul>
<p>After hitting OK the connection will be added to LINQPad and you can start querying the custom UmbracoDataContext:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_query1.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_query1_thumb.png" border="0" alt="demo_query1" title="demo_query1" width="620" height="290" /></a></p>
<p>Notice here the output of TopProducts (Ultimate picker), Introduction (Richtext editor) and PricesValidUntil (date). ProductCategorys and Productss are the above mentioned children and grand children which are here surpressed with ‘Surpress lazy secondary queries’. Another example:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_query2.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_query2_thumb.png" border="0" alt="demo_query2" title="demo_query2" width="620" height="374" /></a></p>
<p>You can also easily create custom Linq Extension methods e.g. in the DAL and use them in your queries like so:</p>
<p><a href="http://farmcode.org/media/sourcecode/Demo-Images/demo_query3.png"><img src="http://farmcode.org/media/sourcecode/Demo-Images/demo_query3_thumb.png" border="0" alt="demo_query3" title="demo_query3" width="215" height="145" /></a></p>
<p>[Credits for the <a rel="noopener noreferrer" href="http://www.extensionmethod.net/Details.aspx?ID=250" target="_blank">ToCSV</a> extension go to Muhammad Mosa.]</p>
<p><a href="/file.axd?file=2011%2f2%2fTheFarm+Linq2UmbracoDataContextDriver+1.0.lpx">TheFarm Linq2UmbracoDataContextDriver 1.0.lpx (16.08 kb)</a></p>]]></content:encoded>
            </item>
            <item>
                <title>Logging Custom Errors with The Umbraco LogHelper</title>
                <link>https://farmcode.org/articles/logging-custom-errors-with-the-umbraco-loghelper/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/logging-custom-errors-with-the-umbraco-loghelper/</guid>
                <description><![CDATA[Logging errors is always a good idea, Umbraco's Log Helper is a great way to add your own custom errors into the UmbracoTracelog.txt file.]]></description>
                <content:encoded><![CDATA[<p>Logging errors is always a good idea, but sometimes developers face the dilemma of choosing exactly how and when to handle errors and log them. Do you have one big generic try-catch with enough code to handle every eventuality, or do you use several different try-catches to specifically catch and handle particular types of errors at very specific points?</p>
<p>The best choice may depend on your project, but in any case you will want to keep this code lean since it may come at the expense of the readaibility of what the code actually does. Luckily, we find Umbraco's Log Helper as a great way to satisfy logging without needing reams of code to make it meaningful!</p>
<p><strong>The code below shows how you can catch an error and call up Umbraco's LogHelper to log your error:</strong></p>
<pre>try
{
// code that could throw an exception
}
catch (Exception ex)
{
  // do things to handle and...
   LogHelper.Error(this.GetType(), "Your custom error message here", ex);
}
</pre>
<p>When called, this custom error message is logged along with the details of the exception to <strong>/App_Data/Logs/UmbracoTraceLog.txt</strong>. This makes diagnosing site issues where you are unable to step into the code, or finding out the reason for historical errors a lot easier.</p>
<p>As a bonus, it keeps all your error logging (and Umbraco's!) in the same place making it easier to manage going forwards.</p>]]></content:encoded>
            </item>
            <item>
                <title>Multi-node tree picker source code from CodeGarden 2010</title>
                <link>https://farmcode.org/articles/multi-node-tree-picker-source-code-from-codegarden-2010/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/multi-node-tree-picker-source-code-from-codegarden-2010/</guid>
                <description><![CDATA[Multi-node tree picker source code from CodeGarden 2010]]></description>
                <content:encoded><![CDATA[<p>This post is about the data type I presented during the Umbraco package competition (which ended up winning too! :). It's a multi-node picker with the full tree interface to allow you to select the nodes you want. It's also sort-able with drag/drop functionality.</p>
<p><a href="/images/picture_image_7.png"><img src="http://farmcode.org/images/picture_image_thumb7.png" border="0" alt="image" title="image" width="580" height="250" /></a></p>
<p>It's a very simple control but has the capability to be made into a very awesome data type which is why I'm starting up a new CodePlex project called:<span> </span>Data Types for Umbraco<span> </span>(found<span> </span><a rel="nofollow noopener noreferrer" href="http://umbdatatypes.codeplex.com/" target="_blank" title="Data Types For Umbraco">here</a>). I'm hoping that people in the Umbraco community will want to become developers on this project so a bunch of us can collaborate to create some seriously amazing data types for Umbraco 4.5.<span> </span>Please let me know if you want to contribute to this project as i think it could have huge potential.<span> </span>Instead of everyone creating their own closed source data types and developing them all in different ways, this would help unify and standardize the way we create data types.</p>
<p>So the first thing I will put up there is the full source for this data type as it was meant to be. However, I'm not going to get around to that today, so in the meantime I've put the source for this control right here. Remember, this is not really the best way to make this data type but it will give you a good indication of how to use the new JavaScript tree API and how to build a simple UserControl data type.</p>
<p>Enjoy!</p>
<h2>ASCX Code</h2>
<pre class="prettyprint"><span class="pun">&lt;%</span><span class="pln">@ </span><span class="typ">Control</span><span class="pln"> </span><span class="typ">Language</span><span class="pun">=</span><span class="str">"C#"</span><span class="pln"> </span><span class="typ">AutoEventWireup</span><span class="pun">=</span><span class="str">"true"</span><span class="pln"> </span><span class="typ">CodeBehind</span><span class="pun">=</span><span class="str">"TreePicker.ascx.cs"</span><span class="pln"><br />    </span><span class="typ">Inherits</span><span class="pun">=</span><span class="str">"ExamineDemo1.usercontrols.TreePicker"</span><span class="pln"> %&gt;<br /></span><span class="pun">&lt;%</span><span class="pln">@ </span><span class="typ">Register</span><span class="pln"> </span><span class="typ">TagPrefix</span><span class="pun">=</span><span class="str">"umb"</span><span class="pln"> </span><span class="typ">TagName</span><span class="pun">=</span><span class="str">"tree"</span><span class="pln"> </span><span class="typ">Src</span><span class="pun">=</span><span class="str">"~/umbraco/controls/Tree/TreeControl.ascx"</span><span class="pln"> %&gt;<br /></span><span class="pun">&lt;</span><span class="tag">script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="com">//a reference to the hidden field</span><span class="pln"><br /></span><span class="com">//storing the selected node data</span><span class="pln"><br /></span><span class="kwd">var</span><span class="pln"> hiddenField </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=PickedNodes.ClientID%&gt;"</span><span class="pun">);</span><span class="pln"><br /><br /></span><span class="com">//create a sortable, drag/drop list and</span><span class="pln"><br /></span><span class="com">//initialize the right panel with previously</span><span class="pln"><br /></span><span class="com">//saved data.</span><span class="pln"><br />jQuery</span><span class="pun">(</span><span class="pln">document</span><span class="pun">).</span><span class="pln">ready</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">sortable</span><span class="pun">({</span><span class="pln"><br />        stop</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">event</span><span class="pun">,</span><span class="pln"> ui</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"> </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".item a.close"</span><span class="pun">).</span><span class="pln">live</span><span class="pun">(</span><span class="str">"click"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        jQuery</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">parent</span><span class="pun">().</span><span class="pln">remove</span><span class="pun">();</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br /><br />    </span><span class="com">//now rebuild the selected items</span><span class="pln"><br />    </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">var</span><span class="pln"> json </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">eval</span><span class="pun">(</span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> hiddenField</span><span class="pun">.</span><span class="pln">val</span><span class="pun">()</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pun">);</span><span class="pln"><br />        jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">html</span><span class="pun">(</span><span class="pln">unescape</span><span class="pun">(</span><span class="pln">json</span><span class="pun">.</span><span class="pln">markup</span><span class="pun">));</span><span class="pln"><br />        </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br />    </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">err</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">};</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /><br /></span><span class="com">//Add event handler to the tree API.</span><span class="pln"><br /></span><span class="com">//Bind to the window load event as the document ready event</span><span class="pln"><br /></span><span class="com">//is too early to query for the tree api object</span><span class="pln"><br />jQuery</span><span class="pun">(</span><span class="pln">window</span><span class="pun">).</span><span class="pln">load</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="com">//add a handler to the tree's nodeClicked event</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=TreePickerControl.ClientID%&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="typ">UmbracoTreeAPI</span><span class="pun">()</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">addEventHandler</span><span class="pun">(</span><span class="str">"nodeClicked"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">e</span><span class="pun">,</span><span class="pln"> node</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />            </span><span class="typ">AddToRight</span><span class="pun">(</span><span class="pln">node</span><span class="pun">);</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br /></span><span class="pun">});</span><span class="pln"><br /><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">AddToRight</span><span class="pun">(</span><span class="pln">node</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="com">//get the node id of the node selected</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> nodeId </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="pln">node</span><span class="pun">).</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"id"</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//check if node id already exists in the right panel</span><span class="pln"><br />    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">find</span><span class="pun">(</span><span class="str">"li[rel='"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">"']"</span><span class="pun">).</span><span class="pln">length </span><span class="pun">&gt;</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br />    </span><span class="com">//create a copy of the node clicked on the tree</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> jNode </span><span class="pun">=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="pln">node</span><span class="pun">).</span><span class="pln">clone</span><span class="pun">().</span><span class="pln">find</span><span class="pun">(</span><span class="str">"a:first"</span><span class="pun">)</span><span class="pln"><br />    </span><span class="com">//remove un-needed attributes</span><span class="pln"><br />    jNode</span><span class="pun">.</span><span class="pln">removeAttr</span><span class="pun">(</span><span class="str">"href"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">removeAttr</span><span class="pun">(</span><span class="str">"umb:nodedata"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"href"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"javascript:SyncItems("</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">");"</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//build a DOM object to put in the right panel</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"&lt;div class='item'&gt;&lt;ul class='rightNode'&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"><br />            </span><span class="str">"&lt;li rel='"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeId </span><span class="pun">+</span><span class="pln"> </span><span class="str">"' class='closed'&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"><br />            </span><span class="str">"&lt;/li&gt;&lt;/ul&gt;&lt;a class='close' href='javascript:void(0);'&gt;[X]&lt;/a&gt;&lt;/div&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">appendTo</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">find</span><span class="pun">(</span><span class="str">".closed"</span><span class="pun">).</span><span class="pln">append</span><span class="pun">(</span><span class="pln">jNode</span><span class="pun">);</span><span class="pln"><br />    </span><span class="com">//now update the hidden field with the</span><span class="pln"><br />    </span><span class="com">//node selection</span><span class="pln"><br />    </span><span class="typ">StorePickedNodes</span><span class="pun">();</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="com">//A method to sync the left tree to the item</span><span class="pln"><br /></span><span class="com">//selected in the right panel</span><span class="pln"><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">SyncItems</span><span class="pun">(</span><span class="pln">nodeId</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">"#&lt;%=TreePickerControl.ClientID%&gt;"</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">.</span><span class="typ">UmbracoTreeAPI</span><span class="pun">()</span><span class="pln"><br />        </span><span class="pun">.</span><span class="pln">syncTree</span><span class="pun">(</span><span class="pln">nodeId</span><span class="pun">.</span><span class="kwd">toString</span><span class="pun">());</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="com">//were going to store both the node ids</span><span class="pln"><br /></span><span class="com">//and the html markup to re-render the </span><span class="pln"><br /></span><span class="com">//right hand column as JSON to be put into</span><span class="pln"><br /></span><span class="com">//the database.</span><span class="pln"><br /></span><span class="kwd">function</span><span class="pln"> </span><span class="typ">StorePickedNodes</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> val </span><span class="pun">=</span><span class="pln"> </span><span class="str">"["</span><span class="pun">;</span><span class="pln"><br />    jQuery</span><span class="pun">(</span><span class="str">".right .item ul.rightNode li"</span><span class="pun">).</span><span class="pln">each</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        val </span><span class="pun">+=</span><span class="pln"> jQuery</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">attr</span><span class="pun">(</span><span class="str">"rel"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">","</span><span class="pun">;</span><span class="pln"><br />    </span><span class="pun">});</span><span class="pln"><br />    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">val </span><span class="pun">!=</span><span class="pln"> </span><span class="str">"["</span><span class="pun">)</span><span class="pln"> val </span><span class="pun">=</span><span class="pln"> val</span><span class="pun">.</span><span class="pln">substr</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> val</span><span class="pun">.</span><span class="pln">length </span><span class="pun">-</span><span class="pln"> </span><span class="lit">1</span><span class="pun">);</span><span class="pln"><br />    val </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"]"</span><span class="pun">;</span><span class="pln"><br />    </span><span class="com">//append the html markup</span><span class="pln"><br />    </span><span class="kwd">var</span><span class="pln"> obj </span><span class="pun">=</span><span class="pln"> </span><span class="str">"{ \"val\": "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> val </span><span class="pun">+</span><span class="pln"> </span><span class="str">", \"markup\": \""</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> escape</span><span class="pun">(</span><span class="pln">jQuery</span><span class="pun">(</span><span class="str">".right"</span><span class="pun">).</span><span class="pln">html</span><span class="pun">())</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">"\"}"</span><span class="pun">;</span><span class="pln"><br />    hiddenField</span><span class="pun">.</span><span class="pln">val</span><span class="pun">(</span><span class="pln">obj</span><span class="pun">);</span><span class="pln">       <br /></span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="pun">&lt;/</span><span class="tag">script</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;%--</span><span class="typ">Inline</span><span class="pln"> styles are dodgy</span><span class="pun">,</span><span class="pln"> but simple </span><span class="kwd">for</span><span class="pln"><br /></span><span class="kwd">this</span><span class="pln"> demonstration</span><span class="pun">--</span><span class="pln">%&gt;<br /><br /></span><span class="pun">&lt;</span><span class="tag">style</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/css"</span><span class="pun">&gt;</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode <br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln">left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">margin</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln">          <br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode li<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">margin</span><span class="pun">:</span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">list-style</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font</span><span class="pun">:</span><span class="pln">icon</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font-family</span><span class="pun">:</span><span class="pln">Arial</span><span class="pun">,</span><span class="pln">Lucida Grande</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">font-size</span><span class="pun">:</span><span class="lit">12px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">min-height</span><span class="pun">:</span><span class="lit">20px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item ul</span><span class="pun">.</span><span class="pln">rightNode li a<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">background-repeat</span><span class="pun">:</span><span class="pln">no-repeat </span><span class="kwd">!important</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">border</span><span class="pun">:</span><span class="lit">0</span><span class="pln"> none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">color</span><span class="pun">:#</span><span class="lit">2F2F2F</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">height</span><span class="pun">:</span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">line-height</span><span class="pun">:</span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">0</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="lit">18px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">text-decoration</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item a<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln">left</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln">   <br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item a</span><span class="pun">.</span><span class="pln">close <br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">margin-left</span><span class="pun">:</span><span class="lit">5px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">item<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">cursor</span><span class="pun">:</span><span class="pln"> pointer</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="lit">100%</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">height</span><span class="pun">:</span><span class="lit">20px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">left</span><span class="pun">.</span><span class="pln">propertypane<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">clear</span><span class="pun">:</span><span class="pln">none</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">margin-right</span><span class="pun">:</span><span class="lit">10px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">right</span><span class="pun">.</span><span class="pln">propertypane<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">300px</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> left</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">clear</span><span class="pun">:</span><span class="pln">right</span><span class="pun">;</span><span class="pln"><br />    </span><span class="kwd">padding</span><span class="pun">:</span><span class="lit">5px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">.</span><span class="pln">multiTreePicker </span><span class="pun">.</span><span class="pln">header<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">width</span><span class="pun">:</span><span class="lit">622px</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br />   <br /></span><span class="pun">&lt;/</span><span class="tag">style</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"multiTreePicker"</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"header propertypane"</span><span class="pun">&gt;</span><span class="pln"><br />        </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln">Select items</span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"left propertypane"</span><span class="pun">&gt;</span><span class="pln">        <br />        </span><span class="pun">&lt;</span><span class="tag">umb:tree</span><span class="pln"> </span><span class="atn">runat</span><span class="pun">=</span><span class="atv">"server"</span><span class="pln"> </span><span class="atn">ID</span><span class="pun">=</span><span class="atv">"TreePickerControl"</span><span class="pln"> <br />            </span><span class="atn">CssClass</span><span class="pun">=</span><span class="atv">"myTreePicker"</span><span class="pln"> </span><span class="atn">Mode</span><span class="pun">=</span><span class="atv">"Standard"</span><span class="pln"> <br />            </span><span class="atn">DialogMode</span><span class="pun">=</span><span class="atv">"id"</span><span class="pln"> </span><span class="atn">ShowContextMenu</span><span class="pun">=</span><span class="atv">"false"</span><span class="pln"> <br />            </span><span class="atn">IsDialog</span><span class="pun">=</span><span class="atv">"true"</span><span class="pln"> </span><span class="atn">TreeType</span><span class="pun">=</span><span class="atv">"content"</span><span class="pln"> </span><span class="pun">/&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;</span><span class="tag">div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"right propertypane"</span><span class="pun">&gt;</span><span class="pln"><br />    </span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br /></span><span class="pun">&lt;/</span><span class="tag">div</span><span class="pun">&gt;</span><span class="pln"><br /><br /></span><span class="pun">&lt;</span><span class="tag">asp:HiddenField</span><span class="pln"> </span><span class="atn">runat</span><span class="pun">=</span><span class="atv">"server"</span><span class="pln"> </span><span class="atn">ID</span><span class="pun">=</span><span class="atv">"PickedNodes"</span><span class="pln"> </span><span class="pun">/&gt;</span><span class="pln"><br /></span></pre>
<h2>C# Code Behind</h2>
<pre class="prettyprint"><span class="pln"><br /></span><span class="kwd">public</span><span class="pln"> partial </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">TreePicker</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> <br />    </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Web</span><span class="pun">.</span><span class="pln">UI</span><span class="pun">.</span><span class="typ">UserControl</span><span class="pun">,</span><span class="pln"> </span><span class="typ">IUsercontrolDataEditor</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        <br /><br /><br />    </span><span class="com">#region IUsercontrolDataEditor Members</span><span class="pln"><br /><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">object</span><span class="pln"> value<br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">get</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="com">//put the node in umbraco</span><span class="pln"><br />            </span><span class="kwd">return</span><span class="pln"> </span><span class="typ">PickedNodes</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">;</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />        </span><span class="kwd">set</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="com">//get from umbraco</span><span class="pln"><br />            </span><span class="typ">PickedNodes</span><span class="pun">.</span><span class="typ">Value</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">();</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br />    </span><span class="com">#endregion</span><span class="pln"><br /></span><span class="pun">}</span></pre>]]></content:encoded>
            </item>
            <item>
                <title>Creating code-behind files for Umbraco templates</title>
                <link>https://farmcode.org/articles/creating-code-behind-files-for-umbraco-templates/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/creating-code-behind-files-for-umbraco-templates/</guid>
                <description><![CDATA[Creating code-behind files for Umbraco templates]]></description>
                <content:encoded><![CDATA[<p>I’ve always had this idea in my head that one of the downfalls of using Umbraco when coming form standard ASP.Net web application was the missing code-behind files. You know, when you create a new web application and add an .aspx page to it it conveniently comes with a .cs and design.cs file. Most of the time I would even let the code-behind file inherit from my own custom Page/MasterPage implementation, e.g. a SecuredPage that comes with various properties and methods to handle authentication. Although Umbraco uses regular masterpages (if you haven’t turned it off in the web.config) all you get in the backoffice is the actual page template. Now, don’t get me wrong: I love the way Umbraco let’s you edit all aspects of your site via the backend and gives you the utmost flexibility and 100% control over the output, presented in a refreshingly simple manner. Yet sometimes you need a bit more, and it’s just another clear plus for Umbraco that you are able do the following without ever having to modify the core.</p>
<p>The 'aha' moment that it is actually quite easy to add code-behind files to Umbraco masterpages came to me when I had to port a quite big ASP.Net website to Umbraco. The website had grown organically over the years with lots of custom templates, user controls, etc. The site also had multi-language support, all of which was handled in the code-behind files of the pages. The goal was to get it over to Umbraco as quick as possible, then rework the functionality bit by bit. So I started by creating a new Umbraco site and ‘wrapped’ it in a web application project in Visual Studio.</p>
<p> </p>
<p><a href="/images/first-image.png"><img src="/images/first-image.png" border="0" alt="1-28-2011 5-00-55 PM" title="1-28-2011 5-00-55 PM" width="343" height="459" /></a></p>
<p><sub>[Please refer to the comments below to find more information on how to set this up in Visual Studio.]</sub></p>
<p>After adding a couple of document types and templates in Umbraco the masterpages folder looks something like this:</p>
<p><a href="/images/34-20.png"><img src="/images/34-20-thumb.png" border="0" alt="1-28-2011 5-28-34 PM" title="1-28-2011 5-28-34 PM" width="153" height="77" /></a></p>
<p>The Root.master file is the main master page, Page1.master and Page2.master are nested master pages in Umbraco. I’ve included all three of them in the solution. Now it’s time to create the code-behind file: right-click on the masterpages folder and add three C# classes and name them Root.master.cs, Page1.master.cs and Page2.master.cs. The result should be something like this:</p>
<p><a href="/images/image-28-01.png"><img src="/images/1-28-thumb.png" border="0" alt="1-28-2011 5-29-38 PM" title="1-28-2011 5-29-38 PM" width="191" height="127" /></a></p>
<p>Visual Studio automatically groups them together, fantastic. Yet they are not really hooked up yet, VS does the grouping just based on file names. The master directive on Root.master currently looks like this:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:4893245a-de6a-4304-b18c-29fdcf6764e1" class="wlWriterEditableSmartContent">
<div><span><span class="pun">&lt;</span></span><span><span class="pun">%</span><span class="pln">@ </span><span class="typ">Master</span><span class="pln"> </span></span><span><span class="typ">Language</span></span><span><span class="pun">=</span><span class="str">"C#"</span></span><span><span class="pln"> <br />           </span><span class="typ">MasterPageFile</span></span><span><span class="pun">=</span><span class="str">"~/umbraco/masterpages/default.master"</span></span><span><span class="pln"> <br />           </span><span class="typ">AutoEventWireup</span></span><span><span class="pun">=</span><span class="str">"true"</span></span><span><span class="pln"> %</span></span><span><span class="pln">&gt;</span></span></div>
</div>
<p>To hook up the cs file we need to add the CodeBehind and Inherits attributes like so:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:367d06de-6e44-4624-bec8-3a56496ae9d8" class="wlWriterEditableSmartContent">
<div><span><span class="pun">&lt;%</span></span><span><span class="pln">@ </span><span class="typ">Master</span><span class="pln"> </span><span class="typ">Language</span></span><span><span class="pun">=</span></span><span><span class="str">"</span></span><span><span class="str">C#</span></span><span><span class="str">"</span></span><span><span class="pln"> <br />           </span><span class="typ">MasterPageFile</span></span><span><span class="pun">=</span></span><span><span class="str">"</span></span><span><span class="str">~/umbraco/masterpages/default.master</span></span><span><span class="str">"</span></span><span><span class="pln"> <br />           </span><span class="typ">AutoEventWireup</span></span><span><span class="pun">=</span></span><span><span class="str">"</span></span><span><span class="str">true</span></span><span><span class="str">"</span></span><span><span class="pln"> <br />           </span><span class="typ">CodeBehind</span></span><span><span class="pun">=</span></span><span><span class="str">"</span></span><span><span class="str">Root.master.cs</span></span><span><span class="str">"</span></span><span><span class="pln"> <br />           </span><span class="typ">Inherits</span></span><span><span class="pun">=</span></span><span><span class="str">"</span></span><span><span class="str">Umbraco_4._6._1.masterpages.Root</span></span><span><span class="str">"</span></span><span><span class="pln">%&gt;</span></span></div>
</div>
<p>You should get an error at this point as the compiler complains that Root is not convertible to System.Web.UI.MasterPage, so we need to fix this in the cs file as well by making the class partial (necessary if you want to later add designer files as well) and inheriting from System.Web.UI.MasterPage. An empty Page_Load message can’t hurt as well:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:d5afca84-faa0-4ffe-b389-afa876d28643" class="wlWriterEditableSmartContent">
<div><span><span class="kwd">using</span></span><span><span class="pln"> </span><span class="typ">System</span><span class="pun">;</span><span class="pln"><br /><br /></span></span><span><span class="kwd">namespace</span></span><span><span class="pln"> Umbraco4_6_1</span><span class="pun">.</span><span class="pln">masterpages<br /></span><span class="pun">{</span><span class="pln"><br />    </span></span><span><span class="kwd">public</span></span><span><span class="pln"> </span></span><span><span class="pln">partial</span></span><span><span class="pln"> </span></span><span><span class="kwd">class</span></span><span><span class="pln"> </span><span class="typ">Root</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> </span><span class="typ">System</span><span class="pun">.</span><span class="typ">Web</span><span class="pun">.</span><span class="pln">UI</span><span class="pun">.</span><span class="typ">MasterPage</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />        </span></span><span><span class="kwd">protected</span></span><span><span class="pln"> </span></span><span><span class="kwd">void</span></span><span><span class="pln"> Page_Load</span><span class="pun">(</span></span><span><span class="kwd">object</span></span><span><span class="pln"> sender</span><span class="pun">,</span><span class="pln"> </span><span class="typ">EventArgs</span><span class="pln"> e</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></span></div>
</div>
<p>You should now be able to switch between both files by pressing F7 in Visual Studio. Let’s try to add a Property and reference that from the template:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:145b4492-011f-40ea-800f-d14449f9c0d9" class="wlWriterEditableSmartContent">
<div><span><span class="pln">        </span></span><span><span class="kwd">public</span></span><span><span class="pln"> </span></span><span><span class="kwd">string</span></span><span><span class="pln"> </span><span class="typ">Message</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span></span><span><span class="kwd">get</span></span><span><span class="pun">;</span><span class="pln"> </span></span><span><span class="kwd">set</span></span><span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"><br /><br />        </span></span><span><span class="kwd">protected</span></span><span><span class="pln"> </span></span><span><span class="kwd">void</span></span><span><span class="pln"> Page_Load</span><span class="pun">(</span></span><span><span class="kwd">object</span></span><span><span class="pln"> sender</span><span class="pun">,</span><span class="pln"> </span><span class="typ">EventArgs</span><span class="pln"> e</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="typ">Message</span><span class="pln"> </span></span><span><span class="pun">=</span></span><span><span class="pln"> </span></span><span><span class="str">"</span></span><span><span class="str">All the best from your code-behind file!! :)</span></span><span><span class="str">"</span></span><span><span class="pun">;</span><span class="pln"><br />        </span><span class="pun">}</span></span></div>
</div>
<p>and something like this on the template:</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:c70b7ac6-b7f3-48d9-b7d8-5d5cda84ab99" class="wlWriterEditableSmartContent">
<div><span><span class="pln">    </span><span class="pun">&lt;</span></span><span><span class="tag">div</span></span><span><span class="pun">&gt;</span><span class="pln"><br />        </span><span class="pun">&lt;%=</span><span class="pln"> </span><span class="typ">Message</span><span class="pln"> %&gt;<br />    </span><span class="pun">&lt;/</span></span><span><span class="tag">div</span></span><span><span class="pun">&gt;</span></span></div>
</div>
<p>Now we just need to compile the project and navigate to a content page that uses the Root template to see the message.</p>
<p> </p>
<h3>Adding designer files</h3>
<p>[As Simon Dingley pointed out below there is an even easier way to create the designer files: right-click on the master.aspx page and select "Convert to web application", which will create the .designer file for the selected item.]</p>
<p>We can also add a designer file to the duo to make things even better. After adding Root.master.designer.cs, Page1.master.designer.cs and Page2.master.designer.cs the solution looks like this:</p>
<p><a href="/images/picture-49-22.png"><img src="/images/picture-49-22-thumb.png" border="0" alt="1-28-2011 5-49-22 PM" title="1-28-2011 5-49-22 PM" width="238" height="187" /></a></p>
<p>Visual Studio is now rightfully complaining that it got duplicate definitions for the classes and even suggests to add the partial keyword, which we will quickly do. After that is all working and compiling nicely we need to give Visual Studio control over the designer files. That is easily accomplished by slightly modifying each .master file (e.g. by adding a single space to an empty line) and saving it, VS will do the rest for you. The most important thing this will do for you is to reference all controls you add to the template so they are available for use in the code-behind file.</p>
<p>Now let’s try to modify the message value from the code-behind of Page1 by adding</p>
<div id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:63c8b174-c1eb-4519-94b9-ea292fac35ee" class="wlWriterEditableSmartContent">
<div><span><span class="kwd">protected</span></span><span><span class="pln"> </span></span><span><span class="kwd">void</span></span><span><span class="pln"> Page_Load</span><span class="pun">(</span></span><span><span class="kwd">object</span></span><span><span class="pln"> sender</span><span class="pun">,</span><span class="pln"> </span><span class="typ">EventArgs</span><span class="pln"> e</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="pun">((</span><span class="typ">Root</span><span class="pun">)</span><span class="pln"> </span><span class="typ">Master</span><span class="pun">).</span><span class="typ">Message</span><span class="pln"> </span></span><span><span class="pun">=</span></span><span><span class="pln"> </span></span><span><span class="str">"</span></span><span><span class="str">Hello from the nested master page!</span></span><span><span class="str">"</span></span><span><span class="pun">;</span><span class="pln"><br />        </span><span class="pun">}</span></span></div>
</div>
<p>to it. Browsing to any Umbraco page that uses the Page1 template will now show the new message.</p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco 4.1 Benchmarks Part 1 (Do Over)</title>
                <link>https://farmcode.org/articles/umbraco-41-benchmarks-part-1-do-over/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:20:25 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-41-benchmarks-part-1-do-over/</guid>
                <description><![CDATA[Umbraco 4.1 Benchmarks Part 1 (Do Over)]]></description>
                <content:encoded><![CDATA[<p>Doh! Turns out that my first<span> </span> Umbraco 4.1 benchmarks <span> </span>was done on a build of 4.1 that had a couple of bugs in it :( BUT, this turns out to be even better for 4.1 that I previously thought! (plus there’s bugs fixed now :) If you didn’t read the last post, i recommend that you do as it has some insight as to how these stats came to be.</p>
<p>So, without further adieu, here’s the (true) new results:</p>
<table border="0" cellspacing="0" cellpadding="2" width="623" class="stats">
<tbody>
<tr>
<th class="first" width="110" valign="top">Test</th>
<th width="168" valign="top">Stats</th>
<th width="68" valign="top">4.0.3</th>
<th width="107" valign="top">4.0.3<span> </span><br />client cached</th>
<th width="69" valign="top">4.1</th>
<th width="99" valign="top">4.1<span> </span><br />client cached</th>
</tr>
<tr class="one">
<td class="first" rowspan="2" width="110" valign="top"><strong>Content app</strong></td>
<td width="168" valign="top">Completed Requests</td>
<td width="68" valign="top">68</td>
<td width="107" valign="top">7</td>
<td width="69" valign="top">45</td>
<td width="99" valign="top">5</td>
</tr>
<tr class="one">
<td width="168" valign="top">Response (KB)</td>
<td width="68" valign="top">687.05</td>
<td width="107" valign="top">72.48</td>
<td width="69" valign="top">382.42</td>
<td width="99" valign="top">11.61</td>
</tr>
<tr class="two">
<td class="first" rowspan="2" width="110" valign="top"><strong>Edit content<span> </span><br />home page</strong></td>
<td width="168" valign="top">Completed Requests</td>
<td width="68" valign="top">50</td>
<td width="107" valign="top">2</td>
<td width="69" valign="top">34</td>
<td width="99" valign="top">1</td>
</tr>
<tr class="two">
<td width="168" valign="top">Response (KB)</td>
<td width="68" valign="top">385.10</td>
<td width="107" valign="top">47.28</td>
<td width="69" valign="top">335.02</td>
<td width="99" valign="top">11.94</td>
</tr>
<tr class="three">
<td class="first" rowspan="2" width="110" valign="top"><strong>Expand all<span> </span><br />content nodes</strong></td>
<td width="168" valign="top">Completed Requests</td>
<td width="68" valign="top">17</td>
<td width="107" valign="top">17</td>
<td width="69" valign="top">16</td>
<td width="99" valign="top">16</td>
</tr>
<tr class="three">
<td width="168" valign="top">Response (KB)</td>
<td width="68" valign="top">18.47</td>
<td width="107" valign="top">18.47</td>
<td width="69" valign="top">13.96</td>
<td width="99" valign="top">7.54</td>
</tr>
<tr class="four">
<td class="first bottom" rowspan="2" width="110" valign="top"><strong>TOTALS</strong></td>
<td width="168" valign="top">Completed Requests</td>
<td width="68" valign="top">135</td>
<td width="107" valign="top">26</td>
<td width="69" valign="top">95</td>
<td width="99" valign="top">22</td>
</tr>
<tr class="bottom four">
<td width="168" valign="top">Response (KB)</td>
<td width="68" valign="top">1063.62</td>
<td width="107" valign="top">138.23</td>
<td width="69" valign="top">731.40</td>
<td width="99" valign="top">31.09</td>
</tr>
</tbody>
</table>
<p>So to recap, here’s the total average savings in 4.1</p>
<ul>
<li>Without client cache (First run)</li>
<ul>
<li>Number of completed requests:<span> </span><strong>30% Less</strong></li>
<li>Response bandwidth:<span> </span><strong>31% Less</strong></li>
</ul>
<li>With client cache</li>
<ul>
<li>Number of completed requests:<span> </span><strong>6% Less</strong></li>
<li>Response bandwidth:<span> </span><strong>78% Less</strong></li>
</ul>
</ul>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco 4.1 Benchmarks Part 2 (Back Office Database Queries)</title>
                <link>https://farmcode.org/articles/umbraco-41-benchmarks-part-2-back-office-database-queries/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-41-benchmarks-part-2-back-office-database-queries/</guid>
                <description><![CDATA[Umbraco 4.1 Benchmarks Part 2 (Back Office Database Queries)]]></description>
                <content:encoded><![CDATA[<p>This is part 2 in a series of Umbraco 4.1 benchmarks created by various members of the core team in the lead up to launch. See<span> </span><a href="/articles/umbraco-41-benchmarks-part-1-do-over/">Part 1 here</a><span> </span>on request/response peformance in the Umbraco back office.</p>
<p>This benchmark report looks at the data layer improvements in 4.1 by comparing query counts in 4.1 to 4.0.3. Not only has the data layer improved but there's been significant improvements in the consumption of the data layer API made by many of the 4.1 pages and controls.</p>
<p>The stats below are represented as a percentage of the total calls of 4.0.3 where the number of queries in 4.0.3 are 100% and the number of queries in 4.1 are a percentage in relation to this. These results are based on the procedures listed at the bottom of this post and on averages run over 3 separate trials.</p>
<table border="0" cellspacing="0" cellpadding="2" width="470" class="stats">
<tbody>
<tr class="one">
<th class="first" width="326" valign="top">Step</th>
<th width="72" valign="top">4.0.3</th>
<th width="70" valign="top">4.1.0</th>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Login</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">68%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Expand all Content nodes</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">23%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Edit Home node</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">49%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Publishing Home node</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">55%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Edit About Umbraco node</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">49%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Go to Settings App</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">100%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Expand Document types tree</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">100%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Edit Home document type</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">61%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Save Home document type</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">67%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Go to Media app</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">50%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Create new folder labeled â€˜Test'</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">88%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Create new image under new â€˜Test' folder labeled â€˜test1'</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">64%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Upload new image file to â€˜test1' and save the node</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">49%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Go to Content app (and in the case of 4.0.3, expand the tree and select the About Umbraco node since in 4.1 this will already be selected and loaded)</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">41%</td>
</tr>
<tr class="one">
<td class="first" width="326" valign="top">Edit Home node</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">43%</td>
</tr>
<tr class="two">
<td class="first" width="326" valign="top">Add â€˜test1' image to the â€˜Text' WYSIWYG property with the image picker and Publish node</td>
<td class="first" width="72" valign="top">100%</td>
<td width="70" valign="top">49%</td>
</tr>
<tr class="four">
<td class="first" width="326" valign="top">Average of averages above</td>
<td width="72" valign="top"> </td>
<td width="70" valign="top">60%</td>
</tr>
<tr class="four bottom">
<td class="first" width="326" valign="top">Complete run through of the above steps</td>
<td width="72" valign="top">100%</td>
<td width="70" valign="top">66%</td>
</tr>
</tbody>
</table>
<p><br />So based on averages, Umbraco 4.1 is looking to have around<span> </span><strong>40% less</strong><span> </span>queries made than 4.0.3!!! Thats HUGE!</p>
<p>The following steps were taken on each trial of the above steps:</p>
<ul>
<li>New instances of both 4.0.3 and 4.1</li>
<li>Install CWS package on both instances</li>
<li>Log out of both instances</li>
<li>Bump web.config for both instances (clear out all data cache)</li>
<li>Use SQL Profiler to determine query counts for each step listed above</li>
</ul>
<p>Also, SQL debugging has been added to 4.1 for MS SQL instances. If you compile the source in Debug mode you can get the SQL command output by adding a trace listener to your web.config. Underneath the configuration node you can add this xml block:</p>
<pre class="prettyprint"><span class="pun">&lt;</span><span class="tag">system</span><span class="pln">.</span><span class="atn">diagnostics</span><span class="pun">&gt;</span><span class="pln"><br />        </span><span class="pun">&lt;</span><span class="tag">trace</span><span class="pln"> </span><span class="atn">autoflush</span><span class="pun">=</span><span class="atv">"true"</span><span class="pun">&gt;</span><span class="pln"><br />          </span><span class="pun">&lt;</span><span class="tag">listeners</span><span class="pun">&gt;</span><span class="pln"><br />                </span><span class="pun">&lt;</span><span class="tag">add</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"SqlListener"</span><span class="pln"> <br />                        </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"System.Diagnostics.TextWriterTraceListener"</span><span class="pln"> <br />                        </span><span class="atn">initializeData</span><span class="pun">=</span><span class="atv">"trace.log"</span><span class="pln"> </span><span class="pun">/&gt;</span><span class="pln"><br />          </span><span class="pun">&lt;/</span><span class="tag">listeners</span><span class="pun">&gt;</span><span class="pln"><br />        </span><span class="pun">&lt;/</span><span class="tag">trace</span><span class="pun">&gt;</span><span class="pln"><br /></span><span class="pun">&lt;/</span><span class="tag">system</span><span class="pln">.</span><span class="atn">diagnostics</span><span class="pun">&gt;</span></pre>
<p>This will create a trace.log file in the root of your web app SQL debugging.</p>]]></content:encoded>
            </item>
            <item>
                <title>Regionalizing validation mesages and regex in Umbraco Contour | How To |</title>
                <link>https://farmcode.org/articles/regionalizing-validation-mesages-and-regex-in-umbraco-contour/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/regionalizing-validation-mesages-and-regex-in-umbraco-contour/</guid>
                <description><![CDATA[Umbraco Contour is a great package, but a common challenge is how do you regionalise fields and labels such as phone numbers with appropriate validation messages? Find out how here!]]></description>
                <content:encoded><![CDATA[<p>Umbraco Contour is a great package for ultra fast building of forms. What we used it for was not entirely what it was meant for.</p>
<p>We were asked to build a form where labels, validation messages AND the regular expressions to validate phone numbers were all regionalized. Contour uses Umbraco's dictionary to store regionalized labels, so we decided to store our validation messages and regex there. Here is how we did it all...</p>
<p>Firstly, we name our field's in the form #Form_FirstName, #Form_LastName etc. In the dictionary, add your languages. Then create items with the same names as the form fields (without the #). This allows Contour to replace your labels. We create two matching items to handle regionalized values for validation messages and regex: #Form_FirstName_vmsg, and #Form_FirstName_regex respectively.</p>
<p>Contour installs RenderForm.ascx under \usercontrols\umbracoContour\ in your project. Noticing this, you can easily change it's CodeBehind property to your own "RenderForm.ascx.cs" which you inherit from Contour's. Overriding OnPreRender() is where the magic happens. The code is pretty self explanatory. We override OnPreRender(), loop through the fields, use their caption property and a suffix ("_vmsg" or "_regex") to get the values from the dictionary.</p>
<p>Here is the code...</p>
<pre>public class RenderForm : Umbraco.Forms.UI.Usercontrols.RenderForm
{
protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            // get the form fields
            FormStorage fs = new FormStorage();
            var form = fs.GetForm(new Guid(this.FormGuid));
            var fields = form.AllFields;

            foreach (var f in fields)
            {
                // get this field's validator
                var fieldId = f.Id.ToString();
                var vals = Page.Validators
                            .Cast()
                            .Where(x =&gt; x.ControlToValidate == fieldId).ToList();
                if (vals.Count &gt; 0)
                {
                    foreach (var baseVal in vals)
                    {
  // get the validator type and assign properties
                        BaseValidator val = baseVal as RegularExpressionValidator;
                        if (val != null) // it is RegularExpressionValidator
                        {
                            // get regionalized regular expression
                            string valExpression = GetRegionalizedValidationText(f.Caption, "_regex");
                            ((RegularExpressionValidator)val).ValidationExpression = !string.IsNullOrEmpty(valExpression) ? valExpression : ((RegularExpressionValidator)val).ValidationExpression;
                        }
                        else // either a RequiredFieldValidator or another type which you must handle here!
                        {
                            // cast to another Validator type you are expecting, then set it's properties
                        }
 
   // Get the error message
val = baseVal as BaseValidator;
                        if (val != null)
                        {
                            // get regionalized error message
                            string errorMessage = GetRegionalizedValidationText(f.Caption, "_vmsg"); 
                            val.ErrorMessage = !string.IsNullOrEmpty(errorMessage) ? errorMessage : val.ErrorMessage;
                        } 
                        val.ValidationGroup = form.Name;
                    }
                }
            }          
        } 
 
 
  // Uses's the given string and suffix to get a value from the Umbraco dictionary.
        public string GetRegionalizedValidationText(string key, string type)
        {
            if (key.Contains("#"))
            {
                string itemName = key.Split('#')[1] + type;

                if (umbraco.library.GetDictionaryItem(itemName) != null) // note: item can exist and be ""
                    return umbraco.library.GetDictionaryItem(itemName);
            }
            return ""; // key does not contain #, or not found in dictionary
        } 
 } </pre>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco 4.1 Database Structure</title>
                <link>https://farmcode.org/articles/umbraco-41-database-structure/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-41-database-structure/</guid>
                <description><![CDATA[Have you ever wondered about the structure of Umbraco 4.1's database? Here is a complete Umbraco database diagram complete with database constraints, indexes and keys.]]></description>
                <content:encoded><![CDATA[<p>We’re finally shipping Umbraco 4.1 with all of the real database constraints, indexes and keys that it so much deserves! This issue was reported on over 3 years ago (<a href="http://umbraco.codeplex.com/workitem/8162">http://umbraco.codeplex.com/workitem/8162</a>) and it’s now a reality! So without further adieu, here’s the complete database diagram. If you stare at it long enough you might notice some constraints missing which may be true, but this is by design (I assure you :). I’ve attempted to compact the diagram to as small as possible but no matter which way you cut it, it’s a bit crazy. Enjoy! (click the image to see the full size)</p>]]></content:encoded>
            </item>
            <item>
                <title>Examine slide deck for CodeGarden 2010</title>
                <link>https://farmcode.org/articles/examine-slide-deck-for-codegarden-2010/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/examine-slide-deck-for-codegarden-2010/</guid>
                <description><![CDATA[Examine slide deck for CodeGarden 2010]]></description>
                <content:encoded><![CDATA[<p>A few people had asked during<span> </span><a rel="noopener noreferrer" href="http://www.codegarden10.com/" target="_blank">CodeGarden 2010</a><span> </span>if I would post up the slide deck for my<span> </span><a rel="noopener noreferrer" href="#http://farmcode.org/page/Umbraco-Examine" target="_blank">Examine</a> presentation, so here it is. There’s not a heap of information in there since i think people would have soaked up most of the info during the examples and coding demos but it’s posted here regardless and hopefully it helps a few people.</p>
<p>I’ve included a PDF version (link at the bottom) and also the image version below (if you’re too lazy to download it :)</p>]]></content:encoded>
            </item>
            <item>
                <title>Examine demo site source code from Codegarden 2010</title>
                <link>https://farmcode.org/articles/examine-demo-site-source-code-from-codegarden-2010/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/examine-demo-site-source-code-from-codegarden-2010/</guid>
                <description><![CDATA[Examine demo site source code from Codegarden 2010]]></description>
                <content:encoded><![CDATA[<p>A few people were asking for the source code from my Examine presentation at CodeGarden, so here it is. I’m not going to go in to all of the details of this site or the Examine config as it’s pretty simple. However, i will give you a very quick run down of it and if you attended CodeGarden and my presentation, you’d probably already know this.</p>
<p>The Umbraco config for this demo site is simple: A search form, a couple of search result pages with different templates (results using XSLT extensions, results to query media using the FluentAPI, custom results using the FluentAPI). Then there’s the content: 5 very simple nodes consisting of a text field and a numeric field and a miniature blog with some posts and comments.</p>
<p>I’ve included all of the source files and a backup of the database that it was running on. The source files are left in the same state as we left the demo during the presentation. So to get it up and running, just restore the database to your MS SQL server, update your web.config, and put the project files into IIS (or open the solution in Visual Studio).</p>
<p>Download<span> </span><u><a rel="noopener noreferrer" href="/media/sourcecode/examinedemosite/DemoSite.zip" target="_blank" title="Examine demo site source code"><strong>here</strong></a></u></p>]]></content:encoded>
            </item>
            <item>
                <title>jQuery popup bubble extension</title>
                <link>https://farmcode.org/articles/jquery-popup-bubble-extension/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/jquery-popup-bubble-extension/</guid>
                <description><![CDATA[jQuery popup bubble extension]]></description>
                <content:encoded><![CDATA[<div class="text">
<p>UPDATED (2009-05-25)!</p>
<p>Here's a quick and extensible framework to enable popup windows, popup bubbles, or popup anything. Currently the framework doesn't create extra DOM elements or style anything differently. It relies on the developer to create the DOM element that will be the popup bubble (or whatever). This extension give you the flexibility to bind any number of events to show or hide the bubble. It also supports having the bubble hide on a timer and comes with a complete event model allowing you to intercept the hide and show bubble events (and cancel them if needed) and fire your own methods upon completion.</p>
<p>I've included a full demo html page to demonstrate some different implementations.</p>
<ul>
<li>Here's the code:<span> </span><a href="/media/sourcecode/AlertBubble/AlertBubble.zip">AlertBubble.zip (20.74 kb)</a></li>
<li>Here's a<span> </span><a rel="noopener noreferrer" href="/media/sourcecode/jquerypopupbubble/AlertBubble.htm" target="_blank">demo</a></li>
</ul>
<p>Here's an example of the usage:</p>
<pre class="prettyprint"><span class="pln">$</span><span class="pun">(</span><span class="str">".bubble"</span><span class="pun">).</span><span class="typ">AlertBubble</span><span class="pun">(</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        fadeTime</span><span class="pun">:</span><span class="pln"> </span><span class="lit">500</span><span class="pun">,</span><span class="pln"><br />        hideEvent</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln">selector</span><span class="pun">:</span><span class="pln"> $</span><span class="pun">(</span><span class="str">"#hideButton"</span><span class="pun">),</span><span class="pln"> </span><span class="kwd">event</span><span class="pun">:</span><span class="pln"> </span><span class="str">"click"</span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">],</span><span class="pln"><br />        showEvent</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln">selector</span><span class="pun">:</span><span class="pln"> $</span><span class="pun">(</span><span class="str">"#showButton"</span><span class="pun">),</span><span class="pln"> </span><span class="kwd">event</span><span class="pun">:</span><span class="pln"> </span><span class="str">"click"</span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">],</span><span class="pln"><br />        showOnStart</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"><br />        text</span><span class="pun">:</span><span class="pln"> </span><span class="str">"I am a bubble"</span><span class="pun">,</span><span class="pln"><br />        hideTimer</span><span class="pun">:</span><span class="lit">2000</span><span class="pln"><br /></span><span class="pun">});</span></pre>
The above code turns the elements with the class of .bubble into an AlertBubble. The parameters passed in are the parameters that are supported by this class:<span> </span><br />
<ul>
<li>fadeTime: the milliseconds to fade in/out. Default = 200 </li>
<li>text: the text to show in the html element. If set to false (by default) it will use the markup that currently exists in the element.</li>
<li>hideEvent/showEvent
<ul>
<li>Allows you to add/remove as many event handlers to show or hide the alert bubble</li>
</ul>
</li>
<li>showOnStart: if the bubble should show on page load or only when showOnStart exists</li>
<li>hideTimer: If set, then the bubble will hide after the set number of milliseconds after shown. Default is false.</li>
<li>onBeforeShowCallback: a function to call before the bubble is shown. If a callback is specified, it must return true for the code to proceed to show the bubble.</li>
<li>onBeforeHideCallback: a function to call before the bubble is hidden. If a callback is specified, it must return true for the code to proceed to hide the bubble.</li>
<li>onAfterShowCallback: a function to call after the bubble is shown.</li>
<li>onAfterHideCallback: a function to call after the bubble is hidden.</li>
</ul>
<p>The extension also has a simple API that can be accessed to show/hide the bubble on demand as well as using events. This is done by storing the API object for the popup bubble extension in the jQuery data object for the popup bubble selector.</p>
<p>API methods:</p>
<ul>
<li>showBubble()</li>
<li>hideBubble()</li>
</ul>
<p>To access the API, you can retrieve it from the jQuery data object with the key "AlertBubble":</p>
<pre class="prettyprint"><span class="kwd">var</span><span class="pln"> api </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">(</span><span class="str">".myselector"</span><span class="pun">).</span><span class="pln">data</span><span class="pun">(</span><span class="str">"AlertBubble"</span><span class="pun">);</span><span class="pln"> </span></pre>
<p>Example:</p>
<pre class="prettyprint"><span class="pln">$</span><span class="pun">(</span><span class="str">".bubble"</span><span class="pun">).</span><span class="pln">each</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">var</span><span class="pln"> api </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">data</span><span class="pun">(</span><span class="str">"AlertBubble"</span><span class="pun">);</span><span class="pln"><br />        </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">api </span><span class="pun">!=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br />                api</span><span class="pun">.</span><span class="pln">hideBubble</span><span class="pun">();</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">});</span></pre>
</div>
<div class="bottom">
<div class="ratingcontainer"></div>
</div>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco TinyMCE Customization for Flash Rich Text</title>
                <link>https://farmcode.org/articles/umbraco-tinymce-customization-for-flash-rich-text/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-tinymce-customization-for-flash-rich-text/</guid>
                <description><![CDATA[Umbraco TinyMCE Customization for Flash Rich Text]]></description>
                <content:encoded><![CDATA[<p>Flash doesn’t support most of the html elements of a standard web page. TinyMCE’s creators Moxiecode have thankfully given us the TinyMCE rules for flash here:</p>
<p><a href="http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements#Full_FlashMX_2004_rule_set:" title="http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements#Full_FlashMX_2004_rule_set:">http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements#Full_FlashMX_2004_rule_set:</a></p>
<p>So to get Umbraco &amp; TinyMCE working to give your flash application the markup that it needs you need to modify your<span> </span><em>\config\tinyMceConfig.config</em><span> </span>file:</p>
<pre>&lt;validElements&gt;
    &lt;![CDATA[+a[href|target],
+b,
+br,
+font[color|face|size],
+img[src|id|width|height|align|hspace|vspace],
+i,
+li,
+p[align|class],
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+span[class],
+textformat[blockindent|indent|leading|leftmargin|rightmargin|tabstops],
+u
]]&gt;
&lt;/validElements&gt;</pre>
<p>Then there’s the issue that flash treats real line breaks and &lt;br/&gt; tags exactly the same! This will probably cause you a few headaches trying to work that out. So to save you that headache, you need to output the rich text markup via XSLT to flash using the XSLT function:<span> </span><em><strong>normalize-space</strong></em></p>
<p>Something like:</p>
<pre>&lt;xsl:value-of select="normalize-space($myRichTextValue)" /&gt;</pre>
<div class="bottom"></div>]]></content:encoded>
            </item>
            <item>
                <title>Sodality Simple Tutorial in Flash Builder (formerly Flex)</title>
                <link>https://farmcode.org/articles/sodality-simple-tutorial-in-flash-builder-formerly-flex/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:46:46 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/sodality-simple-tutorial-in-flash-builder-formerly-flex/</guid>
                <description><![CDATA[Sodality Simple Tutorial in Flash Builder (formerly Flex)]]></description>
                <content:encoded><![CDATA[<p>This tutorial goes through the building of a simple demo app with Sodality. If it’s moving too slow for you I’d recommend downloading the source and only going through the checkpoint steps of the tutorial (3, 5 &amp; 7).</p>
<ol>
<li><a href="#1">Project Setup</a></li>
<li><a href="#2">Basic Sodality interactions</a></li>
<li><a href="#3">Checkpoint 1</a></li>
<li><a href="#4">Inserting Asychronous behaviour</a></li>
<li><a href="#5">Checkpoint 2</a></li>
<li><a href="#6">Intercepting before and after</a></li>
<li><a href="#7">Checkpoint 3</a></li>
<li><a href="/media/sourcecode/sodality/SodalitySimpleDemo.zip">Download Source</a></li>
</ol>
<h2><a name="1" title="1"></a>1. Project Setup</h2>
<ul>
<li>In Flash Builder, set up a new ActionScript project (i.e. NOT a Flex Project) named “SodalitySimpleDemo’.</li>
<li>Download the<span> </span><a href="/media/sourcecode/sodality/SodalitySimpleDemo.zip">Sodality SWC</a><span> </span>and add it to your project, making sure you add it to your source (Project Properties &gt; ActionScript Build Path &gt; Library path &gt; Add SWC).</li>
<li>Open the Compiler Settings (Project Properties &gt; ActionScript Compiler) and uncheck “Copy non-embedded”, uncheck “Generate HTML Wrapper”, this is not required by the framework but will help keep things clean.</li>
<li>Add the compiler argument “-keep-as3-metadata+=Advice,Trigger,Property’ to the “Additional Compiler Arguments’ field (still in the Compiler Settings area). This tells Flash Builder to keep the metatags we use to make sodality work.</li>
</ul>
<h2><a name="2" title="2"></a>2. Basic Sodality interactions</h2>
<p>First we must add a President to the project, the president executes the core logic of Sodality.</p>
<p>Within the SodalitySimpleDemo class (which flash builder created in the default package), add this private variable:</p>
<pre class="prettyprint"><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> president</span><span class="pun">:</span><span class="typ">President</span><span class="pun">;</span></pre>
<p>Add this to the SodalitySimpleDemo constructor to instantiate the president:</p>
<pre class="prettyprint"><span class="pln">president </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">President</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">);</span></pre>
<p>Passing through the root object to the president tells it how much of the display hierarchy should be managed by this president (i.e. in this case the whole hierarchy).</p>
<p>Now we must create an Advice class, this class represents a certain action that is taking place within your application. For simplicity’s sake we will create an Advice class representing a mouse click and we’ll create it in the default package. The MouseClickAdvice class will contain a message which will be displayed later:</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br /><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">Advice</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Advice</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="pln">message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">=</span><span class="kwd">null</span><span class="pun">){</span><span class="pln"><br />                        </span><span class="kwd">super</span><span class="pun">();</span><span class="pln"><br />                        </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">message </span><span class="pun">=</span><span class="pln"> message</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Consider this Advice class similar to an event, we’ll use it to run other code when something gets clicked on. You’ll notice the message property is annotated with the “Property’ metatag, this forces the value to be copied over when the MouseClickAdvice is cloned in the dispatching process, generally all public properties of Advice classes should be annotated in this way. You’ll also note that the constructor arguments must always be optional in Advice subclasses, this is again to allow the cloning behaviour that Advice undergoes.</p>
<p>Next, we’ll add a button to the SodalitySimpleDemo class which we'll use to dispatch our advice, add this to the constructor:</p>
<pre class="prettyprint"><span class="kwd">var</span><span class="pln"> button</span><span class="pun">:</span><span class="typ">Sprite</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pun">();</span><span class="pln"><br />button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">beginFill</span><span class="pun">(</span><span class="lit">0xff0000</span><span class="pun">);</span><span class="pln"><br />button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">drawRect</span><span class="pun">(</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">);</span><span class="pln"><br />button</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">CLICK</span><span class="pun">,</span><span class="pln"> onMouseClick</span><span class="pun">);</span><span class="pln"><br />button</span><span class="pun">.</span><span class="pln">buttonMode </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"><br />addChild</span><span class="pun">(</span><span class="pln">button</span><span class="pun">);</span></pre>
<p>And then we’ll add the event handler which will dispatch the MouseClickAdvice:</p>
<pre class="prettyprint"><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">MouseEvent</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />        dispatchEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="str">"Button Clicked"</span><span class="pun">));</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Now the MouseClickAdvice is being dispatched but nothing is listening for it. Before we do that we'll add a text field to the SodalitySimpleDemo class that we can display the message in. Add this private property to the class:</p>
<pre class="prettyprint"><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> resultField</span><span class="pun">:</span><span class="typ">TextField</span><span class="pun">;</span></pre>
<p>And add this to the constructor:</p>
<pre class="prettyprint"><span class="pln">resultField </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TextField</span><span class="pun">();</span><span class="pln"><br />addChild</span><span class="pun">(</span><span class="pln">resultField</span><span class="pun">);</span></pre>
<p>Now we'll add a function to the SodalitySimpleDemo class which will catch the advice (using the Sodality 'Trigger' Metadata), note that the method must be public for the President to find it:</p>
<pre class="prettyprint"><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"after"</span><span class="pun">)]</span><span class="pln"><br /></span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> afterMouseClick</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">MouseClickAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />        resultField</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> cause</span><span class="pun">.</span><span class="pln">message</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>This is all fine except that Sodality won’t trigger functions within classes unless they’re tagged with the interface IAdvisor (this only works for DisplayObjects, more on that in<span> </span><a href="#4">Step 4</a>).</p>
<p>So change the SodalitySimpleDemo class definition line to:</p>
<pre class="prettyprint"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">IAdvisor</span></pre>
<p><a href="#top">Back to top</a></p>
<h2><a name="3" title="3"></a>3. Checkpoint 1</h2>
<p>At this point your project should run happily and when you click on the red square, the text “Button Clicked’ should appear in the corner of the SWF.</p>
<p>Your classes should look like this:</p>
<h3>SodalitySimpleDemo.as</h3>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">Sprite</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">MouseEvent</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">text</span><span class="pun">.</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advisors</span><span class="pun">.</span><span class="typ">IAdvisor</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">IAdvisor</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> president</span><span class="pun">:</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> resultField</span><span class="pun">:</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pun">()</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln"><br />                        president </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">President</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">);</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> button</span><span class="pun">:</span><span class="typ">Sprite</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pun">();</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">beginFill</span><span class="pun">(</span><span class="lit">0xff0000</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">drawRect</span><span class="pun">(</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">CLICK</span><span class="pun">,</span><span class="pln"> onMouseClick</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">buttonMode </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">button</span><span class="pun">);</span><span class="pln"><br />                        <br />                        resultField </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TextField</span><span class="pun">();</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">resultField</span><span class="pun">);</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">MouseEvent</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        dispatchEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="str">"Button Clicked"</span><span class="pun">));</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"after"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> afterMouseClick</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">MouseClickAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        resultField</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> cause</span><span class="pun">.</span><span class="pln">message</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<h3>MouseClickAdvice.as</h3>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">DisplayObject</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">Advice</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Advice</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="pln">message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">=</span><span class="kwd">null</span><span class="pun">){</span><span class="pln"><br />                        </span><span class="kwd">super</span><span class="pun">();</span><span class="pln"><br />                        </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">message </span><span class="pun">=</span><span class="pln"> message</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p><a href="#5">Skip to Checkpoint 2</a></p>
<p><a href="#top">Back to top</a></p>
<h2><a name="4" title="4"></a>4. Inserting Asychronous behaviour</h2>
<p>You’ll be thinking to yourselves that this is just a convoluted event management system at this point, so now we’ll load a file in between when the button is clicked and when the handling function gets called (something that would be impossible with events).</p>
<p>We’ll change the demo so that when the red button is clicked another (non-visual) class loads a file before the “afterMouseClick’ handler function gets called.</p>
<p>First we'll create the file to load in, simply create a text file called 'file.txt' in the 'bin-debug' folder containing the words "File Loaded".</p>
<p>Now we’ll need to create a new interface representing an action (Advice) that needs to load a file. This represents all of the interactions that our file loading Advisor (which we’re about to build) will need from the advice:</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">IAdvice</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">interface</span><span class="pln"> </span><span class="typ">ILoadFileAdvice</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">IAdvice</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">get</span><span class="pln"> fileURL</span><span class="pun">():</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">set</span><span class="pln"> message</span><span class="pun">(</span><span class="pln">value</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">;</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Then we'll modify MouseClickAdvice to implement the new interface (and modify the constructor arguments to take a url):</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">Advice</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Advice</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">ILoadFileAdvice</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="pln">fileURL</span><span class="pun">:</span><span class="typ">String</span><span class="pun">=</span><span class="kwd">null</span><span class="pun">){</span><span class="pln"><br />                        </span><span class="kwd">super</span><span class="pun">();</span><span class="pln"><br />                        </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">fileURL </span><span class="pun">=</span><span class="pln"> fileURL</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> _message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> _fileURL</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">get</span><span class="pln"> fileURL</span><span class="pun">():</span><span class="typ">String</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">return</span><span class="pln"> _fileURL<br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">set</span><span class="pln"> fileURL</span><span class="pun">(</span><span class="pln">value</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        _fileURL </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">get</span><span class="pln"> message</span><span class="pun">():</span><span class="typ">String</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">return</span><span class="pln"> _message<br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">set</span><span class="pln"> message</span><span class="pun">(</span><span class="pln">value</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        _message </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Then we’ll need to create our new Advisor, whose responsibility it is to load a file whenever an action requires it:</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">Event</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">net</span><span class="pun">.</span><span class="typ">URLLoader</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">net</span><span class="pun">.</span><span class="typ">URLRequest</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">AsyncMethodAdvice</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advisors</span><span class="pun">.</span><span class="typ">DynamicAdvisor</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">FileLoaderAdvisor</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">DynamicAdvisor</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> lastCause</span><span class="pun">:</span><span class="typ">ILoadFileAdvice</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> lastAdvice</span><span class="pun">:</span><span class="typ">AsyncMethodAdvice</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"before"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> beforeFileLoad</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">ILoadFileAdvice</span><span class="pun">,</span><span class="pln"><br />                                        advice</span><span class="pun">:</span><span class="typ">AsyncMethodAdvice</span><span class="pun">,</span><span class="pln"> time</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        lastCause </span><span class="pun">=</span><span class="pln"> cause</span><span class="pun">;</span><span class="pln"><br />                        lastAdvice </span><span class="pun">=</span><span class="pln"> advice</span><span class="pun">;</span><span class="pln"><br />                        </span><span class="kwd">var</span><span class="pln"> loader</span><span class="pun">:</span><span class="typ">URLLoader</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">URLLoader</span><span class="pun">();</span><span class="pln"><br />                        loader</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">Event</span><span class="pun">.</span><span class="pln">COMPLETE</span><span class="pun">,</span><span class="pln"> onLoadComplete</span><span class="pun">);</span><span class="pln"><br />                        loader</span><span class="pun">.</span><span class="pln">load</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">URLRequest</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">.</span><span class="pln">fileURL</span><span class="pun">));</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onLoadComplete</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">Event</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        lastCause</span><span class="pun">.</span><span class="pln">message </span><span class="pun">=</span><span class="pln"> </span><span class="pun">((</span><span class="pln">e</span><span class="pun">.</span><span class="pln">target </span><span class="kwd">as</span><span class="pln"> </span><span class="typ">URLLoader</span><span class="pun">).</span><span class="pln">data </span><span class="kwd">as</span><span class="pln"> </span><span class="typ">String</span><span class="pun">);</span><span class="pln"><br />                        lastAdvice</span><span class="pun">.</span><span class="pln">adviceContinue</span><span class="pun">();</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Much of this should be familiar, the class loads in a file and gets it's content. Have a look at the beforeFileLoad function’s parameters though, it is noteworthy that this class never references the MouseClickAdvice class, meaning that any other Advice class that implements ILoadFileAdvice will now be picked up by this class and load a file. Also of note is that the second parameter of the beforeFileLoad function is an AsyncMethodAdvice instance, this tells Sodality to wait until the “adviceContinue’ method is called on this instance before other listeners to this advice continue getting called.</p>
<p>The order in which the listeners get called is based on the “triggerTiming’ property within the “Trigger’ metatag. This is the reason that the 'afterMouseClick' method on the SodalitySimpleDemo will wait until after the file is loaded (and lastAdvice.adviceContinue() is called in 'onLoadComplete') before it gets called and sets the message into the TextField.</p>
<p>Before the new Advisor will do anything though, it must be added to the president. You can see it extends DyamicAdvisor instead of implementing IAdvisor (like SodalitySimpleDemo did), this is because non-visual Advisors need a little more logic to be added to the President. The first way a DynamicAdvisor can be added to the President is using the President's addAdvisor method, this is not the recommended way of doing it because it means references to the president must be passed around your application, tangling your logic. The preferrable way is to set the advisorDisplay property of the new Advisor to a DisplayObject which is added to the display hierarchy (beneath the original display you passed into the President when you created it).</p>
<p>Add this to the constructor of SodalitySimpleDemo to add the new Advisor:</p>
<pre class="prettyprint"><span class="kwd">var</span><span class="pln"> fileLoaderAdvisor</span><span class="pun">:</span><span class="typ">FileLoaderAdvisor</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FileLoaderAdvisor</span><span class="pun">();</span><span class="pln"><br />fileLoaderAdvisor</span><span class="pun">.</span><span class="pln">advisorDisplay </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">;</span></pre>
<p>The final touch is to modify the onMouseClick method to use the file's URL (as opposed to "Button Clicked"):</p>
<pre class="prettyprint"><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">MouseEvent</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />        dispatchEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="str">"file.txt"</span><span class="pun">));</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p><a href="#top">Back to top</a></p>
<h2><a name="5" title="5"></a>5. Checkpoint 2</h2>
<p>Now, when you run the app, click the red box, the file will be loaded in and it’s contents will be shown in the TextField.</p>
<p>The FileLoaderAdvisor class and the ILoadFileAdvice should be as shown in Step 4 above (they won’t change throughout the tutorial).</p>
<p>Your classes should look like this:</p>
<h3>SodalitySimpleDemo.as</h3>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">Sprite</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">MouseEvent</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">text</span><span class="pun">.</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advisors</span><span class="pun">.</span><span class="typ">IAdvisor</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">IAdvisor</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> president</span><span class="pun">:</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> resultField</span><span class="pun">:</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pun">()</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln"><br />                        president </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">President</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">);</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> button</span><span class="pun">:</span><span class="typ">Sprite</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pun">();</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">beginFill</span><span class="pun">(</span><span class="lit">0xff0000</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">drawRect</span><span class="pun">(</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">CLICK</span><span class="pun">,</span><span class="pln"> onMouseClick</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">buttonMode </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">button</span><span class="pun">);</span><span class="pln"><br />                        <br />                        resultField </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TextField</span><span class="pun">();</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">resultField</span><span class="pun">);</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> fileLoaderAdvisor</span><span class="pun">:</span><span class="typ">FileLoaderAdvisor</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FileLoaderAdvisor</span><span class="pun">();</span><span class="pln"><br />                        fileLoaderAdvisor</span><span class="pun">.</span><span class="pln">advisorDisplay </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">MouseEvent</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        dispatchEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="str">"file.txt"</span><span class="pun">));</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"after"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> afterMouseClick</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">MouseClickAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        resultField</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> cause</span><span class="pun">.</span><span class="pln">message</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<h3>MouseClickAdvice.as</h3>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advice</span><span class="pun">.</span><span class="typ">Advice</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Advice</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">ILoadFileAdvice</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="pln">fileURL</span><span class="pun">:</span><span class="typ">String</span><span class="pun">=</span><span class="kwd">null</span><span class="pun">){</span><span class="pln"><br />                        </span><span class="kwd">super</span><span class="pun">();</span><span class="pln"><br />                        </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">fileURL </span><span class="pun">=</span><span class="pln"> fileURL</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> _message</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> _fileURL</span><span class="pun">:</span><span class="typ">String</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">get</span><span class="pln"> fileURL</span><span class="pun">():</span><span class="typ">String</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">return</span><span class="pln"> _fileURL<br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">set</span><span class="pln"> fileURL</span><span class="pun">(</span><span class="pln">value</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        _fileURL </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Property</span><span class="pun">(</span><span class="kwd">toString</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">,</span><span class="pln">clonable</span><span class="pun">=</span><span class="str">"true"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">get</span><span class="pln"> message</span><span class="pun">():</span><span class="typ">String</span><span class="pun">{</span><span class="pln"><br />                        </span><span class="kwd">return</span><span class="pln"> _message<br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="kwd">set</span><span class="pln"> message</span><span class="pun">(</span><span class="pln">value</span><span class="pun">:</span><span class="typ">String</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        _message </span><span class="pun">=</span><span class="pln"> value</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p><a href="#7">Skip to CheckPoint 3</a></p>
<p><a href="#top">Back to top</a></p>
<h2><a name="6" title="6"></a>6. Intercepting before and after</h2>
<p>For the final step, we build an (incredibly rudimentary) load monitor which outputs the time that outputs the time before and after the file loads.</p>
<p>Lets create our Load Monitor class:</p>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">Sprite</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">text</span><span class="pun">.</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">utils</span><span class="pun">.</span><span class="pln">getTimer</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advisors</span><span class="pun">.</span><span class="typ">IAdvisor</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">LoadMonitor</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">IAdvisor</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> textField</span><span class="pun">:</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">LoadMonitor</span><span class="pun">(){</span><span class="pln"><br />                        textField </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TextField</span><span class="pun">();</span><span class="pln"><br />                        textField</span><span class="pun">.</span><span class="pln">y </span><span class="pun">=</span><span class="pln"> </span><span class="lit">100</span><span class="pun">;</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">textField</span><span class="pun">);</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                <br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"before"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> beforeFileLoad</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">ILoadFileAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        textField</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Load begun: "</span><span class="pun">+</span><span class="pln">getTimer</span><span class="pun">();</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"after"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> afterFileLoad</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">ILoadFileAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        textField</span><span class="pun">.</span><span class="pln">appendText</span><span class="pun">(</span><span class="str">"\nLoad finished: "</span><span class="pun">+</span><span class="pln">getTimer</span><span class="pun">());</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Notice that it has two triggered functions; one before the Advice is executed and one after the Advice executes. Also note that it implements the IAdvisor interface so that the President manages it.</p>
<p>Add these lines to the SodalitySimpleDemo constructor to add the LoadMonitor to our app:</p>
<pre class="prettyprint"><span class="kwd">var</span><span class="pln"> loadMonitor</span><span class="pun">:</span><span class="typ">LoadMonitor</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">LoadMonitor</span><span class="pun">();</span><span class="pln"><br />addChild</span><span class="pun">(</span><span class="pln">loadMonitor</span><span class="pun">);</span></pre>
<p><a href="#top">Back to top</a></p>
<h2><a name="7" title="7"></a>7. Checkpoint 3</h2>
<p>Now when you run the app and click the red button, several things happen in this order:</p>
<ul>
<li>The LoadMonitor outputs the time before any other Advisors see the advice.</li>
<li>The FileLoaderAdvisor begins loading the file, at this point the president waits for confirmation to continue.</li>
<li>The file finishes loading, the FileLoaderAdvisor calls the adviceContinue method, telling the President to continue.</li>
<li>The SodalitySimpleDemo sets the text in it’s TextField to the contents of the file.</li>
<li>The LoadMonitor outputs the time after the advice has been to all Advisors.</li>
</ul>
<p>This process is done without the Advisors being aware of each other, allowing for a discreet relationship between code frameworks. The only thing tying the operations together is the Advice class which simply stores and transfers data.</p>
<p>NOTE: You may be wondering why the LoadMonitor’s beforeFileLoad function gets called before the FileLoaderAdvisor’s beforeFileLoad method, this is based on the order in which the Advisor’s are added. This is not an issue with the prebuilt Advisors and more control over ordering is coming in version 4 (see the roadmap in the repository).</p>
<p>Your main class should look like this (the MouseClickAdvice class didn’t change in this step):</p>
<h3>SodalitySimpleDemo.as</h3>
<pre class="prettyprint"><span class="kwd">package</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">display</span><span class="pun">.</span><span class="typ">Sprite</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">events</span><span class="pun">.</span><span class="typ">MouseEvent</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> flash</span><span class="pun">.</span><span class="pln">text</span><span class="pun">.</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />        </span><span class="kwd">import</span><span class="pln"> org</span><span class="pun">.</span><span class="pln">farmcode</span><span class="pun">.</span><span class="pln">sodality</span><span class="pun">.</span><span class="pln">advisors</span><span class="pun">.</span><span class="typ">IAdvisor</span><span class="pun">;</span><span class="pln"><br />        <br />        </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pln"> </span><span class="kwd">extends</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pln"> </span><span class="kwd">implements</span><span class="pln"> </span><span class="typ">IAdvisor</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> president</span><span class="pun">:</span><span class="typ">President</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">var</span><span class="pln"> resultField</span><span class="pun">:</span><span class="typ">TextField</span><span class="pun">;</span><span class="pln"><br />                <br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="typ">SodalitySimpleDemo</span><span class="pun">()</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln"><br />                        president </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">President</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">);</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> button</span><span class="pun">:</span><span class="typ">Sprite</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Sprite</span><span class="pun">();</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">beginFill</span><span class="pun">(</span><span class="lit">0xff0000</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">graphics</span><span class="pun">.</span><span class="pln">drawRect</span><span class="pun">(</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">,</span><span class="lit">100</span><span class="pun">);</span><span class="pln"><br />                        button</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="typ">MouseEvent</span><span class="pun">.</span><span class="pln">CLICK</span><span class="pun">,</span><span class="pln"> onMouseClick</span><span class="pun">);</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">button</span><span class="pun">);</span><span class="pln"><br />                        <br />                        resultField </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TextField</span><span class="pun">();</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">resultField</span><span class="pun">);</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> fileLoaderAdvisor</span><span class="pun">:</span><span class="typ">FileLoaderAdvisor</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FileLoaderAdvisor</span><span class="pun">();</span><span class="pln"><br />                        fileLoaderAdvisor</span><span class="pun">.</span><span class="pln">advisorDisplay </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">;</span><span class="pln"><br />                        <br />                        </span><span class="kwd">var</span><span class="pln"> loadMonitor</span><span class="pun">:</span><span class="typ">LoadMonitor</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">LoadMonitor</span><span class="pun">();</span><span class="pln"><br />                        addChild</span><span class="pun">(</span><span class="pln">loadMonitor</span><span class="pun">);</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">protected</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> onMouseClick</span><span class="pun">(</span><span class="pln">e</span><span class="pun">:</span><span class="typ">MouseEvent</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        dispatchEvent</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">MouseClickAdvice</span><span class="pun">(</span><span class="str">"file.txt"</span><span class="pun">));</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">[</span><span class="typ">Trigger</span><span class="pun">(</span><span class="pln">triggerTiming</span><span class="pun">=</span><span class="str">"after"</span><span class="pun">)]</span><span class="pln"><br />                </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> afterMouseClick</span><span class="pun">(</span><span class="pln">cause</span><span class="pun">:</span><span class="typ">MouseClickAdvice</span><span class="pun">):</span><span class="kwd">void</span><span class="pun">{</span><span class="pln"><br />                        resultField</span><span class="pun">.</span><span class="pln">text </span><span class="pun">=</span><span class="pln"> cause</span><span class="pun">.</span><span class="pln">message</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p> </p>
<h2><a name="8" title="8"></a>8.<span> </span><a href="/media/sourcecode/sodality/SodalitySimpleDemo.zip">Download Source</a></h2>]]></content:encoded>
            </item>
            <item>
                <title>Upgrading to Umbraco 4</title>
                <link>https://farmcode.org/articles/upgrading-to-umbraco-4/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/upgrading-to-umbraco-4/</guid>
                <description><![CDATA[Upgrading to Umbraco 4]]></description>
                <content:encoded><![CDATA[<p>his is a pretty detailed guide of how to upgrade a version 3 Umbraco web application project to be version Umbraco version 4. Theoretically Version 4 is 100% backwards compatible with version 3. I've run a couple of upgrades and everything seems to work great. To upgrade an Umbraco 3 installation that is not part of your own web application project, it should be nearly the same, however you wouldn't need to worry about DLL references, etc.. as mentioned below.<span> </span></p>
<ol>
<li>Download umbraco 4 binary files:<span> </span><a rel="noopener noreferrer" href="http://www.codeplex.com/umbraco/Release/ProjectReleases.aspx?ReleaseId=20699#ReleaseFiles" target="_blank" title="Umbraco 4 Download" class="externallink">Umbraco 4 Download</a></li>
<li>Backup Database</li>
<li>Take backup of all files for current version 3 install
<ul>
<li>If using source control might be best to create a branch</li>
</ul>
</li>
<li>All of the Umbraco DLLs that your project is referencing need to be updated to the new Umbraco 4 DLLs.
<ul>
<li>Generally this means replacing the folder that contains your referenced DLLs with the DLLs in the bin folder of the Umbraco 4 download.</li>
</ul>
</li>
<li>Update/Replace the "umbraco" folder's files:
<ul>
<li>If your project has not customized any of the files located in the "umbraco" folder, then just delete your original "umbraco" folder and replace it with the new "umbraco" folder found in the Umbraco 4 download.</li>
<li>If you project does have customized files in the "umbraco" folder, then it might be worthwhile running a diff on the files compared to the new umbraco 4 files to see what has changed and then manually make the changes to the new files to suit your needs.</li>
</ul>
</li>
<li>Update/Replace the "umbraco_client" folder's files:
<ul>
<li>If your project has not customized any of the files located in the "umbraco_client" folder, then just delete your original "umbraco_client" folder and replace it with the new "umbraco_client" folder found in the Umbraco 4 download.
<ul>
<li>In most cases, files should not be modified in this folder</li>
</ul>
</li>
<li>If you project does have customized files in the "umbraco_client" folder, then it might be worthwhile running a diff on the files compared to the new umbraco 4 files to see what has changed and then manually make the changes to the new files to suit your needs.
<ul>
<li>In most cases, files that have been modified in this folder have been done to modify the UI of the admin section (which requires a paid Umbraco license) or custom icons have been added to style tree nodes.</li>
</ul>
</li>
</ul>
</li>
<li>Web.config changes:
<ul>
<li>There are a few changes to the Web.config in umbraco 4 which may need to be manually merged in the AppSettings:
<ul>
<li>Change the value of the umbracoConfigurationStatus to be an empty string... otherwise the installer will fail to run.</li>
<li>The umbracoSmtpServer value is no longer used, Umbraco 4 uses the system.net -&gt; mailSettings -&gt; smtp values instead</li>
<li>The umbracoDisableVersionCheck is no longer required and can be removed</li>
<li>The umbracoVersionCheckPeriod should be merged from the Web.config of the Umbraco 4 download files</li>
<li>The umbracoUseSSL should be merged from the Web.config of the Umbraco 4 download files</li>
<li>The umbracoUseMediumTrust should be merged from the Web.config of the Umbraco 4 download files</li>
</ul>
</li>
<li>The browserCaps section can be removed as the /config/browserCaps.config is no longer used.</li>
<li>The Umbraco membership providers must be added to your membership providers section if you have one, otherwise create the same membership providers section as seen in the version 4 web.config</li>
<li>The Umbraco roleManager providers must be added to your roleManagers section if you have one, otherwise create the same rolderManagers section as seen in the version 4 web.config</li>
<li>The Umbraco siteMap providers must be added to your siteMap section if you have one, otherwise create the same siteMap section as seen in the version 4 web.config</li>
<li>In the pages-&gt;controls section, you need to add the umbraco reference, this is important otherwise the new master page templates will not work.</li>
</ul>
</li>
<li>All other files in the /config folder of your installation may need to be manually merged with the new versions of these files:
<ul>
<li>Don't overwrite your Dashboard.config, XsltExtension.config, formHandlers.config, 404handlers.config, metablogConfig.config, restExtensions.config, or your UrlRewriting.config files!!</li>
<li>If you've customized your tinyMceConfig.config then you will need to manually merge this file, otherwise, overwrite it with the new Umbraco 4 version</li>
<li>The umbraco.Settings file:
<ul>
<li>You'll need to merge the errors section if you want support for different error pages based on culture</li>
<li>The allowedAttributes property of the imaging tag has been updated to no longer support: title,hspace,vspace</li>
<li>The disableHtmlEmail property of the notifications section is no longer needed</li>
<li>By default the TidyEditorContent in Umbraco 4 is set to true (which uses a new version of Tidy)</li>
<li>The requestHandler section should be completely replaced by the new Umbraco 4 version (unless you've specifically made changes to this for your own reasons)</li>
<li>The templates section should be added
<ul>
<li>Please not if you set the useAspNetMasterPages to false, Umbraco 4 will still work (there's a couple of quirky bugs in the admin section with this but no show stoppers) but will be using the old Umbraco 3 templates. Setting this to true will automatically upgrade your templates to use master pages!</li>
</ul>
</li>
<li>The logging section should be added</li>
<li>The webservices section should be replaced</li>
<li>The repostories and providers sections should be added</li>
</ul>
</li>
<li>Replace the /config/splashes files with the new version 4 files.</li>
<li>Add the new App_Browsers folder</li>
</ul>
</li>
<li>Replace the default.aspx file in the root of your project with the new Umbraco 4 default.aspx file</li>
<li>Replace the /install folder with the Umbraco 4 /install folder</li>
<li>Copy the Umbraco 4 /data/packages folder into your /data folder</li>
<li>Copy the master pages folder into your root directory<span> </span></li>
<li>Delete all DLLs from your project's output bin folder to ensure there are no old Umbraco DLLs hanging around</li>
<li>Attempt to rebuild your project!
<ul>
<li>If your project does not build, then this is most likely due to an error in your project, not Umbraco 4 DLLs. Umbraco 4 is 100% backwards compatible with version 3 and version 3 controls/packages</li>
</ul>
</li>
<li>Run the installer: /yoursiteurl/install/
<ul>
<li>The installer should run seamlessly and you shouldn't need to modify anything</li>
<li>When prompted to install Runway, probably best not to do this on an existing installation</li>
</ul>
</li>
</ol>
<p><span>Some things to note after upgrading:</span></p>
<ul>
<li>Though Umbraco automatically created new master page templates for me, i had to manually add the</li>
<li>I had to add a ScriptManager to my master master template as many of my controls relied on it. Umbraco 3 must have automatically inserted a ScriptManager</li>
<li>It seems as though any public boolean properties that exist in user controls that get set via macros used to either have a 1 or 0 passed in to it which Umbraco would convert. With the new umbraco:macro control, true or false needs to be passed to it instead of 1 or 0.</li>
</ul>]]></content:encoded>
            </item>
            <item>
                <title>Importing SVN to Mercurial with complex SVN repository</title>
                <link>https://farmcode.org/articles/importing-svn-to-mercurial-with-complex-svn-repository/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:51:56 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/importing-svn-to-mercurial-with-complex-svn-repository/</guid>
                <description><![CDATA[Importing SVN to Mercurial with complex SVN repository]]></description>
                <content:encoded><![CDATA[<p>Here @<span> </span><a rel="noopener noreferrer" target="_blank">TheFARM</a>, we’ve been moving across to Mercurial (on<span> </span><a rel="noopener noreferrer" href="http://bitbucket.org/" target="_blank">BitBucket</a>) for our code repositories. In many cases our SVN repositories are structured ‘˜normally’:</p>
<ul>
<li>trunk</li>
<li>tags</li>
<li>branches</li>
</ul>
<p>Using the ‘˜hg convert’ command line, when your SVN repository is structured this way will import your trunk into the Mercurial ‘˜default’ branch and your branches/tags into named branches. This also imports all history and revisions. From there, you can merge as you wish to structure your Mercurial repository the way that you want.</p>
<p>However, in some cases we have more complicated repositories. An example of this is a structure like the following:</p>
<ul>
<li>trunk</li>
<ul>
<li>DotNet</li>
<li>Flash</li>
</ul>
<li>tags</li>
<li>branches</li>
<ul>
<li>v1.1-DotNet</li>
<li>v1.2-Flash</li>
</ul>
</ul>
<p>In the above structure, we’ve actually branched the trunk/DotNet &amp; trunk/Flash folders separately into their own branches. Unfortunately, Mercurial doesn’t operate this way so it doesn’t really understand creating branches from folders. There’s a couple different ways that you can get this from SVN into Mercurial whilst maintaining all of your history”</p>
<p>One way is to run ‘˜hg convert’ on the entire repository. You’ll end up with 3 branches in Mercurial:<span> </span><em>default</em>,<span> </span><em>v1.1-DotNet<span> </span></em>&amp;<span> </span><em>v1.2-Flash</em>. The problem is that if you try to merge the named branches into default, you’ll end up with a mess since the branches don’t have the same folder structure as default. To overcome this, you can restructure each named branch to follow the same folder structure as<span> </span><em>default</em>. To do this, we us the ‘˜rename’ method on Tortoise Hg. So for instance, if we had this folder structure inside of<span> </span><em>v1.1-DotNet</em>:</p>
<ul>
<li>BuildFiles</li>
<li>MyProject.Web</li>
<li>MyProject.Config</li>
</ul>
<p>So that we can merge this with<span> </span><em>default<span> </span></em>we need to restructure this into:</p>
<ul>
<li>DotNet</li>
<ul>
<li>BuildFiles</li>
<li>MyProject.Web</li>
<li>MyProject.Config</li>
</ul>
</ul>
<p>So we just need to right click each folder seperately, and select the rename option from the Tortoise Hg sub menu:</p>
<p>Then we prefix the folder name with the new folder location which will the ‘˜move’ the file:</p>
<p>Now that the named branch<span> </span><em>v1.1-DotNet</em><span> </span>is in the same folder structure as<span> </span><em>default</em>, we can perform a merge.</p>
<p>The other way to import a complicated SVN structure to mercurial is to convert individual branches to mercurial repositories one by one. The first thing you’ll need to do is run an ‘˜hg convert’ on the Trunk of your SVN repository. This will create your new ‘˜master’ mercurial repository for which will push the other individual mercurial repositories in to. Next, run an ‘˜hg convert’ on each of your SVN branches. For example:<span> </span><em>hg convert svn://my.svn.server.local/MyProject/Branches/v1.1-DotNet.</em></p>
<p>Once you have individual repositories for your branches, we can force push these into your ‘˜master’ repository. To do a merge of these branches, the above procedure will still need to be followed to ensure your branches have the same folder structure as<span> </span><em>default</em>. HOWEVER, because we’ve forced pushed changesets into Mercurial, it has no idea how these branches relate to each other (in fact, it gives you warnings about this when you force push). When you try to do a merge, you’ll end up getting conflict warnings for every file that exists in both locations since Mercurial doesn’t know which one is newer/older. This can be a huge pain in the arse, especially if you have tons of files. If we assume that the branch files are the most up to date and we just want to replace the files in<span> </span><em>default,<span> </span></em>then there’s a fairly obscure way to do that. In the merge dialog, you’ll need to select the option ‘œinternal : other‘ from the list of Merge tools:</p>
<p>This tells Mercurial that for any conflict you want to use the ‘˜other’ revision (which is your branch revision since you should have<span> </span><em>default</em><span> </span>checked out to do the merge).</p>
<p> </p>
<p>We’ve had success with both of these options for converting SVN to Mercurial and maintaining our history.</p>]]></content:encoded>
            </item>
            <item>
                <title>Adding embedded resource with ClientDependency</title>
                <link>https://farmcode.org/articles/adding-embedded-resource-with-clientdependency/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/adding-embedded-resource-with-clientdependency/</guid>
                <description><![CDATA[Adding embedded resource with ClientDependency]]></description>
                <content:encoded><![CDATA[<p>The<span> </span><a href="http://ucomponents.codeplex.com/">uComponents</a><span> </span>project for<span> </span><a rel="noopener noreferrer" href="http://umbraco.org/" target="_blank">Umbraco</a><span> </span>is coming along rather nicely! So far there are 13 new data types created and a few extensions, hopefully soon we’ll have a package ready to go. In the meantime, I thought I’d share a nice little code snippet that we’re using this throughout uComponents that allows you to add embedded resources to<span> </span><a rel="noopener noreferrer" href="http://clientdependency.codeplex.com/" target="_blank">ClientDependency</a>. It’s pretty easy and works perfectly with Umbraco 4.5 or any other site you have running ClientDependency. This will ensure that embedded resources (JavaScript or CSS) are added to the ClientDependency combined scripts/styles and also compressed and cached.</p>
<p>First, I’ll show you how to register your embedded resources using our extension method class (for a<span> </span><em>Control<span> </span></em>object):</p>
<pre class="prettyprint"><span class="kwd">this</span><span class="pun">.</span><span class="typ">AddResourceToClientDependency</span><span class="pun">(</span><span class="pln"><br />    </span><span class="str">"DataTypesForUmbraco.Controls.Shared.Resources.PrevalueEditor.css"</span><span class="pun">,</span><span class="pln"> <br />    </span><span class="typ">ClientDependency</span><span class="pun">.</span><span class="typ">Core</span><span class="pun">.</span><span class="typ">ClientDependencyType</span><span class="pun">.</span><span class="typ">Css</span><span class="pun">);</span></pre>
<p>The above code assumes:</p>
<ul>
<li>The class that you are consuming the code inherits from<span> </span><em>System.Web.UI.Control</em></li>
<li>That your embedded resource’s path is:<span> </span><em>DataTypesForUmbraco.Controls.Shared.Resources.PrevalueEditor.css</em>
<ul>
<li>If you don’t know about embedded resources, or know how they work, you should read:<span> </span><a rel="noopener noreferrer" href="http://support.microsoft.com/kb/910442" target="_blank">Working With Embedded Resources in ASP.Net</a></li>
</ul>
</li>
<li>That your embedded resource is a CSS type</li>
</ul>
<p>Pretty easy right!! Well, the only thing missing is that you’ll need to add our extension method class to your project which looks like this:</p>
<pre class="prettyprint"><span class="com">/// </span><span class="pln"><br /></span><span class="com">/// Extension methods for embedded resources</span><span class="pln"><br /></span><span class="com">/// </span><span class="pln"><br /></span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">ResourceExtensions</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br /><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// Adds an embedded resource to the ClientDependency output by name</span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> </span><span class="typ">AddResourceToClientDependency</span><span class="pun">(</span><span class="kwd">this</span><span class="pln"> </span><span class="typ">Control</span><span class="pln"> ctl</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> resourceName</span><span class="pun">,</span><span class="pln"> <br /></span><span class="typ">ClientDependencyType</span><span class="pln"> type</span><span class="pun">)</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="com">//get the urls for the embedded resources           </span><span class="pln"><br />        </span><span class="kwd">var</span><span class="pln"> resourceUrl </span><span class="pun">=</span><span class="pln"> ctl</span><span class="pun">.</span><span class="typ">Page</span><span class="pun">.</span><span class="typ">ClientScript</span><span class="pun">.</span><span class="typ">GetWebResourceUrl</span><span class="pun">(</span><span class="pln">ctl</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">(),</span><span class="pln"> resourceName</span><span class="pun">);</span><span class="pln"><br /><br />        </span><span class="com">//add the resources to client dependency</span><span class="pln"><br />        </span><span class="typ">ClientDependencyLoader</span><span class="pun">.</span><span class="typ">Instance</span><span class="pun">.</span><span class="typ">RegisterDependency</span><span class="pun">(</span><span class="pln">resourceUrl</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">);</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// Adds an embedded resource to the ClientDependency output by name and priority</span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="com">/// </span><span class="pln"><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> </span><span class="typ">AddResourceToClientDependency</span><span class="pun">(</span><span class="kwd">this</span><span class="pln"> </span><span class="typ">Control</span><span class="pln"> ctl</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> resourceName</span><span class="pun">,</span><span class="pln"> <br /></span><span class="typ">ClientDependencyType</span><span class="pln"> type</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">int</span><span class="pln"> priority</span><span class="pun">)</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="com">//get the urls for the embedded resources           </span><span class="pln"><br />        </span><span class="kwd">var</span><span class="pln"> resourceUrl </span><span class="pun">=</span><span class="pln"> ctl</span><span class="pun">.</span><span class="typ">Page</span><span class="pun">.</span><span class="typ">ClientScript</span><span class="pun">.</span><span class="typ">GetWebResourceUrl</span><span class="pun">(</span><span class="pln">ctl</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">(),</span><span class="pln"> resourceName</span><span class="pun">);</span><span class="pln"><br /><br />        </span><span class="com">//add the resources to client dependency</span><span class="pln"><br />        </span><span class="typ">ClientDependencyLoader</span><span class="pun">.</span><span class="typ">Instance</span><span class="pun">.</span><span class="typ">RegisterDependency</span><span class="pun">(</span><span class="pln">priority</span><span class="pun">,</span><span class="pln"> resourceUrl</span><span class="pun">,</span><span class="pln"> type</span><span class="pun">);</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="pun">}</span></pre>
<p>So basically, if you have a<span> </span><em>Control,<span> </span></em>you can register your embedded resources in ClientDependency with one line of code... sweeeeet.</p>]]></content:encoded>
            </item>
            <item>
                <title>jQuery Vertical Align</title>
                <link>https://farmcode.org/articles/jquery-vertical-align/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/jquery-vertical-align/</guid>
                <description><![CDATA[jQuery Vertical Align]]></description>
                <content:encoded><![CDATA[<p>An easy way to vertical align elements with one line of code:</p>
<pre class="prettyprint"><span class="pln">$</span><span class="pun">(</span><span class="str">'.innerText'</span><span class="pun">).</span><span class="typ">VerticalAlign</span><span class="pun">();</span><span class="pln">  </span></pre>
<p><em>I've removed the parameters as it turns out if you pass in a negative offset using padding, IE6 throws an error and JavaScript fails to continue executing. If you get the following error in IE6 debugging, it may be due to passing in a negative value to a padding css attribute, or similar:</em></p>
<ul>
<li><em><strong>invalid argument jquery J[G]=K</strong></em></li>
</ul>
<p><em>It's fairly easy to structure your html to not require a vertical align offset so it's really not needed anyways.</em><span> </span><br /><br /><span style="text-decoration: line-through;">It also supports a couple of parameters:</span><span> </span></p>
<ul>
<li><span style="text-decoration: line-through;">offset = the number of pixels to offset the vertical alignment</span><span> </span></li>
<li><span style="text-decoration: line-through;">usePadding = true/false. the default is false which uses a margin to align, if set to true, it uses padding<span> </span></span></li>
</ul>
<pre class="prettyprint"><span style="text-decoration: line-through;"><span class="pln">$</span><span class="pun">(</span><span class="str">'.innerText'</span><span class="pun">).</span><span class="typ">VerticalAlign</span><span class="pun">({</span><span class="pln">offset</span><span class="pun">:-</span><span class="lit">20</span><span class="pun">,</span><span class="pln"> usePadding</span><span class="pun">:</span><span class="kwd">true</span><span class="pun">})</span></span></pre>
<p>Get the source: <span> </span><a href="/media/sourcecode/jQueryVerticalAlign/VerticalAlign.zip">VerticalAlign.zip (290.00 bytes)</a></p>]]></content:encoded>
            </item>
            <item>
                <title>Selection Problem  With Custom Media Type Content in Umbraco 4</title>
                <link>https://farmcode.org/articles/selection-problem-with-custom-media-type-content-in-umbraco-4/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/selection-problem-with-custom-media-type-content-in-umbraco-4/</guid>
                <description><![CDATA[Selection Problem  With Custom Media Type Content in Umbraco 4]]></description>
                <content:encoded><![CDATA[<p><strong>The Problem</strong></p>
<p>You have a custom media type. You want to add a link to it in the WYSIWYG editor. </p>
<p>You go to add a link as normal, except in the "Insert/Edit Link" pop up, you click on the "Media" tab. You notice that when you click on it, no url is inserted in the Url field. </p>
<p> </p>
<p>The problem is due to this method in the Umbraco source:</p>
<pre class="prettyprint"><span class="kwd">private</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> findMediaLink</span><span class="pun">(</span><span class="typ">Media</span><span class="pln"> dd</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> nodeLink</span><span class="pun">)</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />  </span><span class="typ">Guid</span><span class="pln"> uploadGuid </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Guid</span><span class="pun">(</span><span class="str">"5032a6e6-69e3-491d-bb28-cd31cd11086c"</span><span class="pun">);</span><span class="pln"><br />  </span><span class="kwd">foreach</span><span class="pln"> </span><span class="pun">(</span><span class="typ">Property</span><span class="pln"> p </span><span class="kwd">in</span><span class="pln"> dd</span><span class="pun">.</span><span class="pln">getProperties</span><span class="pun">)</span><span class="pln"><br />  </span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">p</span><span class="pun">.</span><span class="typ">PropertyType</span><span class="pun">.</span><span class="typ">DataTypeDefinition</span><span class="pun">.</span><span class="typ">DataType</span><span class="pun">.</span><span class="typ">Id</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> uploadGuid <br />        </span><span class="pun">&amp;&amp;</span><span class="pln"> </span><span class="pun">!</span><span class="typ">String</span><span class="pun">.</span><span class="typ">IsNullOrEmpty</span><span class="pun">(</span><span class="pln">p</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">()))</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />      </span><span class="kwd">return</span><span class="pln"> p</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">();</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br />  </span><span class="pun">}</span><span class="pln"><br />  </span><span class="kwd">return</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>This method is called from the overrided Render(ref XmlTree tree) method in Umbraco's loadMedia class. Here is the code block: </p>
<pre class="prettyprint"><span class="kwd">string</span><span class="pln"> nodeLink </span><span class="pun">=</span><span class="pln"> findMediaLink</span><span class="pun">(</span><span class="pln">dd</span><span class="pun">,</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">());</span><span class="pln"><br /></span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="typ">String</span><span class="pun">.</span><span class="typ">IsNullOrEmpty</span><span class="pun">(</span><span class="pln">nodeLink</span><span class="pun">))</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />    xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"javascript:openMedia('"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeLink </span><span class="pun">+</span><span class="pln"> </span><span class="str">"');"</span><span class="pun">;</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span><span class="kwd">else</span><span class="pln"><br /></span><span class="pun">{</span><span class="pln"><br />    xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"><br />    xNode</span><span class="pun">.</span><span class="typ">DimNode</span><span class="pun">();</span><span class="pln"><br /></span><span class="pun">}</span></pre>
<p>Notice that when findMediaLink() is called, your custom media type is never going to return  "5032a6e6-69e3-491d-bb28-cd31cd11086c" as a Guid. So your media type never gets assiged it's openMedia action, and xNode.DimNode() will always be called.</p>
<p> </p>
<p><strong>The Work Around</strong></p>
<p>You must replace the Umbraco media tree handler with your own one. We called ours "MediaTree".</p>
<p>Here's how:</p>
<ul>
<li>Create a class (eg. MediaTree) that inherits from loadMedia (see code below)</li>
<li>Copy and paste the Render(ref XmlTree tree), and findMediaLink(Media dd, string nodeLink) methods from loadMedia.cs into your new class</li>
<li>Modify the findMediaLink(Media dd, string nodeLink) method to get the Guid from your custom media type, and check if it is equal to p.PropertyType.DataTypeDefinition.DataType.Id (see code below)</li>
</ul>
<p> </p>
<p>Here's the class:</p>
<pre class="prettyprint"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MediaTree</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> loadMedia<br /></span><span class="pun">{</span><span class="pln"><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="typ">MediaTree</span><span class="pun">(</span><span class="kwd">string</span><span class="pln"> application</span><span class="pun">)</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> </span><span class="kwd">base</span><span class="pun">(</span><span class="pln">application</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">}</span><span class="pln"><br /><br />    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">override</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> </span><span class="typ">Render</span><span class="pun">(</span><span class="kwd">ref</span><span class="pln"> </span><span class="typ">XmlTree</span><span class="pln"> tree</span><span class="pun">)</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="typ">Media</span><span class="pun">[]</span><span class="pln"> docs</span><span class="pun">;</span><span class="pln"><br /><br />        </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">m_id </span><span class="pun">==</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">)</span><span class="pln"><br />            docs </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Media</span><span class="pun">.</span><span class="typ">GetRootMedias</span><span class="pun">();</span><span class="pln"><br />        </span><span class="kwd">else</span><span class="pln"><br />            docs </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Media</span><span class="pun">(</span><span class="pln">m_id</span><span class="pun">).</span><span class="typ">Children</span><span class="pun">;</span><span class="pln"><br /><br />        </span><span class="kwd">foreach</span><span class="pln"> </span><span class="pun">(</span><span class="typ">Media</span><span class="pln"> dd </span><span class="kwd">in</span><span class="pln"> docs</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="typ">XmlTreeNode</span><span class="pln"> xNode </span><span class="pun">=</span><span class="pln"> </span><span class="typ">XmlTreeNode</span><span class="pun">.</span><span class="typ">Create</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">);</span><span class="pln"><br />            xNode</span><span class="pun">.</span><span class="typ">NodeID</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">();</span><span class="pln"><br />            xNode</span><span class="pun">.</span><span class="typ">Text</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Text</span><span class="pun">;</span><span class="pln"><br /><br />            </span><span class="com">// Check for dialog behaviour</span><span class="pln"><br />            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="kwd">this</span><span class="pun">.</span><span class="typ">IsDialog</span><span class="pun">)</span><span class="pln"><br />            </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="kwd">this</span><span class="pun">.</span><span class="typ">ShowContextMenu</span><span class="pun">)</span><span class="pln"><br />                    xNode</span><span class="pun">.</span><span class="typ">Menu</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"><br />                xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"javascript:openMedia("</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">");"</span><span class="pun">;</span><span class="pln"><br />            </span><span class="pun">}</span><span class="pln"><br />            </span><span class="kwd">else</span><span class="pln"><br />            </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="typ">ShowContextMenu</span><span class="pun">)</span><span class="pln"><br />                    xNode</span><span class="pun">.</span><span class="typ">Menu</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">List</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">IAction</span><span class="pun">[]</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="typ">ActionRefresh</span><span class="pun">.</span><span class="typ">Instance</span><span class="pln"> </span><span class="pun">});</span><span class="pln"><br />                </span><span class="kwd">else</span><span class="pln"><br />                    xNode</span><span class="pun">.</span><span class="typ">Menu</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"><br />                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="typ">DialogMode</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> </span><span class="typ">TreeDialogModes</span><span class="pun">.</span><span class="pln">fulllink</span><span class="pun">)</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln"><br />                    </span><span class="kwd">string</span><span class="pln"> nodeLink </span><span class="pun">=</span><span class="pln"> findMediaLink</span><span class="pun">(</span><span class="pln">dd</span><span class="pun">,</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">());</span><span class="pln"><br />                    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="typ">String</span><span class="pun">.</span><span class="typ">IsNullOrEmpty</span><span class="pun">(</span><span class="pln">nodeLink</span><span class="pun">))</span><span class="pln"><br />                    </span><span class="pun">{</span><span class="pln"><br />                        xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"javascript:openMedia('"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> nodeLink </span><span class="pun">+</span><span class="pln"> </span><span class="str">"');"</span><span class="pun">;</span><span class="pln"><br />                    </span><span class="pun">}</span><span class="pln"><br />                    </span><span class="kwd">else</span><span class="pln"><br />                    </span><span class="pun">{</span><span class="pln"><br />                        xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"><br />                        xNode</span><span class="pun">.</span><span class="typ">DimNode</span><span class="pun">();</span><span class="pln"><br />                    </span><span class="pun">}</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />                </span><span class="kwd">else</span><span class="pln"><br />                </span><span class="pun">{</span><span class="pln"><br />                    xNode</span><span class="pun">.</span><span class="typ">Action</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"javascript:openMedia('"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">()</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">"');"</span><span class="pun">;</span><span class="pln"><br />                </span><span class="pun">}</span><span class="pln"><br />            </span><span class="pun">}</span><span class="pln"><br />            xNode</span><span class="pun">.</span><span class="typ">HasChildren</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">HasChildren</span><span class="pun">;</span><span class="pln"><br /><br />            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="typ">IsDialog</span><span class="pun">)</span><span class="pln"><br />                xNode</span><span class="pun">.</span><span class="typ">Source</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="typ">GetTreeDialogUrl</span><span class="pun">(</span><span class="pln">dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">);</span><span class="pln"><br />            </span><span class="kwd">else</span><span class="pln"><br />                xNode</span><span class="pun">.</span><span class="typ">Source</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="typ">GetTreeServiceUrl</span><span class="pun">(</span><span class="pln">dd</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">);</span><span class="pln"><br /><br />            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">dd</span><span class="pun">.</span><span class="typ">ContentType</span><span class="pln"> </span><span class="pun">!=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"><br />            </span><span class="pun">{</span><span class="pln"><br />                xNode</span><span class="pun">.</span><span class="typ">Icon</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">ContentType</span><span class="pun">.</span><span class="typ">IconUrl</span><span class="pun">;</span><span class="pln"><br />                xNode</span><span class="pun">.</span><span class="typ">OpenIcon</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> dd</span><span class="pun">.</span><span class="typ">ContentType</span><span class="pun">.</span><span class="typ">IconUrl</span><span class="pun">;</span><span class="pln"><br />            </span><span class="pun">}</span><span class="pln"><br /><br />            tree</span><span class="pun">.</span><span class="typ">Add</span><span class="pun">(</span><span class="pln">xNode</span><span class="pun">);</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br />    </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> findMediaLink</span><span class="pun">(</span><span class="typ">Media</span><span class="pln"> dd</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">string</span><span class="pln"> nodeLink</span><span class="pun">)</span><span class="pln"><br />    </span><span class="pun">{</span><span class="pln"><br />        </span><span class="typ">TheFarm</span><span class="pun">.</span><span class="typ">Umbraco</span><span class="pun">.</span><span class="typ">Controls</span><span class="pun">.</span><span class="typ">MultiMediaUploadDT</span><span class="pln"> mmDT </span><span class="pun">=</span><span class="pln"> <br />                </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">TheFarm</span><span class="pun">.</span><span class="typ">Umbraco</span><span class="pun">.</span><span class="typ">Controls</span><span class="pun">.</span><span class="typ">MultiMediaUploadDT</span><span class="pun">();</span><span class="pln"><br />        </span><span class="typ">Guid</span><span class="pln"> farmUpload </span><span class="pun">=</span><span class="pln"> mmDT</span><span class="pun">.</span><span class="typ">Id</span><span class="pun">;</span><span class="pln"><br /><br />        </span><span class="typ">Guid</span><span class="pln"> uploadGuid </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Guid</span><span class="pun">(</span><span class="str">"5032a6e6-69e3-491d-bb28-cd31cd11086c"</span><span class="pun">);</span><span class="pln"><br />        </span><span class="kwd">foreach</span><span class="pln"> </span><span class="pun">(</span><span class="typ">Property</span><span class="pln"> p </span><span class="kwd">in</span><span class="pln"> dd</span><span class="pun">.</span><span class="pln">getProperties</span><span class="pun">)</span><span class="pln"><br />        </span><span class="pun">{</span><span class="pln"><br />            </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">((</span><span class="pln">p</span><span class="pun">.</span><span class="typ">PropertyType</span><span class="pun">.</span><span class="typ">DataTypeDefinition</span><span class="pun">.</span><span class="typ">DataType</span><span class="pun">.</span><span class="typ">Id</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> uploadGuid </span><span class="pun">||</span><span class="pln"> <br />                p</span><span class="pun">.</span><span class="typ">PropertyType</span><span class="pun">.</span><span class="typ">DataTypeDefinition</span><span class="pun">.</span><span class="typ">DataType</span><span class="pun">.</span><span class="typ">Id</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> farmUpload</span><span class="pun">)</span><span class="pln"> <br />                </span><span class="pun">&amp;&amp;</span><span class="pln"> </span><span class="pun">!</span><span class="typ">String</span><span class="pun">.</span><span class="typ">IsNullOrEmpty</span><span class="pun">(</span><span class="pln">p</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">()))</span><span class="pln"><br />            </span><span class="pun">{</span><span class="pln"><br />                </span><span class="kwd">return</span><span class="pln"> p</span><span class="pun">.</span><span class="typ">Value</span><span class="pun">.</span><span class="typ">ToString</span><span class="pun">();</span><span class="pln"><br />            </span><span class="pun">}</span><span class="pln"><br />        </span><span class="pun">}</span><span class="pln"><br />        </span><span class="kwd">return</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"><br />    </span><span class="pun">}</span><span class="pln"><br /><br /></span><span class="pun">}</span></pre>
<p>Note: For this to work your custom media class must contain a Guid.</p>
<p>eg.</p>
<pre class="prettyprint"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">override</span><span class="pln"> </span><span class="typ">Guid</span><span class="pln"> </span><span class="typ">Id</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="kwd">get</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Guid</span><span class="pun">(</span><span class="str">"{12345678-ABCD-EFGH-IJKLM-NOPQRSTUVWX}"</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> <br /></span><span class="pun">}</span><span class="pln"> </span></pre>
<p>Now go to the database and edit the umbracoAppTree table.</p>
<pre class="prettyprint"><span class="kwd">public</span><span class="pln"> </span><span class="kwd">override</span><span class="pln"> </span><span class="typ">Guid</span><span class="pln"> </span><span class="typ">Id</span><span class="pln"> <br /></span><span class="pun">{</span><span class="pln"> <br />    </span><span class="kwd">get</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Guid</span><span class="pun">(</span><span class="str">"{12345678-ABCD-EFGH-IJKLM-NOPQRSTUVWX}"</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> <br /></span><span class="pun">}</span><span class="pln"> </span></pre>
<p>That's it.</p>]]></content:encoded>
            </item>
            <item>
                <title>Umbraco Version 4 Tree API</title>
                <link>https://farmcode.org/articles/umbraco-version-4-tree-api/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 14 Dec 2017 14:28:17 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/umbraco-version-4-tree-api/</guid>
                <description><![CDATA[Umbraco Version 4 Tree API]]></description>
                <content:encoded><![CDATA[<p><em>[Entry migrated from<span> </span></em><a href="#"><em>suite101.thefarmdigital.com.au</em></a>]</p>
<p><strong>UPDATED! 2009/06/24</strong></p>
<p><em>This document is not completely current. The version 5 information in the word document is now irrelavent. JsTree has already been implemented in version 4.1 and version 5 documentation has already begun.</em></p>
<p><img src="http://umbraco.org/media/119969/banner-v4-sidebar.png" border="0" alt="" /></p>
<p>It's been a long time since I've been able to work on the core of Umbraco version 4 as it's been extremely busy here. I've been meaning to post this document up for some time but just never got around it. Some umbracians were asking about trees in version 4.</p>
<p>I've attached the file that describes the version 4 tree api. This was an initial document created for the Umbraco core team. It is probably close to 100% accurate but i know there's been some minor changes to the tree api since i wrote this.</p>
<p>Hope this helps some of you!</p>
<p><a rel="enclosure" href="/media/documents/Umbraco_Trees_v1.doc">Umbraco_Trees_v1.doc (246.00 kb)</a></p>]]></content:encoded>
            </item>
            <item>
                <title>Lets Encrypt Web.config IIS Redirect for HTTP to HTTPs Allowing HTTP access to the .well-known Folder</title>
                <link>https://farmcode.org/articles/lets-encrypt-webconfig-iis-redirect-for-http-to-https-allowing-http-access-to-the-well-known-folder/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Mon, 19 Feb 2018 15:27:00 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/lets-encrypt-webconfig-iis-redirect-for-http-to-https-allowing-http-access-to-the-well-known-folder/</guid>
                <description><![CDATA[Lets Encrypt offer a free SSL service, but configuring a server to allow non-HTTPs access to the .well-known, while also redirecting all other non-HTTPs requests can be tricky. Luckily IIS allows a neat way this can be achieved with Web.config redirects, here is how!]]></description>
                <content:encoded><![CDATA[<p>Let's Encrypt offers a neat service providing free SSL certificates which can be renewed through a service. However, the renewal process itself can be tricky : it requires the Let's Encrypt servers to access to your server's filesystem along a non-HTTPs connection. This may sound simple, until you consider that you may also want to have a generic redirect from all <em><strong>other</strong></em> non-HTTPs requests to their HTTPs equivalent.</p>
<p>So how do you include the best type of 301 redirect, while also separately allow through any requests to the required to the .<strong>/well-known</strong> folder and all of it's sub-folders? Luckily redirects are infinitely configurable in IIS, and below are some of the ways we have achieved this using Web.config redirects</p>
<p><br />This is specified as two rules, the first saying to 'take no action' for any requests that includes <strong>.well-known/&lt;anything&gt;</strong>, thereby causing IIS to ignore the second rule which says "redirect all requests that are not HTTPs to the corresponding HTTPs equivalent. So accessing <strong>http://mysite.com/anything</strong> will automatically redirect (with a 301 to <strong>https://mysite.com/</strong><span><strong>anything</strong> </span> unless the .well-known pattern is found at the start of the request.</p>]]></content:encoded>
            </item>
            <item>
                <title>How To Get Umbraco Root Node By Document Type in Razor Using Umbraco 7 Helper</title>
                <link>https://farmcode.org/articles/how-to-get-umbraco-root-node-by-document-type-in-razor-using-umbraco-7-helper/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:31:15 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-to-get-umbraco-root-node-by-document-type-in-razor-using-umbraco-7-helper/</guid>
                <description><![CDATA[How To Get Umbraco Root Node By Document Type in Razor Using Umbraco 7 Helper]]></description>
                <content:encoded><![CDATA[<p>If like us, you enjoy building great <a rel="noopener noreferrer" href="https://www.simonantony.net" target="_blank" title="Umbraco">Umbraco</a> websites, no doubt you've had the need on occasion to get a particular node from the root of the content tree. There are a number of ways to do this, one of the more common ones is to use something like:</p>
<pre>var currentRoot = Model.Content.AncestorOrSelf(1);</pre>
<p>However, this will only be able to get you the root node of the current tree. Suppose you had another tree (not in the path of the current node) in the root of Umbraco's content tree such as 'Site Settings'. How can you get this one without using Node Ids or other types of hard-coded references? Luckily, one of the helper methods will prove quite useful. On Umbraco's helper object, you can call:</p>
<pre>Umbraco.TypedContentAtRoot();</pre>
<p>Which will actually return a collection of all nodes in the root of your content tree, irrespective of path and tree structure.  It may not be obvious why this is incredibly useful, so let's suppose you had a node with a document type alias of 'SiteSettings' from anywhere in Umbraco's content on your site you can do:</p>
<pre>var siteSettings= Umbraco.TypedContentAtRoot().FirstOrDefault(x =&gt; x.ContentType.Alias.Equals("SiteSettings")); </pre>
<p>This will return the first node (if it exists) in the root of Umbraco's content tree which has the document type of "SiteSettings". If no such node of this type exists in Umbraco's root, then the value of the <strong>siteSettings</strong> variable will be null. It's important to note that by including either .First() or .FirstOrDefault() at the start of your query, this will likely be more efficient than doing either of these at the end of your query like so:</p>
<pre>var siteSettings= Umbraco.TypedContentAtRoot()<br />       .Where(x =&gt; x.ContentType.Alias.Equals("SiteSettings")).FirstOrDefault(); </pre>
<p>Taking the First or Default at the end, basically means you gether nodes you discard in the next step which is wasteful, and can lead to a new possibility of a null reference exception if indeed the initial query returns no nodes.</p>
<p>From experience, we have also noted that some of these queries can be quite costly on the servers time and resources. If you find many queries of this kind in each page, it would be worth considering storing these values for later use either in a caching layer or by holding in memory of the application for re-use, without needing to re-run this lookup. If you do this, we recommend then being sure to attach an event to Umbraco publish to invalidate the cache where needed (i.e. if the updated nodes affect the query, your application should re-run this query and update it's cache.</p>
<p>We will discuss some of these topics later in more detail and build on some of these ideas, but hopefully these will prove useful.</p>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>Selectively Turning off Request Validation of Masterpages in Umbraco to Allow Posting of Markup via MVC Controllers</title>
                <link>https://farmcode.org/articles/selectively-turning-off-request-validation-of-masterpages-in-umbraco-to-allow-posting-of-markup-via-mvc-controllers/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 11:52:55 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/selectively-turning-off-request-validation-of-masterpages-in-umbraco-to-allow-posting-of-markup-via-mvc-controllers/</guid>
                <description><![CDATA[Selectively Turning off Request Validation in MVC and Masterpages in Umbraco to Allow Posting of Markup]]></description>
                <content:encoded><![CDATA[<p>Request validation does a lot to protect your web application from abuse such as SQL and XSS injections. However, there are some select cases in which you may wish to allow users ot post markup to your websites <strong>MVC Controllers</strong> or <strong>WebForms</strong>. For example, suppose you had a richtext form as part of a customer profile you wish to allow users to edit and save. Saving their profile will lead to markup being posted in the data, which in turn will lead to a <strong>“A potentially dangerous ... value was detected from the client”</strong> exception without some minor configuration tweaks.  However, you don't really wish to 'turn off all validation for your web application' as this will likely open it up to abuse in ways you might not have imagined when coding it! So how can safely achieve this with an Umbraco site?</p>
<p>Fortunately, there are a numer of ways to do this and we will structure these by WebForms and MVC to show you what options you have for your project!</p>
<h3>WebForms - Umbraco Masterpages</h3>
<p>There is a neat way you can turn off request validation including a particular Umbraco directive within the masterpage which needs to be placed within a content area:</p>
<pre> &lt;umbraco:DisableRequestValidation runat="server" /&gt;</pre>
<h3>WebForms - .NET Masterpages</h3>
<p>Separately, using a base .NET feature you can include within ASPX masterpages which will have the same desired effect (does not require Umbraco):</p>
<pre> &lt;%@ Page validateRequest="false" %&gt;</pre>
<h3>MVC Controller</h3>
<p>MVC controllers are a different matter, while the posting of keys that include markup will not be an issue, reading them back will be! Luckily, you don't need to change any configuration for this to work, and can be more selective about what you let through. Typically, if you wanted to read a posted <strong>Form</strong> key or <strong>QueryString</strong> key in code (with an HTTPContext) you can do something like:</p>
<pre>Request.QueryString["mykey"] </pre>
<p>or</p>
<p>Request.Form["mykey"]<br /><br />However, if your form data includes markup, attempting to read this property from these objects will lead to a validation exception. However, you have another (unsanitised) version of these dictionary keys available to you:</p>
<pre>Request.Unvalidated.QueryString["mykey"]</pre>
<p>and</p>
<pre> Request.Unvalidated.Form["mykey"]</pre>
<p>This way, you can read the markup only from the fields you expect it to be in, not needing to allow all requests for a particular template, page or route through to your application.</p>]]></content:encoded>
            </item>
            <item>
                <title>How To Reset Main Umbraco 7 Admin Password Programatically If Locked Out</title>
                <link>https://farmcode.org/articles/how-to-reset-main-umbraco-7-admin-password-programatically-if-locked-out/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:07:43 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-to-reset-main-umbraco-7-admin-password-programatically-if-locked-out/</guid>
                <description><![CDATA[How To Reset Main Umbraco 7 Admin Password Programatically If Locked Out]]></description>
                <content:encoded><![CDATA[<p>It happens to the best of us! Sometimes you lock yourself out of your home, car and sometimes even Umbraco! Maybe you've inherited an Umbraco website from someone else and the client does not have the login details for the main acccount (i.e. user Id = 0). Or perhaps you've logged in a few times incorrectly and now the account is locked!</p>
<p>The main Umbraco account is special, as by default it will not be visible in the <strong>Users</strong> section of Umbraco to any other users - including other admins. So being able to log in as another admin, doesn't allow you to reset the main admins login details or unlock their account.</p>
<p>You can go into the database and manually reset the password, but this is made slightly more complicated now given that some versions of Umbraco 7 use slightly different hashes to others. While there is now a password reset facility, typically you would need to either have valid SMTP login details or a copy of something like <a rel="nofollow noopener noreferrer" href="http://smtp4dev.codeplex.com" target="_blank">SMTP4DEV</a> to allow you to 'capture' the password reset email if this is a development website.</p>
<p>Well here is a neat solution we find useful which sidesteps all of these! You can programatically reset the main admins password - and this will work on any version of Umbraco 7.  Simply copy the below code into a .cs file in <strong>~/App_Code</strong> and this will unlock, validate and reset both the email address (to "hello@farmcode.org") and password (to "abc123abc123"). Once saved, simply restart IIS to trigger the event that will run this code! Once IIS has started, you can simply delete this file (as you don't want it re-setting the main admin each time the site starts!)</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #800000; font-weight: bold;">using</span> Umbraco<span style="color: #808030;">.</span>Core<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> Umbraco<span style="color: #808030;">.</span>Core<span style="color: #808030;">.</span>Events<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> Umbraco<span style="color: #808030;">.</span>Core<span style="color: #808030;">.</span>Logging<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> Umbraco<span style="color: #808030;">.</span>Core<span style="color: #808030;">.</span>Models<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> Umbraco<span style="color: #808030;">.</span>Core<span style="color: #808030;">.</span>Services<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> System<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> System<span style="color: #808030;">.</span>IO<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> System<span style="color: #808030;">.</span>Text<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> System<span style="color: #808030;">.</span>Configuration<span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">using</span> umbraco<span style="color: #808030;">.</span>IO<span style="color: #800080;">;</span>

<span style="color: #800000; font-weight: bold;">namespace</span> FarmCode<span style="color: #808030;">.</span>PasswordReset
<span style="color: #800080;">{</span>
     <span style="color: #800000; font-weight: bold;">public</span> <span style="color: #800000; font-weight: bold;">class</span> RegisterEvents <span style="color: #808030;">:</span> ApplicationEventHandler
     <span style="color: #800080;">{</span>
          <span style="color: #800000; font-weight: bold;">protected</span> <span style="color: #800000; font-weight: bold;">override</span> <span style="color: #800000; font-weight: bold;">void</span> ApplicationStarted<span style="color: #808030;">(</span>UmbracoApplicationBase 
                    umbracoApplication<span style="color: #808030;">,</span> ApplicationContext applicationContext<span style="color: #808030;">)</span>
          <span style="color: #800080;">{</span>
               UmbracoApplicationBase<span style="color: #808030;">.</span>ApplicationInit <span style="color: #808030;">+</span><span style="color: #808030;">=</span> ResetAdminPassword<span style="color: #800080;">;</span>
          <span style="color: #800080;">}</span>

          <span style="color: #800000; font-weight: bold;">public</span> <span style="color: #800000; font-weight: bold;">void</span> ResetAdminPassword<span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">object</span> sender<span style="color: #808030;">,</span> EventArgs e<span style="color: #808030;">)</span>
          <span style="color: #800080;">{</span>
               <span style="color: #800000; font-weight: bold;">var</span> userService <span style="color: #808030;">=</span> ApplicationContext<span style="color: #808030;">.</span>Current<span style="color: #808030;">.</span>Services<span style="color: #808030;">.</span>UserService<span style="color: #800080;">;</span>

               <span style="color: #800000; font-weight: bold;">var</span> adminUser <span style="color: #808030;">=</span> userService<span style="color: #808030;">.</span>GetUserById<span style="color: #808030;">(</span><span style="color: #008c00;">0</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
               adminUser<span style="color: #808030;">.</span>Username <span style="color: #808030;">=</span> adminUser<span style="color: #808030;">.</span>Email <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">hello@farmcode.org</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
               adminUser<span style="color: #808030;">.</span>FailedPasswordAttempts <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
               adminUser<span style="color: #808030;">.</span>IsLockedOut <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">false</span><span style="color: #800080;">;</span>
               adminUser<span style="color: #808030;">.</span>IsApproved <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">true</span><span style="color: #800080;">;</span>
               userService<span style="color: #808030;">.</span>SavePassword<span style="color: #808030;">(</span>adminUser<span style="color: #808030;">,</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">abc123abc123</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
          <span style="color: #800080;">}</span>
     <span style="color: #800080;">}</span>
<span style="color: #800080;">}</span>
</pre>]]></content:encoded>
            </item>
            <item>
                <title>Adding Simple Pagination To Search Results View Using Linq in Umbraco</title>
                <link>https://farmcode.org/articles/adding-simple-pagination-to-search-results-view-using-linq-in-umbraco/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 15 Dec 2017 15:05:19 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/adding-simple-pagination-to-search-results-view-using-linq-in-umbraco/</guid>
                <description><![CDATA[Adding Simple Pagination To Search Results View Using Linq in Umbraco]]></description>
                <content:encoded><![CDATA[<p>Adding pagination can be a pain - especially if you're otherwise happy with your code and don't look forward to re-writing it now that a need for pagination has arisen! Fortunately, there is a simple way you can do this on any type of collection using Linq that we find very helpful! Best of all it's totally flexible: while you could easily include this logic directly in your search result view, you can just as easily structure some of this functionality into the controller or library. This example assumes you have a model that includes a list of results stored in the 'Results' property of the model</p>
<pre>    <span style="color: #800000; font-weight: bold;">var</span> Page <span style="color: #808030;">=</span> <span style="color: #008c00;">1</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">var</span> ResultsPerPage <span style="color: #808030;">=</span> <span style="color: #008c00;">10</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">var</span> totalResults <span style="color: #808030;">=</span> model<span style="color: #808030;">.</span>Results<span style="color: #808030;">.</span>Count<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">var</span> TotalPages <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">int</span><span style="color: #808030;">)</span>Math<span style="color: #808030;">.</span>Ceiling<span style="color: #808030;">(</span><span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">double</span><span style="color: #808030;">)</span>totalResults <span style="color: #808030;">/</span> <span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">double</span><span style="color: #808030;">)</span>ResultsPerPage<span style="color: #808030;">)</span><span style="color: #800080;">;</span>

    <span style="color: #800000; font-weight: bold;">if</span> <span style="color: #808030;">(</span><span style="color: #808030;">!</span><span style="color: #800000; font-weight: bold;">string</span><span style="color: #808030;">.</span>IsNullOrEmpty<span style="color: #808030;">(</span>Request<span style="color: #808030;">.</span>QueryString<span style="color: #808030;">[</span><span style="color: #800000;">"</span><span style="color: #0000e6;">page</span><span style="color: #800000;">"</span><span style="color: #808030;">]</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="color: #800000; font-weight: bold;">int</span><span style="color: #808030;">.</span>TryParse<span style="color: #808030;">(</span>Request<span style="color: #808030;">.</span>QueryString<span style="color: #808030;">[</span><span style="color: #800000;">"</span><span style="color: #0000e6;">page</span><span style="color: #800000;">"</span><span style="color: #808030;">]</span><span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">out</span> Page<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        
        <span style="color: #800000; font-weight: bold;">if</span> <span style="color: #808030;">(</span>Page <span style="color: #808030;">&lt;</span> <span style="color: #008c00;">1</span><span style="color: #808030;">)</span> <span style="color: #800080;">{</span> Page <span style="color: #808030;">=</span> <span style="color: #008c00;">1</span><span style="color: #800080;">;</span> <span style="color: #800080;">}</span>

        <span style="color: #800000; font-weight: bold;">if</span> <span style="color: #808030;">(</span>Page <span style="color: #808030;">&gt;</span> totalPages<span style="color: #808030;">)</span> <span style="color: #800080;">{</span> Page <span style="color: #808030;">=</span> totalPages<span style="color: #800080;">;</span> <span style="color: #800080;">}</span>  

        <span style="color: #696969;">// ... (then some way down your view where you display the results) ... </span>
        
        @<span style="color: #800000; font-weight: bold;">foreach</span> <span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">var</span> singleItem <span style="color: #800000; font-weight: bold;">in</span> model<span style="color: #808030;">.</span>Results<span style="color: #808030;">.</span>Skip<span style="color: #808030;">(</span><span style="color: #808030;">(</span>Page <span style="color: #808030;">-</span> <span style="color: #008c00;">1</span><span style="color: #808030;">)</span> <span style="color: #808030;">*</span> ResultsPerPage<span style="color: #808030;">)</span>
                        <span style="color: #808030;">.</span>Take<span style="color: #808030;">(</span>ResultsPerPage<span style="color: #808030;">)</span><span style="color: #808030;">)</span> <span style="color: #800080;">{</span> 

                <span style="color: #696969;">// display single item here </span>
    <span style="color: #800080;">}</span>
</pre>
<p>This gives you the basic idea, it may be helpful to create (for example) a helper method to render a single item, then within the foreach(...) loop you can simply pass it the current item, but otherwise this gives you a neat way to add pagination to existing code without the need to rewrite it!</p>]]></content:encoded>
            </item>
            <item>
                <title>Why Response.Redirect() Causes Thread Abort Exception and How To Solve</title>
                <link>https://farmcode.org/articles/why-responseredirect-causes-thread-abort-exception-and-how-to-solve/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 18 Jan 2018 16:33:41 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/why-responseredirect-causes-thread-abort-exception-and-how-to-solve/</guid>
                <description><![CDATA[Thread abort exceptions can often be caused by doing Response.Redirect(...) within your Web Application, but what causes this and how can you solve it? Everything you need to know here.]]></description>
                <content:encoded><![CDATA[<p><strong>Thread abort exceptions</strong> can often be caused by calling <strong>Response.Redirect(myurl)</strong> within your Web Application and it may not be obvious to the developer what could be wrong with this or indeed why it would lead to an exception. Typically, you can expect to get a <strong>thread abort exception</strong> that looks like the below:</p>
<pre><strong>Exception: System.Threading.ThreadAbortException: Thread was being aborted.</strong></pre>
<p>What causes this? When calling <strong>Response.Redirect(...)</strong> with only a Url parameter, the <strong>endResponse</strong> flag by default is set to true. When set true, this flag ends the page execution (aborting the thread that would otherwise have continued building up the response had it not hit your redirect call) and shifts execution to the <strong>Application_EndRequest</strong> event. This aborting of the thread (and abnormal termination of building upt  he response) is what causes the exception. </p>
<p>In an ideal world, the best practice would be to avoid building up a response at all if you suspect the need to redirect (perhaps testing the condition that would lead to the redirect before trying to render a page at all). But in practice, the need to redirect can crop up anywhere and if you find yourself plagued by these exceptions, you can easily solve it by calling:</p>
<pre>Response.Redirect(myurl, false)
Context.ApplicationInstance.CompleteRequest();
</pre>
<p>The extra parameter on Redirect(...) sets the <strong>endResponse</strong> flag to false, allowing the first thread to complete its execution all the way to the end (as a result, will not give the 'thread abort exception'). The second method <strong>CompleteRequest()</strong> then tells .NET to skip all future stages in the ASP.NET pipeline and jump directly to the EndRequest step (since you are redirecting, there is nothing more that needs to be done with the current request).</p>
<p>This not only will remove all Thread Abort Exceptions and annoying "ThreadAbortException: Thread was being aborted." you may see in logs, but will also invoke (in a sympathetic way!) all the .NET goodies to clean up after themselves in a way that's fairly efficient.</p>]]></content:encoded>
            </item>
            <item>
                <title>How to Secure and Protect Media in Umbraco Behind a Login</title>
                <link>https://farmcode.org/articles/securing-the-media-section-in-umbraco-behind-a-login/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 9 Nov 2018 13:34:31 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/securing-the-media-section-in-umbraco-behind-a-login/</guid>
                <description><![CDATA[Have you ever needed to protect Umbraco's media section behind a secure login? Perhaps you have a project with a secure download area members must register in order to be able to access? Here is a very simple, lightweight way to add secure media to Umbraco which only authenticated users can access.]]></description>
                <content:encoded><![CDATA[<p><span style="font-weight: 400;">Websites often have a need to incentivise user registration (i.e. creating a login) in order to access premium resources such as downloadable templates, PDF information brochures and more. These details can be very useful for your remarketing efforts. But creating a customer portal with a secure login to access protected media can often become a huge amount of work to get right! What if there was a much simpler and neater way that took advantage of Umbraco CMS to do most of the legwork for us?</span></p>
<p><span style="font-weight: 400;">As a website owner, ideally you don’t really want one person registering, then sharing the links and goodies with everyone, this would defeat the purpose of putting these resources behind a login! </span><span style="font-weight: 400;">So today’s post will focus on a nice simple way of securing files within the Umbraco CMS media section. To do this, we will:</span></p>
<ul>
<li style="font-size: 18px;"><span style="font-weight: 400;">Modify the default Media Type to include a new property which the user can use to specify if this should be a ‘protected resource’</span></li>
<li style="font-size: 18px;"><span style="font-weight: 400;">Creating a controller to handle the downloading of all media items</span></li>
</ul>
<h3>Modifying the Media Type</h3>
<p>So let’s start with adding a new property to the default media types. In Umbraco CMS, select a media type on which you want to secure, for instance the ‘<strong>File</strong>’ media type. Select Tabs and create a new tab called Security.</p>
<p>Next select Generic properties and add a new property on the security tab with the following details:</p>
<ul>
<li style="font-size: 18px;"><span style="font-weight: 400;">Name: Protected Media</span></li>
<li style="font-size: 18px;"><span style="font-weight: 400;">Alias: protectedMedia</span></li>
<li style="font-size: 18px;"><span style="font-weight: 400;">Type: True/false</span></li>
<li style="font-size: 18px;"><span style="font-weight: 400;">Tab: Security</span></li>
</ul>
<p>Repeat the steps for any of the other media types you would also like the user to be able to protect.</p>
<p><img style="width: 500px; height:248.35164835164838px;" src="/media/1265/protected-media-property-910.jpg?width=500&amp;height=248.35164835164838" alt="" data-udi="umb://media/549b1f13a3a641f9912b7819214fe912" /></p>
<h3>C# Code</h3>
<p>Here is the code which, on startup, adds the custom route to access the media items. You can include this in your project however is best, we have included it here as a nice simple file you might drop into the App_Code folder for convenience: </p>
<pre>using System;
using System.IO;
using System.Web.Mvc;
using System.Web.Routing;
using System.Text;
using Umbraco.Core;

namespace App_Code
{
    public class StartupHandler : IApplicationEventHandler
    {
        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            RouteTable.Routes.RouteExistingFiles = true;
            RouteTable.Routes.MapRoute(
                "MediaRoute",
                "Media/{id}/{file}",
                new
                {
                    controller = "Media",
                    action = "Index",
                    id = UrlParameter.Optional,
                    file = UrlParameter.Optional
                }
            );
        }

        public void OnApplicationInitialized(
            UmbracoApplicationBase umbracoApplication,
            ApplicationContext applicationContext)
        {
        }

        public void OnApplicationStarting(
            UmbracoApplicationBase umbracoApplication,
            ApplicationContext applicationContext)
        {
        }
    }
}</pre>
<p>Next we need to add a controller that will handle the incoming requests for these media items:</p>
<pre>using System;
using System.IO;
using System.Web;
using System.Web.Configuration;
using System.Web.Mvc;
using System.Web.Security;
using Umbraco;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Web;

namespace App_Code.Controllers
{
    public class MediaController : Controller
    {
        public ActionResult Index(string id, string file)
        {
            string mediaPath = "/media/" + id + "/" + file;
            var mediaService = ApplicationContext.Current.Services.MediaService;
            var media = mediaService.GetMediaByPath(mediaPath);

            if (media != null)
            {
                bool requiresMemberLogin = media.GetValue("protectedMedia");

                if (requiresMemberLogin == true)
                {
                    var ticket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
                    if (ticket == null)
                    {
                        System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("/");
                        AuthenticationSection authenticationSection = (AuthenticationSection)configuration.GetSection("system.web/authentication");
                        FormsAuthenticationConfiguration formsAuthentication = authenticationSection.Forms;

                        // User is accessing protected media, and is not logged in!
                        // we might get the login node from Umbraco's tree via Linq Queries
                        // or may have a setting for the member login area, but in any case
                        // can do something like:                        
                        //
                        // RedirecToUmbracoPage(nodeId)l
                        // or

                        return Redirect("/login");                            
                    }
                }

                FileStream fileStream = new FileStream(Server.MapPath(mediaPath), FileMode.Open);

                return new FileStreamResult(fileStream, MimeMapping.GetMimeMapping(file));
            }
            else
            {
                return HttpNotFound();
            }
        }
    }
}
</pre>
<p>And that's really all there is to it! This will ensure logged in users are redirected to log in before accessing protected media without the need to build complex code. This example is working in Umbraco 7.7.3 - the latest version at the time of writing. </p>
<p>How you want to handle unauthorised access to media is up to you and may depend on the project. You could just as easily do this with members and use a Linq query to obtain the login Url from Umbraco's content tree, but we believe this light weight method of protecting Umbraco's media is quite useful.</p>]]></content:encoded>
            </item>
            <item>
                <title>Moving Umbraco media from one Azure blob storage to another</title>
                <link>https://farmcode.org/articles/moving-umbraco-media-from-one-azure-blob-storage-to-another/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Thu, 6 Dec 2018 15:13:47 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/moving-umbraco-media-from-one-azure-blob-storage-to-another/</guid>
                <description><![CDATA[How to implement a new blob storage container for your existing Umbraco Media - especially useful when moving from one Azure subscription to another.]]></description>
                <content:encoded><![CDATA[<p>I've just been working upon an existing Umbraco 7 site that has been upgraded from around 7.2.4 to 7.11.1. This instance is hosted in a third party's Azure account (lets call them ripoff.com) where the client was being charged an extortionate amount of money each month, hence we decided to move to their own account. </p>
<p><strong>Key issues to resolve</strong></p>
<ol>
<li>One of the issues we had was the media had been uploaded into the Azure subscription run by ripoff.com and we needed to migrate it over to our own account.</li>
<li>Another was then to ensure the references for the Umbraco media was updated to reflect the new root url i.e. <a href="https://oldone.blob.core.windows.net/media/1475/game.jpg">https://ripoff.blob.core.windows.net/media/1475/game.jpg</a><span> </span>to<span> </span><a href="https://newone.blob.core.windows.net/media/1475/game.jpg">https://newone.blob.core.windows.net/media/1475/game.jpg</a> </li>
</ol>
<p><strong>Pre-requisites</strong></p>
<p>You will need access to the old and new Azure subscriptions</p>
<p>You will need access to the files upon your server instance</p>
<p>You will need to connect SQL Server Management studio to your site</p>
<p>YOU WILL NEED TO BACKUP EVERYTHING FIRST :-) Have a rollback plan in place should anything go wrong! We will not be held responsible for anything you mess up.</p>
<p><strong>How did we do it?</strong></p>
<p>The following is the steps we undertook in order to achieve this:</p>
<ol>
<li>Download and install Microsoft Azure Storage Explorer - a brilliant little tool (cross platform as well, i did all this from my Mac!). Download from Microsoft here<a href="https://azure.microsoft.com/en-gb/features/storage-explorer/"> https://azure.microsoft.com/en-gb/features/storage-explorer/</a></li>
<li>Configure the tool and connect to both instances - you can do this in the one instance (especially if you use the same login for both instances)</li>
<li>Open up the source storage account / Blob Containers / media folder - you should now see all the folders and files for your media.</li>
<li>Right click on media and select Copy Blob Container</li>
<li>Open up your target storage account / Blob Containers, right click and select Paste Blob Container - leave it to do it's stuff (view progress in the activities window below).</li>
<li>Once this is 100% complete, congratulations, you have copied your media over! Easy part done.</li>
</ol>
<p><strong>Tell Umbraco how to get the data</strong></p>
<ol>
<li>In Azure blob explorer, select the media storage container on your target instance</li>
<li>In the bottom panel, you should see an Actions / Properties tab. Select properties and copy the URL - this is the url to your new media folder.</li>
<li>In your Umbraco site, open up the FileSystemProviders.config file and update the Root URL with the url obtained in step 1 (remove the media/ part) and for the container name setting, set this to media. Finally update the connection string (you can get this from the Azure portal or via the Blob Explorer window - see the properties area for Primary Connection String). Save this file.</li>
</ol>
<p>If you now goto your media section and upload a new image, it *should* use the new blob storage settings and save to the new location - check this by looking at the generated URL or use Chrome inspector to check the url for the thumbnails.</p>
<p>Now you would think that is it, unfortunately not. In theory the Umbraco provider should read out this value when dishing out the media url and append the new blob storage url, alas it's never that simple in Umbraco land so this is what I had to do to get it all working.</p>
<p>This means that ALL your existing images will still be hardcoded to use the old storage URL - not great by any stretch. Whilst sorting this, I came across <a href="https://our.umbraco.com/packages/backoffice-extensions/azure-blob-storage-provider/your-remarks-ideas-etc/59425-Moving-existing-images-to-Blob-Storage">a post on Our </a>that had similar issues, I then took a couple of the posts, tweaked them and came up with a new solution for doing this.</p>
<p>What actually happens is that the database stores hard links to the original source so in our case, we had hundreds (actually thousands) of references to the ripoff link that we needed to change.</p>
<p>What follows at the end of the post is the SQL Statements we ran, in order, to fix this. Please backup your DB first, this could cause a major screwup if you get this wrong! Finally it's a good idea to republish all the media, <a href="https://our.umbraco.com/member/45290">John Ligtenberg</a> posted a class that achieves this and tells you at the end how many it's published. This way the front end should then see the new blob storage urls, the back office media section should display all the thumbnails and everything should just *work*.</p>
<p>It worked for us, the site was moved over and ripoff agency was relieved of itss duties. Hope it helps you out, however if you are still stuck or this is too technical for you, give me a call on 07967739393 or <a href="mailto:hello@simonantony.co.uk">hello@simonantony.co.uk</a> and I can book in some consultancy time to do it for you!</p>
<p> </p>
<p> </p>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>How do I use the Umbraco LogHelper method to trap errors and exceptions?</title>
                <link>https://farmcode.org/articles/how-do-i-use-the-umbraco-loghelper-method-to-trap-errors-and-exceptions/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 16 Jul 2019 14:35:00 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/how-do-i-use-the-umbraco-loghelper-method-to-trap-errors-and-exceptions/</guid>
                <description><![CDATA[See how to use the Umbraco LogHelper to log error messages to the UmbracoTraceLog.txt file.]]></description>
                <content:encoded><![CDATA[<p>See below how to use the Umbraco LogHelper to log error messages to the UmbracoTraceLog.txt file.</p>
<p>Umbraco uses Log4Net for all it's logging, additional options can be set in the Log4net.config file.</p>]]></content:encoded>
            </item>
            <item>
                <title>The provided anti-forgery token was meant for user "me@my.com", but the current user is "".</title>
                <link>https://farmcode.org/articles/the-provided-anti-forgery-token-was-meant-for-user-me-mycom-but-the-current-user-is/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Fri, 24 Apr 2020 11:32:33 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/the-provided-anti-forgery-token-was-meant-for-user-me-mycom-but-the-current-user-is/</guid>
                <description><![CDATA[How to fix the error The provided anti-forgery token was meant for user "me@my.com", but the current user is "".]]></description>
                <content:encoded><![CDATA[<p>If you have a form which uses Html.AntiForgeryToken() (of which you should always do!) and get this error, here is a way to handle it.</p>
<p>What is happening here is that the form is typically handled behind a login page to the site. Your session expires whilst filling in the form, then when you come to submit the form, your user id is no longer what it was originally and .net says you are trying to forge the request hence the error.</p>
<p>A quick search on <a href="https://stackoverflow.com/a/15615786">StackOverflow</a> pulls up this gem:</p>
<p><em>This is happening because the anti-forgery token embeds the username of the user as part of the encrypted token for better validation. When you first call the @Html.AntiForgeryToken() the user is not logged in so the token will have an empty string for the username, after the user logs in, if you do not replace the anti-forgery token it will not pass validation because the initial token was for anonymous user and now we have an authenticated user with a known username.</em></p>
<p><em>You have a few options to solve this problem:</em></p>
<ol>
<li>
<p><em>Just this time let your SPA do a full POST and when the page reloads it will have an anti-forgery token with the updated username embedded.</em></p>
</li>
<li>
<p><em>Have a partial view with just @Html.AntiForgeryToken() and right after logging in, do another AJAX request and replace your existing anti-forgery token with the response of the request.</em></p>
</li>
<li>
<p><em>Just disable the identity check the anti-forgery validation performs. Add the following to your Application_Start method: <strong>AntiForgeryConfig.SuppressIdentityHeuristicChecks = true</strong>.</em></p>
</li>
</ol>
<p>You can also do the following.</p>
<p>In Umbraco, we can override the default Global.Asax file and add our own custom class. We need to do it this way as once submitted, the error is thrown before the controller is hit hence you cannot use the controller.</p>
<p>Simply create a new class file called global.asax.cs and copy the code below into it. Then modify the default Umbraco Global.asax file to reference this new class.</p>
<p> </p>]]></content:encoded>
            </item>
            <item>
                <title>Find all content changed on your Umbraco website - audit log</title>
                <link>https://farmcode.org/articles/find-all-content-changed-on-your-umbraco-website-audit-log/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Mon, 2 Aug 2021 15:43:27 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/find-all-content-changed-on-your-umbraco-website-audit-log/</guid>
                <description><![CDATA[The following script will run on Umbraco 7 & 8 and will show you all the content changed and by whom - very useful if you want to compare staging and live versions so you can update them.]]></description>
                <content:encoded><![CDATA[<p>The following script will run on Umbraco 7 &amp; 8 and will show you all the content changed and by whom - very useful if you want to compare staging and live versions so you can update them.</p>
<p><img style="width: 0px; height:0px;" src="/nothing.jpg" alt="" data-udi="umb://media/beed344e78a449d19ff33b268d877deb" /><img style="width: 500px; height:221.1191335740072px;" src="/media/1266/content-changed-umbraco.png?width=500&amp;height=221.1191335740072" alt="Content audit in Umbraco 7/8" data-udi="umb://media/beed344e78a449d19ff33b268d877deb" /></p>]]></content:encoded>
            </item>
            <item>
                <title>Remove trailing slash from URL in Umbraco</title>
                <link>https://farmcode.org/articles/remove-trailing-slash-from-url-in-umbraco/</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 22 Mar 2022 10:03:04 GMT</pubDate>
               <guid isPermaLink="true">https://farmcode.org/articles/remove-trailing-slash-from-url-in-umbraco/</guid>
                <description><![CDATA[Here we show you how to remove the trailing slash from your front end urls in Umbraco]]></description>
                <content:encoded><![CDATA[<p>A common issue with Umbraco is that front end URL's are available both with and without the trailing slash i.e.</p>
<p>mysite.com/testpage</p>
<p>mysite.com/testpage/</p>
<p>Although they are the same page, Google will see this as duplicate content and derank accordingly - what we need it a way to force Umbraco to remove the trailing slash.</p>
<p>There is a setting in the UmbracoSettings.Config file to add a trailing slash:</p>
<pre>&lt;requestHandler&gt;
    &lt;!-- this will add a trailing slash (/) to urls when in directory url mode --&gt;
    &lt;addTrailingSlash&gt;true&lt;/addTrailingSlash&gt;
&lt;/requestHandler&gt;<br /><br />But this does not really work for us in this situation - you can still access both url's (particularly in a multi domain site as was in my case)<br /><br />The trick is to use the URL redirect rule shown below.</pre>]]></content:encoded>
            </item>
        
        
	
        <item>
                <title>Examine Category</title>
                <link>https://farmcode.org/tag/Examine</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Examine</guid>
                <description>Examine category in the Simon Antony Knowledgebase, for all articles filed under Examine</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco Category</title>
                <link>https://farmcode.org/tag/Umbraco</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco</guid>
                <description>Umbraco category in the Simon Antony Knowledgebase, for all articles filed under Umbraco</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>IIS Category</title>
                <link>https://farmcode.org/tag/IIS</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/IIS</guid>
                <description>IIS category in the Simon Antony Knowledgebase, for all articles filed under IIS</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Browsers Category</title>
                <link>https://farmcode.org/tag/Browsers</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Browsers</guid>
                <description>Browsers category in the Simon Antony Knowledgebase, for all articles filed under Browsers</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>SQL Server Category</title>
                <link>https://farmcode.org/tag/SQL%20Server</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/SQL%20Server</guid>
                <description>SQL Server category in the Simon Antony Knowledgebase, for all articles filed under SQL Server</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco 7 Category</title>
                <link>https://farmcode.org/tag/Umbraco%207</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%207</guid>
                <description>Umbraco 7 category in the Simon Antony Knowledgebase, for all articles filed under Umbraco 7</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>C# Category</title>
                <link>https://farmcode.org/tag/C#</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/C#</guid>
                <description>C# category in the Simon Antony Knowledgebase, for all articles filed under C#</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>programming Category</title>
                <link>https://farmcode.org/tag/programming</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/programming</guid>
                <description>programming category in the Simon Antony Knowledgebase, for all articles filed under programming</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Packages Category</title>
                <link>https://farmcode.org/tag/Packages</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Packages</guid>
                <description>Packages category in the Simon Antony Knowledgebase, for all articles filed under Packages</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>.NET Category</title>
                <link>https://farmcode.org/tag/.NET</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/.NET</guid>
                <description>.NET category in the Simon Antony Knowledgebase, for all articles filed under .NET</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>.NET Umbraco Category</title>
                <link>https://farmcode.org/tag/.NET%20Umbraco</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/.NET%20Umbraco</guid>
                <description>.NET Umbraco category in the Simon Antony Knowledgebase, for all articles filed under .NET Umbraco</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Snapshot Category</title>
                <link>https://farmcode.org/tag/Snapshot</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Snapshot</guid>
                <description>Snapshot category in the Simon Antony Knowledgebase, for all articles filed under Snapshot</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Information Technology Category</title>
                <link>https://farmcode.org/tag/Information%20Technology</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Information%20Technology</guid>
                <description>Information Technology category in the Simon Antony Knowledgebase, for all articles filed under Information Technology</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Flash Category</title>
                <link>https://farmcode.org/tag/Flash</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Flash</guid>
                <description>Flash category in the Simon Antony Knowledgebase, for all articles filed under Flash</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Javascript Category</title>
                <link>https://farmcode.org/tag/Javascript</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Javascript</guid>
                <description>Javascript category in the Simon Antony Knowledgebase, for all articles filed under Javascript</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Security Category</title>
                <link>https://farmcode.org/tag/Security</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Security</guid>
                <description>Security category in the Simon Antony Knowledgebase, for all articles filed under Security</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Graphics Category</title>
                <link>https://farmcode.org/tag/Graphics</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Graphics</guid>
                <description>Graphics category in the Simon Antony Knowledgebase, for all articles filed under Graphics</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Configuration Category</title>
                <link>https://farmcode.org/tag/Configuration</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Configuration</guid>
                <description>Configuration category in the Simon Antony Knowledgebase, for all articles filed under Configuration</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Source Control Category</title>
                <link>https://farmcode.org/tag/Source%20Control</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Source%20Control</guid>
                <description>Source Control category in the Simon Antony Knowledgebase, for all articles filed under Source Control</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>ClientDependency Category</title>
                <link>https://farmcode.org/tag/ClientDependency</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/ClientDependency</guid>
                <description>ClientDependency category in the Simon Antony Knowledgebase, for all articles filed under ClientDependency</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Azure Category</title>
                <link>https://farmcode.org/tag/Azure</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Azure</guid>
                <description>Azure category in the Simon Antony Knowledgebase, for all articles filed under Azure</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Logging Category</title>
                <link>https://farmcode.org/tag/Logging</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Logging</guid>
                <description>Logging category in the Simon Antony Knowledgebase, for all articles filed under Logging</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>HTML Tag</title>
                <link>https://farmcode.org/tag/HTML</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/HTML</guid>
                <description>HTML tag for all articles tagged with HTML in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>linq Tag</title>
                <link>https://farmcode.org/tag/linq</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/linq</guid>
                <description>linq tag for all articles tagged with linq in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>umbraco Tag</title>
                <link>https://farmcode.org/tag/umbraco</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/umbraco</guid>
                <description>umbraco tag for all articles tagged with umbraco in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Examine Tag</title>
                <link>https://farmcode.org/tag/Examine</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Examine</guid>
                <description>Examine tag for all articles tagged with Examine in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Packages Tag</title>
                <link>https://farmcode.org/tag/Packages</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Packages</guid>
                <description>Packages tag for all articles tagged with Packages in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>XPATH Tag</title>
                <link>https://farmcode.org/tag/XPATH</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/XPATH</guid>
                <description>XPATH tag for all articles tagged with XPATH in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>XSLT Tag</title>
                <link>https://farmcode.org/tag/XSLT</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/XSLT</guid>
                <description>XSLT tag for all articles tagged with XSLT in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Examine Tag</title>
                <link>https://farmcode.org/tag/Examine</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Examine</guid>
                <description>Examine tag for all articles tagged with Examine in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco Tag</title>
                <link>https://farmcode.org/tag/Umbraco</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco</guid>
                <description>Umbraco tag for all articles tagged with Umbraco in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Random Tag</title>
                <link>https://farmcode.org/tag/Random</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Random</guid>
                <description>Random tag for all articles tagged with Random in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>GetMedia Tag</title>
                <link>https://farmcode.org/tag/GetMedia</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/GetMedia</guid>
                <description>GetMedia tag for all articles tagged with GetMedia in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>HTTP Error Tag</title>
                <link>https://farmcode.org/tag/HTTP%20Error</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/HTTP%20Error</guid>
                <description>HTTP Error tag for all articles tagged with HTTP Error in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>IIS Tag</title>
                <link>https://farmcode.org/tag/IIS</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/IIS</guid>
                <description>IIS tag for all articles tagged with IIS in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Servers Tag</title>
                <link>https://farmcode.org/tag/Servers</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Servers</guid>
                <description>Servers tag for all articles tagged with Servers in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>IIS Tag</title>
                <link>https://farmcode.org/tag/IIS</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/IIS</guid>
                <description>IIS tag for all articles tagged with IIS in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>ASP.Net Tag</title>
                <link>https://farmcode.org/tag/ASP.Net</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/ASP.Net</guid>
                <description>ASP.Net tag for all articles tagged with ASP.Net in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Chrome Tag</title>
                <link>https://farmcode.org/tag/Chrome</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Chrome</guid>
                <description>Chrome tag for all articles tagged with Chrome in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Browsers Tag</title>
                <link>https://farmcode.org/tag/Browsers</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Browsers</guid>
                <description>Browsers tag for all articles tagged with Browsers in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Error Handling Action Tag</title>
                <link>https://farmcode.org/tag/Error%20Handling%20Action</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Error%20Handling%20Action</guid>
                <description>Error Handling Action tag for all articles tagged with Error Handling Action in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco Exception Tag</title>
                <link>https://farmcode.org/tag/Umbraco%20Exception</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%20Exception</guid>
                <description>Umbraco Exception tag for all articles tagged with Umbraco Exception in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>404 Tag</title>
                <link>https://farmcode.org/tag/404</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/404</guid>
                <description>404 tag for all articles tagged with 404 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Error Tag</title>
                <link>https://farmcode.org/tag/Error</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Error</guid>
                <description>Error tag for all articles tagged with Error in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Error Handling Tag</title>
                <link>https://farmcode.org/tag/Error%20Handling</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Error%20Handling</guid>
                <description>Error Handling tag for all articles tagged with Error Handling in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Template Tag</title>
                <link>https://farmcode.org/tag/Template</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Template</guid>
                <description>Template tag for all articles tagged with Template in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Domain Tag</title>
                <link>https://farmcode.org/tag/Domain</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Domain</guid>
                <description>Domain tag for all articles tagged with Domain in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Checkboxtree Tag</title>
                <link>https://farmcode.org/tag/Checkboxtree</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Checkboxtree</guid>
                <description>Checkboxtree tag for all articles tagged with Checkboxtree in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>UComponents Tag</title>
                <link>https://farmcode.org/tag/UComponents</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/UComponents</guid>
                <description>UComponents tag for all articles tagged with UComponents in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Attribute Error Tag</title>
                <link>https://farmcode.org/tag/Attribute%20Error</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Attribute%20Error</guid>
                <description>Attribute Error tag for all articles tagged with Attribute Error in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Cache Tag</title>
                <link>https://farmcode.org/tag/Cache</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Cache</guid>
                <description>Cache tag for all articles tagged with Cache in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Sitemap Tag</title>
                <link>https://farmcode.org/tag/Sitemap</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Sitemap</guid>
                <description>Sitemap tag for all articles tagged with Sitemap in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Database Tag</title>
                <link>https://farmcode.org/tag/Database</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Database</guid>
                <description>Database tag for all articles tagged with Database in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Delete Tag</title>
                <link>https://farmcode.org/tag/Delete</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Delete</guid>
                <description>Delete tag for all articles tagged with Delete in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Duplicated rows Tag</title>
                <link>https://farmcode.org/tag/Duplicated%20rows</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Duplicated%20rows</guid>
                <description>Duplicated rows tag for all articles tagged with Duplicated rows in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Primary key Tag</title>
                <link>https://farmcode.org/tag/Primary%20key</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Primary%20key</guid>
                <description>Primary key tag for all articles tagged with Primary key in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>SQL Tag</title>
                <link>https://farmcode.org/tag/SQL</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/SQL</guid>
                <description>SQL tag for all articles tagged with SQL in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Table Tag</title>
                <link>https://farmcode.org/tag/Table</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Table</guid>
                <description>Table tag for all articles tagged with Table in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>SQL Server Tag</title>
                <link>https://farmcode.org/tag/SQL%20Server</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/SQL%20Server</guid>
                <description>SQL Server tag for all articles tagged with SQL Server in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Error Republishing Tag</title>
                <link>https://farmcode.org/tag/Error%20Republishing</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Error%20Republishing</guid>
                <description>Error Republishing tag for all articles tagged with Error Republishing in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco.Config Tag</title>
                <link>https://farmcode.org/tag/Umbraco.Config</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco.Config</guid>
                <description>Umbraco.Config tag for all articles tagged with Umbraco.Config in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>XmlException Tag</title>
                <link>https://farmcode.org/tag/XmlException</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/XmlException</guid>
                <description>XmlException tag for all articles tagged with XmlException in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Document Tag</title>
                <link>https://farmcode.org/tag/Document</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Document</guid>
                <description>Document tag for all articles tagged with Document in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Orphaned Results Tag</title>
                <link>https://farmcode.org/tag/Orphaned%20Results</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Orphaned%20Results</guid>
                <description>Orphaned Results tag for all articles tagged with Orphaned Results in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Grouping Tag</title>
                <link>https://farmcode.org/tag/Grouping</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Grouping</guid>
                <description>Grouping tag for all articles tagged with Grouping in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Nodes Tag</title>
                <link>https://farmcode.org/tag/Nodes</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Nodes</guid>
                <description>Nodes tag for all articles tagged with Nodes in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Razor Tag</title>
                <link>https://farmcode.org/tag/Razor</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Razor</guid>
                <description>Razor tag for all articles tagged with Razor in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco7 Tag</title>
                <link>https://farmcode.org/tag/Umbraco7</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco7</guid>
                <description>Umbraco7 tag for all articles tagged with Umbraco7 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco 7 Tag</title>
                <link>https://farmcode.org/tag/Umbraco%207</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%207</guid>
                <description>Umbraco 7 tag for all articles tagged with Umbraco 7 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Deprecated Tag</title>
                <link>https://farmcode.org/tag/Deprecated</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Deprecated</guid>
                <description>Deprecated tag for all articles tagged with Deprecated in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>HTML 4.01 Tag</title>
                <link>https://farmcode.org/tag/HTML%204.01</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/HTML%204.01</guid>
                <description>HTML 4.01 tag for all articles tagged with HTML 4.01 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Support Tag</title>
                <link>https://farmcode.org/tag/Support</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Support</guid>
                <description>Support tag for all articles tagged with Support in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Tags Tag</title>
                <link>https://farmcode.org/tag/Tags</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Tags</guid>
                <description>Tags tag for all articles tagged with Tags in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Web development Tag</title>
                <link>https://farmcode.org/tag/Web%20development</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Web%20development</guid>
                <description>Web development tag for all articles tagged with Web development in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>BackOffice Tag</title>
                <link>https://farmcode.org/tag/BackOffice</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/BackOffice</guid>
                <description>BackOffice tag for all articles tagged with BackOffice in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Dashboard Tag</title>
                <link>https://farmcode.org/tag/Dashboard</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Dashboard</guid>
                <description>Dashboard tag for all articles tagged with Dashboard in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Server error Tag</title>
                <link>https://farmcode.org/tag/Server%20error</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Server%20error</guid>
                <description>Server error tag for all articles tagged with Server error in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Templates Tag</title>
                <link>https://farmcode.org/tag/Templates</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Templates</guid>
                <description>Templates tag for all articles tagged with Templates in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco 7 Tag</title>
                <link>https://farmcode.org/tag/Umbraco%207</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%207</guid>
                <description>Umbraco 7 tag for all articles tagged with Umbraco 7 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Dictionary Tag</title>
                <link>https://farmcode.org/tag/Dictionary</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Dictionary</guid>
                <description>Dictionary tag for all articles tagged with Dictionary in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>HTML5 Tag</title>
                <link>https://farmcode.org/tag/HTML5</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/HTML5</guid>
                <description>HTML5 tag for all articles tagged with HTML5 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Configuration Tag</title>
                <link>https://farmcode.org/tag/Configuration</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Configuration</guid>
                <description>Configuration tag for all articles tagged with Configuration in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>CSS3 Tag</title>
                <link>https://farmcode.org/tag/CSS3</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/CSS3</guid>
                <description>CSS3 tag for all articles tagged with CSS3 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>MIME Types Tag</title>
                <link>https://farmcode.org/tag/MIME%20Types</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/MIME%20Types</guid>
                <description>MIME Types tag for all articles tagged with MIME Types in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Server Tag</title>
                <link>https://farmcode.org/tag/Server</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Server</guid>
                <description>Server tag for all articles tagged with Server in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>C# Tag</title>
                <link>https://farmcode.org/tag/C#</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/C#</guid>
                <description>C# tag for all articles tagged with C# in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>programming Tag</title>
                <link>https://farmcode.org/tag/programming</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/programming</guid>
                <description>programming tag for all articles tagged with programming in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Packages Tag</title>
                <link>https://farmcode.org/tag/Packages</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Packages</guid>
                <description>Packages tag for all articles tagged with Packages in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco-Examine Tag</title>
                <link>https://farmcode.org/tag/Umbraco-Examine</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco-Examine</guid>
                <description>Umbraco-Examine tag for all articles tagged with Umbraco-Examine in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>.NET Tag</title>
                <link>https://farmcode.org/tag/.NET</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/.NET</guid>
                <description>.NET tag for all articles tagged with .NET in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>CodeGarden Tag</title>
                <link>https://farmcode.org/tag/CodeGarden</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/CodeGarden</guid>
                <description>CodeGarden tag for all articles tagged with CodeGarden in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>controls Tag</title>
                <link>https://farmcode.org/tag/controls</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/controls</guid>
                <description>controls tag for all articles tagged with controls in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>.NET Tag</title>
                <link>https://farmcode.org/tag/.NET</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/.NET</guid>
                <description>.NET tag for all articles tagged with .NET in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>LINQPad Tag</title>
                <link>https://farmcode.org/tag/LINQPad</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/LINQPad</guid>
                <description>LINQPad tag for all articles tagged with LINQPad in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>UmbracoDataContext Tag</title>
                <link>https://farmcode.org/tag/UmbracoDataContext</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/UmbracoDataContext</guid>
                <description>UmbracoDataContext tag for all articles tagged with UmbracoDataContext in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>.NET Umbraco Tag</title>
                <link>https://farmcode.org/tag/.NET%20Umbraco</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/.NET%20Umbraco</guid>
                <description>.NET Umbraco tag for all articles tagged with .NET Umbraco in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Debug Tag</title>
                <link>https://farmcode.org/tag/Debug</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Debug</guid>
                <description>Debug tag for all articles tagged with Debug in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Logging Tag</title>
                <link>https://farmcode.org/tag/Logging</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Logging</guid>
                <description>Logging tag for all articles tagged with Logging in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Snapshot Tag</title>
                <link>https://farmcode.org/tag/Snapshot</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Snapshot</guid>
                <description>Snapshot tag for all articles tagged with Snapshot in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Snapshot Tag</title>
                <link>https://farmcode.org/tag/Snapshot</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Snapshot</guid>
                <description>Snapshot tag for all articles tagged with Snapshot in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Visual Studio Tag</title>
                <link>https://farmcode.org/tag/Visual%20Studio</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Visual%20Studio</guid>
                <description>Visual Studio tag for all articles tagged with Visual Studio in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>ClientDependency Tag</title>
                <link>https://farmcode.org/tag/ClientDependency</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/ClientDependency</guid>
                <description>ClientDependency tag for all articles tagged with ClientDependency in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Performance Tag</title>
                <link>https://farmcode.org/tag/Performance</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Performance</guid>
                <description>Performance tag for all articles tagged with Performance in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Information Technology Tag</title>
                <link>https://farmcode.org/tag/Information%20Technology</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Information%20Technology</guid>
                <description>Information Technology tag for all articles tagged with Information Technology in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Forms Tag</title>
                <link>https://farmcode.org/tag/Forms</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Forms</guid>
                <description>Forms tag for all articles tagged with Forms in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco Contour Tag</title>
                <link>https://farmcode.org/tag/Umbraco%20Contour</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%20Contour</guid>
                <description>Umbraco Contour tag for all articles tagged with Umbraco Contour in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Databases Tag</title>
                <link>https://farmcode.org/tag/Databases</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Databases</guid>
                <description>Databases tag for all articles tagged with Databases in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>flash Tag</title>
                <link>https://farmcode.org/tag/flash</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/flash</guid>
                <description>flash tag for all articles tagged with flash in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>javascript Tag</title>
                <link>https://farmcode.org/tag/javascript</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/javascript</guid>
                <description>javascript tag for all articles tagged with javascript in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Flash Tag</title>
                <link>https://farmcode.org/tag/Flash</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Flash</guid>
                <description>Flash tag for all articles tagged with Flash in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Javascript Tag</title>
                <link>https://farmcode.org/tag/Javascript</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Javascript</guid>
                <description>Javascript tag for all articles tagged with Javascript in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>jQuery Tag</title>
                <link>https://farmcode.org/tag/jQuery</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/jQuery</guid>
                <description>jQuery tag for all articles tagged with jQuery in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Password Tag</title>
                <link>https://farmcode.org/tag/Password</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Password</guid>
                <description>Password tag for all articles tagged with Password in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Security Tag</title>
                <link>https://farmcode.org/tag/Security</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Security</guid>
                <description>Security tag for all articles tagged with Security in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Security Tag</title>
                <link>https://farmcode.org/tag/Security</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Security</guid>
                <description>Security tag for all articles tagged with Security in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>bezier Tag</title>
                <link>https://farmcode.org/tag/bezier</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/bezier</guid>
                <description>bezier tag for all articles tagged with bezier in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Graphics Tag</title>
                <link>https://farmcode.org/tag/Graphics</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Graphics</guid>
                <description>Graphics tag for all articles tagged with Graphics in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Open Source Tag</title>
                <link>https://farmcode.org/tag/Open%20Source</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Open%20Source</guid>
                <description>Open Source tag for all articles tagged with Open Source in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Graphics Tag</title>
                <link>https://farmcode.org/tag/Graphics</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Graphics</guid>
                <description>Graphics tag for all articles tagged with Graphics in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Rich Text Tag</title>
                <link>https://farmcode.org/tag/Rich%20Text</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Rich%20Text</guid>
                <description>Rich Text tag for all articles tagged with Rich Text in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>TinyMCE Tag</title>
                <link>https://farmcode.org/tag/TinyMCE</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/TinyMCE</guid>
                <description>TinyMCE tag for all articles tagged with TinyMCE in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Configuration Tag</title>
                <link>https://farmcode.org/tag/Configuration</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Configuration</guid>
                <description>Configuration tag for all articles tagged with Configuration in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Dep Tag</title>
                <link>https://farmcode.org/tag/Dep</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Dep</guid>
                <description>Dep tag for all articles tagged with Dep in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>dependency injection Tag</title>
                <link>https://farmcode.org/tag/dependency%20injection</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/dependency%20injection</guid>
                <description>dependency injection tag for all articles tagged with dependency injection in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Unity Tag</title>
                <link>https://farmcode.org/tag/Unity</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Unity</guid>
                <description>Unity tag for all articles tagged with Unity in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Mercurial Tag</title>
                <link>https://farmcode.org/tag/Mercurial</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Mercurial</guid>
                <description>Mercurial tag for all articles tagged with Mercurial in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Source Control Tag</title>
                <link>https://farmcode.org/tag/Source%20Control</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Source%20Control</guid>
                <description>Source Control tag for all articles tagged with Source Control in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>SVN Tag</title>
                <link>https://farmcode.org/tag/SVN</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/SVN</guid>
                <description>SVN tag for all articles tagged with SVN in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Tortoise HG Tag</title>
                <link>https://farmcode.org/tag/Tortoise%20HG</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Tortoise%20HG</guid>
                <description>Tortoise HG tag for all articles tagged with Tortoise HG in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Source Control Tag</title>
                <link>https://farmcode.org/tag/Source%20Control</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Source%20Control</guid>
                <description>Source Control tag for all articles tagged with Source Control in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>ClientDependency Tag</title>
                <link>https://farmcode.org/tag/ClientDependency</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/ClientDependency</guid>
                <description>ClientDependency tag for all articles tagged with ClientDependency in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>HTTPs Tag</title>
                <link>https://farmcode.org/tag/HTTPs</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/HTTPs</guid>
                <description>HTTPs tag for all articles tagged with HTTPs in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Redirect Tag</title>
                <link>https://farmcode.org/tag/Redirect</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Redirect</guid>
                <description>Redirect tag for all articles tagged with Redirect in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Rewrite Rules Tag</title>
                <link>https://farmcode.org/tag/Rewrite%20Rules</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Rewrite%20Rules</guid>
                <description>Rewrite Rules tag for all articles tagged with Rewrite Rules in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>SSL Tag</title>
                <link>https://farmcode.org/tag/SSL</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/SSL</guid>
                <description>SSL tag for all articles tagged with SSL in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Web.config Tag</title>
                <link>https://farmcode.org/tag/Web.config</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Web.config</guid>
                <description>Web.config tag for all articles tagged with Web.config in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>C# Tag</title>
                <link>https://farmcode.org/tag/C#</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/C#</guid>
                <description>C# tag for all articles tagged with C# in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Query Tag</title>
                <link>https://farmcode.org/tag/Query</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Query</guid>
                <description>Query tag for all articles tagged with Query in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Admin Tag</title>
                <link>https://farmcode.org/tag/Admin</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Admin</guid>
                <description>Admin tag for all articles tagged with Admin in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Login Tag</title>
                <link>https://farmcode.org/tag/Login</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Login</guid>
                <description>Login tag for all articles tagged with Login in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Users Tag</title>
                <link>https://farmcode.org/tag/Users</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Users</guid>
                <description>Users tag for all articles tagged with Users in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Exception Tag</title>
                <link>https://farmcode.org/tag/Exception</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Exception</guid>
                <description>Exception tag for all articles tagged with Exception in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Media Tag</title>
                <link>https://farmcode.org/tag/Media</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Media</guid>
                <description>Media tag for all articles tagged with Media in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Azure Tag</title>
                <link>https://farmcode.org/tag/Azure</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Azure</guid>
                <description>Azure tag for all articles tagged with Azure in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Blob Storage Tag</title>
                <link>https://farmcode.org/tag/Blob%20Storage</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Blob%20Storage</guid>
                <description>Blob Storage tag for all articles tagged with Blob Storage in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Migration Tag</title>
                <link>https://farmcode.org/tag/Migration</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Migration</guid>
                <description>Migration tag for all articles tagged with Migration in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Azure Tag</title>
                <link>https://farmcode.org/tag/Azure</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Azure</guid>
                <description>Azure tag for all articles tagged with Azure in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>errors Tag</title>
                <link>https://farmcode.org/tag/errors</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/errors</guid>
                <description>errors tag for all articles tagged with errors in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Log4Net Tag</title>
                <link>https://farmcode.org/tag/Log4Net</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Log4Net</guid>
                <description>Log4Net tag for all articles tagged with Log4Net in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>loghelper Tag</title>
                <link>https://farmcode.org/tag/loghelper</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/loghelper</guid>
                <description>loghelper tag for all articles tagged with loghelper in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Logging Tag</title>
                <link>https://farmcode.org/tag/Logging</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Logging</guid>
                <description>Logging tag for all articles tagged with Logging in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>anti-forgery Tag</title>
                <link>https://farmcode.org/tag/anti-forgery</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/anti-forgery</guid>
                <description>anti-forgery tag for all articles tagged with anti-forgery in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Application_Error Tag</title>
                <link>https://farmcode.org/tag/Application_Error</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Application_Error</guid>
                <description>Application_Error tag for all articles tagged with Application_Error in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Umbraco 8 Tag</title>
                <link>https://farmcode.org/tag/Umbraco%208</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Umbraco%208</guid>
                <description>Umbraco 8 tag for all articles tagged with Umbraco 8 in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>auditlog Tag</title>
                <link>https://farmcode.org/tag/auditlog</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/auditlog</guid>
                <description>auditlog tag for all articles tagged with auditlog in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Rewrite Tag</title>
                <link>https://farmcode.org/tag/Rewrite</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Rewrite</guid>
                <description>Rewrite tag for all articles tagged with Rewrite in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>Trailing slash Tag</title>
                <link>https://farmcode.org/tag/Trailing%20slash</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/Trailing%20slash</guid>
                <description>Trailing slash tag for all articles tagged with Trailing slash in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>
        <item>
                <title>URL Rewriting Tag</title>
                <link>https://farmcode.org/tag/URL%20Rewriting</link>
                <dc:creator>Simon Antony Limited</dc:creator>
                <pubDate>Tue, 27 Feb 2024 10:54:52 GMT</pubDate>
                <guid>https://farmcode.org/tag/URL%20Rewriting</guid>
                <description>URL Rewriting tag for all articles tagged with URL Rewriting in the Simon Antony Knowledgebase.</description>
                <content:encoded></content:encoded>
            </item>

    </channel>
</rss>