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

<channel>
	<title>Purposeful Procrastination &#187; Programming</title>
	<atom:link href="http://jtnlex.com/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://jtnlex.com/blog</link>
	<description>It'll be useful someday, surely.</description>
	<lastBuildDate>Fri, 25 Jun 2010 03:52:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using asymmetric properties in views</title>
		<link>http://jtnlex.com/blog/2010/06/16/using-asymmetric-properties-in-views/</link>
		<comments>http://jtnlex.com/blog/2010/06/16/using-asymmetric-properties-in-views/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 12:13:34 +0000</pubDate>
		<dc:creator>JT</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[programming tips]]></category>

		<guid isPermaLink="false">http://jtnlex.com/blog/?p=76</guid>
		<description><![CDATA[Many people separate their business logic and view classes into two or more separate assemblies. This gives rise to the ability to use an asymmetric set for view properties that aren&#8217;t meant to be accessible. Simply put: public string SomeProperty { get; internal set; } The internal modifier means that this property is only accessible [...]]]></description>
			<content:encoded><![CDATA[<p>Many people separate their business logic and view classes into two or more separate assemblies. This gives rise to the ability to use an asymmetric set for view properties that aren&#8217;t meant to be accessible.</p>
<p>Simply put:</p>
<pre class="brush:csharp">
public string SomeProperty { get; internal set; }
</pre>
<p>The <code>internal</code> modifier means that this property is only accessible to classes in the same assembly. Obviously asymmetric properties in general are applicable in other scenarios. Note too that while this is using the compact property syntax, the same principle holds for explicit setters.</p>
]]></content:encoded>
			<wfw:commentRss>http://jtnlex.com/blog/2010/06/16/using-asymmetric-properties-in-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Docs API: get all spreadsheets/docs in a folder</title>
		<link>http://jtnlex.com/blog/2010/06/09/google-docs-api-get-all-spreadsheetsdocs-in-a-folder/</link>
		<comments>http://jtnlex.com/blog/2010/06/09/google-docs-api-get-all-spreadsheetsdocs-in-a-folder/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 13:39:22 +0000</pubDate>
		<dc:creator>JT</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[google docs]]></category>
		<category><![CDATA[google docs api]]></category>
		<category><![CDATA[programming tips]]></category>

		<guid isPermaLink="false">http://jtnlex.com/blog/?p=67</guid>
		<description><![CDATA[It&#8217;s easy enough to get a list of spreadsheets for a user, or a list of folders, but there&#8217;s a trick to getting the contents of a folder. The first part of the trick is to ignore the category. Firstly, because it&#8217;s removed in version 3.0 of the API, and secondly because it filters by [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy enough to get a list of spreadsheets for a user, or a list of folders, but there&#8217;s a trick to getting the contents of a folder.</p>
<p>The first part of the trick is to ignore the category. Firstly, because it&#8217;s removed in version 3.0 of the API, and secondly because it filters by name. This means that if you have 2 folders with the same name you&#8217;ll get dodgey results.</p>
<p>To do it right?<br />
<span id="more-67"></span></p>
<pre class="brush:csharp">
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Documents;

// snipped method declaration etc

var docService = new DocumentsService("company-app-version");
docService.setUserCredentials("username", "password");

var folderList = docService.Query(new FolderQuery());
var fLinks = folderList.Entries.Select(e =>
    new
    {
        // note how to get the document Id of the folder
        Id = DocumentsListQuery.DocumentId(e.Id.AbsoluteUri),
        Name = e.Title.Text
    });

foreach (var folder in fLinks)
{
    Console.WriteLine("Folder {0}", folder.Name);

    var fileList = docService.Query(
        new SpreadsheetQuery()
        {
            // setting the base address to the folder's URI restricts your results
            BaseAddress = DocumentsListQuery.folderBaseUri + folder.Id
        });

    foreach (var file in fileList.Entries)
    {
        Console.WriteLine(" - {0}", file.Title.Text);
    }
}
</pre>
<p>This will give you a list of the files in all your folders. Note you can get a list of all files in all folders a lot easier than this. That&#8217;s not the point: use this technique when you <em>don&#8217;t</em> want to get the whole list and filter after the fact.</p>
<p>Pertinent points:</p>
<ul>
<li>Line 15: getting the Id of the folder from its URI</li>
<li>Line 27: setting the base URI of the query to be the folder prefix and the folder&#8217;s Id.</li>
</ul>
<p>I wish I&#8217;d found this quicker&#8230;</p>
<p>(Updated to add clarification about example, and a couple of comments in the code)</p>
]]></content:encoded>
			<wfw:commentRss>http://jtnlex.com/blog/2010/06/09/google-docs-api-get-all-spreadsheetsdocs-in-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert file path to file URL</title>
		<link>http://jtnlex.com/blog/2010/05/21/convert-file-path-to-file-url/</link>
		<comments>http://jtnlex.com/blog/2010/05/21/convert-file-path-to-file-url/#comments</comments>
		<pubDate>Fri, 21 May 2010 06:59:38 +0000</pubDate>
		<dc:creator>JT</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://jtnlex.com/blog/?p=63</guid>
		<description><![CDATA[A very short note: I was trying to find an analogue to Java&#8217;s File.toURI().toURL() method in .NET, looking through System.IO et al, and not finding it on the lazyweb. To my surprise, all you need use is UriBuilder: new UriBuilder(@"c:\path\to\file.txt").ToString(); This will output &#8220;file://c:/path/to/file.txt&#8220;. Simple, but far too much time wasted finding it&#8230;]]></description>
			<content:encoded><![CDATA[<p>A very short note: I was trying to find an analogue to Java&#8217;s <code>File.toURI().toURL()</code> method in .NET, looking through <code>System.IO</code> et al, and not finding it on the lazyweb.</p>
<p>To my surprise, all you need use is UriBuilder:</p>
<pre class="brush:csharp">
new UriBuilder(@"c:\path\to\file.txt").ToString();
</pre>
<p>This will output &#8220;<code>file://c:/path/to/file.txt</code>&#8220;. Simple, but far too much time wasted finding it&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jtnlex.com/blog/2010/05/21/convert-file-path-to-file-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
