<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Thu, 23 Feb 2012 21:31:25 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Latest posts</title><link>http://www.yetanotherchris.me/home/</link><description></description><lastBuildDate>Mon, 13 Feb 2012 12:11:40 +0000</lastBuildDate><copyright></copyright><language>en-GB</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>Filtering System.Diagnostics Trace messages</title><category>asp.net</category><category>system.diagnostics</category><category>trace</category><dc:creator>Chris S</dc:creator><pubDate>Mon, 13 Feb 2012 11:46:43 +0000</pubDate><link>http://www.yetanotherchris.me/home/2012/2/13/filtering-systemdiagnostics-trace-messages.html</link><guid isPermaLink="false">1111787:12911737:15012522</guid><description><![CDATA[<p>One of the biggest points earners for me on Stackoverflow has been <a href="http://stackoverflow.com/questions/147557/error-logging-in-c-sharp/148117">this question</a> about Error logging in C#/.NET. Having been fairly experienced with the setup of Log4net, I've seen firsthand how much over kill it generally is for logging (unless you like to use your live servers for debugging), and also how it just isn't needed as .NET has its own in built and comprehensive logging framework built in.</p>

<p>One thing that isn't mentioned in my answer is how to filter your log messages according to error type: information, error, critical etc. It's fairly easy to do with TraceListeners, but requires quite a few extra lines of XML in your web.config/app.config. The example below shows how to filter information messages, it's setup to use the eventlog and write to the ASP.NET category, which is necessary with web apps if the user you are running the app pool with doesn't have admin access, or the registry key for a new event log source doesn't exist.</p>

<pre><code>&lt;system.diagnostics&gt;
    &lt;!-- Add multiple sources for varying levels of tracing --&gt;
    &lt;sources&gt;
        &lt;source name="debugSource" switchName="defaultSwitch" switchType="System.Diagnostics.SourceSwitch"&gt;
            &lt;listeners&gt;
                &lt;add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="ASP.NET 2.0.50727.0" /&gt;
            &lt;/listeners&gt;
        &lt;/source&gt;
    &lt;/sources&gt;
    &lt;switches&gt;
        &lt;add name="defaultSwitch" value="Error"/&gt;&lt;!-- See System.Diagnostics.SourceLevels enum --&gt;
    &lt;/switches&gt;

    &lt;trace autoflush="false" indentsize="4"&gt;
        &lt;listeners&gt;
            &lt;add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="ASP.NET 2.0.50727.0" /&gt;
        &lt;/listeners&gt;
    &lt;/trace&gt;
&lt;/system.diagnostics&gt;
</code></pre>

<p>You should be using a wrapper/Façade class for the logging so you can have a single entry point and class with one responsibility in your app. Checking for the output level is then easy:</p>

<pre><code>private TraceSource _traceSource  = new TraceSource("defaultSource");

public void LogInformation(string message,object params args)
{
    if ((_traceSource.Switch.Level &amp; SourceLevels.Information) == SourceLevels.Information)
    {
    ...
    }
}
</code></pre>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-15012522.xml</wfw:commentRss></item><item><title>Parsing XFDF (PDF annotations) in C#</title><category>pdf</category><category>xfdf</category><dc:creator>Chris S</dc:creator><pubDate>Tue, 07 Feb 2012 22:32:41 +0000</pubDate><link>http://www.yetanotherchris.me/home/2012/2/7/parsing-xfdf-pdf-annotations-in-c.html</link><guid isPermaLink="false">1111787:12911737:14921619</guid><description><![CDATA[<p>I'm in the middle of doing the final two modules of the 3rd year of my part-time Computer Science degree, which means going back to the books. I've gone through virtually every note taking technique possible for the reading over the years - textbook + pencil on the tube, Pulse pen, converting PDFs by hand for the Kindle and netbook. This year I've decided to try something different, and use the annotations functionality built into the PDF 9+ format. Fortunately the Open University provides most of the course reading in PDF format (except <a href="http://www.id-book.com/">this book</a>,  the main course text of one module). There's no lectures and occasional seminars so the majority of your time is spent reading the course texts and doing the activities for each assignment.</p>

<p>So far PDF annotations have been quite successful for me, and cut down on the arduous task I had in past years of typing up my notes into Google Docs. I'm using RepliGo on my Android phone for the annotations as it's bar far the most polished and smoothest, although I did buy + try Foxit and EzPdf. Even better is I can read/squint at my phone while I'm crammed into a commuter train each morning.</p>

