<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3504325405839228885</id><updated>2026-03-05T11:08:55.809+11:00</updated><category term="MVC"/><category term="WPF"/><category term="Entity Framework"/><category term="Windows Phone 7"/><category term="Coding Tips"/><category term="MVVM"/><category term="Tip"/><category term="Asp.Net"/><category term="Binding"/><category term="Blogger"/><category term="C#"/><category term="Cassette"/><category term="ColumnDefinitions"/><category term="Combinatory Parser"/><category term="Controller"/><category term="DatePicker"/><category term="DotNetAuth"/><category term="Entity Framework Migrations"/><category term="Extension Methods"/><category term="Functional Programming"/><category term="Gist"/><category term="Google API"/><category term="Grid"/><category term="Html"/><category term="Layout"/><category term="Meetup.com"/><category term="Navigation"/><category term="OAuth"/><category term="OAuth 2"/><category term="OpenPop.Net"/><category term="POP3"/><category term="Razor"/><category term="RowDefinitions"/><category term="Sharing"/><category term="ShowDialog"/><category term="Silverlight"/><category term="Text"/><category term="Tricks"/><category term="Ve Parser"/><category term="Visual Studio"/><category term="Window"/><category term="XAML"/><category term="Zip"/><category term="powershell"/><title type='text'>Sam Naseri&#39;s Blog</title><subtitle type='html'>Some .Net development notes and maybe some general writings ....</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-8527945398983209523</id><published>2012-12-27T16:56:00.001+11:00</published><updated>2012-12-27T16:56:27.149+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="Tip"/><title type='text'>Open Explorer from command console or powershell</title><content type='html'>I was reading &lt;a href=&quot;http://www.basarat.com/2012/11/open-command-window-at-current-directory.html&quot; target=&quot;_blank&quot;&gt;this post about how to open command line from an explorer window at the same path&lt;/a&gt;. This is very helpful to speed up works a little bit.&lt;br /&gt;
&lt;br /&gt;
In order to open command line in current directory you just need to type &#39;cmd&#39; in address bar. Also you can type &#39;powershell&#39; if you need powershell.&lt;br /&gt;
&lt;br /&gt;
However, in reverse if you want to open windows explorer from command line this is what you need to type in command line:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;explorer .&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
note that if you miss explorer then it will open your user&#39;s documents folder.&lt;br /&gt;
And for powershell the command is:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ii .&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;i&gt;note:&lt;/i&gt; ii is alias for invoke-item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/8527945398983209523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/12/open-explorer-from-command-console-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8527945398983209523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8527945398983209523'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/12/open-explorer-from-command-console-or.html' title='Open Explorer from command console or powershell'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-2294365929035423511</id><published>2012-12-07T11:27:00.001+11:00</published><updated>2012-12-12T23:19:04.276+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DotNetAuth"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="OAuth"/><title type='text'>Introduction to DotNetAuth</title><content type='html'>Recently I have been working on implementation of OAuth protocol. The outcome was not that much bad, so I decided to make it available for others to use it free. Although I am still working on its features, it is fully functional. I have used it in several of my projects.&lt;br /&gt;
&lt;br /&gt;
OAuth protocol is a protocol which is implemented by a lot of famous social networks and is the fundamental key to working with most of their APIs, specially to access to methods&amp;nbsp;which requires some of identity of the requester. So if you want to integrate your website with Facebaook or Google Plus or LinkedIn etc probably your first step would be to handle OAuth protocol.&lt;br /&gt;
&lt;br /&gt;
Also it is a common practice to use OAuth for authenticating user&#39;s in your website. Instead of the classic set of username/password credentials, you can simply deliver the user identification to these social networks and ask for user&#39;s primary set of information like name, date of birth, gender etc through their API.&lt;br /&gt;
&lt;br /&gt;
OAuth protocol is a complete protocol as it considers all the parties(one which needs to authorize, one which need to make an authorized request, end user who authorizes) and all common scenarios in ways of communication between parties.&lt;br /&gt;
&lt;br /&gt;
DotNetAuth is a an implementation of the OAuth protocol which only supports the consumption of protocol, and it is only for server side flow. So if you are the developing a website which wants to makes user-authorized requests to social network sites like Facebook or Google API this library is for. Also this library helps you take advantage of the OAuth protcol to identify users of your website and use OAuth for user membership(sign up, sign in features).&lt;br /&gt;
&lt;br /&gt;
Source Code:&lt;br /&gt;
&lt;a href=&quot;https://bitbucket.org/samnaseri/dotnetauth&quot;&gt;https://bitbucket.org/samnaseri/dotnetauth&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Nuget Packages:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;nuget-button&quot;&gt;Install-Package DotNetAuth&lt;/pre&gt;
&lt;pre class=&quot;nuget-button&quot;&gt;Install-Package DotNetAuth.Profiles&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Asp.Net MVC Sample:&lt;/b&gt;&lt;br /&gt;
This is just a sample to show what it would look like.&lt;br /&gt;
Just add above packages and then you can have the following methods in your ProfileController:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;pre style=&quot;background-position: initial initial; background-repeat: initial initial; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileController&lt;/span&gt;&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Controller&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileProperty&lt;/span&gt;[]&amp;nbsp;requiredProperties&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[]&amp;nbsp;{&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileProperty&lt;/span&gt;.Email,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileProperty&lt;/span&gt;.DisplayName,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileProperty&lt;/span&gt;.UniqueID,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ProfileProperty&lt;/span&gt;.DisplayName&amp;nbsp;};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;GET:&amp;nbsp;/Profile/&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style=&quot;color: #2b91af;&quot;&gt;HttpGet&lt;/span&gt;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ActionResult&lt;/span&gt;&amp;nbsp;Index()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;View();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;RedirectResult&lt;/span&gt;&amp;nbsp;Login()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;userProcessUri&amp;nbsp;=&amp;nbsp;Url.Action(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Callback&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Profile&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;,&amp;nbsp;protocol:&amp;nbsp;Request.Url.Scheme);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;provider&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;LoginProvider&lt;/span&gt;.Get(&lt;span style=&quot;color: #2b91af;&quot;&gt;LoginProviderRegistry&lt;/span&gt;.Facebook.Fullname);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;authorizationUrl&amp;nbsp;=&amp;nbsp;DotNetAuth.Profiles.&lt;span style=&quot;color: #2b91af;&quot;&gt;Login&lt;/span&gt;.GetAuthenticationUri(provider,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Uri&lt;/span&gt;(userProcessUri),&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;DefaultLoginStateManager&lt;/span&gt;(Session),&amp;nbsp;requiredProperties);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;authorizationUrl.Wait();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;Redirect(authorizationUrl.Result.AbsoluteUri);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;GET:&amp;nbsp;/Process&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style=&quot;color: #2b91af;&quot;&gt;HttpGet&lt;/span&gt;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ActionResult&lt;/span&gt;&amp;nbsp;Callback(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;providerName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;userProcessUri&amp;nbsp;=&amp;nbsp;Url.Action(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Callback&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Profile&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;,&amp;nbsp;protocol:&amp;nbsp;Request.Url.Scheme);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;provider&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;LoginProvider&lt;/span&gt;.Get(&lt;span style=&quot;color: #2b91af;&quot;&gt;LoginProviderRegistry&lt;/span&gt;.Facebook.Fullname);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;profile&amp;nbsp;=&amp;nbsp;DotNetAuth.Profiles.&lt;span style=&quot;color: #2b91af;&quot;&gt;Login&lt;/span&gt;.GetProfile(provider,&amp;nbsp;Request.Url,&amp;nbsp;userProcessUri,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;DefaultLoginStateManager&lt;/span&gt;(Session),&amp;nbsp;requiredProperties);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;profile.Wait();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;Content(profile.Result.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;/pre&gt;
&lt;br /&gt;
And that&#39;s it.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/2294365929035423511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/12/introduction-to-dotnetauth.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2294365929035423511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2294365929035423511'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/12/introduction-to-dotnetauth.html' title='Introduction to DotNetAuth'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-4259627650842892984</id><published>2012-11-30T16:27:00.000+11:00</published><updated>2012-11-30T16:27:42.965+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="Cassette"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Bundling using Cassette in Asp.Net MVC</title><content type='html'>I am a big fan of Cassette library. It is an ending to lots of problems you will face in managing your web application scripts and style sheets. Basically what it does is serving JavaScript files and CSS files in a much more efficient and manageable way.&lt;br /&gt;
&lt;br /&gt;
In short these are benefits of using Cassette:  &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;bundling assets&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;multiple files concatenation into single file, so fewer HTTP requests&lt;/li&gt;
&lt;li&gt;reference management&lt;/li&gt;
&lt;li&gt;avoiding including unnecessary assets in a page&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;performance improvements&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;assets auto versioning and caching&amp;nbsp;&lt;/li&gt;
&lt;li&gt;performance achievements through caching&amp;nbsp;&lt;/li&gt;
&lt;li&gt;HTTP compression&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;good transforms&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;script minification&lt;/li&gt;
&lt;li&gt;support for CoffeeScript&lt;/li&gt;
&lt;li&gt;support for SASS&amp;nbsp;&lt;/li&gt;
&lt;li&gt;support for LESS&amp;nbsp;&lt;/li&gt;
&lt;li&gt;support for hogan html templates which means precompiled html templates&amp;nbsp;&lt;/li&gt;
&lt;li&gt;embedding small images into CSS files&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;a little bit of access control over script files.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;debug friendly&lt;/li&gt;
&lt;/ul&gt;
Although Cassette is for both JavaScript and style sheets, if you do it for JavaScript files the same process is for style sheets and HTML templates. So, let start by JavaScript files.&lt;br /&gt;
&lt;h2&gt;
Setting up the Cassette in your web project&lt;/h2&gt;
First of all we need to do a little work to make Cassette features working in our web projects.&lt;br /&gt;
&lt;h3&gt;
The automatic way:&lt;/h3&gt;
Using nuget package, just run the following command:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;install-package cassette.aspnet&lt;/span&gt;&lt;/blockquote&gt;
&lt;h3&gt;
The manual way:&lt;/h3&gt;
You may be a control freak like me, I need to do the things manually in order to make sure that I do know what is happening in my web application, and hence I know what is wrong in case of a failure.&lt;br /&gt;
&lt;br /&gt;
So here are the things that should be done to make Cassette working: &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Configuring web.config to&amp;nbsp;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;add required HTTP module and HTTP handler&amp;nbsp;&lt;/li&gt;
&lt;li&gt;add Cassette.Views to razor page namespaces, you have to do this step for areas manually, even if using nuget package.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Adding CassetteConfiguration class&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Add references to required assemblies:&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette.Views&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette.Aspnet&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;AjaxMin&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;For all the features:&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette.CoffeeScript&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette.Sass&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Cassette.Hogan&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;IronRuby&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;IronRuby.Libraries&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;IronRuby.Libraries.Yaml&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Jurassic&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
This is the HTTP module you need to add  to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;configuration&amp;gt;system.web&amp;gt;httpModules&lt;/span&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;add&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;CassetteHttpModule&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;Cassette.Aspnet.CassetteHttpModule,&amp;nbsp;Cassette.Aspnet&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
You may add the same to&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;configuration&amp;gt;system.webServer&amp;gt;httpModules.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is the HTTP handler you need to add to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;configuration&amp;gt;system.web&amp;gt;httpHandlers&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;add&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;CassetteHttpHandler&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;cassette.axd&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;preCondition&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;integratedMode&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;verb&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;*&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;allowPathInfo&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;Cassette.Aspnet.CassetteHttpHandler,&amp;nbsp;Cassette.Aspnet&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
You may add the same entry to&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;configuration&amp;gt;system.webServer&amp;gt;httpHandlers.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
And you have to include Cassette.Views in &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;configuration&amp;gt;system.web&amp;gt;pages&amp;gt;namespaces&lt;/span&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;add&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;Cassette.Views&lt;/span&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
If you are using Asp.Net MVC Areas, Add the above namespace to every area&#39;s web.config.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
How to implement Cassette&lt;/h2&gt;
Simply there is only three steps:&lt;br /&gt;
1. create bundles to bundle a set of scripts together by writing the following line in CassetteConfiguration: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;bundles.Add&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;ScriptBundle&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;lib/js&quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;/blockquote&gt;
This will create a bundle named &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;lib/js&lt;/span&gt; which bundles all files in &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;lib/js&lt;/span&gt; folder.&lt;br /&gt;
&lt;br /&gt;
2. reference bundles to specify which script is required in your razor page by writing:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Bundles&lt;/span&gt;.Reference(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;lib/js&quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;/blockquote&gt;
It records a flag that bundle &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;lib/js&lt;/span&gt; should be rendered when rendering scripts.&lt;br /&gt;
&lt;br /&gt;
3. create the script tag(s) to load all the referenced libraries. in your razor page you write:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;background: yellow;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Bundles&lt;/span&gt;.RenderScripts();&lt;/pre&gt;
&lt;/blockquote&gt;
It renders all the so far mentioned bundles into one or several &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;script &lt;/span&gt;tags.&lt;br /&gt;
&lt;h3&gt;
Step 1. Creating and configuration of bundles&lt;/h3&gt;
In step one you specify which files to be included in a bundle called &quot;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;lib/js&lt;/span&gt;&quot;, you may also specify more advanced setting for bundle, like how to search for files, which files should be ignored, etc.&lt;br /&gt;
&lt;br /&gt;
When bundling you specify a folder path, then according to some rules, script files within that path will be added to the bundle. Default rules exclude -vsdoc.js files and also if alternative .min or .debug file exists, then only one file is picked.&lt;br /&gt;
&lt;h3&gt;
Step 2. Adding references to scripts&lt;/h3&gt;
In step two you only mention that the specified bundle is required, you can do this &#39;referencing bundles&#39; anywhere, it could be the layout page, a partial view. So you ask for a bundle to be included only when it is required and at the place that requirement is raised. For example you have a partial view that requires a specific script, so you add a reference to that script in that partial view. Assuming that no other view or partial view has a demand for that script, then that script only will be loaded for pages which contains that partial view.&lt;br /&gt;
&lt;br /&gt;
The reference you specify is a bundle path. So if you write @Bundles.Reference(&quot;X&quot;) then you should have bundles.Add(&quot;X&quot;) in your Cassette configuration, or you should have a bundles.Add(&quot;Y&quot;) where X can be find in Y.&lt;br /&gt;
&lt;h3&gt;
Step 3. Rendering the actual script tags&lt;/h3&gt;
In step three you actually create script tags. So the bundles you have mentioned so far using the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;@Bundles.Reference&lt;/span&gt; will be rendered into one or multiple script tags. If your &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/s10awwz0(v=vs.100).aspx&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;compliation &lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;debug &lt;/span&gt;attribute is set to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;true&lt;/span&gt;, then Cassette does not join scripts and does not minify them, so you still can debug your scripts. In contrast, if &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;debug=&quot;false&quot;&lt;/span&gt;, then Cassette concatenates scripts files into a single file and also minifies them.&lt;br /&gt;
&lt;br /&gt;
It may be a little bit confusing, at least it was for me. As I described it here, the step one may seems unnecessary, but you should note that in step two &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;lib/js&quot;&lt;/span&gt; does not refer to a scripts folder, but it is referring to the bundle we created at step one.&lt;br /&gt;
&lt;br /&gt;
Rendering script tags is where you get the point of Cassette, the way that Cassette renders script tags and brings scripts into your page has several benefits. But before going forward to discuss the benefits, first let me describe some facts about &lt;b&gt;how Cassette works&lt;/b&gt;, so then I can tell how those benefits are achieved.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Cassette exposes a HTTP handler for sending back scripts to client.&lt;/li&gt;
&lt;li&gt;Cassette computes a hash for each bundle. If the scripts change, the hash value will change.&lt;/li&gt;
&lt;li&gt;Cassette will return a bundle even if you asked for a single script file. For example you asked for &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;lib/js/MySpecificLib.js&quot;&lt;/span&gt;, then Cassette will return bundle &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;lib/js&quot;&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;Cassette will include dependencies and order scripts based on their dependencies.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
So the benefits are:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- You can prevent direct access to your script libraries. So if you are using Cassette for all your&amp;nbsp;resources&amp;nbsp; then you may restrict direct access to libraries folder. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- Unless you created a bundle you can not reference to a script file. So there is a limited number of bundles all defined in CassetteConfiguration class. Each bundle is accessed via Cassette&#39;s HTTP handler and has a URL which is consisted of bundle&#39;s hash. So if you change the scripts then the hash changes and the URL changes, so the browser would not use the cached version and hence you forced browser to fetch the new version of bundle. And as long as the scripts are the same you can rely the browser caching. Here I have to point out an important guideline: put third parties libraries and your own libraries in different bundles, because they have different change&amp;nbsp;frequencies&amp;nbsp; Your app&#39;s scripts change more often, so they bundle need to be reloaded more often.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- When referencing you can be specific about exactly which scripts you need, you&amp;nbsp;don&#39;t&amp;nbsp;have to mention the bundle itself. If you specify a script file instead of a bundle, then cassette will render a script tag&amp;nbsp;pointing&amp;nbsp;to any bundle which contains that file, chances are that file already has been loaded once. However because you specified the file name rather than the bundle name, you can move that file to another bundle, for example make your bundles more granular and specific, without being worried about places which that bundle was&amp;nbsp;referenced. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- You only need to reference the scripts you directly need, you&amp;nbsp;don&#39;t&amp;nbsp;need to be worried about if you have included the required libraries which your scripts requires. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- One important thing you should know is that the way script tags are rendered is dependent on &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/s10awwz0(v=vs.100).aspx&quot; target=&quot;_blank&quot;&gt;compilation &lt;/a&gt;debug attribute. If it&#39;s value is true, Cassette will generate debug friendly script tags and script files are rendered as it is. In contrast, if debug value is false, then Cassette will generate&amp;nbsp;efficient&amp;nbsp;script tags and script files are concatenated and minified. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- Probably you are using layout pages in a way that your pages are not concerned with the head section of html. Using Cassette you render scripts only in layout page and then reference the bundles in page whenever they are required, so when each page is served the scripts(bundles) related to that specific page is rendered. &lt;br /&gt;
&lt;br /&gt;
Note: For simplicity, I have written this article for scripts. However the same story happens for style sheets, the only difference is that instead of &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ScriptBundle &lt;/span&gt;you use &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;StylesheetBundle&lt;/span&gt;. And instead of &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;@Bundles.RenderScripts()&lt;/span&gt; you will write &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;@Bundles.RenderStylesheets()&lt;/span&gt; .&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Targeted&amp;nbsp;Bundles&lt;/h2&gt;
When defining a bundle you can restrict it to a specific target. Actually, the Cassette itself referes to it as PageLocation, however you can use this feature beyond page location, so I named it targetted bundling.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/4259627650842892984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/11/bundling-using-cassette-in-aspnet-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4259627650842892984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4259627650842892984'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/11/bundling-using-cassette-in-aspnet-mvc.html' title='Bundling using Cassette in Asp.Net MVC'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-5581991948414587588</id><published>2012-11-29T12:55:00.003+11:00</published><updated>2012-11-29T12:55:51.275+11:00</updated><title type='text'>A behavior to keep DataGrid&#39;s SelectedItem into View</title><content type='html'>The following simple behavior will forces a DataGrid to keep its SelectedItem into view. The way that it works is simply hooking SelectionChanged event and calling DataGrid.ScrollIntoView method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/4166148.js?file=KeepSelectionInView behavior.cs&quot;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/5581991948414587588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/11/a-behavior-to-keep-datagrids.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5581991948414587588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5581991948414587588'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/11/a-behavior-to-keep-datagrids.html' title='A behavior to keep DataGrid&#39;s SelectedItem into View'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-2816398440946121402</id><published>2012-11-29T11:48:00.000+11:00</published><updated>2012-11-29T11:48:05.792+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MVVM"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><title type='text'>An advice : Remove code behind files in WPF</title><content type='html'>In WPF when using MVVM it is better to delete the code behind file straight away. Those almost empty code files are not necessary at all and the project will compile without them. Moreover, if you have removed the code behind file an press F7 key, then nothing happens. It matters to me because I have a habit to press F7 to navigate to code related to XAML, and doing so it always opens code behind file which is not desired.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/2816398440946121402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/11/an-advice-remove-code-behind-files-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2816398440946121402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2816398440946121402'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/11/an-advice-remove-code-behind-files-in.html' title='An advice : Remove code behind files in WPF'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-7192749937156430006</id><published>2012-08-07T11:24:00.002+10:00</published><updated>2012-08-07T11:24:47.375+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Meetup.com"/><category scheme="http://www.blogger.com/atom/ns#" term="OAuth 2"/><title type='text'>Meetup Invalid Authorization request</title><content type='html'>Trying to connect to Meetup.com API using OAuth2.0 I had a problem which I find out this is not documented in their API documentation.&lt;br /&gt;
The redirect_url parameter is case sensitive. So if this is the case then you will recieve the error message :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;D_boxhead&quot; style=&quot;background-color: white; color: #666666; font-family: verdana, Arial, sans-serif; font-size: 12px; line-height: 18px; overflow: hidden; padding: 0.5em 0.5em 1em;&quot;&gt;
&lt;h2 style=&quot;color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 26px; letter-spacing: -0.5px; line-height: 1.1; margin: 0px; padding: 0px 0px 6.4px;&quot;&gt;
Invalid Authorization request&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;D_docsection&quot; style=&quot;background-color: white; color: #666666; font-family: verdana, Arial, sans-serif; font-size: 12px; line-height: 18px; overflow: hidden;&quot;&gt;
&lt;div class=&quot;D_boxsection &quot; style=&quot;border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; font-size: 1em; line-height: 1.5em; overflow: hidden; padding-bottom: 0.9em; padding-left: 5px !important; padding-right: 0.5em; padding-top: 0.9em;&quot;&gt;
If you were directed here by another application, contact its developer&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
So make sure that the redirect uri of your application defined at&amp;nbsp;&lt;a href=&quot;http://www.meetup.com/meetup_api/oauth_consumers/&quot;&gt;http://www.meetup.com/meetup_api/oauth_consumers/&lt;/a&gt;&amp;nbsp;exactly(case wise) matches the redirect_uri parameter you pass in your authorization request.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/7192749937156430006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/08/meetup-invalid-authorization-request.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/7192749937156430006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/7192749937156430006'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/08/meetup-invalid-authorization-request.html' title='Meetup Invalid Authorization request'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-490188777400824251</id><published>2012-04-23T15:00:00.000+10:00</published><updated>2012-04-23T15:00:44.350+10:00</updated><title type='text'>Automata and Compilers courses from coursera</title><content type='html'>I did write ve parser without any technical knowledge about parsing algorithms, I always wanted to improve my knowledge in this area and now I have the chance to do it.&lt;br /&gt;
I am very excited to start two online free courses today. These courses are &lt;a href=&quot;https://www.coursera.org/course/automata&quot; target=&quot;_blank&quot;&gt;Automata &lt;/a&gt;and &lt;a href=&quot;https://www.coursera.org/course/compilers&quot; target=&quot;_blank&quot;&gt;Compilers&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
There are some other computer science courses available on &lt;a href=&quot;http://coursera.org/&quot;&gt;coursera.org&lt;/a&gt;. Have a look at it, there is also courses in other fields.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/490188777400824251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/04/automata-and-compilers-courses-from.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/490188777400824251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/490188777400824251'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/04/automata-and-compilers-courses-from.html' title='Automata and Compilers courses from coursera'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-1711521936577834070</id><published>2012-03-29T18:51:00.000+11:00</published><updated>2012-03-29T19:09:27.263+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ColumnDefinitions"/><category scheme="http://www.blogger.com/atom/ns#" term="Grid"/><category scheme="http://www.blogger.com/atom/ns#" term="Layout"/><category scheme="http://www.blogger.com/atom/ns#" term="RowDefinitions"/><category scheme="http://www.blogger.com/atom/ns#" term="Tip"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><category scheme="http://www.blogger.com/atom/ns#" term="XAML"/><title type='text'>WPF Grid Layout Simplified Using Rows and Columns Attached Properties</title><content type='html'>A major problem with WPF and XAML is that XAML code tends to be very cluttered and after a little your XAML code gets too much complicated. In a recent project I suggested to define new controls by deriving from existing controls, so you can assign a shorter name to them or avoiding setting the same property the same value for thousand of time(e.g. Horizontal orientation stack panel).&lt;br /&gt;
&lt;br /&gt;
Here is another tip to make you XAML code less cluttered. One area that you may find it hard to write and read and maintain is Grid layout control. Defining RowDefinitions and ColumnDefinitions waste too much space and adds too&amp;nbsp;unnecessary&amp;nbsp;lines of code. Hence it become too&amp;nbsp;complicated&amp;nbsp;to handle it.&lt;br /&gt;
The solution I am sugessting here is to use some attached properties to define RowDefinitions and ColumnDefinitions in a smarter way.&lt;br /&gt;
You can fetch the code for attached properties here:&amp;nbsp;&lt;a href=&quot;https://gist.github.com/2234500&quot;&gt;https://gist.github.com/2234500&lt;/a&gt;&lt;br /&gt;
This code adds these attached properties to Grid&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Grid.Rows&lt;/li&gt;
&lt;li&gt;Grid.Columns&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
and adds these attached properties to UIElemnet&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Cell&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Grid.Rows and Grid.Columns are same thing but one is for specifying rows and one is for columns. These two properties are simply text value which you can set it according to the following Rules:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Separate items with semi colon(;) , Example &quot;auto;auto;*&quot;&lt;/li&gt;
&lt;li&gt;Use auto for adding an Auto sized row or column , Example &quot;auto;auto&quot;&lt;/li&gt;
&lt;li&gt;Specify * for adding an star sized row or column, Example &quot;1*,2*, *&quot;&lt;/li&gt;
&lt;li&gt;Specify only a number for adding a fixed size row or column, Example &quot;200,200,100&quot;&lt;/li&gt;
&lt;li&gt;Append # followed by a number to add multiple rows and columns of same sizing. &quot;1*#4,auto&quot;&lt;/li&gt;
&lt;li&gt;The number of starts in an item will multiplies star factor. Example &quot;**,***,*&quot; instead of &quot;2*,3*,*&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;XAML Sample:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Grid&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;s&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Grid.Rows&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;auto;1*;auto;auto&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: red;&quot;&gt;s:Grid.Columns&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;&quot;*#5;auto&quot;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;&amp;gt; ... &lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Grid&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Adds 4 rows to grid which are all Auto sized except the second row which occupies all remained space. Also adds 5 star columns followed by an Auto sized column.&lt;br /&gt;
&lt;b&gt;Implementaion&lt;/b&gt;&lt;br /&gt;
As I said this is simply 3 attached properties which allows you to specify the rows and columns using a textual representation. Here is the function which converts the textual value into a GridLength value:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridLength&lt;/span&gt;&amp;nbsp;ParseGridLength(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;text)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text&amp;nbsp;=&amp;nbsp;text.Trim();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(text.ToLower()&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;auto&quot;&lt;/span&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridLength&lt;/span&gt;.Auto;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(text.Contains(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;*&quot;&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;startCount&amp;nbsp;=&amp;nbsp;text.ToCharArray().Count(c&amp;nbsp;=&amp;gt;&amp;nbsp;c&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;*&#39;&lt;/span&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;pureNumber&amp;nbsp;=&amp;nbsp;text.Replace(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;*&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;ratio&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.IsNullOrWhiteSpace(pureNumber)&amp;nbsp;?&amp;nbsp;1&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;double&lt;/span&gt;.Parse(pureNumber);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridLength&lt;/span&gt;(startCount&amp;nbsp;*&amp;nbsp;ratio,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridUnitType&lt;/span&gt;.Star);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;pixelsCount&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;double&lt;/span&gt;.Parse(text);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridLength&lt;/span&gt;(pixelsCount,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridUnitType&lt;/span&gt;.Pixel);
}
&lt;/pre&gt;
&lt;br /&gt;
And here is the function which makes # operator working:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridLength&lt;/span&gt;&amp;gt;&amp;nbsp;Parse(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;text)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(text.Contains(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;#&quot;&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;parts&amp;nbsp;=&amp;nbsp;text.Split(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[]&amp;nbsp;{&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;#&#39;&lt;/span&gt;&amp;nbsp;},&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;StringSplitOptions&lt;/span&gt;.RemoveEmptyEntries);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;count&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;.Parse(parts[1].Trim());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Enumerable&lt;/span&gt;.Repeat(ParseGridLength(parts[0]),&amp;nbsp;count);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[]&amp;nbsp;{&amp;nbsp;ParseGridLength(text)&amp;nbsp;};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;br /&gt;
And finally the attached property change callback:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;grid&amp;nbsp;=&amp;nbsp;d&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;System.Windows.Controls.&lt;span style=&quot;color: #2b91af;&quot;&gt;Grid&lt;/span&gt;;
&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;oldValue&amp;nbsp;=&amp;nbsp;e.OldValue&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;;
&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;newValue&amp;nbsp;=&amp;nbsp;e.NewValue&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;;
&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(oldValue&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;||&amp;nbsp;newValue&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;;
 
&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(oldValue&amp;nbsp;!=&amp;nbsp;newValue)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grid.ColumnDefinitions.Clear();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newValue
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Split(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[]&amp;nbsp;{&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;;&#39;&lt;/span&gt;&amp;nbsp;},&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;StringSplitOptions&lt;/span&gt;.RemoveEmptyEntries)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.SelectMany(Parse)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Select(l&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ColumnDefinition&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Width&amp;nbsp;=&amp;nbsp;l&amp;nbsp;})
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.ToList().ForEach(grid.ColumnDefinitions.Add);
}&lt;/pre&gt;
&lt;br /&gt;
The above code is for Columns attached property but this is the same for Rows attached property as well.&lt;br /&gt;
&lt;br /&gt;
The whole source code for these attached properties:&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/2234500.js&quot;&gt;
 
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/1711521936577834070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/03/wpf-grid-layout-simplified-using-rows.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1711521936577834070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1711521936577834070'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/03/wpf-grid-layout-simplified-using-rows.html' title='WPF Grid Layout Simplified Using Rows and Columns Attached Properties'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-114187789236131318</id><published>2012-03-27T14:13:00.001+11:00</published><updated>2012-03-27T14:18:17.889+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gist"/><category scheme="http://www.blogger.com/atom/ns#" term="Sharing"/><title type='text'>GitHub Gist</title><content type='html'>Love sharing? Are you a social coder? A lot of times you may wanted to share piece of code but you give up just because it was going to be a cumbersome process to create a project on CodePlex or GitHub.&lt;br /&gt;
I just see a simple feature of GitHub, named &lt;a href=&quot;https://gist.github.com/&quot; target=&quot;_blank&quot;&gt;Gist&lt;/a&gt;. It&#39;s a simple method for sharing your code that you find useful for others.

For example, having to implement online payment functionality for my Asp.Net MVC website I ended up with a simple PaymentController which I just shared it with GitHub.&lt;br /&gt;
Here is my first gist:&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/2211309.js&quot;&gt;
 
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/114187789236131318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/03/github-gists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/114187789236131318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/114187789236131318'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/03/github-gists.html' title='GitHub Gist'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-5274783227793613600</id><published>2012-03-26T16:32:00.001+11:00</published><updated>2012-03-27T19:14:23.732+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework Migrations"/><title type='text'>Why Invalid Object Name &#39;dbo.__MigrationHistory&#39;?</title><content type='html'>&lt;br /&gt;
Unfortunately I am using&amp;nbsp;
Entity Framework&amp;nbsp;in my project. After migration support added to Entity Framework I thought using this feature may help me feel a little better about&amp;nbsp;
Entity Framework&amp;nbsp;. But the way migration is implemented in EF shows that nothing has changed. Migration has lots of problems and bugs.&lt;br /&gt;
After carefully doing all the required cumbersome procedures&amp;nbsp;
Entity Framework&amp;nbsp;migration failed to work and I found no workaround until I strangely faced the exception &#39;Invalid Object Name &#39;dbo.__MigrationHistory&#39;&#39;. This exception give me &amp;nbsp;a clue about the cause of my problems.&lt;br /&gt;
It seems that Entity Framework team do not use appropriate testing methods and they only care about the main courses and are very&amp;nbsp;negligent&amp;nbsp;about alternative cases. For example in this case they presumed that always the default schema is dbo. It creates __MigrationHistory on the default schema, but queries for it on the dbo schema.&lt;br /&gt;
After a while I find another problem. Entity Framework also tries to insert rows into __MigrationHistory without specifying schema name.&lt;br /&gt;
&lt;br /&gt;
Ok, I wrote this code to make Entity Framework script generator apply &#39;dbo.&#39; before the __MigrationHistory. I know this is naive solution but at least it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/2213903.js&quot;&gt;
 
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/5274783227793613600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/03/why-invalid-object-name.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5274783227793613600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5274783227793613600'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/03/why-invalid-object-name.html' title='Why Invalid Object Name &#39;dbo.__MigrationHistory&#39;?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-2320848266086973523</id><published>2012-03-26T14:59:00.001+11:00</published><updated>2012-03-29T18:20:43.837+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><title type='text'>A WPF Technique: Decorating controls by deriving from standard control</title><content type='html'>I always consider StackPanel as Vertical StackPanel as it is Vertical by default, but why there is no layout control that is horizontal by default?. I believe it does not worth for the WPF framework to introduce one as it is very easy to write if you need one. In this post I am going to describe how easy is to create a HorizontalStackPanel and a couple of related useful notes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Define types by deriving from WPF controls.&lt;/b&gt;&lt;br /&gt;
The simplest way to write your own controls is to derive from existing ones. You do not need to do anything else. Yes, that it, you have the same control with the same functionalities but with a different Type. For example you may derive a class from TextBlock, it still is a TextBlock but it has its own specific type, so it is behave in a slightly different in some cases, mostly when you refer the types like in a TargetType of a Style.&lt;br /&gt;
Here is a summary of benefits of doing so:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Defining some common behaviour in code and not using the styles&lt;/li&gt;
&lt;li&gt;Easier targeting them in styles&lt;/li&gt;
&lt;li&gt;More readable XAML code&lt;/li&gt;
&lt;li&gt;Very helpful for code sharing between Silverlight and WPF&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;HorizontalStackPanel as an example&lt;/b&gt;&lt;br /&gt;
For example you may define a HorizontalStackPanel by deriving a type from StackPanel and setting its Orientation to Horizontal in its constructor. Actually it is not a horizontal stackpanel but it is InitialyHorizontalStackPanel as the users have the opportunity to change the orientation later using XAML or code.&lt;br /&gt;
Also the HorizontalAlignment in StackPanel has a default value of Stretch, you need to set it back to Left and do the same for VerticalAlignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Horizontal&lt;/span&gt;&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;StackPanel&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Horizontal()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Orientation&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Orientation&lt;/span&gt;.Horizontal;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Vertical&lt;/span&gt;&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;StackPanel&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Vertical()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Orientation&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Orientation&lt;/span&gt;.Vertical;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
So now you can write these XAML code&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;Orientation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Horizontal&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
This way&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Vertical&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Horizontal&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Horizontal&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Vertical&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Which is much more readable and less cluttered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/2320848266086973523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/11/wpf-tips-1-decorating-controls-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2320848266086973523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2320848266086973523'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/11/wpf-tips-1-decorating-controls-by.html' title='A WPF Technique: Decorating controls by deriving from standard control'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-797455281271684841</id><published>2012-02-15T10:06:00.000+11:00</published><updated>2012-02-15T10:06:02.118+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><title type='text'>Entity Framework 4.3 Released</title><content type='html'>Just read&amp;nbsp;&lt;a href=&quot;http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-released.aspx&quot; target=&quot;_blank&quot;&gt;this announcement&lt;/a&gt;&amp;nbsp;about the release of Entity Framework 4.3. Despite some fixes, the only great feature added to this version is the Entity Framework Migration. So now using Entity Framework 4.3 you can keep your data after changing your data model. In the past, you need to drop and recreate database or handle database upgrade manually.</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/797455281271684841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/02/entity-framework-43-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/797455281271684841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/797455281271684841'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/02/entity-framework-43-released.html' title='Entity Framework 4.3 Released'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-2299103839787036971</id><published>2012-01-14T16:51:00.000+11:00</published><updated>2012-01-14T16:51:10.748+11:00</updated><title type='text'>Using third party web services in your applications</title><content type='html'>Reading a &lt;a href=&quot;http://stackoverflow.com/questions/8855866/windows-phone-literal-uri-request&quot; target=&quot;_blank&quot;&gt;question &lt;/a&gt;in &lt;a href=&quot;http://stackoverflow.com/&quot; target=&quot;_blank&quot;&gt;StackOverflow &lt;/a&gt;website I thought I have to write about my suggestion to Windows Phone developers regarding the way you should use third party web services in your applications:&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Adding a layer of indirection is considerable&lt;/b&gt;&lt;br /&gt;
It is very common that you need to consume a web service from a third party to show some information to your users or provide some functionality for them. So the easiest way is to add a reference to their web service in your application and call methods.&lt;br /&gt;
In certain scenarios you have to employ this method. But I am thinking of not adding a direct dependency to a third party web services. Ans I suggest to add a layer of indirection by implementing your own web service by&amp;nbsp;dispatching&amp;nbsp;the request from your applications to the&amp;nbsp;third&amp;nbsp;party web service.&lt;br /&gt;
&lt;b&gt;Application Vulnerability to changes in&amp;nbsp;web service&amp;nbsp;definition&lt;/b&gt;&lt;br /&gt;
By adding a direct dependency to a third party web service and considering the fact that the web service owners may change the web service definition, all the installed instance of your application may fail to work if such a change happens. Then you have to provide an updated version of your application and wait users to install the update. Some users may not be happy with the situation and decide to uninstall the application instead of updating.&lt;br /&gt;
&lt;b&gt;The chance of adding your own functionality&lt;/b&gt;&lt;br /&gt;
If you directly call the third party web service you are limited to functionalities provided by that web service, for example imagine that you call&amp;nbsp;web service&amp;nbsp;to receive a list of addresses. Now if you want to pin them on a map, you need the latitude and longitude of the addresses which is not provided by the web service. I believe in most of the cases you will be much more productive if you have some power to do the things in your own way.&lt;br /&gt;
&lt;b&gt;Performance and efficiency considerations&lt;/b&gt;&lt;br /&gt;
As the designers of third party web service have thought about some specific scenarios the set of methods they provided may not match your exact needs. For example you may have to make two or three calls to receive all the required data and no single method gives all the response you needed. And the result from the first calls is not enough to provide any feedback to user . Or as an another example you may only need to show a part of received data and have nothing to do with the whole given data. As can be clearly seen by this examples there could be two kind of problems with third party web services, extra&amp;nbsp;round-trips&amp;nbsp;and extra bandwidth consumption, which avoiding them can increase your application performance.&lt;br /&gt;
&lt;b&gt;Logging and tracking&lt;/b&gt;&lt;br /&gt;
Generally a good method for logging and other cross cutting concerns is to have an indirection layer, which receives requests and dispatches them. And here in our topic about third party&amp;nbsp;web services, if we do not sit in user&#39;s way to access to data and services we have no chance to track them and have a report of it.&amp;nbsp;So create a web service and dispatch the request to third party web service and meanwhile collect some useful data like error exceptions, calls count, performance logging, caching. And do not forget to be respectful to users privacy. If your application is mostly calling the web service then you could have a nice report your application usage.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Some disadvantages&lt;/b&gt;&lt;br /&gt;
No need to say, writing your own web service has its own disadvantages. First it is costly, you have to develop, test, maintain the web service. Also you have to pay for hosting, if you do not have a spare web space. And your hosting may not be as powerful and fast as the third party web service is, so your app would not be as fast as it could be. Also there are legal issues about using third party web services, some web services specifically forbidden not using their services directly. I am not very into security, but I have a vague idea about there may be some security issues.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What do you think?&lt;/b&gt;&lt;br /&gt;
Also there may be some other advantages and disadvantages, I would like to hear about them, so do not hesitate to leave a comment.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/2299103839787036971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/01/using-third-party-web-services-in-your.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2299103839787036971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2299103839787036971'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/01/using-third-party-web-services-in-your.html' title='Using third party web services in your applications'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-5424099042566269421</id><published>2012-01-11T16:36:00.001+11:00</published><updated>2012-01-11T16:36:36.140+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Coding Tips"/><title type='text'>Assigning null to anonymouse type properties</title><content type='html'>Just a quick note about handling an issue for anonymous types, if you wanted to assign a null value to a property you will face a compile error which says&amp;nbsp;&lt;b&gt;Cannot assign &amp;lt;null&amp;gt; to anonymous type property&lt;/b&gt;, and the easy solution for this is to write to cast the null to desired type, this is important specially if you are creating an array of anonymouse typed objects.&lt;br /&gt;
&lt;br /&gt;
Here is a sample code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;[]&amp;nbsp;{&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Fixed&amp;nbsp;Value&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;)&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;B_FixedValue_EditViewModel&lt;/span&gt;()&amp;nbsp;}&amp;nbsp;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Fixed&amp;nbsp;List&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;}&amp;nbsp;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Calculation&amp;nbsp;on&amp;nbsp;one&amp;nbsp;value&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&amp;nbsp;}&amp;nbsp;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Calculation&amp;nbsp;on&amp;nbsp;two&amp;nbsp;values&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&amp;nbsp;}&amp;nbsp;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Loading&amp;nbsp;a&amp;nbsp;value&amp;nbsp;from&amp;nbsp;database&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&amp;nbsp;}&amp;nbsp;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;{&amp;nbsp;Name&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Conditional&amp;nbsp;Value&amp;nbsp;Provision&quot;&lt;/span&gt;,&amp;nbsp;ViewModel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;}&amp;nbsp;,
};&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/5424099042566269421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2012/01/assigning-null-to-anonymouse-type.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5424099042566269421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5424099042566269421'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2012/01/assigning-null-to-anonymouse-type.html' title='Assigning null to anonymouse type properties'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-2668182500404096323</id><published>2011-12-20T10:43:00.002+11:00</published><updated>2011-12-20T12:33:18.023+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MVVM"/><category scheme="http://www.blogger.com/atom/ns#" term="ShowDialog"/><category scheme="http://www.blogger.com/atom/ns#" term="Window"/><category scheme="http://www.blogger.com/atom/ns#" term="WPF"/><title type='text'>Showing a modal and continue to execution of calling window</title><content type='html'>Again some bits of code. For a couple of reason you may consider not using the ShowDialog method of a window, one is that the calling method does not continue the execution and it blocks until the dialog window becomes closed. I have written my MVVM tool set in a way that this behaviour causes some problems. The other reason is ShowDialog blocks all other windows in your application, so what if you want to open a window over another window in a way that only the calling window becomes blocked. Here is the solution I came up with:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;WPFWindowExtensions&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;ShowNonBlockingModal(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Window&lt;/span&gt;&amp;nbsp;window)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;parent&amp;nbsp;=&amp;nbsp;window.Owner;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;EventHandler&lt;/span&gt;&amp;nbsp;parentDeactivate&amp;nbsp;=&amp;nbsp;(_,&amp;nbsp;__)&amp;nbsp;=&amp;gt;&amp;nbsp;{&amp;nbsp;window.Activate();&amp;nbsp;};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parent.Activated&amp;nbsp;+=&amp;nbsp;parentDeactivate;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;EventHandler&lt;/span&gt;&amp;nbsp;window_Closed&amp;nbsp;=&amp;nbsp;(_,&amp;nbsp;__)&amp;nbsp;=&amp;gt;&amp;nbsp;{&amp;nbsp;parent.Activated&amp;nbsp;-=&amp;nbsp;parentDeactivate;&amp;nbsp;};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;window.Show();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;/pre&gt;
&lt;br /&gt;
I tried to keep it simple to be more readable, however you may add a check for the window.Owner to have a value and throw an exception if it is null, or you may automatically set the owner with the current active window as described in this&lt;a href=&quot;http://sarafianalex.wordpress.com/2008/09/12/wpf-showdialog/&quot; target=&quot;_blank&quot;&gt; blog post&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/2668182500404096323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/12/showing-modal-and-continue-to-execution.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2668182500404096323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/2668182500404096323'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/12/showing-modal-and-continue-to-execution.html' title='Showing a modal and continue to execution of calling window'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-6052175081733394843</id><published>2011-12-16T13:22:00.000+11:00</published><updated>2011-12-16T22:54:39.743+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DatePicker"/><category scheme="http://www.blogger.com/atom/ns#" term="Navigation"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7"/><title type='text'>OnNavigatedTo will be called after selecting a date using DatePicker</title><content type='html'>&lt;b&gt;Long Story:&lt;/b&gt;&lt;br /&gt;
During developing my Windows Phone application I faced a strange problem. At first I thought that the problems is related to DatePicker Value binding is not working properly. I tried several things and then finally I relaized that OnNavigatedTo method is being called when the user selects a data or presses the back button and then when this method is executed again I override all the bindings. And the solution is very simple, just check for NavigationMode of event args to not be NavigationMode.Back, here is a sample code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;OnNavigatedTo(System.Windows.Navigation.&lt;span style=&quot;color: #2b91af;&quot;&gt;NavigationEventArgs&lt;/span&gt;&amp;nbsp;e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.OnNavigatedTo(e);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(e.NavigationMode&amp;nbsp;==&amp;nbsp;System.Windows.Navigation.&lt;span style=&quot;color: #2b91af;&quot;&gt;NavigationMode&lt;/span&gt;.Back)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;viewModel&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;AddWeightViewModel&lt;/span&gt;();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;viewModel.Date&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;DateTime&lt;/span&gt;.Today;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.DataContext&amp;nbsp;=&amp;nbsp;viewModel;
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Short Story:&lt;/b&gt;&lt;br /&gt;
Always make sure that you add the following lines of code to the OnNavigatedTo method, specially if you have a DatePicker on your page:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(e.NavigationMode&amp;nbsp;==&amp;nbsp;System.Windows.Navigation.&lt;span style=&quot;color: #2b91af;&quot;&gt;NavigationMode&lt;/span&gt;.Back)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;;&lt;/pre&gt;
&lt;br /&gt;
By adding the above code to the beginning of OnNavigatedTo you prevent from resetting your page data. Keep in mind although the OnNavigatedTo is called, the page is still has its own values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/6052175081733394843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/12/onnavigatedto-will-be-called-after.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/6052175081733394843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/6052175081733394843'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/12/onnavigatedto-will-be-called-after.html' title='OnNavigatedTo will be called after selecting a date using DatePicker'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-8450448402121036971</id><published>2011-12-15T14:22:00.000+11:00</published><updated>2011-12-16T22:55:32.912+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Binding"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7"/><title type='text'>Solution to a problem in Application Bar and Binding on the same page</title><content type='html'>Just a quick share of a useful code I found in MSDN forums for&amp;nbsp;when application bar button invokes the event handler before binding on the current element takes place.&lt;br /&gt;
The problem is that if you add a textbox to the page and then user presses a button on the application bar, then if user presses that button just after filling that textbox, then unexpectedly you will not receive the updated value for that textbox&#39;s binding target, whatever the reason is the solution for this is to update binding manually knowing the fact that the textbox is the current focused control, here is the code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Utilities&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;MakeSureBindingsApplied()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;focusObj&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;FocusManager&lt;/span&gt;.GetFocusedElement()&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;TextBox&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(focusObj&amp;nbsp;!=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;binding&amp;nbsp;=&amp;nbsp;focusObj.GetBindingExpression(&lt;span style=&quot;color: #2b91af;&quot;&gt;TextBox&lt;/span&gt;.TextProperty);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;binding.UpdateSource();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;br /&gt;
Then what you have to do is just to call it in the event handler for application bar button, make sure that you call this method before reading data from binding&#39;s targets.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;saveButton_Click(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&amp;nbsp;sender,&amp;nbsp;System.&lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;&amp;nbsp;e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Utilities&lt;/span&gt;.MakeSureBindingsApplied();&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/8450448402121036971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/12/solution-to-problem-in-application-bar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8450448402121036971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8450448402121036971'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/12/solution-to-problem-in-application-bar.html' title='Solution to a problem in Application Bar and Binding on the same page'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-7077097827936690352</id><published>2011-12-07T16:55:00.001+11:00</published><updated>2011-12-08T12:06:45.921+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenPop.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="POP3"/><title type='text'>Library for reading emails from a POP3 server</title><content type='html'>I needed to get the list of messages in a the inbox, so I can process them and save them into a database. After searching a while I found out a good free library for this purpose is &lt;a href=&quot;http://hpop.sourceforge.net/&quot; target=&quot;_blank&quot;&gt;OpenPop. Net&lt;/a&gt;&amp;nbsp;. This library has a good interface and easy to use. Also is well documented, plus lots of useful examples. And one important thing, it supports SSL, so, for example you can read your emails in your gmail or live accounts.&lt;br /&gt;
&lt;br /&gt;
This is a simple sample code for having your inbox in an Asp.Net page:&lt;br /&gt;
No need to say, you have to change the third line with your own gmail credentials:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;&amp;nbsp;client&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;&amp;nbsp;OpenPop.Pop3.Pop3Client
&amp;nbsp;&amp;nbsp;&amp;nbsp;client.Connect(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;pop.gmail.com&quot;&lt;/span&gt;,&amp;nbsp;995,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;True&lt;/span&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;client.Authenticate(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;mygmailaccountid@gmail.com&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;mypassword&quot;&lt;/span&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;&amp;nbsp;messageCount&amp;nbsp;=&amp;nbsp;client.GetMessageCount()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;&amp;nbsp;allMessages&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;&amp;nbsp;List(&lt;span style=&quot;color: blue;&quot;&gt;Of&lt;/span&gt;&amp;nbsp;Net.Mail.MailMessage)(messageCount)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt;&amp;nbsp;i&amp;nbsp;=&amp;nbsp;1&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;To&lt;/span&gt;&amp;nbsp;Math.Max(10,&amp;nbsp;messageCount)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;&amp;nbsp;message&amp;nbsp;=&amp;nbsp;client.GetMessage(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;&amp;nbsp;mailMessage&amp;nbsp;=&amp;nbsp;message.ToMailMessage()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;allMessages.Add(mailMessage)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;grdInbox.DataSource&amp;nbsp;=&amp;nbsp;allMessages
&amp;nbsp;&amp;nbsp;&amp;nbsp;grdInbox.DataBind()
&amp;nbsp;&amp;nbsp;&amp;nbsp;client.Dispose()&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/7077097827936690352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/12/library-for-reading-emails-from-pop3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/7077097827936690352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/7077097827936690352'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/12/library-for-reading-emails-from-pop3.html' title='Library for reading emails from a POP3 server'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-4823718680661112662</id><published>2011-12-04T14:12:00.001+11:00</published><updated>2011-12-07T16:59:36.317+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7"/><title type='text'>Finally I started Windows Phone 7 development</title><content type='html'>A couple of weeks ago I attended in a Microsoft&#39;s workshop for Windows Phone 7 development just after buying my&amp;nbsp;Samsung&amp;nbsp;Omnia 7 phone, the workshop inspired me with the fact that Windows Phone 7 development is just fun.&lt;br /&gt;
So moving to Windows Phone 7 world I will be posting about Windows Phone 7 applications, games, news, development tips in the future.&lt;br /&gt;
&lt;br /&gt;
For the&amp;nbsp;beginning&amp;nbsp;I would like to write about why moving to Windows Phone 7, of course, &amp;nbsp;from my&amp;nbsp;perceptive. I have several reason but here is two of them that I can share. One is that its development is easy and the other one is that I hope in Windows Phone 7 future.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reason 1 : Windows Phone 7 development is easy.&lt;/b&gt;&lt;br /&gt;
Now that I have wrote a couple of applications reading for publishing into market I am thinking of developing Windows Phone 7 application is even easier than writing Desktop or Web applications. For every functionality you desire to add to your application there is a too much simple API.&lt;br /&gt;
Also I attended in an Android development workshop at SystemGroup company. I was just pain. In two hours we only learnt how to add a button to UI and then handle it&#39;s click button. No need to say iPhone development is even harder than Windows Phone.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reason 2 : Windows Phone 7 will beat both iPhone and Android in the near future&lt;/b&gt;&lt;br /&gt;
First of all I have to say I hate iPhone, I know iPhone is the favourite phone for most of you, but to me it never attracted me. I used iPhone as the company&#39;s phone, it was nothing special to me. iPhone seems too boring to me. To understand me you have to use both iPhone and Windows Phone for a while, then you will probably get this feeling. Also I am not inspired by the Siri as it is only a non practical funny feature.&lt;br /&gt;
Also there are some predictions that in the future Windows Phone will beat Android.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/4823718680661112662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/12/finally-i-started-windows-phone-7.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4823718680661112662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4823718680661112662'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/12/finally-i-started-windows-phone-7.html' title='Finally I started Windows Phone 7 development'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-5182986630832586324</id><published>2011-11-23T14:17:00.001+11:00</published><updated>2011-11-23T14:36:07.105+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Text"/><category scheme="http://www.blogger.com/atom/ns#" term="Zip"/><title type='text'>Compressing and Decompressing Text Strings using GZipStream</title><content type='html'>Simply wanted to pass a text to client and the&amp;nbsp;receive&amp;nbsp;it back again. Something like the old viewstate concept. I searched the web for ready to use piece of code that compress the text into byte[] and vice versa but I failed to find a working source code, so I wrote one.&lt;br /&gt;
&lt;br /&gt;
Here it is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Zip&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//public&amp;nbsp;static&amp;nbsp;Encoding&amp;nbsp;Encoding&amp;nbsp;=&amp;nbsp;System.Text.Encoding.Unicode;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;byte&lt;/span&gt;[]&amp;nbsp;Compress(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;text,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Encoding&lt;/span&gt;&amp;nbsp;Encoding&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(text&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Encoding&amp;nbsp;=&amp;nbsp;Encoding&amp;nbsp;??&amp;nbsp;System.Text.&lt;span style=&quot;color: #2b91af;&quot;&gt;Encoding&lt;/span&gt;.Unicode;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;If&amp;nbsp;the&amp;nbsp;encoding&amp;nbsp;is&amp;nbsp;not&amp;nbsp;specified&amp;nbsp;use&amp;nbsp;the&amp;nbsp;Unicode&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;textBytes&amp;nbsp;=&amp;nbsp;Encoding.GetBytes(text);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;bytes&amp;nbsp;according&amp;nbsp;to&amp;nbsp;the&amp;nbsp;encoding&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;textStream&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;MemoryStream&lt;/span&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;&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;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Make&amp;nbsp;a&amp;nbsp;stream&amp;nbsp;of&amp;nbsp;to&amp;nbsp;be&amp;nbsp;feeded&amp;nbsp;by&amp;nbsp;zip&amp;nbsp;stream&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;zip&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GZipStream&lt;/span&gt;(textStream,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;CompressionMode&lt;/span&gt;.Compress);&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;zip&amp;nbsp;stream&amp;nbsp;to&amp;nbsp;receive&amp;nbsp;zipped&amp;nbsp;content&amp;nbsp;in&amp;nbsp;textStream&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;zip.Write(textBytes,&amp;nbsp;0,&amp;nbsp;textBytes.Length);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Write&amp;nbsp;textBytes&amp;nbsp;into&amp;nbsp;zip&amp;nbsp;stream,&amp;nbsp;then&amp;nbsp;zip&amp;nbsp;will&amp;nbsp;populate&amp;nbsp;textStream&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;zip.Close();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;textStream.ToArray();&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;bytes&amp;nbsp;from&amp;nbsp;the&amp;nbsp;text&amp;nbsp;stream&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&amp;nbsp;Decompress(&lt;span style=&quot;color: blue;&quot;&gt;byte&lt;/span&gt;[]&amp;nbsp;value,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Encoding&lt;/span&gt;&amp;nbsp;Encoding&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(value&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Encoding&amp;nbsp;=&amp;nbsp;Encoding&amp;nbsp;??&amp;nbsp;System.Text.&lt;span style=&quot;color: #2b91af;&quot;&gt;Encoding&lt;/span&gt;.Unicode;&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;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;If&amp;nbsp;the&amp;nbsp;encoding&amp;nbsp;is&amp;nbsp;not&amp;nbsp;specified&amp;nbsp;use&amp;nbsp;the&amp;nbsp;Uncide&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;inputStream&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;MemoryStream&lt;/span&gt;(value);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;stream&amp;nbsp;based&amp;nbsp;on&amp;nbsp;input&amp;nbsp;value&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;outputStream&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;MemoryStream&lt;/span&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;&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;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;stream&amp;nbsp;to&amp;nbsp;recieve&amp;nbsp;output&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;&amp;nbsp;zip&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;GZipStream&lt;/span&gt;(inputStream,&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;CompressionMode&lt;/span&gt;.Decompress);&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Create&amp;nbsp;a&amp;nbsp;stream&amp;nbsp;to&amp;nbsp;decompress&amp;nbsp;inputStream&amp;nbsp;into&amp;nbsp;outputStream&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;byte&lt;/span&gt;[]&amp;nbsp;bytes&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;byte&lt;/span&gt;[4096];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;n;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;while&lt;/span&gt;&amp;nbsp;((n&amp;nbsp;=&amp;nbsp;zip.Read(bytes,&amp;nbsp;0,&amp;nbsp;bytes.Length))&amp;nbsp;!=&amp;nbsp;0)&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;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;While&amp;nbsp;zip&amp;nbsp;results&amp;nbsp;output&amp;nbsp;bytes&amp;nbsp;from&amp;nbsp;input&amp;nbsp;stream&lt;/span&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;outputStream.Write(bytes,&amp;nbsp;0,&amp;nbsp;n);&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;&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;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Write&amp;nbsp;the&amp;nbsp;unzipped&amp;nbsp;bytes&amp;nbsp;into&amp;nbsp;output&amp;nbsp;stream&lt;/span&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;&amp;nbsp;zip.Close();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;Encoding.GetString(outputStream.ToArray());&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;//&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;string&amp;nbsp;from&amp;nbsp;unzipped&amp;nbsp;bytes&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/5182986630832586324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/11/compressing-and-decompressing-text.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5182986630832586324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/5182986630832586324'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/11/compressing-and-decompressing-text.html' title='Compressing and Decompressing Text Strings using GZipStream'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-1877894035565914745</id><published>2011-11-21T10:13:00.001+11:00</published><updated>2011-11-28T15:38:01.495+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Controller"/><category scheme="http://www.blogger.com/atom/ns#" term="Html"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="Razor"/><title type='text'>MVC Tips #1, Passing HTML or Javascript as Data</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;Sometimes you need to render an html to output which the source of HTML is from your model. For security reasons rendering html directly from data requires to be explicitly requested, here is the 2 scenarios for doing so:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;[AllowHtml]&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;If your model has a property which contains HTML content you add the AllowHtml property before the property. By doing so you inform the MVC that you expect html content in that property.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Although the it is named AllowHtml it also &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial; font-size: 15px; white-space: pre-wrap;&quot;&gt;works for JavaScript.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial; font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;@Html.Raw(Model.HtmlContent)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 15px; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;When rendering a Razor view &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial; font-size: 15px; white-space: pre-wrap;&quot;&gt;to allow html content be rendered to output use @Html.Raw(Model.HtmlContent).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial; font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;WARNING&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Arial; font-size: 15px; white-space: pre-wrap;&quot;&gt; &lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;By using any of the above technique you need to make sure that the HTML or JavaScript content is safe. So if the data comes from some untrusted source you application will become vulnerable to attacks. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;WARNING 2 &lt;/b&gt;Also pay attention to fact that AllowHtml also allows JavaScript, so dont assume that by applying this attribute only safe html code will be passed to client.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Note&lt;/b&gt; : &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;If you have a custom model binder and use pass the html values in your model, you may receive this exception:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;i&gt;A potentially dangerous Request.Form value was detected from the client&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;I found a solution for this problem at &lt;a href=&quot;http://blogs.taiga.nl/martijn/2011/09/29/custom-model-binders-and-request-validation/&quot; target=&quot;_blank&quot;&gt;this Martijn Boland&#39;s blog post&lt;/a&gt;. which worked fine for me and you can learn about why this problem exists and how the solution works.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 15px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/1877894035565914745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/11/mvc-tips-1-passing-html-or-javascript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1877894035565914745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1877894035565914745'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/11/mvc-tips-1-passing-html-or-javascript.html' title='MVC Tips #1, Passing HTML or Javascript as Data'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-4582653471903486235</id><published>2011-11-01T11:48:00.000+11:00</published><updated>2011-11-01T11:49:01.033+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Asp.Net MVC : Setting Model as string and avoiding Illegal Characters in Path</title><content type='html'>If you for every reason need to set a page&#39;s model type to be string type, then you may face this exception:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;Illegal Characters in path&lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Which seem to be weird, or you even may dont understand that the cause of the above problem is the Model type being string.&lt;br /&gt;
Actually the reason that you get the above exception is that in your Controller you as usual called the View method passing the model as the only argument and the model value is a string. But what you may have not pay attention to is that View method also has another override which accepts an string as the view name. So if you pass the model like this code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;View(&quot;myStringModel&quot;);&lt;/pre&gt;
&lt;br /&gt;
In the above code you specified to go to page with the name &quot;myStringModel&quot; and such a page does not exists.

Solution: My suggestion is to select the right overload by specifying the argument explicitly, like the below code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;View(model:&amp;nbsp;&quot;myStringModel&quot;);&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/4582653471903486235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/11/aspnet-mvc-setting-model-as-string-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4582653471903486235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/4582653471903486235'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/11/aspnet-mvc-setting-model-as-string-and.html' title='Asp.Net MVC : Setting Model as string and avoiding Illegal Characters in Path'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-8551653021196226955</id><published>2011-10-10T00:14:00.000+11:00</published><updated>2011-10-10T00:14:17.636+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Combinatory Parser"/><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Ve Parser"/><title type='text'>Ve Parser, A combinatory parser for .Net</title><content type='html'>A couple of years ago I tried to write a simple parser and I wanted to do it in the simplest way, I did not wanted to create a high performance compiler supporting lots of features, so instead of learning some already ready parser libraries I followed the recursive descent parsers technique and wrote the parser I wanted, then after doing some refactoring I end up with something that was different from a recursive descent parser. I searched through the net and I found out that the thing I made is called combinatory parser. Actually what I did was&amp;nbsp;a simple library for creating combinatory parsers in .Net environment.&lt;br /&gt;
&lt;br /&gt;
Last week I needed the parser for a current project, and&amp;nbsp;then I brought back the source codes from my archive. I thought this would be a good idea to make it a public available(aka open source) library, so it would become more alive. I named the library Ve Parser and&amp;nbsp;published&amp;nbsp;the codes&amp;nbsp;in codeplex: you can go and visit it in &lt;a href=&quot;http://veparser.codeplex.com/&quot;&gt;http://veparser.codeplex.com/.&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/8551653021196226955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/10/ve-parser-combinatory-parser-for-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8551653021196226955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/8551653021196226955'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/10/ve-parser-combinatory-parser-for-net.html' title='Ve Parser, A combinatory parser for .Net'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-1366813581520190091</id><published>2011-10-03T20:38:00.002+11:00</published><updated>2011-10-03T20:55:40.927+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogger"/><category scheme="http://www.blogger.com/atom/ns#" term="Google API"/><title type='text'>A solution for User does not have permission to create new post</title><content type='html'>&lt;div class=&quot;OutlineElement Ltr SCX105583742&quot; style=&quot;margin-left: 0px; text-indent: 0px;&quot;&gt;
&lt;span class=&quot;TextRun SCX105583742&quot; style=&quot;font-family: Calibri,Sans-Serif;&quot; xml:lang=&quot;EN-US&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;TextRun SCX105583742&quot; style=&quot;font-family: Calibri,Sans-Serif;&quot; xml:lang=&quot;EN-US&quot;&gt;&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
Developing a piece of code for sending content to a blog in Blogger I wrote the whole thing and then I tested and published my work. Then after a while without modifying the codes it becomes corrupted and by investigating the error logs I found this error message: &lt;strong&gt;&quot;User does not have permission to create new post&quot;&lt;/strong&gt;. If you search for this error you will see a lot of people having the same problem and nowhere there is no solution for it, or even an explanation about it. &lt;/div&gt;
&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
I had a code like this &lt;/div&gt;
&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;response = service.Insert(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;Uri&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&quot;http://myblogname.blogspot.com/feeds/posts/default&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;), newPost);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
I just changed it to &lt;/div&gt;
&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;response = service.Insert(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas;&quot;&gt;Uri&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&quot;http://www.blogger.com/feeds/874763488093493674364/posts/default&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;), newPost); &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
In the above code, that number after &#39;feeds/&#39; is the blog id which you can find it easily when you are in your blog&#39;s control panel, almost every url is consisted of your blog id. (For security and privacy reasons I wrote a fake id, but yours should look similar.)&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;Paragraph SCX105583742&quot; paraid=&quot;1169485185&quot; style=&quot;background-color: transparent; color: windowtext; font-family: &amp;quot;Segoe UI&amp;quot;,Tahoma,Verdana,&amp;quot;Sans-Serif&amp;quot;; font-style: normal; font-weight: normal; text-align: left; text-indent: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/1366813581520190091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/10/solution-for-user-does-not-have.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1366813581520190091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/1366813581520190091'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/10/solution-for-user-does-not-have.html' title='A solution for User does not have permission to create new post'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3504325405839228885.post-6979414534893558783</id><published>2011-09-29T13:28:00.000+10:00</published><updated>2011-09-29T13:28:28.090+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Coding Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="Extension Methods"/><title type='text'>IsIn extension method</title><content type='html'>My motivation for writing blogs is to share my knowledge, although I am not a so professional developer. With the advent of extension methods I find it very helpful and started to use them everyday. Now I am going to share some of those small extension methods that may help you in writing your codes, maybe simply to make your codes pretty looking.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Name&lt;/b&gt;&lt;br /&gt;
IsIn&lt;br /&gt;
&lt;b&gt;Purpose&lt;/b&gt;&lt;br /&gt;
Lots of the time we use expressions like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(x&amp;nbsp;=&amp;nbsp;value1&amp;nbsp;||&amp;nbsp;x&amp;nbsp;=&amp;nbsp;value2&amp;nbsp;||&amp;nbsp;x&amp;nbsp;=&amp;nbsp;value3&amp;nbsp;||&amp;nbsp;x&amp;nbsp;=&amp;nbsp;value4&amp;nbsp;||&amp;nbsp;x&amp;nbsp;=&amp;nbsp;value5)&amp;nbsp;{
 
}&lt;/pre&gt;&lt;br /&gt;
The problem with these codes are:&lt;br /&gt;
It&#39;s very dirty code and hard to understand, specially if the variables names and values are too long. which sometimes are.&lt;br /&gt;
If the if block contains other conditions it&#39;s bug prone to edit condition operators and if by mistake you change an or (||) operator with an and(&amp;amp;&amp;amp;) operator, you can&#39;t find the bug easily.&lt;br /&gt;
&lt;strong&gt;Extension Method&lt;/strong&gt;&lt;br /&gt;
The code for extension method is very simple and straight. Most of the time extension methods that I wrote is just&amp;nbsp; a reversed version of another metohd which here the IsIn extension method simply call the Any method on the list of possible&amp;nbsp; values:&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;nbsp;IsIn&amp;lt;T&amp;gt;(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&amp;nbsp;T&amp;nbsp;source,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;params&lt;/span&gt;&amp;nbsp;T[]&amp;nbsp;list)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T,&amp;nbsp;T,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;nbsp;compare&amp;nbsp;=&amp;nbsp;(v1,&amp;nbsp;v2)&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;EqualityComparer&lt;/span&gt;&amp;lt;T&amp;gt;.Default.Equals(v1,&amp;nbsp;v2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;list.Any(item&amp;nbsp;=&amp;gt;&amp;nbsp;compare(item,&amp;nbsp;source));
}&lt;/pre&gt;&lt;br /&gt;
&lt;strong&gt;Usage&lt;/strong&gt;&lt;br /&gt;
Now you can easily use it very simple:&lt;br /&gt;
Before code:&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(x&amp;nbsp;==&amp;nbsp;1&amp;nbsp;||&amp;nbsp;x&amp;nbsp;==&amp;nbsp;2&amp;nbsp;||&amp;nbsp;x&amp;nbsp;==&amp;nbsp;7&amp;nbsp;||&amp;nbsp;x&amp;nbsp;==&amp;nbsp;8)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;X&amp;nbsp;is&amp;nbsp;a&amp;nbsp;magic&amp;nbsp;number&quot;&lt;/span&gt;);&lt;/pre&gt;After code:&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(x.IsIn(1&amp;nbsp;,&amp;nbsp;2&amp;nbsp;,&amp;nbsp;7&amp;nbsp;,&amp;nbsp;8))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;X&amp;nbsp;is&amp;nbsp;a&amp;nbsp;magic&amp;nbsp;number&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;
&lt;strong&gt;Whole thing&lt;/strong&gt;&lt;br /&gt;
If you just need to copy, this is the block of code you need to copy and paste in your class library and then you just need to correct the namespace with your own naming conventions:&lt;br /&gt;
&lt;pre style=&quot;background: white; color: black; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Collections.Generic;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;System.Linq;
 
&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;MyApp.Common
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;ExtensionMethods&lt;/span&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;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;nbsp;IsIn&amp;lt;T&amp;gt;(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&amp;nbsp;T&amp;nbsp;source&amp;nbsp;,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;params&lt;/span&gt;&amp;nbsp;T[]&amp;nbsp;list)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;Func&lt;/span&gt;&amp;lt;T,&amp;nbsp;T,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&amp;gt;&amp;nbsp;compare&amp;nbsp;=&amp;nbsp;(v1&amp;nbsp;,&amp;nbsp;v2)&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;span style=&quot;color: #2b91af;&quot;&gt;EqualityComparer&lt;/span&gt;&amp;lt;T&amp;gt;.Default.Equals(v1&amp;nbsp;,&amp;nbsp;v2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&amp;nbsp;list.Any(item&amp;nbsp;=&amp;gt;&amp;nbsp;compare(item&amp;nbsp;,&amp;nbsp;source));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://samondotnet.blogspot.com/feeds/6979414534893558783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samondotnet.blogspot.com/2011/09/isin-extension-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/6979414534893558783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3504325405839228885/posts/default/6979414534893558783'/><link rel='alternate' type='text/html' href='http://samondotnet.blogspot.com/2011/09/isin-extension-method.html' title='IsIn extension method'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>