<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Righthand's blog</title>
    <description />
    <link>http://blog.rthand.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 2.6.0.5</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://blog.rthand.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Miha Markic</dc:creator>
    <dc:title>Righthand's blog</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RighthandBlogs" /><feedburner:info uri="righthandblogs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Tips for Setting Git on Windows for SSH</title>
      <description>&lt;p&gt;Last weekend I took some time to configure &lt;a href="http://git-scm.com/" target="_blank"&gt;Git&lt;/a&gt; (and &lt;a href="http://gitolite.com/gitolite/master-toc.html" target="_blank"&gt;Gitolite&lt;/a&gt; for easier repository access management) on my Ubuntu server. It was a fun experience for a Linux newbie. Anyway, here are a bunch of things to watch out when configuring Git client on Windows.&lt;/p&gt;
&lt;h2&gt;If you want to use OpenSSH (SSH that comes with Git)&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Always generate public/private key pair using &lt;strong&gt;ssh-keygen -r rsa &lt;/strong&gt;even when using PuTTY. (I initially made a mistake because I used Puttygen).&lt;/li&gt;
&lt;li&gt;Set the environment variable &lt;strong&gt;HOME=C:\Users\[USERNAME]&lt;/strong&gt;, this variable isn't set by default. SSH looks for private keys in the C:\Users\[USERNAME]\.ssh folder. Not sure whether there are options to instruct it to looks elsewhere.&lt;/li&gt;
&lt;li&gt;Use default key name which is id_rsa. From what I can tell SSH looks for identity and id_rsa names (no suffixes).&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;When using &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank"&gt;PuTTY&lt;/a&gt; (an alternative to OpenSSH)&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Set environment variable &lt;strong&gt;GIT_SSH = C:\Program Files (x86)\PuTTY\plink.exe&lt;/strong&gt; (path valid for x64 system). This variable will tell Git what library to use for SSH communication.&lt;/li&gt;
&lt;li&gt;Run Pageant (part of PuTTY distribution) which will handle your private keys. Added bonus is that you don't have to repeat passphrase to private key when accessing it (granted you set the passphrase when you created the key - always a good practice).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Other tip would include trying the SSH connection to the server first using verbose output: &lt;strong&gt;SSH -vvv [USERONSERVER]@[SERVER]&lt;/strong&gt;. This output helps to a certain extent.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/Cmfp2EwnxQU" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/Cmfp2EwnxQU/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/05/20/Setting-Git-on-Windows-for-SSH-traps.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=3b1f6228-6ad2-42d9-a5d2-0fe1bcdfda5a</guid>
      <pubDate>Mon, 20 May 2013 11:34:00 +0300</pubDate>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=3b1f6228-6ad2-42d9-a5d2-0fe1bcdfda5a</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=3b1f6228-6ad2-42d9-a5d2-0fe1bcdfda5a</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/05/20/Setting-Git-on-Windows-for-SSH-traps.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=3b1f6228-6ad2-42d9-a5d2-0fe1bcdfda5a</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=3b1f6228-6ad2-42d9-a5d2-0fe1bcdfda5a</feedburner:origLink></item>
    <item>
      <title>Making JSON data strong typed with TypeScript and CodeSmith</title>
      <description>&lt;h2&gt;The situation&lt;/h2&gt;