<p>Of all the PDF readers there are, mobile or desktop, none provide the annotations as plain text. It's frustrating as RepliGo stamps its name in the title of the annotation, which ends up in the exported annotations PDF (which Foxit does provide). Luckily Foxit desktop, and a few of the Android readers, provide an export to XFDF feature - a new Adobe file format I discovered yesterday.</p>

<p>XFDF is Adobe's PDF format format, which is just XML. Foxit can export to this format, giving you something similar to:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"&gt;
    &lt;annots&gt;
        &lt;highlight page="5" color="#ffff00" date="D:20120202165351Z00'00'" rect="141.36,518.13,538.56,569.96" 
            title="RepliGo Reader" creationdate="D:20120202165351Z00'00'" 
            opacity="1.0" subject="Your text" coords="..."/&gt;
        ....
    &lt;/annots&gt;
    &lt;fields/&gt;
    &lt;f href="unit2.pdf"/&gt;
    &lt;ids original="3f6a55fb77e99aa479b4fce428bb0ebb" modified="b8903ee8c6c74e19b95bcdca02eb1809"/&gt;
&lt;/xfdf&gt;
</code></pre>

<p>So in order for me to turn this into a Google docs friendly format, I present my 14-liner solution that every PDF reader didn't think was necessary to provide us poor students with:</p>

<pre><code>static void Main(string[] args)
{
    string xml = File.ReadAllText("export.xfdf", Encoding.UTF8);
    XDocument doc = XDocument.Load(new StringReader(xml));
    var elements = doc.Root.Element(XName.Get("annots", "http://ns.adobe.com/xfdf/")).
                    Elements(XName.Get("highlight", "http://ns.adobe.com/xfdf/"))
                    .OrderBy(e =&gt; int.Parse(e.Attribute("page").Value));

    StringBuilder builder = new StringBuilder();
    builder.Append("&lt;html&gt;&lt;body&gt;");
    foreach (XElement element in elements)
    {
        builder.AppendFormat("&lt;p&gt;{0}&lt;/p&gt;", element.Attribute("subject").Value);
    }
    builder.Append("&lt;/body&gt;&lt;/html&gt;");

    File.WriteAllText(@"C:\annotations.html", builder.ToString(), Encoding.Unicode);
}
</code></pre>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-14921619.xml</wfw:commentRss></item><item><title>Why I'm so Tired (UK edition)</title><category>misc</category><dc:creator>Chris S</dc:creator><pubDate>Thu, 12 Jan 2012 21:46:54 +0000</pubDate><link>http://www.yetanotherchris.me/home/2012/1/12/why-im-so-tired-uk-edition.html</link><guid isPermaLink="false">1111787:12911737:14556012</guid><description><![CDATA[<p>This is a modification of <a href="http://www.stanford.edu/~dement/tired.html">this page</a> that I adjusted for 2012 UK statistics.</p>

<p>I'm tired because I'm overworked. Let me explain...</p>

<ul>
<li>The population of the UK is 62 million. 9 million are retired. That leaves 55 million to do the work.</li>
<li>There are 12 million who are underage or still in school, and 30 people who are still working on their PhD's since the 50's, which leave 42 million to do the work.</li>
<li>Two hundred thousand are in the Armed Forces, which leaves forty one and a half million to do the work.</li>
<li>Of this there are 6 million employed by the public sector. This leaves 35.5 million to do the work. </li>
<li>Now, there are 100,000 people in prisons, so that leaves 35.4 million to do the work.</li>
<li>There are 1.6 million unemployed, leaving 33.8 million to do the work.</li>
<li>There are 50,200 people being treated in hospitals, at doctor appointments, or on sick leave today. That leaves just <strike>35,399,999 people</strike> two people to do the work.</li>
<li>You and me.</li>
</ul>

<p>And you're sitting there playing around on the Internet!</p>

