PageRenderTime 54ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/QFeedParser.Tests/Test Files/Valid/FileSys/RSS/Aaronontheweb-RSS.xml

#
XML | 967 lines | 938 code | 29 blank | 0 comment | 0 complexity | c218600cd157d7b8b7ef973c75be2edb MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  3. <channel>
  4. <title>Aaronontheweb</title>
  5. <description>.NET Development with Social Media APIs</description>
  6. <link>http://www.aaronstannard.com/</link>
  7. <docs>http://www.rssboard.org/rss-specification</docs>
  8. <generator>BlogEngine.NET 1.6.1.0</generator>
  9. <language>en-GB</language>
  10. <blogChannel:blogRoll>http://www.aaronstannard.com/opml.axd</blogChannel:blogRoll>
  11. <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
  12. <dc:creator>Aaron Stannard</dc:creator>
  13. <dc:title>Aaronontheweb</dc:title>
  14. <geo:lat>0.000000</geo:lat>
  15. <geo:long>0.000000</geo:long>
  16. <item>
  17. <title>How to Query a User's del.icio.us Feed with RestSharp</title>
  18. <description>
  19. &lt;p&gt;I've been meaning to give &lt;a href="http://restsharp.org/"&gt;RestSharp&lt;/a&gt; a go since I first started using Hammock in my startup project's codebase, just because &lt;a href="http://herdingcode.com/?p=244"&gt;I had heard&amp;nbsp;some good things&amp;nbsp;about&amp;nbsp;RestSharp's auto-parsing capabilities&lt;/a&gt;.&lt;/p&gt;
  20. &lt;p&gt;This weekend I cobbled together a small example using del.icio.us' RSS feeds (not to be confused with its draconian REST API) for users and RestSharp performed magnificently, although its POCO -&amp;gt; XML Element mapping process requires a lot of experimentation before you get it just right.&lt;/p&gt;
  21. &lt;p&gt;Here's an example RSS feed for &lt;a href="http://delicious.com/Aaronontheweb"&gt;my personal del.icio.us account&lt;/a&gt;:&lt;/p&gt;
  22. &lt;pre class="brush: xml;"&gt;&amp;lt;rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/"&amp;gt;
  23. &amp;lt;channel&amp;gt;
  24. &amp;lt;title&amp;gt;Delicious/Aaronontheweb&amp;lt;/title&amp;gt;
  25. &amp;lt;link&amp;gt;http://delicious.com/Aaronontheweb&amp;lt;/link&amp;gt;
  26. &amp;lt;description&amp;gt;bookmarks posted by Aaronontheweb&amp;lt;/description&amp;gt;
  27. &amp;lt;atom:link rel="self" type="application/rss+xml" href="http://feeds.delicious.com/v2/rss/Aaronontheweb?count=2"/&amp;gt;
  28. &amp;lt;item&amp;gt;
  29. &amp;lt;title&amp;gt;Windows Presentation Foundation (WPF) Dialog Boxes Overview&amp;lt;/title&amp;gt;
  30. &amp;lt;pubDate&amp;gt;Fri, 04 Jun 2010 23:48:12 +0000&amp;lt;/pubDate&amp;gt;
  31. &amp;lt;guid isPermaLink="false"&amp;gt;[REMOVED]&amp;lt;/guid&amp;gt;
  32. &amp;lt;link&amp;gt;http://msdn.microsoft.com/en-us/library/aa969773.aspx&amp;lt;/link&amp;gt;
  33. &amp;lt;dc:creator&amp;gt;&amp;lt;![CDATA[Aaronontheweb]]&amp;gt;&amp;lt;/dc:creator&amp;gt;
  34. &amp;lt;comments&amp;gt;[REMOVED]&amp;lt;/comments&amp;gt;
  35. &amp;lt;wfw:commentRss&amp;gt;[REMOVED]&amp;lt;/wfw:commentRss&amp;gt;
  36. &amp;lt;source url="http://feeds.delicious.com/v2/rss/Aaronontheweb"&amp;gt;Aaronontheweb's bookmarks&amp;lt;/source&amp;gt;
  37. &amp;lt;description&amp;gt;How to use dialog boxes in WPF (for WPF noobs like myself.)&amp;lt;/description&amp;gt;
  38. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;.net&amp;lt;/category&amp;gt;
  39. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;wpf&amp;lt;/category&amp;gt;
  40. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;dialogs&amp;lt;/category&amp;gt;
  41. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;tutorial&amp;lt;/category&amp;gt;
  42. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;nullable&amp;lt;/category&amp;gt;
  43. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;c#&amp;lt;/category&amp;gt;
  44. &amp;lt;/item&amp;gt;
  45. &amp;lt;item&amp;gt;
  46. &amp;lt;title&amp;gt;Developer's Guide: Data API Protocol - YouTube APIs and Tools - Google Code&amp;lt;/title&amp;gt;
  47. &amp;lt;pubDate&amp;gt;Mon, 31 May 2010 22:43:47 +0000&amp;lt;/pubDate&amp;gt;
  48. &amp;lt;guid isPermaLink="false"&amp;gt;[REMOVED]&amp;lt;/guid&amp;gt;
  49. &amp;lt;link&amp;gt;[REMOVED]&amp;lt;/link&amp;gt;
  50. &amp;lt;dc:creator&amp;gt;&amp;lt;![CDATA[Aaronontheweb]]&amp;gt;&amp;lt;/dc:creator&amp;gt;
  51. &amp;lt;comments&amp;gt;[REMOVED]&amp;lt;/comments&amp;gt;
  52. &amp;lt;wfw:commentRss&amp;gt;[REMOVED]&amp;lt;/wfw:commentRss&amp;gt;
  53. &amp;lt;source url="http://feeds.delicious.com/v2/rss/Aaronontheweb"&amp;gt;Aaronontheweb's bookmarks&amp;lt;/source&amp;gt;
  54. &amp;lt;description&amp;gt;Finally figured it out - how to sign all requests with my API key using a querystring. So simple, yet so difficult.&amp;lt;/description&amp;gt;
  55. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;youtube&amp;lt;/category&amp;gt;
  56. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;API&amp;lt;/category&amp;gt;
  57. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;key&amp;lt;/category&amp;gt;
  58. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;Google&amp;lt;/category&amp;gt;
  59. &amp;lt;category domain="http://delicious.com/Aaronontheweb/"&amp;gt;gdata&amp;lt;/category&amp;gt;
  60. &amp;lt;/item&amp;gt;
  61. &amp;lt;/channel&amp;gt;
  62. &amp;lt;/rss&amp;gt;&lt;/pre&gt;
  63. &lt;p&gt;The best way to utilize RestSharp to parse any sort of API response, whether it's custom REST XML, JSON, Atom, or RSS, is to first take a look at the raw response format and then to try to model a set of&amp;nbsp;Data Transfer Objects (DTOs) which&amp;nbsp;contain the response format elements you want to actually&amp;nbsp;use in your application. Your DTOs just need to be simple POCO objects for this to work, but there are a set of &lt;a href="http://wiki.github.com/johnsheehan/RestSharp/deserialization"&gt;POCO-XML Element matching&amp;nbsp;rules&lt;/a&gt; you need to observe if you're using RestSharp's default deserializer - &lt;a href="http://wiki.github.com/johnsheehan/RestSharp/deserialization"&gt;you can read them here&lt;/a&gt;.&lt;/p&gt;
  64. &lt;p&gt;Here are the classes that I modeled for this RSS format:&lt;/p&gt;
  65. &lt;pre class="brush: c-sharp;"&gt;public class RssFeed
  66. {
  67. public string Version { get; set; }
  68. public RssChannel Channel { get;set; }
  69. }
  70. public class RssChannel
  71. {
  72. public string Title { get; set; }
  73. public string Description { get; set; }
  74. public string Link { get; set; }
  75. public RssItems Item { get; set; }
  76. }
  77. public class RssItems : List&amp;lt;item&amp;gt;{}
  78. public class item
  79. {
  80. public string Title { get; set; }
  81. public string Description { get; set; }
  82. public string Link { get; set; }
  83. public string Author { get; set; }
  84. public string Comments { get; set; }
  85. public string PubDate { get; set; }
  86. }&lt;/pre&gt;
  87. &lt;p&gt;This diagram explains how these DTO classes map to the del.icio.us RSS format:&lt;/p&gt;
  88. &lt;p style="text-align:center;"&gt;&lt;a title="del.icio.us restsharp POCO class to XML document mapping by Aaronontheweb, on Flickr" href="http://www.flickr.com/photos/50581866@N06/4701896653/"&gt;&lt;img src="http://farm5.static.flickr.com/4062/4701896653_08da0eaeb9.jpg" alt="del.icio.us restsharp POCO class to XML document mapping" width="488" height="286" /&gt;&lt;/a&gt;&lt;/p&gt;
  89. &lt;blockquote&gt;
  90. &lt;p&gt;&lt;strong&gt;ProTip: Handling Lists of XML Elements with POCO Classes&lt;/strong&gt;&lt;/p&gt;
  91. &lt;p&gt;One thing that's a bit tricky is handling lists of XML elements, such as the &lt;span style="font-family: courier new,courier;"&gt;&amp;lt;item&amp;gt;&lt;/span&gt; elements in this case. In order for RestSharp to&amp;nbsp;deserialize&amp;nbsp;them, you need&amp;nbsp;create a List&amp;lt;T&amp;gt; object where the name of&amp;nbsp;class&amp;nbsp;T matches the name of the listed element, which is why my class name is &lt;span style="font-family: courier new,courier;"&gt;item&lt;/span&gt; in this case.&lt;/p&gt;
  92. &lt;/blockquote&gt;
  93. &lt;p&gt;Once you have your POCO classes in order, then you need to actually make requests against the del.icio.us feed for a particular user. Here's&amp;nbsp;my code for doing that:&lt;/p&gt;
  94. &lt;pre class="brush: c-sharp;"&gt;public class DeliciousRequest
  95. {
  96. public const string DeliciousFeedBase = @"http://feeds.delicious.com/v2/rss/";
  97. private RestSharp.RestClient _client;
  98. public DeliciousRequest()
  99. {
  100. this._client = new RestClient
  101. {
  102. BaseUrl = DeliciousFeedBase
  103. };
  104. }
  105. public RssFeed GetBookMarksForUser(string username)
  106. {
  107. var request = new RestRequest {RequestFormat = DataFormat.Xml, Resource = username};
  108. var response = this._client.Execute&amp;lt;RssFeed&amp;gt;(request);
  109. return response.Data;
  110. }
  111. }&lt;/pre&gt;
  112. &lt;p&gt;All RSS feeds for del.icio.us users can be found using http://feeds.delicious.com/v2/rss/{USERNAME}, therefore you can understand why the &lt;span style="font-family: courier new,courier;"&gt;RestClient&lt;/span&gt;'s BaseURL and the &lt;span style="font-family: courier new,courier;"&gt;RestRequest&lt;/span&gt;'s Resource arguments are defined as they are. Once you have your &lt;span style="font-family: courier new,courier;"&gt;RestRequest&lt;/span&gt; defined, you simply call the client's &lt;span style="font-family: courier new,courier;"&gt;Execute&amp;lt;T&amp;gt;&lt;/span&gt; method where T is the type of your POCO DTO class.&lt;/p&gt;
  113. &lt;p&gt;And that's it - RestSharp is easy, and I look forward to creating some more examples with it down the road.&lt;/p&gt;
  114. &lt;p&gt;&lt;strong&gt;More RestSharp Examples&lt;/strong&gt;:&lt;/p&gt;
  115. &lt;ul&gt;
  116. &lt;li&gt;&lt;a href="http://www.stum.de/2009/12/22/using-restsharp-to-consume-restful-web-services/"&gt;Using RestSharp to Consume RESTful Web Services&lt;/a&gt;&lt;/li&gt;
  117. &lt;li&gt;&lt;a href="http://lukencode.com/2010/04/14/google-weather-api-with-restsharp/"&gt;Google Weather API with RestSharp&lt;/a&gt;&lt;/li&gt;
  118. &lt;/ul&gt;
  119. &lt;div class="addthis_toolbox addthis_default_style" style="padding-top:10px" &gt;
  120. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f14%2fHow-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx&amp;title=How+to+Query+a+User's+del.icio.us+Feed+with+RestSharp&amp;description="&gt;&lt;img src="http://s7.addthis.com/static/btn/v2/sm-share-en.gif" alt="Bookmark and Share" style="border:0"/&gt;&lt;/a&gt;
  121. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f14%2fHow-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx&amp;title=How+to+Query+a+User's+del.icio.us+Feed+with+RestSharp&amp;description=&amp;s=dotnetkicks"&gt;&lt;img src="http://dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f14%2fHow-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx" border="0" alt="DotnetKicks" /&gt;&lt;/a&gt;
  122. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f14%2fHow-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx&amp;title=How+to+Query+a+User's+del.icio.us+Feed+with+RestSharp&amp;description=&amp;s=dotnetshoutout"&gt;&lt;img style="height:19px" height="19px" src="http://dotnetshoutout.com/image.axd?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f14%2fHow-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx" border="0" alt="dotnetshoutout" /&gt;&lt;/a&gt;
  123. &lt;/div&gt;&lt;p style="margin-top:15px;"&gt;&lt;em&gt;If you enjoyed this post, remember to &lt;a style="background:none;padding-right:0px;" href="http://www.aaronstannard.com/syndication.axd"&gt;subscribe to my RSS feed&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;
  124. </description>
  125. <link>http://www.aaronstannard.com/post/2010/06/14/How-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx</link>
  126. <author>Aaronontheweb</author>
  127. <comments>http://www.aaronstannard.com/post/2010/06/14/How-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx#comment</comments>
  128. <guid>http://www.aaronstannard.com/post.aspx?id=65c351cf-dfd5-4508-a2b9-6f9c2a5c1251</guid>
  129. <pubDate>Mon, 14 Jun 2010 12:26:00 -1200</pubDate>
  130. <category>.NET</category>
  131. <category>Del.icio.us</category>
  132. <dc:publisher>Aaronontheweb</dc:publisher>
  133. <pingback:server>http://www.aaronstannard.com/pingback.axd</pingback:server>
  134. <pingback:target>http://www.aaronstannard.com/post.aspx?id=65c351cf-dfd5-4508-a2b9-6f9c2a5c1251</pingback:target>
  135. <slash:comments>1</slash:comments>
  136. <trackback:ping>http://www.aaronstannard.com/trackback.axd?id=65c351cf-dfd5-4508-a2b9-6f9c2a5c1251</trackback:ping>
  137. <wfw:comment>http://www.aaronstannard.com/post/2010/06/14/How-to-Parse-a-Users-Delicious-Feed-with-RestSharp.aspx#comment</wfw:comment>
  138. <wfw:commentRss>http://www.aaronstannard.com/syndication.axd?post=65c351cf-dfd5-4508-a2b9-6f9c2a5c1251</wfw:commentRss>
  139. </item>
  140. <item>
  141. <title>The Myth of the Single-Person Startup</title>
  142. <description>
  143. &lt;p&gt;&lt;a title="Lonely Road by Matt and Kim Rudge, on Flickr" href="http://www.flickr.com/photos/mattandkim/3734982429/"&gt;&lt;img style="margin: 0px 0px 10px 10px; display: inline" src="http://farm3.static.flickr.com/2594/3734982429_6bb7844bef.jpg" alt="Lonely Road" width="402" height="268" align="right" /&gt;&lt;/a&gt;&lt;/p&gt;
  144. &lt;p&gt;During the month of May, 2010 I took an unpaid leave of absence from work for the entire month and set off to launch my own web-based startup company.&lt;/p&gt;
  145. &lt;p&gt;&lt;a title="Lonely Road by Matt and Kim Rudge, on Flickr" href="http://www.flickr.com/photos/mattandkim/3734982429/"&gt;&lt;/a&gt;&lt;/p&gt;
  146. &lt;p&gt;My objective was to take a month off work, shut myself away in my apartment, spend a month coding up all of the basic plumbing I needed to get the first core part of my service in working order, and profit. Needless to say, &lt;strong&gt;I failed to reach my goals&lt;/strong&gt;,&amp;nbsp; but not for any of the typical reasons like poor project planning, lack-of-focus, and so forth. No, I failed because I took the experiences of other entrepreneurs too literally and tried to &amp;ldquo;be my own boss,&amp;rdquo; without appreciating what that really means.&lt;/p&gt;
  147. &lt;h3&gt;Success doesn't occur in a vaccuum&lt;/h3&gt;
  148. &lt;p&gt;I grew up with a father who successfully launched his own self-funded business and made it look easy. Naturally, being the 24 year-old who doesn&amp;rsquo;t know any better, I figured it was as easy as having the technical knowledge to engineer my own product, having a good eye&amp;nbsp;for end-user requirements, having a decent business plan, and enough time / resources to actually put something to market.&lt;/p&gt;
  149. &lt;p&gt;Naturally, when I finally secured the time I needed to begin engineering my product in earnest, I shut myself away, locked out virtually all human contact, and dove head first into my code. After all, that&amp;rsquo;s all what successful single-person startups do, right? &amp;ldquo;Sure,&amp;rdquo; I thought.&lt;/p&gt;
  150. &lt;p&gt;Twelve days into my project I&amp;nbsp;had to scrap&amp;nbsp;virtually every piece of code I had written &amp;ndash; everything. It was a disaster. I wiped the slate clean and started redesigning and refactoring the entire thing, and I still hadn&amp;rsquo;t said more than a few sentences about it to anybody. Bear in mind that I was living off of my savings, so&amp;nbsp;the time = money&amp;nbsp;factor&amp;nbsp;loomed large over my head.&amp;nbsp;I went back to work on my project, still determined to get something done.&lt;/p&gt;
  151. &lt;p&gt;With one week to go before I was due back at work, I bought lunch for the Chief Architect from my&amp;nbsp;regular job and had him take a look at some of my UML diagrams. I explained the domain I was working in, what I was trying to do, and what trouble I had run into thus far. In that one hour of speaking with him, I learned things that could have saved me the previous&amp;nbsp;three weeks of 16-hour days, sleepless nights, endless debugging, and lessons-learned-the-hard-way.&lt;/p&gt;
  152. &lt;blockquote&gt;
  153. &lt;p&gt;This is going to seem like a total &amp;ldquo;no shit&amp;rdquo; observation for people who&amp;rsquo;ve been around the block before, but bear with me: though there are many entrepreneurs who successfully start businesses where they are the sole founder and first employee, they never truly do it alone.&lt;/p&gt;
  154. &lt;p&gt;They use other colleagues as sounding boards for ideas; they run design ideas by people who are familiar with the business or engineering domain; they stay in touch with potential customers and clients all the way through the process; they operate in professional networks; and they do a much better job keeping friends and family in the loop than I did.&lt;/p&gt;
  155. &lt;/blockquote&gt;
  156. &lt;p&gt;I never looked at any of these contacts as must-have items before I set off on my own, and I got burned big time for it. I spent a substantial amount of time barking up the wrong trees and architecting solutions for the wrong problems, and all it would have taken to avoid that was some more collaboration and idea-sharing with people who were never going to be partners, employees, investors, et al.&lt;/p&gt;
  157. &lt;h3&gt;Stay in the loop with your people&lt;/h3&gt;
  158. &lt;p&gt;Lesson learned: the appeal of locking yourself in a confined space with nothing more than an Internet connection, a stack of programming books, and a mountain of pop tarts is significant if you&amp;rsquo;re young and tired of people telling you what to do.&lt;/p&gt;
  159. &lt;p&gt;However, isolating yourself from the world while you undertake a startup project is disastrous &amp;ndash; you don&amp;rsquo;t necessarily need partners working with you day-in and day-out on the project, but you absolutely need sounding boards and supportive people you can share ideas and experiences with, because ultimately if you don&amp;rsquo;t get some outside perspective on what you&amp;rsquo;re doing, you&amp;rsquo;ll make myopic decisions and stumble along the way.&lt;/p&gt;
  160. &lt;p&gt;Get feedback where you can; talk database schema with the DBA in the break room at your day job while he&amp;rsquo;s refilling his coffee; share your ongoing startup problems with family and friends who&amp;rsquo;ve launched businesses before; join online news groups and connect with other people familiar with your problem domain; just stay in contact.&lt;/p&gt;
  161. &lt;p&gt;Remember this: being independent isn't the same thing as being alone - always keep a network to support you even if their contributions never amount to something more than friendly advice and encouragement.&lt;/p&gt;
  162. &lt;div class="addthis_toolbox addthis_default_style" style="padding-top:10px" &gt;
  163. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f12%2fThe-Myth-of-the-Single-Person-Startup.aspx&amp;title=The+Myth+of+the+Single-Person+Startup&amp;description="&gt;&lt;img src="http://s7.addthis.com/static/btn/v2/sm-share-en.gif" alt="Bookmark and Share" style="border:0"/&gt;&lt;/a&gt;
  164. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f12%2fThe-Myth-of-the-Single-Person-Startup.aspx&amp;title=The+Myth+of+the+Single-Person+Startup&amp;description=&amp;s=dotnetkicks"&gt;&lt;img src="http://dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f12%2fThe-Myth-of-the-Single-Person-Startup.aspx" border="0" alt="DotnetKicks" /&gt;&lt;/a&gt;
  165. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f12%2fThe-Myth-of-the-Single-Person-Startup.aspx&amp;title=The+Myth+of+the+Single-Person+Startup&amp;description=&amp;s=dotnetshoutout"&gt;&lt;img style="height:19px" height="19px" src="http://dotnetshoutout.com/image.axd?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f12%2fThe-Myth-of-the-Single-Person-Startup.aspx" border="0" alt="dotnetshoutout" /&gt;&lt;/a&gt;
  166. &lt;/div&gt;&lt;p style="margin-top:15px;"&gt;&lt;em&gt;If you enjoyed this post, remember to &lt;a style="background:none;padding-right:0px;" href="http://www.aaronstannard.com/syndication.axd"&gt;subscribe to my RSS feed&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;
  167. </description>
  168. <link>http://www.aaronstannard.com/post/2010/06/12/The-Myth-of-the-Single-Person-Startup.aspx</link>
  169. <author>Aaronontheweb</author>
  170. <comments>http://www.aaronstannard.com/post/2010/06/12/The-Myth-of-the-Single-Person-Startup.aspx#comment</comments>
  171. <guid>http://www.aaronstannard.com/post.aspx?id=70ef41af-dda6-4f73-a325-44cf7bbfb9c2</guid>
  172. <pubDate>Sat, 12 Jun 2010 18:36:00 -1200</pubDate>
  173. <category>Startup</category>
  174. <dc:publisher>Aaronontheweb</dc:publisher>
  175. <pingback:server>http://www.aaronstannard.com/pingback.axd</pingback:server>
  176. <pingback:target>http://www.aaronstannard.com/post.aspx?id=70ef41af-dda6-4f73-a325-44cf7bbfb9c2</pingback:target>
  177. <slash:comments>18</slash:comments>
  178. <trackback:ping>http://www.aaronstannard.com/trackback.axd?id=70ef41af-dda6-4f73-a325-44cf7bbfb9c2</trackback:ping>
  179. <wfw:comment>http://www.aaronstannard.com/post/2010/06/12/The-Myth-of-the-Single-Person-Startup.aspx#comment</wfw:comment>
  180. <wfw:commentRss>http://www.aaronstannard.com/syndication.axd?post=70ef41af-dda6-4f73-a325-44cf7bbfb9c2</wfw:commentRss>
  181. </item>
  182. <item>
  183. <title>Discussion: How to Use RestSharp / Hammock to Automatically Parse the YouTube Response Format into POCO Objects</title>
  184. <description>
  185. &lt;p&gt;If you've been &lt;a href="http://twitter.com/MarketingNinja"&gt;following me on Twitter&lt;/a&gt; over the past couple of weeks, you might have noticed that I've been a little &lt;a href="http://twitter.com/MarketingNinja/status/15154555062"&gt;frustrated with the YouTube GData API lately&lt;/a&gt;. Simply put: XML makes me sad. Since that frustrated Tweet I've developed a solution using LINQ-to-XML and a bunch of hard-coded namespaces which isn't how I would prefer to do it.&lt;/p&gt;
  186. &lt;p&gt;I would much rather use the built in object deserialization capabilities in &lt;a href="http://restsharp.org/"&gt;RestSharp&lt;/a&gt; or &lt;a href="http://hammock.codeplex.com/"&gt;HammockREST&lt;/a&gt;. I'll be honest - I do not have a damn clue how to use Hammock's built-in deserialization capabilities. I tried tinkering with it on my own to no avail, and there's not much documentation to speak of.&lt;/p&gt;
  187. &lt;p&gt;&lt;a href="http://wiki.github.com/johnsheehan/RestSharp/deserialization"&gt;RestSharp has some more detailed documentation on its deserialization capabilities&lt;/a&gt;, but it doesn't answer some lingering questions I have. So without further aideu, I'd like to solicit the opinion of the developer community.&lt;/p&gt;
  188. &lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
  189. &amp;lt;feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007" gd:etag="W/&amp;amp;quot;DkMMRn0zeSp7ImA9WxFWE0k.&amp;amp;quot;"&amp;gt;
  190. &amp;lt;id&amp;gt;tag:youtube.com,2008:user:smartdraw:uploads&amp;lt;/id&amp;gt;
  191. &amp;lt;updated&amp;gt;2010-05-31T22:21:27.381Z&amp;lt;/updated&amp;gt;
  192. &amp;lt;category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#video" /&amp;gt;
  193. &amp;lt;title&amp;gt;Uploads by smartdraw&amp;lt;/title&amp;gt;
  194. &amp;lt;logo&amp;gt;http://www.youtube.com/img/pic_youtubelogo_123x63.gif&amp;lt;/logo&amp;gt;
  195. &amp;lt;link rel="related" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw?v=2" /&amp;gt;
  196. &amp;lt;link rel="alternate" type="text/html" href="http://www.youtube.com/profile_videos?user=smartdraw" /&amp;gt;
  197. &amp;lt;link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads?v=2" /&amp;gt;
  198. &amp;lt;link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads/batch?v=2" /&amp;gt;
  199. &amp;lt;link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads?start-index=1&amp;amp;amp;max-results=25&amp;amp;amp;v=2" /&amp;gt;
  200. &amp;lt;link rel="service" type="application/atomsvc+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads?alt=atom-service&amp;amp;amp;v=2" /&amp;gt;
  201. &amp;lt;link rel="next" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads?start-index=26&amp;amp;amp;max-results=25&amp;amp;amp;v=2" /&amp;gt;
  202. &amp;lt;author&amp;gt;
  203. &amp;lt;name&amp;gt;smartdraw&amp;lt;/name&amp;gt;
  204. &amp;lt;uri&amp;gt;http://gdata.youtube.com/feeds/api/users/smartdraw&amp;lt;/uri&amp;gt;
  205. &amp;lt;/author&amp;gt;
  206. &amp;lt;generator version="2.0" uri="http://gdata.youtube.com/"&amp;gt;YouTube data API&amp;lt;/generator&amp;gt;
  207. &amp;lt;openSearch:totalResults&amp;gt;30&amp;lt;/openSearch:totalResults&amp;gt;
  208. &amp;lt;openSearch:startIndex&amp;gt;1&amp;lt;/openSearch:startIndex&amp;gt;
  209. &amp;lt;openSearch:itemsPerPage&amp;gt;25&amp;lt;/openSearch:itemsPerPage&amp;gt;
  210. &amp;lt;entry gd:etag="W/&amp;amp;quot;CEIHQn47eCp7ImA9WxFWE0k.&amp;amp;quot;"&amp;gt;
  211. &amp;lt;id&amp;gt;tag:youtube.com,2008:video:NJPrllhYZrg&amp;lt;/id&amp;gt;
  212. &amp;lt;published&amp;gt;2010-02-10T23:27:38.000Z&amp;lt;/published&amp;gt;
  213. &amp;lt;updated&amp;gt;2010-05-31T21:48:53.000Z&amp;lt;/updated&amp;gt;
  214. &amp;lt;category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#video" /&amp;gt;
  215. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="People" label="People &amp;amp;amp; Blogs" /&amp;gt;
  216. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="SmartDraw" /&amp;gt;
  217. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="flowcharts" /&amp;gt;
  218. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="visuals" /&amp;gt;
  219. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="communicate" /&amp;gt;
  220. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="visually" /&amp;gt;
  221. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="communication" /&amp;gt;
  222. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="powerpoint" /&amp;gt;
  223. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="presentations" /&amp;gt;
  224. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="mind" /&amp;gt;
  225. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="maps" /&amp;gt;
  226. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="software" /&amp;gt;
  227. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="Business" /&amp;gt;
  228. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="graphics" /&amp;gt;
  229. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="strategic" /&amp;gt;
  230. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="planning" /&amp;gt;
  231. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="solutions" /&amp;gt;
  232. &amp;lt;category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="tools" /&amp;gt;
  233. &amp;lt;title&amp;gt;SmartDraw 2010 Guided Tour&amp;lt;/title&amp;gt;
  234. &amp;lt;content type="application/x-shockwave-flash" src="http://www.youtube.com/v/NJPrllhYZrg?f=user_uploads&amp;amp;amp;d=AWaEdOkfU7AZas-hLyE9s8EO88HsQjpE1a8d1GxQnGDm&amp;amp;amp;app=youtube_gdata" /&amp;gt;
  235. &amp;lt;link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=NJPrllhYZrg&amp;amp;amp;feature=youtube_gdata" /&amp;gt;
  236. &amp;lt;link rel="http://gdata.youtube.com/schemas/2007#video.responses" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/NJPrllhYZrg/responses?v=2" /&amp;gt;
  237. &amp;lt;link rel="http://gdata.youtube.com/schemas/2007#video.ratings" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/NJPrllhYZrg/ratings?v=2" /&amp;gt;
  238. &amp;lt;link rel="http://gdata.youtube.com/schemas/2007#video.complaints" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/NJPrllhYZrg/complaints?v=2" /&amp;gt;
  239. &amp;lt;link rel="http://gdata.youtube.com/schemas/2007#video.related" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/NJPrllhYZrg/related?v=2" /&amp;gt;
  240. &amp;lt;link rel="http://gdata.youtube.com/schemas/2007#mobile" type="text/html" href="http://m.youtube.com/details?v=NJPrllhYZrg" /&amp;gt;
  241. &amp;lt;link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/smartdraw/uploads/NJPrllhYZrg?v=2" /&amp;gt;
  242. &amp;lt;author&amp;gt;
  243. &amp;lt;name&amp;gt;smartdraw&amp;lt;/name&amp;gt;
  244. &amp;lt;uri&amp;gt;http://gdata.youtube.com/feeds/api/users/smartdraw&amp;lt;/uri&amp;gt;
  245. &amp;lt;/author&amp;gt;
  246. &amp;lt;yt:accessControl action="comment" permission="allowed" /&amp;gt;
  247. &amp;lt;yt:accessControl action="commentVote" permission="allowed" /&amp;gt;
  248. &amp;lt;yt:accessControl action="videoRespond" permission="moderated" /&amp;gt;
  249. &amp;lt;yt:accessControl action="rate" permission="allowed" /&amp;gt;
  250. &amp;lt;yt:accessControl action="embed" permission="allowed" /&amp;gt;
  251. &amp;lt;yt:accessControl action="syndicate" permission="allowed" /&amp;gt;
  252. &amp;lt;gd:comments&amp;gt;
  253. &amp;lt;gd:feedLink href="http://gdata.youtube.com/feeds/api/videos/NJPrllhYZrg/comments?v=2" countHint="0" /&amp;gt;
  254. &amp;lt;/gd:comments&amp;gt;
  255. &amp;lt;media:group&amp;gt;
  256. &amp;lt;media:credit role="uploader" scheme="urn:youtube"&amp;gt;smartdraw&amp;lt;/media:credit&amp;gt;
  257. &amp;lt;media:description type="plain"&amp;gt;Explains the features of SmartDraw, the software that allows you produce any visual, whether it's a flowchart or a floor plan, in a matter of minutes.
  258. Download a free trial of SmartDraw here: http://www.smartdraw.com/downloads/?id=343742&amp;lt;/media:description&amp;gt;
  259. &amp;lt;media:keywords&amp;gt;SmartDraw, flowcharts, visuals, communicate, visually, communication, powerpoint, presentations, mind, maps, software, Business, graphics, strategic, planning, solutions, tools&amp;lt;/media:keywords&amp;gt;
  260. &amp;lt;media:player url="http://www.youtube.com/watch?v=NJPrllhYZrg&amp;amp;amp;feature=youtube_gdata" /&amp;gt;
  261. &amp;lt;media:thumbnail url="http://i.ytimg.com/vi/NJPrllhYZrg/default.jpg" height="90" width="120" time="00:03:21" /&amp;gt;
  262. &amp;lt;media:thumbnail url="http://i.ytimg.com/vi/NJPrllhYZrg/2.jpg" height="90" width="120" time="00:03:21" /&amp;gt;
  263. &amp;lt;media:thumbnail url="http://i.ytimg.com/vi/NJPrllhYZrg/1.jpg" height="90" width="120" time="00:01:40.500" /&amp;gt;
  264. &amp;lt;media:thumbnail url="http://i.ytimg.com/vi/NJPrllhYZrg/3.jpg" height="90" width="120" time="00:05:01.500" /&amp;gt;
  265. &amp;lt;media:thumbnail url="http://i.ytimg.com/vi/NJPrllhYZrg/hqdefault.jpg" height="360" width="480" /&amp;gt;
  266. &amp;lt;media:title type="plain"&amp;gt;SmartDraw 2010 Guided Tour&amp;lt;/media:title&amp;gt;
  267. &amp;lt;yt:duration seconds="402" /&amp;gt;
  268. &amp;lt;yt:uploaded&amp;gt;2010-02-10T23:27:38.000Z&amp;lt;/yt:uploaded&amp;gt;
  269. &amp;lt;yt:videoid&amp;gt;NJPrllhYZrg&amp;lt;/yt:videoid&amp;gt;
  270. &amp;lt;/media:group&amp;gt;
  271. &amp;lt;gd:rating average="4.4444447" max="5" min="1" numRaters="9" rel="http://schemas.google.com/g/2005#overall" /&amp;gt;
  272. &amp;lt;yt:statistics favoriteCount="9" viewCount="16206" /&amp;gt;
  273. &amp;lt;yt:rating numDislikes="1" numLikes="8" /&amp;gt;
  274. &amp;lt;/entry&amp;gt;
  275. &amp;lt;/feed&amp;gt;&lt;/pre&gt;
  276. &lt;p&gt;Now, here are use cases for how I might want to use this format:&lt;/p&gt;
  277. &lt;ol&gt;
  278. &lt;li&gt;The GData API will only serve a maximum of 50 entries at any given time - one way to paginate through all of the entries in one go is to parse the &lt;span style="font-family: courier new,courier;"&gt;link rel="next&lt;/span&gt;" field and query that URL until the field no longer exists. Is there a way you can use a POCO class in Hammock or RestSharp to automatically grab this field between queries against the API?&lt;/li&gt;
  279. &lt;li&gt;Imagine you create a POCO class which contains the YouTube video ID, the author's username, the number of comments on the video, the keywords for the video, the number of views, and the number of the number of favorites. How would you structure this class such that RestSharp or HammockREST can automatically parse it from an ATOM response format like the one above? Bear in mind that these fields come from four of the five different XML namespaces (atom, Media RSS [media], GData [gd], and YouTube [yt]) used in this response format.&lt;/li&gt;
  280. &lt;/ol&gt;
  281. &lt;div class="addthis_toolbox addthis_default_style" style="padding-top:10px" &gt;
  282. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f08%2fRestSharp-Hammock-Parse-YouTube.aspx&amp;title=Discussion%3a+How+to+Use+RestSharp+%2f+Hammock+to+Automatically+Parse+the+YouTube+Response+Format+into+POCO+Objects&amp;description="&gt;&lt;img src="http://s7.addthis.com/static/btn/v2/sm-share-en.gif" alt="Bookmark and Share" style="border:0"/&gt;&lt;/a&gt;
  283. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f08%2fRestSharp-Hammock-Parse-YouTube.aspx&amp;title=Discussion%3a+How+to+Use+RestSharp+%2f+Hammock+to+Automatically+Parse+the+YouTube+Response+Format+into+POCO+Objects&amp;description=&amp;s=dotnetkicks"&gt;&lt;img src="http://dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f08%2fRestSharp-Hammock-Parse-YouTube.aspx" border="0" alt="DotnetKicks" /&gt;&lt;/a&gt;
  284. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f08%2fRestSharp-Hammock-Parse-YouTube.aspx&amp;title=Discussion%3a+How+to+Use+RestSharp+%2f+Hammock+to+Automatically+Parse+the+YouTube+Response+Format+into+POCO+Objects&amp;description=&amp;s=dotnetshoutout"&gt;&lt;img style="height:19px" height="19px" src="http://dotnetshoutout.com/image.axd?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f08%2fRestSharp-Hammock-Parse-YouTube.aspx" border="0" alt="dotnetshoutout" /&gt;&lt;/a&gt;
  285. &lt;/div&gt;&lt;p style="margin-top:15px;"&gt;&lt;em&gt;If you enjoyed this post, remember to &lt;a style="background:none;padding-right:0px;" href="http://www.aaronstannard.com/syndication.axd"&gt;subscribe to my RSS feed&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;
  286. </description>
  287. <link>http://www.aaronstannard.com/post/2010/06/08/RestSharp-Hammock-Parse-YouTube.aspx</link>
  288. <author>Aaronontheweb</author>
  289. <comments>http://www.aaronstannard.com/post/2010/06/08/RestSharp-Hammock-Parse-YouTube.aspx#comment</comments>
  290. <guid>http://www.aaronstannard.com/post.aspx?id=daa79e23-405f-48c8-93f9-f96d3097aa44</guid>
  291. <pubDate>Tue, 08 Jun 2010 17:35:00 -1200</pubDate>
  292. <category>.NET</category>
  293. <category>YouTube</category>
  294. <dc:publisher>Aaronontheweb</dc:publisher>
  295. <pingback:server>http://www.aaronstannard.com/pingback.axd</pingback:server>
  296. <pingback:target>http://www.aaronstannard.com/post.aspx?id=daa79e23-405f-48c8-93f9-f96d3097aa44</pingback:target>
  297. <slash:comments>3</slash:comments>
  298. <trackback:ping>http://www.aaronstannard.com/trackback.axd?id=daa79e23-405f-48c8-93f9-f96d3097aa44</trackback:ping>
  299. <wfw:comment>http://www.aaronstannard.com/post/2010/06/08/RestSharp-Hammock-Parse-YouTube.aspx#comment</wfw:comment>
  300. <wfw:commentRss>http://www.aaronstannard.com/syndication.axd?post=daa79e23-405f-48c8-93f9-f96d3097aa44</wfw:commentRss>
  301. </item>
  302. <item>
  303. <title>Two Ways to Randomize IList&lt;T&gt; Objects</title>
  304. <description>
  305. &lt;p&gt;I recently developed a self-sorted &lt;a href="http://msdn.microsoft.com/en-us/library/5y536ey6.aspx"&gt;IList&lt;/a&gt; implementation for a project and I needed some automated way to unit test it - so naturally, the best way to automatically test a sorting function is to force it to&amp;nbsp;sort the results of an unsorting function ;). Just for reference, IList is the interface implemented by every sort of List&amp;lt;T&amp;gt; variant in the .NET Collections library, with the notable exception of &lt;a href="http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.aspx"&gt;SortedList&lt;/a&gt; which is really a misnomer given&amp;nbsp;that it&amp;nbsp;actually implements &lt;a href="http://msdn.microsoft.com/en-us/library/system.collections.idictionary.aspx"&gt;IDictionary&lt;/a&gt;&amp;nbsp;instead of IList.&lt;/p&gt;
  306. &lt;p&gt;I was excited at the prospect of developing my own unsorting method, but sadly a quick Bing query revealed a couple of solutions developed by programmers far more diligent than&amp;nbsp;I, and I decided to roll both of their solutions into a pair of generic extension methods which I have tested and built into my solution. Let's take a look at them:&lt;/p&gt;
  307. &lt;h3&gt;Solution 1 - Randomizing an IList&amp;lt;T&amp;gt; Object Using LINQ Projection&lt;/h3&gt;
  308. &lt;p&gt;By far the most simple, yet elegant method for &lt;a href="http://www.ookii.org/post/randomizing_a_list_with_linq.aspx"&gt;randomizing the contents of an IList object&lt;/a&gt; I found was this one developed by &lt;a href="http://www.ookii.org/"&gt;Sven Groot&lt;/a&gt;, which uses LINQ's OrderBy method to randomize the contents of an &lt;a href="http://msdn.microsoft.com/en-us/library/9eekhta0.aspx"&gt;IEnumerable&lt;/a&gt; object:&lt;/p&gt;
  309. &lt;pre class="brush: c-sharp;"&gt;public static IEnumerable&amp;lt;T&amp;gt; Randomize&amp;lt;T&amp;gt;(this IEnumerable&amp;lt;T&amp;gt; source)
  310. {
  311. Random rnd = new Random();
  312. return source.OrderBy&amp;lt;T, int&amp;gt;((item) =&amp;gt; rnd.Next());
  313. }&lt;/pre&gt;
  314. &lt;p&gt;In terms of brevity, it doesn't get much better than this. Also, given that I need to ultimately create an IList&amp;lt;T&amp;gt; object out of this randomized collection remember that List&amp;lt;T&amp;gt; has a constructor which accepts an IEnumerable&amp;lt;T&amp;gt; collection as an argument.&lt;/p&gt;
  315. &lt;h3&gt;Solution 2 - Randomizing an IList&amp;lt;T&amp;gt; Object Using an Index Swap Routine&lt;/h3&gt;
  316. &lt;p&gt;The more traditional, pre-LINQ solution would be to &lt;a href="http://bytes.com/topic/net/answers/119718-randomize-array-items"&gt;randomize the contents of an&amp;nbsp;IList&amp;lt;T&amp;gt; object using a swap routine&lt;/a&gt; given that all IList objects have indexers, which is exactly what &lt;a href="http://www.yoda.arachsys.com/csharp/"&gt;Jon Skeet&lt;/a&gt; did using this solution:&lt;/p&gt;
  317. &lt;pre class="brush: c-sharp;"&gt;Random rng = new Random();
  318. for (int i = list.Count - 1; i &amp;gt; 0; i--)
  319. {
  320. int swapIndex = rng.Next(i + 1);
  321. if (swapIndex != i)
  322. {
  323. //Changed this from "object" to "T" in order to support generics.
  324. object tmp = list[swapIndex];
  325. list[swapIndex] = list[i];
  326. list[i] = tmp;
  327. }
  328. }&lt;/pre&gt;
  329. &lt;p&gt;If you have time, make sure you read &lt;a href="http://bytes.com/topic/net/answers/119718-randomize-array-items"&gt;Jon's explanation of&amp;nbsp;how the&amp;nbsp;algorithm works&lt;/a&gt; (it's pretty cool imho.) I went ahead and wrapped this code into an extension method just like Sven's LINQ solution, and here's what that looks like:&lt;/p&gt;
  330. &lt;pre class="brush: c-sharp;"&gt;public static IEnumerable&amp;lt;T&amp;gt; RandomizeWithSwaps&amp;lt;T&amp;gt;(this IList&amp;lt;T&amp;gt; list)
  331. {
  332. Random rng = new Random();
  333. for (int i = list.Count - 1; i &amp;gt; 0; i--)
  334. {
  335. int swapIndex = rng.Next(i + 1);
  336. if (swapIndex != i)
  337. {
  338. //Changed this from "object" to "T" in order to support generics.
  339. T tmp = list[swapIndex];
  340. list[swapIndex] = list[i];
  341. list[i] = tmp;
  342. }
  343. }
  344. return list;
  345. }&lt;/pre&gt;
  346. &lt;p&gt;One thing worth noting is that this extension method will only work with IList types - IEnumerable doesn't have any support for indexers, thus this extension method is somewhat wonky. Given that, I went with&amp;nbsp;using&amp;nbsp;the LINQ solution in my unit testing code.&lt;/p&gt;
  347. &lt;div class="addthis_toolbox addthis_default_style" style="padding-top:10px" &gt;
  348. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f07%2fTwo-Ways-to-Randomize-IList-Objects.aspx&amp;title=Two+Ways+to+Randomize+IList%3cT%3e+Objects&amp;description=Explains+how+to+randomize+the+contents+of+any+IList%3cT%3e+collection+using+Linq+or+an+index+swap+routine."&gt;&lt;img src="http://s7.addthis.com/static/btn/v2/sm-share-en.gif" alt="Bookmark and Share" style="border:0"/&gt;&lt;/a&gt;
  349. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f07%2fTwo-Ways-to-Randomize-IList-Objects.aspx&amp;title=Two+Ways+to+Randomize+IList%3cT%3e+Objects&amp;description=Explains+how+to+randomize+the+contents+of+any+IList%3cT%3e+collection+using+Linq+or+an+index+swap+routine.&amp;s=dotnetkicks"&gt;&lt;img src="http://dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f07%2fTwo-Ways-to-Randomize-IList-Objects.aspx" border="0" alt="DotnetKicks" /&gt;&lt;/a&gt;
  350. &lt;a style="padding-right:10px" href="http://www.addthis.com/bookmark.php?v=250&amp;username=aaronontheweb&amp;url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f07%2fTwo-Ways-to-Randomize-IList-Objects.aspx&amp;title=Two+Ways+to+Randomize+IList%3cT%3e+Objects&amp;description=Explains+how+to+randomize+the+contents+of+any+IList%3cT%3e+collection+using+Linq+or+an+index+swap+routine.&amp;s=dotnetshoutout"&gt;&lt;img style="height:19px" height="19px" src="http://dotnetshoutout.com/image.axd?url=http%3a%2f%2fwww.aaronstannard.com%2fpost%2f2010%2f06%2f07%2fTwo-Ways-to-Randomize-IList-Objects.aspx" border="0" alt="dotnetshoutout" /&gt;&lt;/a&gt;
  351. &lt;/div&gt;&lt;p style="margin-top:15px;"&gt;&lt;em&gt;If you enjoyed this post, remember to &lt;a style="background:none;padding-right:0px;" href="http://www.aaronstannard.com/syndication.axd"&gt;subscribe to my RSS feed&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;
  352. </description>
  353. <link>http://www.aaronstannard.com/post/2010/06/07/Two-Ways-to-Randomize-IList-Objects.aspx</link>
  354. <author>Aaronontheweb</author>
  355. <comments>http://www.aaronstannard.com/post/2010/06/07/Two-Ways-to-Randomize-IList-Objects.aspx#comment</comments>
  356. <guid>http://www.aaronstannard.com/post.aspx?id=8196d518-bf57-4ae1-bfd9-b9f841b865e4</guid>
  357. <pubDate>Mon, 07 Jun 2010 12:27:00 -1200</pubDate>
  358. <category>.NET</category>
  359. <dc:publisher>Aaronontheweb</dc:publisher>
  360. <pingback:server>http://www.aaronstannard.com/pingback.axd</pingback:server>
  361. <pingback:target>http://www.aaronstannard.com/post.aspx?id=8196d518-bf57-4ae1-bfd9-b9f841b865e4</pingback:target>
  362. <slash:comments>0</slash:comments>
  363. <trackback:ping>http://www.aaronstannard.com/trackback.axd?id=8196d518-bf57-4ae1-bfd9-b9f841b865e4</trackback:ping>
  364. <wfw:comment>http://www.aaronstannard.com/post/2010/06/07/Two-Ways-to-Randomize-IList-Objects.aspx#comment</wfw:comment>
  365. <wfw:commentRss>http://www.aaronstannard.com/syndication.axd?post=8196d518-bf57-4ae1-bfd9-b9f841b865e4</wfw:commentRss>
  366. </item>
  367. <item>
  368. <title>Frustration Central: Parsing the DateTime Values from the SlideShare REST API</title>
  369. <description>
  370. &lt;p&gt;I feel a little bad about posting this given that Jon Boutelle, the CTO of &lt;a href="http://www.slideshare.net/"&gt;SlideShare&lt;/a&gt;, already &lt;a href="http://groups.google.com/group/slideshare-developers/browse_thread/thread/4d7bd64df132c15e"&gt;admitted that this portion of the SlideShare 2.0 REST API sucks and that they're going to fix it eventually&lt;/a&gt;, but given that I'm in the middle of rewriting my original SlideShare Presentation XML deserializer I wanted to post my current solution to this problem and solicit the opinion of the .NET community in order to find a more elegant solution, if one exists.&lt;/p&gt;
  371. &lt;p&gt;Here's the problem - if you're trying to query any number of presentation objects from SlideShare, you're inevitably going to make a call to &lt;span style="font-family: courier new,courier;"&gt;&lt;a href="http://www.slideshare.net/developers/documentation"&gt;get_slideshow&lt;/a&gt;&lt;/span&gt; or to some method which depends on it. That's an unavoidable&amp;nbsp;fact of life when you're dealing with the SlideShare API. For the most part, the SlideShare API's response format is intuitive and intelligible - here's an example response using actual data:&lt;/p&gt;
  372. &lt;pre class="brush: xml;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
  373. &amp;lt;Slideshow&amp;gt;
  374. &amp;lt;ID&amp;gt;3997766&amp;lt;/ID&amp;gt;
  375. &amp;lt;Title&amp;gt;Startup Metrics 4 Pirates (Montreal, May 2010)&amp;lt;/Title&amp;gt;
  376. &amp;lt;Description&amp;gt;slides from my talk at Startup Camp Montreal 6 (May, 2010)&amp;lt;/Description&amp;gt;
  377. &amp;lt;Status&amp;gt;2&amp;lt;/Status&amp;gt;
  378. &amp;lt;Username&amp;gt;dmc500hats&amp;lt;/Username&amp;gt;
  379. &amp;lt;URL&amp;gt;[removed for fomatting reasons]&amp;lt;/URL&amp;gt;
  380. &amp;lt;ThumbnailURL&amp;gt;[removed for fomatting reasons]&amp;lt;/ThumbnailURL&amp;gt;
  381. &amp;lt;ThumbnailSmallURL&amp;gt;[removed for fomatting reasons]&amp;lt;/ThumbnailSmallURL&amp;gt;
  382. &amp;lt;Embed&amp;gt;
  383. [removed for fomatting reasons]
  384. &amp;lt;/Embed&amp;gt;
  385. &amp;lt;Created&amp;gt;Thu May 06 14:10:46 -0500 2010&amp;lt;/Created&amp;gt;
  386. &amp;lt;Language&amp;gt;en&amp;lt;/Language&amp;gt;
  387. &amp;lt;Format&amp;gt;ppt&amp;lt;/Format&amp;gt;
  388. &amp;lt;Download&amp;gt;1&amp;lt;/Download&amp;gt;
  389. &amp;lt;Tags&amp;gt;
  390. &amp;lt;Tag Count="1" Owner="1"&amp;gt;startup&amp;lt;/Tag&amp;gt;
  391. &amp;lt;Tag

Large files files are truncated, but you can click here to view the full file