&lt;p&gt;Imagine a scenario where you have a JSON service that returns data and you'd like to have it strongly typed on javascript powered client side.&lt;/p&gt;
&lt;p&gt;Let's say there is an ASP.NET MVC application that goes by the name MvcApplication33 (yes, the 33rd in a row of test applications) . There are two models in there in two files under Models folder:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;namespace MvcApplication33.Models&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Customer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Surname { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int Age { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Order[] Orders { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;namespace MvcApplication33.Models&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Order&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public double Amount { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Category { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool IsActive { get; set; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There is also a ApiController derived CustomersController like:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;namespace MvcApplication33.Controllers&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class CustomersController: ApiController&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEnumerable&amp;lt;Customer&amp;gt; GetCustomers()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new Customer[]{ new Customer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = "Tubo",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age = 22,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orders = new[]{ new Order { Amount = 54, IsActive = true, Category = "waste"} }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It simply returns an Customer array consisting of a single customer with a single order. The javascript, well jQuery, code that gets this data would look like:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;$(function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.getJSON("/api/customers", null, function (d) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var jsonCustomer = d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;The problem&lt;/h2&gt;
&lt;p&gt;While the code above works there is a drawback (mostly for people coming from strong typed languages): on the client side there is no metadata information at design time whatsoever. One is left with dynamic constructs. &lt;a href="http://www.typescriptlang.org/" target="_blank"&gt;TypeScript&lt;/a&gt; addresses this with interfaces. One could write matching TypeScript interfaces for C# types like:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;interface ICustomer {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Surname: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age: number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orders: IOrder[];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;interface IOrder {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount: number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Category: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsActive: bool;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and then rewrite retrieval like&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;$(function () {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.getJSON("/api/customers", null,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d =&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var customer = &amp;lt;ICustomer[]&amp;gt;d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small; font-family: courier new,courier;"&gt;});&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This way customer becomes an instance of a type that implements ICustomer which means &lt;strong&gt;properties are now strong typed and intellisense works&lt;/strong&gt;. Of course this is only TypeScript design time sugar which doesn't reflect in generated javascript code but that's enough to prevent a zillion of typing and other "easy to catch at design time" errors.&lt;/p&gt;
&lt;p&gt;There is one problem though. Typing interfaces is boring, error prone and there are synchronization issues between manually typed ones and their C# originals.&lt;/p&gt;
&lt;h2&gt;The solution&lt;/h2&gt;
&lt;p&gt;There is already all metadata information for our interfaces in C# code. Hence I created a &lt;a href="http://www.codesmithtools.com/" target="_blank"&gt;CodeSmith&lt;/a&gt; template that automatically creates TypeScript interfaces based on their C# originals by parsing C# code. When C# code changes the template can be rećrun to recreate interfaces. Almost one click error-less operation.&lt;/p&gt;
&lt;p&gt;Here is how it works: the template parses all C# files in a given folder and subfolders and generates matching TypeScript interfaces with corresponding namesapaces (using TypeScript modules). The template output for the given problem would look like:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;// Autogenerated using CodeSmith and JsonGenerator&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;// &amp;copy; Righthand, 2013&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;module MvcApplication33.Models {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;export interface ICustomer {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Surname: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age: number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orders: IOrder[];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;export interface IOrder {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Amount: number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Category: string;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsActive: bool;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; export module Subform {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; export interface ISubclass {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Tubo: bool;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Just for testing nested interfaces there is also interface ISubclass from original file located in Models subfolder named (Subform).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="/images/2013/04/struct.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The TypeScript file that uses the mentioned autogenerated interfaces should reference autogenerated interfaces file using &amp;lt;reference&amp;gt; directive. Here is a sample TypeScript test:&lt;/p&gt;
&lt;p&gt;/// &amp;lt;reference path="typings/jquery/jquery.d.ts" /&amp;gt;&lt;br /&gt;&lt;strong&gt;/// &amp;lt;reference path="../CodeSmith/JsonInterfaces.ts" /&amp;gt;&lt;/strong&gt;&lt;br /&gt;module KnockoutTest {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.getJSON("/api/customers", null,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var customers = &lt;strong&gt;&amp;lt;MvcApplication33.Models.ICustomer[]&amp;gt;&lt;/strong&gt;d;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(customer[0].Name);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &lt;br /&gt;}&lt;/p&gt;
&lt;h2&gt;How to&lt;/h2&gt;
&lt;p&gt;The template comes in two parts. An actual CodeSmith template (JsonInterfaces.cst) and a .net assembly (KnockoutGenerator.Extractor.Parser.dll - name should give you a hint where all this is going in a next blog post) which is used to extract metadata from C# sources. The assembly code could be a part of CodeSmith template but it is easier to develop (read: debug) code within Visual Studio. The assembly in turn uses &lt;a href="http://www.codeproject.com/Articles/408663/Using-NRefactory-for-analyzing-Csharp-code" target="_blank"&gt;NRefactory&lt;/a&gt; (free C# parser and much more) which (v4.x) is a part of CodeSmith, so no additional files required.&lt;/p&gt;
&lt;p&gt;Perhaps the easiest way to use the template is to include these two files in a project and use CodeSmith from within Visual Studio. The template requires a single property: FolderWithModels which is rather self explanatory. Excerpts from attached sample project:&lt;/p&gt;
&lt;p&gt;The CodeSmith project content located in Project1.csp:&lt;/p&gt;
&lt;p&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;codeSmith xmlns="http://www.codesmithtools.com/schema/csp.xsd"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;propertySets&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;propertySet name="JsonInterfaces" output="JsonInterfaces.ts" template="JsonInterfaces.cst"&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="FolderWithModels"&amp;gt;..\Models&amp;lt;/property&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/propertySet&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/propertySets&amp;gt;&lt;br /&gt;&amp;lt;/codeSmith&amp;gt;&lt;/p&gt;
&lt;p&gt;The project structure. I tend to put CodeSmith related stuff in CodeSmith folder. Feel free to arrange it otherwise.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/2013/04/struct2.png" alt="folder structure" /&gt;&lt;/p&gt;
&lt;p&gt;Right click on Project1.csp and Generate Outputs should (re)generate JsonInterfaces.ts. Open the output file and if Web Essentials and TypeScript are installed it should (re)generate final JavaScript file.&lt;/p&gt;
&lt;p&gt;The project itself won't show any meaningful output (for now) but you can use JSON output in a strongly typed way.&lt;/p&gt;
&lt;p&gt;Have fun and read next post which will talk about further enhancements for &lt;a href="http://knockoutjs.com/" target="_blank"&gt;knockoutjs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can download my sample project (without NuGet packages, just sources) which includes everything you need (subfolder CodeSmith).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.rthand.com/FILES/2013/04/mvcapplication33.zip"&gt;MvcApplication33.zip (566.78 kb)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;NOTE: The CodeSmith template could be rewritten to T-4 (using the same support assembly) however, one should make sure that NRefactory assemblies are there otherwise parser won't work.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/5PcKVBDDlSA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/5PcKVBDDlSA/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/04/03/Making-JSON-data-strong-typed-with-TypeScript-and-CodeSmith.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=6e09e76a-414c-4856-b44c-29f129ca7998</guid>
      <pubDate>Wed, 03 Apr 2013 12:20:00 +0300</pubDate>
      <category>ASP.Net</category>
      <category>CodeSmith</category>
      <category>Visual Studio</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=6e09e76a-414c-4856-b44c-29f129ca7998</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=6e09e76a-414c-4856-b44c-29f129ca7998</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/04/03/Making-JSON-data-strong-typed-with-TypeScript-and-CodeSmith.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=6e09e76a-414c-4856-b44c-29f129ca7998</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=6e09e76a-414c-4856-b44c-29f129ca7998</feedburner:origLink></item>
    <item>
      <title>Defining custom regions in TypeScript files and preserving their content during CodeSmith template based code generation</title>
      <description>&lt;p&gt;I am looking to do some &lt;a href="http://www.typescriptlang.org/" target="_blank"&gt;TypeScript&lt;/a&gt; code generation with &lt;a href="http://www.codesmithtools.com/" target="_blank"&gt;CodeSmith&lt;/a&gt; and I&amp;rsquo;d like to use &lt;a href="http://docs.codesmithtools.com/display/Generator/PreserveRegions+Merge+Strategy" target="_blank"&gt;PreserveMerge merging strategy&lt;/a&gt;(preserve merge preserves your custom code within generated code between regenerations). CodeSmith&amp;rsquo;s merging mechanism is powerful and flexible (besides preserve it supports insert merge strategy as well. But if you feel constrained then feel free to &lt;a href="http://docs.codesmithtools.com/display/Generator/Defining+Your+Own+Merge+Strategy" target="_blank"&gt;create your own merging strategy&lt;/a&gt;). Out of the box it supports C#, VB.NET, XML and T-SQL start region and end region notation. This is a problem for TypeScript because, it can&amp;rsquo;t use any of those with TypeScript files hence I have to define my own start and end region &lt;em&gt;keywords&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;So I came up with&lt;/p&gt;