<p><em>All that time researching the UK figures, and I realised the stats on the original page are completely made up.</em></p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-14556012.xml</wfw:commentRss></item><item><title>SOPA: How to transfer your domains from Godaddy.com</title><category>godaddy</category><category>sopa</category><dc:creator>Chris S</dc:creator><pubDate>Mon, 26 Dec 2011 20:41:56 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/12/26/sopa-how-to-transfer-your-domains-from-godaddycom.html</link><guid isPermaLink="false">1111787:12911737:14333839</guid><description><![CDATA[<p>I'm not really fuming about the SOPA issue as I live in the UK, however given <a href="http://en.wikipedia.org/wiki/DNS_root_zone">the amount of DNS control the US has</a>, it is worth giving a little-bit-of-a-crap about.</p>

<p>If you happen to use Godaddy for your domains, you might be considering moving away from them after it was revealed that they played quite a big part in penning the details of SOPA (mostly for their own business gain).</p>

<p><a href="http://blog.jeffepstein.me/post/14629857835/a-step-by-step-guide-to-transfer-domains-out-of-godaddy">Here's a great post</a> on how to transfer your domains to Namecheap.com who are against the SOPA legislation. You give the author a referral but that's fine with me. You can also check which big websites still use Godaddy on <a href="http://byedaddy.org/">Byedaddy.org</a></p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-14333839.xml</wfw:commentRss></item><item><title>Spruce 1.1 released</title><category>spruce</category><category>tfs</category><dc:creator>Chris S</dc:creator><pubDate>Mon, 12 Dec 2011 21:15:52 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/12/12/spruce-11-released.html</link><guid isPermaLink="false">1111787:12911737:14079347</guid><description><![CDATA[<p>I've just released a new minor version of Spruce - my open source ASP.NET MVC project for Team Foundation Server. The minor increment fixes a few issues, but also (barring bug fixes) ends the development cycle of the project. I'm not planning on adding any new features or support for new work items to Spruce in the future. It's now got support for MS Agile's Bugs, Tasks, Issue work items and doesn't support the other three work items.</p>

<p>I'm hoping we get a pleasant surprise with the next version of Team Foundation Server, with a UI that moves away from the awful Office/OWA style to something that matches modern DVC websites, like you find with Github, Bitbucket and to some degree Codeplex. Infact if they shipped the Codeplex interface with TFS it would be an improvement. I know Microsoft were recruiting for WPF developers for their TFS team so there's promise there, but they're behind the whole Ruby/Google/Amazon/Git/NoSQL crowd in establishing their presence in the format of a diverse online toolset for developers. You get MSDN.com and the MVC team's efforts and that's about it. Appharbor.com and TeamBuild Server are examples of holes that have been plugged by other companies when Microsoft themselves could probably produce an awesome product, instead of being stuck in the early noughties Winforms world and flogging the dead Silverlight horse. </p>

<p>Anyway ranting aside, Spruce can be found at <a href="http://spruce.codeplex.com">Codeplex</a>.</p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-14079347.xml</wfw:commentRss></item><item><title>403 Forbidden errors with ASP.NET MVC 3</title><category>asp.net</category><category>mvc3</category><dc:creator>Chris S</dc:creator><pubDate>Sun, 20 Nov 2011 19:43:30 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/11/20/403-forbidden-errors-with-aspnet-mvc-3.html</link><guid isPermaLink="false">1111787:12911737:13797817</guid><description><![CDATA[<p>Have you just created an ASP.NET MVC 3 site on your local/developer box to use Windows authentication, mapped it correctly and then continually got an authentication box appearing even though you're typing the username/password correctly? And the permissions on disk are fine, you even have everyone mapped to the root folder.</p>

<p>When you cancel, you get a 403.1 or 403.x error. As I discovered this error comes from a security feature of Windows Vista/7 that stops loop back auth checks which essentially cripples your windows authentication settings without changing the registry. <strong>It only ever happens when you're testing the site on localhost, or using a domain that's mapped to 127.0.0.1 in your hosts file or DNS server.</strong></p>

<p>There's a support.microsoft.com page about it <a href="http://support.microsoft.com/kb/896861">here</a>, but the most reliable fix is the 1st of the two options. Here's the relevant parts:</p>

<blockquote>
  <p>In Registry Editor, locate and then click the following registry key:
  HKEY<em>LOCAL</em>MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0</p>
  
  <p>Right-click MSV1_0, point to New, and then click Multi-String Value.</p>
  
  <p>Type BackConnectionHostNames, and then press ENTER.</p>
  
  <p>Right-click BackConnectionHostNames, and then click Modify.</p>
  
  <p>In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.</p>
</blockquote>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-13797817.xml</wfw:commentRss></item><item><title>To Squarespace.com and Beyond!</title><category>news</category><dc:creator>Chris S</dc:creator><pubDate>Sun, 20 Nov 2011 14:25:38 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/11/20/to-squarespacecom-and-beyond.html</link><guid isPermaLink="false">1111787:12911737:13797687</guid><description><![CDATA[<p>As you've probably noticed if you're one of the 10 people who don't browse the site for less than 40 seconds (that's 99% of the traffic), the URL has changed and the design too. I've moved all my content over from the dedicated Win 2008 server running N2 to Squarespace.com, saving me about £25 a month.</p>

<p>I wasn't that keen on the domain name of the old site, and it was hosted on a virtual dedicated server which was a waste of money for the traffic I get. I did consider doing this a few years ago when I moved to N2, but at the time no blog engines had what I needed for the site.</p>

<p>Fortunately they now do, markdown is supported by all blog sites along with some HTML support and generous amounts of bandwidth and disk space. Being able to post your own HTML and upload your own Javascript, XAPs, and tinker with the CSS/JS/HTML is fairly important for a develop blog though, I tried out Posterous, Tumblr, Wordpress-hosted and Typepad and settled with Squarespace as they let you do whatever you want to your site, bar server-side processing. I think Squarespace is probably the slickest CMS system I've used, they've definitely got a good UI team hidden away in New York.</p>

<p>In the site move I've culled the PHP and Perl snippets - no tears shed there - and lost a few of the tools - the syntax highlighter, network tools, google postcode parser and the <a href="http://docy.codeplex.com">docy</a> subdomain. There's better tools out there on the web so no real loss.</p>

<p>Apart from the price change, the biggest improvement of my new hosted CMS/Blog setup is not having to worry about backups or downtime. The 'screw this' moment that made me move was my old server's application pools suddenly stopping for a day last month where I couldn't remote desktop in to restart them and a server reboot would've taken 4 hours. It all seemed to be a bit of a waste of my life fiddling with IIS for something as trivial as a blog.</p>

<p>So now I'm all setup and ready to blog, blog, blog - get ready for at least a post a month!</p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-13797687.xml</wfw:commentRss></item><item><title>Random photo of the month</title><category>photos</category><dc:creator>Chris S</dc:creator><pubDate>Wed, 09 Nov 2011 23:44:00 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/11/9/random-photo-of-the-month.html</link><guid isPermaLink="false">1111787:12911737:13765363</guid><description><![CDATA[<p><span class="full-image-block ssNonEditable"><span><img src="http://www.yetanotherchris.me/storage/photos/captialism1.jpg?__SQUARESPACE_CACHEVERSION=1321573500435" alt=""/></span></span></p>

<p>One of the posters found at occupy St Pauls.</p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-13765363.xml</wfw:commentRss></item><item><title>A new Spruce UI, a big refactor and a release candidate!</title><category>spruce</category><category>tfs</category><category>ui</category><dc:creator>Chris S</dc:creator><pubDate>Sat, 22 Oct 2011 19:26:00 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/10/22/a-new-spruce-ui-a-big-refactor-and-a-release-candidate.html</link><guid isPermaLink="false">1111787:12911737:13814882</guid><description><![CDATA[<p>It’s been roughly a year since I started the Spruce project, back in November 2010. Over the course of a year it’s had a lot of hold-ups and could be mistaken for yet another open source project where the author excitedly starts the project and then ditches it after about 3 beta releases. It’s also understandably not had much interest – I would guess that small .NET/C++ teams generally use Fogbugz, JIRA and other web-based bug and task tracking tools, while larger teams will either use TFS with the CMMI project type or the Scrum dashboards via tools like Urban Turtle and the Scrum Dashboard, or just Visual Studio.</p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-13814882.xml</wfw:commentRss></item><item><title>Using Spruce on a different web server from TFS</title><category>iis</category><category>spruce</category><category>tfs</category><dc:creator>Chris S</dc:creator><pubDate>Sun, 16 Oct 2011 19:22:00 +0000</pubDate><link>http://www.yetanotherchris.me/home/2011/10/16/using-spruce-on-a-different-web-server-from-tfs.html</link><guid isPermaLink="false">1111787:12911737:13814838</guid><description><![CDATA[<p>One of the big issues I’ve come up against when developing Spruce has been using the website on a different web server from the one TFS runs as. By default TFS creates itself as ‘Team Foundation Server’ as a separate site inside IIS. As its API is entirely web services based, this is where your calls are made to, the .NET assemblies simply wrap these HTTP calls up in an easy to use package.</p>
]]></description><wfw:commentRss>http://www.yetanotherchris.me/home/rss-comments-entry-13814838.xml</wfw:commentRss></item></channel></rss>