&lt;pre class="brush: csharp; toolbar: false;"&gt;/// #region [Name]&lt;/pre&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;pre class="brush: csharp; toolbar: false;"&gt;/// #endregion&lt;/pre&gt;
&lt;p&gt;notations &amp;ndash; TypeScript will ignore them (as comments) and they are explicit enough. Nothing Earth shattering but they should do the job for me.&lt;/p&gt;
&lt;h2&gt;Definining new region keywords for CodeSmith&lt;/h2&gt;
&lt;p&gt;Now I have to update CodeSmith with my these new TypeScript region &lt;em&gt;keywords&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;CodeSmith uses regular expressions for searching region &lt;em&gt;keywords&lt;/em&gt;. They are defined in registry under the key HKEY_CURRENT_USER\Software\CodeSmith\&amp;lt;VERSION&amp;gt;\LanguageRegionDefinition. Here is a C# definition&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.rthand.com/images/2013/03/image.png"&gt;&lt;img style="background-image: none; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; margin-right: auto; border-width: 0px;" title="image" src="/images/2013/03/image_thumb.png" alt="image" width="632" height="251" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The definition consists of LanguageKeys, RegionStartRegex and RegionEndRegex. Pretty much self-explanatory.&lt;/p&gt;
&lt;p&gt;Here is my TypeScript entry under next available number 4 (also attached to this post):&lt;/p&gt;
&lt;pre class="brush: csharp; toolbar: false;"&gt;LanguageKeys: Typescript|TS
RegionStartRegex: ^[ \t]*///[ \t]*\#region(?:[ \t]*(?&amp;lt;name&amp;gt;[^\r\n]*))?[ \t]*\r?\n
RegionEndRegex: ^[ \t]*///[ \t]*\#endregion[ \t]*\r?\n&lt;/pre&gt;
&lt;p&gt;Creating the node 4 as a sibling to other region definitions does the trick. Note: LanguageKeys is important when you set the merge strategy (you can use any of strings that are pipe delimited: either TypeScript or TS in my case).&lt;/p&gt;
&lt;h2&gt;Using regions in TypeScript generated code&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s create a very simple proof of concept (the project is attached to this post).&lt;/p&gt;
&lt;p&gt;First create new console project and then add a CodeSmith template for TypeScript code. As a TargetLanguage you could put "TypeScript&amp;rdquo; even though CodeSmith doesn&amp;rsquo;t really know how to syntax color it. It is just a hint for CodeSmith. Place one or more region delimiters within template (mine is really simple one, just to show the concept), here is my template:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;lt;%@ Template Language="C#" TargetLanguage="TypeScript" Debug="False" %&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;module RegionTest { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp; function tubo(){ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var i = 5; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// #region Test &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// #endregion &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;&amp;nbsp; } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Add CodeSmith project file and add the above template as an output. In the Edit Output settings set the proper output file name (test.ts in my case), Merge type as &amp;ldquo;PreserveRegions&amp;rdquo; and Initialization string as &amp;ldquo;RegionNameRegex=.*;&amp;rdquo; or &amp;ldquo;RegionNameRegex=.*;Language=TypeScript;&amp;rdquo; if you didn&amp;rsquo;t set it as TargetLanguage (it defaults to template&amp;rsquo;s TargetLanguage when not defined). RegionNameRegex gives you a chance to use only selected region names for preserve strategy &amp;ndash; in my case any name or no name will do. Below are my Edit Output settings.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.rthand.com/images/2013/03/image_1.png"&gt;&lt;img style="background-image: none; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; margin-right: auto; border-width: 0px;" title="image" src="/images/2013/03/image_thumb_1.png" alt="image" width="599" height="438" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Generate the code, the output content should appear just like the template definition since there is no &lt;em&gt;real&lt;/em&gt; code generation.&lt;/p&gt;
&lt;p&gt;Add custom code within the Test region in generated test.ts file (not in template), like:&lt;/p&gt;
&lt;pre class="brush: js; toolbar: false;"&gt;/// #region Test
alert ("wow, this is really a persistent alert");
/// #endregion&lt;/pre&gt;
&lt;p&gt;And generate the code once more. If everything is in place the new output should have persisted the custom code of the Test region.&lt;/p&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;To enable CodeSmith&amp;rsquo;s PreserveRegion merging strategy in an unsuported TypeScript language I had to add a registry key and that&amp;rsquo;s it. The simplicity of making a language &lt;em&gt;supported&lt;/em&gt; in this case shows the CodeSmith flexibility and power and the CodeSmith&amp;rsquo;s use or registry shows bad practice &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="$wlEmoticon-smile2.png" alt="Smile" /&gt; they should really use files instead of registry (hint).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.rthand.com/files/2013%2f03%2fTestPreserve.zip"&gt;TestPreserve.zip (20.95 kb)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.rthand.com/files/2013%2f03%2ftypescrip-regions.zip"&gt;typescrip-regions.reg (614.00 bytes)&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/ZZ0Zch7u1RU" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/ZZ0Zch7u1RU/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/03/30/Defining-custom-regions-in-TypeScript-files-and-preserving-their-content-during-CodeSmith-template-based-code-generation.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=44447688-3ecf-45cc-85c6-c3c7d3e76c7d</guid>
      <pubDate>Sat, 30 Mar 2013 17:35:00 +0300</pubDate>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=44447688-3ecf-45cc-85c6-c3c7d3e76c7d</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=44447688-3ecf-45cc-85c6-c3c7d3e76c7d</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/03/30/Defining-custom-regions-in-TypeScript-files-and-preserving-their-content-during-CodeSmith-template-based-code-generation.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=44447688-3ecf-45cc-85c6-c3c7d3e76c7d</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=44447688-3ecf-45cc-85c6-c3c7d3e76c7d</feedburner:origLink></item>
    <item>
      <title>How to compile MvvmCross v3 sources</title>
      <description>&lt;p&gt;As you well know, or you might not, &lt;a href="https://github.com/slodge/MvvmCross" target="_blank"&gt;MvvmCross&lt;/a&gt; is a cross platform MVVM framework supporting many platforms, such as Android and iOS (both through &lt;a href="http://xamarin.com/" target="_blank"&gt;Xamarin&lt;/a&gt;), WPF, WinRT, WP7. Feature worth drooling.&lt;/p&gt;  &lt;p&gt;Now, AFAIK there are two versions available. v2 (aka vNext) which is supposedly stable and v3 which is work in progress but holds many improvements. Here is how to get v3 sources compiled for Android (I didn’t test others) in case you run into problems like me.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;head to &lt;a href="https://github.com/slodge/MvvmCross/tree/v3/Cirrious" target="_blank"&gt;Github repository&lt;/a&gt; for v3 branch (optionally)&lt;/li&gt;    &lt;li&gt;use &lt;em&gt;git clone –b v3 &lt;/em&gt;&lt;a title="git://github.com/slodge/MvvmCross.git" href="git://github.com/slodge/MvvmCross.git"&gt;&lt;em&gt;git://github.com/slodge/MvvmCross.git&lt;/em&gt;&lt;/a&gt; do fetch sources&lt;/li&gt;    &lt;li&gt;open MvvmCross_All.sln solution (using Visual Studio 2012) which references all projects for all platforms. If you don’t have Touch support (or others) Visual Studio will let you know. You can safely ignore those warnings.&lt;/li&gt;    &lt;li&gt;build solution. If it does consider yourself lucky, otherwise continue reading.&lt;/li&gt;    &lt;li&gt;If you get something like&lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Error 172 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Perhaps it doesn't exist in the Mono for Android profile?       &lt;br /&gt;File name: 'Newtonsoft.Json.dll'&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;then there is a problem with build process. My guess is that it happens because portable class libraries, which Newtonsoft.Json.dll is, aren’t officially supported by Xamarin. Yet.&lt;/p&gt;    &lt;p&gt;The workaround is to get &lt;a href="http://json.codeplex.com/" target="_blank"&gt;Newtonsoft.Json&lt;/a&gt; sources (use PCL csproj version), include the project into solution and replace the reference in Plugins\Cirrious\Json\Cirrious.MvvmCross.Plugins.Json project with the Newtonsof.Json project itself.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now you can run samples, at least I did – tested with Samples\Tutorial\Tutorial.UI.Droid.&lt;/p&gt;  &lt;p&gt;There is another build error you might encounter (in general for Xamarin.Android). Sometimes the build process yields a ton of senseless errors (can’t find classes, interfaces, etc.) even though the code should compile. Try building again – most of the times it builds without errors the second time.&lt;/p&gt;  &lt;p&gt;If you are interested into MvvmCross project make sure you read &lt;a href="http://slodge.blogspot.co.uk/" target="_blank"&gt;Stuart’s blog&lt;/a&gt; (creator of MvvmCross).&lt;/p&gt;  &lt;p&gt;I have to test it a bit now, so more blog posts on the topic might follow.&lt;/p&gt;  &lt;p&gt;Have fun with MVVM everywhere.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/P2NZnH-xBwY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/P2NZnH-xBwY/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/03/13/How-to-compile-MvvmCross-v3-sources.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=9f1654e8-c296-4d5a-9537-aba8686cafa8</guid>
      <pubDate>Wed, 13 Mar 2013 11:22:49 +0300</pubDate>
      <category>.net</category>
      <category>Mono For Android</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=9f1654e8-c296-4d5a-9537-aba8686cafa8</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=9f1654e8-c296-4d5a-9537-aba8686cafa8</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/03/13/How-to-compile-MvvmCross-v3-sources.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=9f1654e8-c296-4d5a-9537-aba8686cafa8</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=9f1654e8-c296-4d5a-9537-aba8686cafa8</feedburner:origLink></item>
    <item>
      <title>No more forums at rthand</title>
      <description>&lt;p&gt;For few of you who used my forums: I’ve decided to shut down my forums at forums.rthand.com. Not much traffic and constant spamming/attacks weren’t worth my time. I think my time will be better spent in my projects.&lt;/p&gt;  &lt;p&gt;You can still contact me through many channels, such as this blog’s Contact page (which should be working lately), twitter (@mihamarkic) and so on.&lt;/p&gt;  &lt;p&gt;Thanks everybody that contributed to forums!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/oFzKZ5121I8" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/oFzKZ5121I8/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/02/20/No-more-forums-at-rthand.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=7ce18b81-b39f-4b22-ab99-3343520d33be</guid>
      <pubDate>Wed, 20 Feb 2013 10:08:21 +0300</pubDate>
      <category>Announcement</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=7ce18b81-b39f-4b22-ab99-3343520d33be</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=7ce18b81-b39f-4b22-ab99-3343520d33be</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/02/20/No-more-forums-at-rthand.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=7ce18b81-b39f-4b22-ab99-3343520d33be</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=7ce18b81-b39f-4b22-ab99-3343520d33be</feedburner:origLink></item>
    <item>
      <title>Blog engine’s e-mail problems</title>
      <description>&lt;p&gt;For some reason I didn’t notice that my blog engine wasn’t properly notifying me of your comments sent through Contact page and thus I was actually unaware of any comment sent.&lt;/p&gt;  &lt;p&gt;Hence I apologize to everybody that contacted me and got no response.&lt;/p&gt;  &lt;p&gt;I am pretty sure the notification system is working properly now.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/AyeuvlCz3Ow" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/AyeuvlCz3Ow/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/02/06/Blog-engines-e-mail-problems.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=48ecd775-2617-426d-9676-65cc8f1c41c9</guid>
      <pubDate>Wed, 06 Feb 2013 15:11:01 +0300</pubDate>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=48ecd775-2617-426d-9676-65cc8f1c41c9</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=48ecd775-2617-426d-9676-65cc8f1c41c9</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/02/06/Blog-engines-e-mail-problems.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=48ecd775-2617-426d-9676-65cc8f1c41c9</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=48ecd775-2617-426d-9676-65cc8f1c41c9</feedburner:origLink></item>
    <item>
      <title>Free Succinctly book series from Syncfusion</title>
      <description>&lt;p&gt;Lately &lt;a href="http://www.syncfusion.com" target="_blank"&gt;Syncfusion&lt;/a&gt; started producing e-books grouped under &lt;a href="http://www.syncfusion.com/resources/techportal/ebooks" target="_blank"&gt;Succinctly series&lt;/a&gt;. The books are for developers on (mostly) Microsoft platform and are a free download albeit registration is required. I’ve peeked into few of them and I have to say I like them.&lt;/p&gt;  &lt;p&gt;They won’t replace commercial n-hundred pages long developer books though but they provide you an introduction, the basics of the topic and serve as quick reference. So it is worth checking them out and kudos to Syncfusion.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/RQxTyVCF3Gw" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/RQxTyVCF3Gw/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/01/16/Free-Succinctly-book-series-from-Syncfusion.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=a6715b6b-0061-4ea8-95a7-4f87476c42ce</guid>
      <pubDate>Wed, 16 Jan 2013 10:43:30 +0300</pubDate>
      <category>Book Review</category>
      <category>Development</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=a6715b6b-0061-4ea8-95a7-4f87476c42ce</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=a6715b6b-0061-4ea8-95a7-4f87476c42ce</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/01/16/Free-Succinctly-book-series-from-Syncfusion.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=a6715b6b-0061-4ea8-95a7-4f87476c42ce</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=a6715b6b-0061-4ea8-95a7-4f87476c42ce</feedburner:origLink></item>
    <item>
      <title>An exotic DevEx’ ReportDesigner breaking change in 12.2</title>
      <description>&lt;p&gt;If you ever customized (excellent) &lt;a href="http://www.devexpress.com/" target="_blank"&gt;DevExpress&lt;/a&gt; ReportDesigner you might have used this line of code to obtain a reference to &lt;em&gt;IDataSourceCollectionProvider&lt;/em&gt; within ReportDesigner class which allows to access field list:&lt;/p&gt;  &lt;pre class="brush: csharp; toolbar: false;"&gt;IDataSourceCollectionProvider dataSourceCollectionProvider = 
    designerHost.GetDesigner(designerHost.RootComponent) 
    as IDataSourceCollectionProvider;&lt;/pre&gt;

&lt;p&gt;This code worked well in 12.1 and perhaps in earlier 12.2 versions but it certainly won’t work in 12.2.5. The bad part is that it fails in runtime, while it still compiles perfectly. At least it fails consistently – always. The reason is that access to various services (&lt;em&gt;IDataSourceCollectionProvider&lt;/em&gt; is one of them) is now through &lt;em&gt;ReportDesigner.GetService(Type serviceType)&lt;/em&gt; method. Replacing the part above with the one below does the trick:&lt;/p&gt;

&lt;pre class="brush: csharp; toolbar: false;"&gt;IDataSourceCollectionProvider dataSourceCollectionProvider = 
    (IDataSourceCollectionProvider)designerHost.GetService(
        typeof(IDataSourceCollectionProvider)
    );&lt;/pre&gt;

&lt;p&gt;The new is more readable and it could be even better if it used generics. I’d certainly consider this declaration instead:&lt;/p&gt;

&lt;pre class="brush: csharp; toolbar: false;"&gt;T GetService&amp;lt;T&amp;gt;()
  where T: class
{
   ...
}&lt;/pre&gt;

&lt;p&gt;which would yield even more readable assignment:&lt;/p&gt;

&lt;pre class="brush: csharp; toolbar: false;"&gt;IDataSourceCollectionProvider dataSourceCollectionProvider = 
    designerHost.GetService&amp;lt;IDataSourceCollectionProvider&amp;gt;();&lt;/pre&gt;

&lt;p&gt;There you have the fix.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/b971DLaZxFc" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/b971DLaZxFc/post.aspx</link>
      <comments>http://blog.rthand.com/post/2013/01/09/An-exotic-DevEx-ReportDesigner-breaking-change-in-122.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=8ec3cc71-3179-43bc-b380-be41f4b32204</guid>
      <pubDate>Wed, 09 Jan 2013 18:59:39 +0300</pubDate>
      <category>.net</category>
      <category>DevExpress</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=8ec3cc71-3179-43bc-b380-be41f4b32204</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=8ec3cc71-3179-43bc-b380-be41f4b32204</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2013/01/09/An-exotic-DevEx-ReportDesigner-breaking-change-in-122.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=8ec3cc71-3179-43bc-b380-be41f4b32204</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=8ec3cc71-3179-43bc-b380-be41f4b32204</feedburner:origLink></item>
    <item>
      <title>Just developing for Windows 8 Store gives your privacy a funeral</title>
      <description>&lt;p&gt;I was poking around with excellent &lt;a href="http://monogame.codeplex.com/" target="_blank"&gt;MonoGame&lt;/a&gt; framework by creating a simple game, or better, starting to create a simple game. So far I&amp;rsquo;ve spent a day to build some infrastructure from scratch and I am able to show a main screen with simple menu items. Nothing really ground-breaking.&lt;/p&gt;
&lt;p&gt;The aspect I am most interested right now is cross platform development with MonoGame. Hence my simple game is built with cross platform support from beginning. Main development target is Windows 7 x64 because it is the easiest to debug the application on. I&amp;rsquo;ve ported the game successfully to Android as well by using &lt;a href="http://xamarin.com/monoforandroid" target="_blank"&gt;Mono For Android&lt;/a&gt; &amp;ndash; tested on both emulator and my Google Nexus phone. Port means just creating a bootstraper (an Android app that launches the game within an activity) and linking the sources to Mono For Android projects (here &lt;a href="http://visualstudiogallery.msdn.microsoft.com/5e730577-d11c-4f2e-8e2b-cbb87f76c044" target="_blank"&gt;Project Linker&lt;/a&gt; comes to great help, though shame that Microsoft Patterns And Practices team seemingly abandoned it).&lt;/p&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;Windows Phone 8 emulator requirements are insane&lt;/h2&gt;
&lt;p&gt;Next I wanted to port it to Windows Phone 8 since its SDK is fresh from the oven and MonoGame supports it (not sure at what stage the support is). However, Windows Phone 8 SDK emulator requirements are just too much: &lt;strong&gt;Visual Studio 2012, Windows 8 Pro, 4GB RAM, and CPU with &lt;/strong&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/1401.hyper-v-list-of-slat-capable-cpus-for-hosts.aspx" target="_blank"&gt;&lt;strong&gt;SLAT&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; support&lt;/strong&gt; to run the emulator which in turn runs on Hyper-V. I don&amp;rsquo;t have a Windows Phone 8 device so I wanted to give the emulator a test run. I have Windows 8 Pro on my laptop but, albeit perfectly functional, the CPU doesn&amp;rsquo;t feature SLAT. SLAT is required by Hyper-V on client versions of Windows 8. The interesting fact is that &lt;a href="http://www.vmware.com/products/workstation/" target="_blank"&gt;VMWare Workstation&lt;/a&gt; runs perfectly well without or with SLAT. Be also aware that VMWare Workstation and Hyper-V on Windows 8 won't coexist peacefully - Workstation will work only when Hyper-V feature isn't present. The bottom line is that the Windows Phone 8 emulator won&amp;rsquo;t run on my laptop. I could run it on my workstation but I haven&amp;rsquo;t migrated to Windows 8 at this time.&lt;/p&gt;
&lt;h2&gt;Windows 8 development license isn&amp;rsquo;t something for privacy consciousness&lt;/h2&gt;
&lt;p&gt;Next I wanted to run a Metro aka Windows Store Apps version of my game. Those should run just fine on my laptop. I started by creating a new Windows Store application and Visual Studio 2012 immediately notified me that I need a developer license for Windows 8 which is free. But reading &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/jj554738%28v=vs.85%29.aspx" target="_blank"&gt;its privacy statement&lt;/a&gt; made me wonder.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;hellip; &lt;br /&gt;When you request a developer license, &lt;strong&gt;Microsoft collects information about your PC and the apps installed on it. This information includes your PC&amp;rsquo;s name, manufacturer, and model; your IP address; a unique identifier generated based on your PC&amp;rsquo;s hardware configuration; and the edition of Windows you&amp;rsquo;re using. &lt;br /&gt;&lt;/strong&gt;&amp;hellip;. &lt;br /&gt;Microsoft may access or disclose information about you, including the content of your communications, in order to: (a) comply with the law or respond to lawful requests or legal process; (b) protect the rights or property of Microsoft or our customers, including the enforcement of our agreements or policies governing your use of the services; or (c) act on a good faith belief that such access or disclosure is necessary to protect the personal safety of Microsoft employees, customers, or the public. We may also disclose personal information as part of a corporate transaction such as a merger or sale of assets. &lt;br /&gt;&amp;hellip;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Remember, I wanted to test my game locally. And for that I&amp;rsquo;d need to send all sort of data to Microsoft? What the heck? Furthermore those legal obligations are really flexible. Not that I have anything to hide or against Microsoft but still why do I have to disclose installed applications on my computer and such? Note that I wouldn&amp;rsquo;t send my data to any company just to test an application on the local machine. So, for the time being, I will skip Windows Store App version as well.&lt;/p&gt;
&lt;p&gt;Progress so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows Desktop [checked]&lt;/li&gt;
&lt;li&gt;Android [checked]&lt;/li&gt;
&lt;li&gt;Windows Phone 8 [unknown]&lt;/li&gt;
&lt;li&gt;Windows Store App [unknown]&lt;/li&gt;
&lt;li&gt;Windows Phone 7 [unknown,soon]&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is only one platform left to try &amp;ndash; Windows Phone 7 where I don&amp;rsquo;t foresee any problems, just didn&amp;rsquo;t have time yet.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/GdQ9my2x8eE" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/GdQ9my2x8eE/post.aspx</link>
      <comments>http://blog.rthand.com/post/2012/11/02/Just-developing-for-Windows-8-Store-gives-your-privacy-a-funeral.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=dc8a57a5-ef9f-4d6c-a58d-8b5e9420e799</guid>
      <pubDate>Fri, 02 Nov 2012 11:35:00 +0300</pubDate>
      <category>.net</category>
      <category>Android</category>
      <category>Development</category>
      <category>MonoForAndroid</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=dc8a57a5-ef9f-4d6c-a58d-8b5e9420e799</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=dc8a57a5-ef9f-4d6c-a58d-8b5e9420e799</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2012/11/02/Just-developing-for-Windows-8-Store-gives-your-privacy-a-funeral.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=dc8a57a5-ef9f-4d6c-a58d-8b5e9420e799</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=dc8a57a5-ef9f-4d6c-a58d-8b5e9420e799</feedburner:origLink></item>
    <item>
      <title>Getting proper OpenGL driver for older AMD(ex. ATI) graphics cards on Windows 8</title>
      <description>&lt;p&gt;I have a not so new laptop that features ATI Radeon HD 3650 Mobility graphics cards. Which is quite fine for the usual tasks. According to AMD website it features OpenGL 3.2 which is, again, good enough. Nothing spectacular but fine.&lt;/p&gt;  &lt;p&gt;Lately I’ve upgraded it to a SSD disk and at the same time I did a fresh Windows 8 install (previously it was Windows 7). Everything worked out very well. The laptop is usable again and quite fast now. Yesterday I tried to experiment with &lt;a href="http://monogame.codeplex.com/" target="_blank"&gt;MonoGame&lt;/a&gt;, an open source implementation of, now legacy, XNA Framework – the framework that was supposed to run everywhere but Microsoft ditched it for some reason. Anyway, I’ve tried to run a sample MonoGame application and immediately faced a problem. First it was throwing an exception that OpenAL.dll is missing. Odd. I’ve found a standalone installation for OpenAL but the I run into another, more descriptive problem, something like: can’t find entry point for ‘glBindFramebuffer’ in OpenGL32.dll. That basically says that I had a pre-OpenGL 2.0 installed (MonoGame uses &lt;a href="http://www.opentk.com/" target="_blank"&gt;OpenTK&lt;/a&gt; which in turn requires minimum 2.0 version of OpenGL). How is that possible?&lt;/p&gt;  &lt;p&gt;From what I understand the situation is that AMD isn’t supporting the Radeon Mobility HD 3xxx with Windows 8 and hence it doesn’t provide OpenGL drivers. So everything falls back to Microsoft provided OpenGL 1.1. That is nicely shown using &lt;a href="http://www.ozone3d.net/gpu_caps_viewer/" target="_blank"&gt;GPU Caps Viewer&lt;/a&gt; application. This is ever more surprising because we had proper OpenGL drivers for it under Windows 7. If it was a desktop machine I’d consider changing the graphics card but that’s just not possible on the laptop. And I wasn’t quite happy to buy a newer laptop just for that, even more so because my laptop is doing just fine.&lt;/p&gt;  &lt;h2&gt;The solution&lt;/h2&gt;  &lt;p&gt;The solution is to install the latest drivers for Windows 7 manually. It is actually quick, easy and it works. You’ll find the procedure in &lt;a href="http://www.lockergnome.com/windows/2012/09/29/make-your-old-graphics-drivers-work-in-windows-8/" target="_blank"&gt;Make Your Old Graphics Drivers Work in Windows 8&lt;/a&gt;article on Lockergnome. The only differences from article are that just right clicking on INF file doesn’t work nor the INF file is named exactly like the one in the article – it has higher number, probably because it is a newer one. Instead of the right click-&amp;gt;install, which didn’t work, I had to go to Computer-&amp;gt;right click-&amp;gt;Manage-&amp;gt;Device Manager-&amp;gt;Display adapters-&amp;gt;ATI Mobility Radeon HD 3650-&amp;gt;right click-&amp;gt;Properties-&amp;gt;Driver-&amp;gt;Update Driver-&amp;gt;Browser my computer for driver software-&amp;gt;Let me pick from a list of device drivers on my computer-&amp;gt;Select proper INF file.&lt;/p&gt;  &lt;p&gt;And voila – now I have OpenGL 3.3 support and MonoGame runs like a charm. Happy OpenGLing!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RighthandBlogs/~4/wtV6M1bRv2g" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/RighthandBlogs/~3/wtV6M1bRv2g/post.aspx</link>
      <comments>http://blog.rthand.com/post/2012/11/01/Getting-proper-OpenGL-driver-for-older-AMD(ex-ATI)-graphics-cards-on-Windows-8.aspx#comment</comments>
      <guid isPermaLink="false">http://blog.rthand.com/post.aspx?id=a31cd259-1105-496b-a7be-f8abdc1647cc</guid>
      <pubDate>Thu, 01 Nov 2012 11:18:16 +0300</pubDate>
      <category>.net</category>
      <category>Graphics</category>
      <category>Hardware</category>
      <category>Windows 8</category>
      <dc:publisher>Miha Markic</dc:publisher>
      <pingback:server>http://blog.rthand.com/pingback.axd</pingback:server>
      <pingback:target>http://blog.rthand.com/post.aspx?id=a31cd259-1105-496b-a7be-f8abdc1647cc</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.rthand.com/trackback.axd?id=a31cd259-1105-496b-a7be-f8abdc1647cc</trackback:ping>
      <wfw:comment>http://blog.rthand.com/post/2012/11/01/Getting-proper-OpenGL-driver-for-older-AMD(ex-ATI)-graphics-cards-on-Windows-8.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.rthand.com/syndication.axd?post=a31cd259-1105-496b-a7be-f8abdc1647cc</wfw:commentRss>
    <feedburner:origLink>http://blog.rthand.com/post.aspx?id=a31cd259-1105-496b-a7be-f8abdc1647cc</feedburner:origLink></item>
  </channel>
</rss>
