<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Vahid Taslimi's blog (وبلاگ وحید تسلیمی)</title><link>http://old.taslimi.me:80/vahid-taslimi-s-blog</link><description>Vahid Taslimi's blog (وبلاگ وحید تسلیمی)</description><item><title>Delete orphan tasks from Nintex Workflow which keep showing up in Nintex Mobile</title><link>http://old.taslimi.me:80/delete-orphan-tasks-from-nintex-workflow-which-keep-showing-up-in-nintex-mobile</link><description>&lt;p&gt;Once in a while you may end up having orphan Nintex Workflow tasks in your environment. Normally you wont end up in this situation in you production environment as this is normally as result of playing with the workflow or the list.&lt;/p&gt;
&lt;p&gt;But anyway we don&amp;rsquo;t live in the perfect world and things like this happen and when it happens it can be really annoying. Specially if you are using Nintex Mobile to respond to your tasks. One symptom is that you keep getting the tasks even though you delete local storage. So here I show you how to delete the orphan tasks for good &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/wlEmoticon-smile_2.png"&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to your SharePoint site.&lt;/li&gt;
&lt;li&gt;Choose to edit the page.&lt;a href="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_2.png"&gt;&lt;img title="image" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="image" src="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_thumb.png" width="577" height="100"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Select insert =&amp;gt; Web Part. From the Categories column select Nintex Workflow 2013(or 2010) and from Parts column select My Workflow Tasks&lt;a href="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_4.png"&gt;&lt;img title="image" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="image" src="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_thumb_1.png" width="586" height="198"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Press Add button to add the web part to your page.&lt;/li&gt;
&lt;li&gt;Once the web part is added press Save button.&lt;/li&gt;
&lt;li&gt;You know must be able to see a list of tasks assigned to you in the web part&lt;/li&gt;
&lt;li&gt;The ones which have Remove task link button are orphan tasks and you can delete them by clicking on the link.&lt;a href="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_13.png"&gt;&lt;img title="image" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="image" src="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_thumb_5.png" width="639" height="213"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;if you don&amp;rsquo;t see them in the first page, make sure you navigate to all pages and delete them all. Unfortunately the this moment there is no way to delete them all in one go and you need to do this one by one by one.&lt;a href="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_15.png"&gt;&lt;img title="image" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="image" src="http://old.taslimi.me/Media/Default/Windows-Live-Writer/Delete-orphan-tasks-from-Nintex-Workflow_8286/image_thumb_6.png" width="646" height="216"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Go back to your Nintex Mobile, Delete Local Storage and you should not see the tasks anymore.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hope this post saves you some headache.&lt;/p&gt;</description><pubDate>Wed, 26 Nov 2014 22:46:55 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/delete-orphan-tasks-from-nintex-workflow-which-keep-showing-up-in-nintex-mobile</guid></item><item><title>We are hiring and here are some reasons for you to come and work with me at Nintex</title><link>http://old.taslimi.me:80/some-reasons-for-you-to-come-and-work-with-me-at-nintex</link><description>&lt;p&gt;So first things first. You are asking if this is a marketing email? answer is yes. I am expanding my team and I am writing this post to convince smart developers like yourself to come and work with us at &lt;a href="http://nintex.com"&gt;Nintex&lt;/a&gt;. It&amp;rsquo;s me writing this and these are my own view points. No one from the company has asked me to write this (in fact no one knows that I am writing this. &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt; not even HR).&lt;/p&gt;
&lt;p&gt;If you are reading this post I am assuming you are already familiar with work culture in good IT companies and their benefits like flexible hours, hack days, free drinks, great work place etc. So I won't bore you with them.&lt;/p&gt;
&lt;p&gt;What I really want to talk about is what we do and why I believe Nintex is developer&amp;rsquo;s heaven &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1- What do we do?&lt;/p&gt;
&lt;p&gt;So my team and I work on &lt;a href="http://en-us.nintex.com/workflow-platform/nintex-mobile"&gt;mobile applications&lt;/a&gt;. We create enterprise mobile apps in real sense which helps companies be much more productive. Now creating mobile apps is cool itself, but boy tell me about creating high quality enterprise mobile apps. Not many of us are fortunate enough to get to work on enterprise mobile apps which pushes mobile applications to their boundaries. It&amp;rsquo;s cool. It&amp;rsquo;s like the hottest thing now.&lt;/p&gt;
&lt;p&gt;2- How do we work?&lt;/p&gt;
&lt;p&gt;We are open to any practical development technologies be it native, xamarin or hybrid. You get to work with the latest and hottest technologies. At the moment we create our apps using native languages Objectve-C, Java and C#. All of us code in all three languages on all three platforms. It&amp;rsquo;s as sweet as it gets for developers. You get a taste of everything xcode, eclipse, visual studio you name it. But the coolest thing is how we design our apps architecture across the platforms. we have literally managed to adapt all patterns we use in backend technologies to all platforms and keep them alike. Inversion of Control, Dependency Injection, Repository pattern you name them and we have them on all platforms. Heck, we have even managed to replicate C#&amp;rsquo;s Async-Await in Objective-C &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt; how cool is that?&lt;/p&gt;
&lt;p&gt;3- What about the team?&lt;/p&gt;
&lt;p&gt;So pretty much everyone in the team comes from enterprise development background and that has helped us a ton. They are all passionate, intelligent developers like yourself who are absolutely fun to work with. We constantly communicate in the team about technical and non-technical stuff. and we learn a lot from each other. It&amp;rsquo;s absolutely a flat team in which everyone owns the products. All of us keep mentoring each other and teaching each other new stuff. In short you know you are working in a team when someone else fixes your broken unit tests without you knowing &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt;&lt;/p&gt;
&lt;p&gt;4- Is it challenging?&lt;/p&gt;
&lt;p&gt;Absolutely. Challenge is what keeps on going and not getting board. Everyday we have some nice technical challenge to attend. It keeps the blood flow constantly.&lt;/p&gt;
&lt;p&gt;5- How is the company?&lt;/p&gt;
&lt;p&gt;I will tell you this from developer to developer, I believe that it says it all; There is absolutely no bureaucracy.&lt;/p&gt;
&lt;p&gt;6- What is the most important thing you achieve?&lt;/p&gt;
&lt;p&gt;OK, for all of us it&amp;rsquo;s the fact that what we do makes some people&amp;rsquo;s life easier and make them more productive. If you want to see an example check out this two minutes video &lt;a title="https://www.youtube.com/watch?v=xXYyvXz6_eI&amp;amp;feature=youtu.be" href="https://www.youtube.com/watch?v=xXYyvXz6_eI&amp;amp;feature=youtu.be"&gt;https://www.youtube.com/watch?v=xXYyvXz6_eI&amp;amp;feature=youtu.be&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;7- How is life in Australia? (if you are not in Australia already)&lt;/p&gt;
&lt;p&gt;Well there is a reason Melbourne has been &lt;a href="http://en.wikipedia.org/wiki/World's_most_liveable_cities"&gt;the most livable city in the world in the last few years&lt;/a&gt; &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt; Great people, great life style great city. I am an expat here but I wouldn&amp;rsquo;t leave this place and neither will my wife &lt;img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Some-reasons-for-you-to-come-and-work-wi_E1BF/wlEmoticon-smile_2.png"&gt; both of us love it here.&lt;/p&gt;
&lt;p&gt;I tried to keep it as short as possible and hopefully this will give you some good reasons to come and work with us. So if you fancy working with us in the down under, drop me a line and we&amp;rsquo;ll setup some interviews. My twitter address is: &lt;a title="https://twitter.com/vahidtaslimi" href="https://twitter.com/vahidtaslimi"&gt;https://twitter.com/vahidtaslimi&lt;/a&gt; and my email address is: &lt;a href="mailto:vahid@taslimi.me"&gt;vahid@taslimi.me&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Sun, 09 Nov 2014 13:44:50 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/some-reasons-for-you-to-come-and-work-with-me-at-nintex</guid></item><item><title>How to delete a team project from tfs online tfs.visualstudio.com</title><link>http://old.taslimi.me:80/how-to-delete-a-team-project-from-tfs-online-tfs.visualstudio.com</link><description>&lt;p&gt;unfortunately we cannot delete a team project from visual studio or online control panel. to delete a team project you need to use the command line utility.&lt;/p&gt;
&lt;p&gt;run visual studio tools command prompt tools. make sure you open the x86 version as x64 version wouldnt work.&lt;/p&gt;
&lt;p&gt;and then run this command:&lt;/p&gt;
&lt;p&gt;tfsdeleteproject /collection:https://YOUR-ACCOUNT-URL.visualstudio.com/DefaultCollection "Your project name"&lt;/p&gt;
&lt;p&gt;if required this will prompt you to login with a Microsoft Account.&lt;/p&gt;
&lt;p&gt;after you log in it will prompt you with a yes/no question. enter y press enter and it will delete your site collection.&lt;/p&gt;</description><pubDate>Tue, 16 Apr 2013 11:46:40 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-delete-a-team-project-from-tfs-online-tfs.visualstudio.com</guid></item><item><title>TFS.VisualStudio.com TF30063: You are not authorized to access Collection</title><link>http://old.taslimi.me:80/tfs.visualstudio.com-tf30063-you-are-not-authorized-to-access-collection</link><description>&lt;p&gt;if you are trying to connect to team foundation server online through visual studio and you get unauthorized excetion.&lt;/p&gt;
&lt;p&gt;first make sure you have got access to that account and if you do then it most probably must be because of a cached microsoft account which does not have access to the collection. to fix this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open visual studio&lt;/li&gt;
&lt;li&gt;using a visual studio built in browser, navigate to http://tfs.visualstudio.com&lt;/li&gt;
&lt;li&gt;Sign out of the exisiting logged in account&lt;/li&gt;
&lt;li&gt;Log in using the microsoft account which has got access to the collection&lt;/li&gt;
&lt;li&gt;and you are good to go.&lt;/li&gt;
&lt;/ol&gt;</description><pubDate>Tue, 16 Apr 2013 11:40:41 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/tfs.visualstudio.com-tf30063-you-are-not-authorized-to-access-collection</guid></item><item><title>How to host website in the Windows Azure Virtual Machine</title><link>http://old.taslimi.me:80/how-to-host-website-in-the-windows-azure-virtual-machine</link><description>&lt;p&gt;How to host website in the Windows Azure Virtual Machine &lt;p&gt;Well as you know Microsoft is now offering IaaS (Infrastructure as a service) services through the new Virtual Machine role. &lt;p&gt;It’s quite good and easy to get up and running with it but. In matter of minutes you can have your windows or linux virtual machine ready to be used. You can shut them off or backup their VHDs. &lt;p&gt;When I gave it a go to try it, the very first thing I wanted to do was to host a website on my VM. So once the VM was ready I remote deskoped in and added IIS and the other stuff. But when I tried to browse the site I got a 404 (page not found) error in the browser. &lt;p&gt;I spent some time figuring out what has gone wrong and finally came to know that by default there is  &lt;table cellspacing="0" cellpadding="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td width="400"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image002_2.jpg"&gt;&lt;img title="clip_image002" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: left; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image002" align="left" src="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image002_thumb.jpg" width="684" height="471"&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;just one endpoint enabled for the VM and that’s used for remote desktop. &lt;p&gt;So bingo I had to log into my windows azure control panel and added a new endpoint for port 80 (http) and 443 (https). &lt;p&gt;&lt;a href="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image004_2.jpg"&gt;&lt;img title="clip_image004" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image004" src="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image004_thumb.jpg" width="665" height="458"&gt;&lt;/a&gt; &lt;p&gt;&lt;a href="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image006_2.jpg"&gt;&lt;img title="clip_image006" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image006" src="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image006_thumb.jpg" width="664" height="458"&gt;&lt;/a&gt; &lt;p&gt;&lt;a href="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image008_2.jpg"&gt;&lt;img title="clip_image008" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image008" src="http://taslimi.me/Media/Default/Windows-Live-Writer/How-to-host-website-in-the-Windows-Azure_13B90/clip_image008_thumb.jpg" width="678" height="468"&gt;&lt;/a&gt; &lt;p&gt;And that fixed the problem.  </description><pubDate>Sat, 15 Sep 2012 12:29:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-host-website-in-the-windows-azure-virtual-machine</guid></item><item><title>Challenges in switching to Agile/Scrum</title><link>http://old.taslimi.me:80/challenges-in-switching-to-agile-scrum</link><description>&lt;p&gt;there is no doubt that agile practices specially scrum is pretty popular these days. This is not because scrum is something funky to have but rather because it really works and works very well. i know what you are saying now… &lt;img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/4611a8c32368_DA6A/wlEmoticon-smile_2.png"&gt; you would be saying but hold on i have seen some companies/projects which started to switch to scrum but they all ended up in tears and had to leave it half way.&lt;/p&gt; &lt;p&gt;well i don't deny that. during my career i have been lucky to see some of those projects and i agree with you. but you know for me they all failed because they simply didn't know themself neither did they know scrum. i mean they didn't know their team culture –strengths and weaknesses-. They did not know how to bend the scrum practices to fit into their team culture either.&lt;/p&gt; &lt;p&gt;i believe shifting to scrum is like getting married. you think you already know how you are going to deal with it but don't consider the fact that it’s total mind shift. specially in software industry up until few years ago everybody was pushing for ultra extra process/documented oriented methodologies like waterfall. and we spent a lot of time learning about all sort of documentation. You have to understand that adopting scrum is not one way adoption and is rather a two way one. meaning you need to bend scrum a bit to adopt it your team culture and you also&amp;nbsp; to bend the team culture to adopt the scrum. &lt;/p&gt; &lt;p&gt;The team which fail to adopt scrum are the ones which go by book and start enforcing everything written in a scrum book the way they were imposing CMMI level 3 processes. the point they were missing was that those books were not holistic and they were just a set of guidelines. the people in charge missed the point that it cannot be done over a night. and they have got to shift gradually.&lt;/p&gt; &lt;p&gt;if you are planning to shift to scrum i would suggest that you first start by teaching the team about scrum. tell them about the values it add and tell them that it’s a total mind shift from what they are doing. i am sure you will be getting comments like “For me agile/scrum is just like waterfall with shorter iterations” make sure you clarify with the team that IT IS NOT.&lt;/p&gt; &lt;p&gt;Then you need to start picking up the scrum practices which are easier to adopt and less challenging like daily stand ups, shorter iterations. give it a go for a while and once the team feels comfortable with these. start adapting the other things like organized backlog review, proper planning meeting.&lt;/p&gt; &lt;p&gt;The next step would be pushing the sprint commitment to the team members. make them understand that if the team commit to something for a sprint they don't have any choice but finishing it as a team.&lt;/p&gt; &lt;p&gt;i would say this is the trickiest of all. because you would have to deal with cultural, technical and process related issues in this regards. Some developer simply don't get it that they have got to honour their sprint commitments and they keep coming up with excuses. you’ve got to fix this.&lt;/p&gt; &lt;p&gt;Then you have to decide how you are going to deal with the Acceptance testing. do you want to do it in the same sprint? do want you want to let the QC team to stay one sprint behind the dev team? or do you want to treat them as two different teams? unfortunately there is no recipe for this and you’ve got to see what works well for you.&lt;/p&gt; &lt;p&gt;The technical challenge you are going to have here is about writing a testable code and writing automated unit tests for the code. you have to note that having automated unit test IS A MUST in a successful scrum project. for me there is no excuse not to write unit tests. well i am not saying to start with TDD but whatever development methodologies you use, you need to write testable code and write unit tests for your code.&lt;/p&gt; &lt;p&gt;writing testable code and unit tests is something that %99 of the developers think they know it but may be half of the actually know how do it.&lt;/p&gt; &lt;p&gt;To write a testable code there are couple of patterns/concepts which are absolutely vital. for example &lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns" target="_blank"&gt;separation of concern&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Dependency_injection" target="_blank"&gt;dependency injection&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" target="_blank"&gt;MVC&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/MVVM" target="_blank"&gt;MVVM&lt;/a&gt; etc. make sure you get enough training materials for your developers to understand these patterns/concepts.&lt;/p&gt; &lt;p&gt;a Few years ago i used a technique which worked well for my team. basically i told my team to code without user interface and leave the user interface as the last task in each user story. so they had no other way of testing their code other than writing unit tests. that worked well.&amp;nbsp; for another team of mine i tried to show them that unit testing not only improves the code quality but also saves the developers a lot of time. like when they wanted to test a booking system they had to fire up the whole application fill out a few forms to reach to the booking page and then test what they wanted to test in that page. Ok if something was wrong they had to do it again. i showed them how they could automate the whole thing in unit test once and run the quickly whenever they want. this trick also worked pretty well.&lt;/p&gt; &lt;p&gt;Now i encourage most of the companies to start adopting agile practices. and i am sure everybody will benefit from it. A very good example of adopting scrum is my current employer. The PMO office has done a very good job on bringing the scrum into the company with no dramas.&lt;/p&gt;</description><pubDate>Sat, 08 Sep 2012 07:33:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/challenges-in-switching-to-agile-scrum</guid></item><item><title>Cool Extension for Visual Studio 2010</title><link>http://old.taslimi.me:80/cool-extension-for-visual-studio-2010</link><description>&lt;p&gt;i have been using Power Commands for Visual Studio for a long time. but i had never noticed that it’s a got very good feature for automatically formatting the document on save. not only it can format the document, but also it can remove and sort using statements in the files when you save them.&lt;/p&gt; &lt;p&gt;it this really good for me because we use stylecop to enforce coding standard within our dev team. &lt;/p&gt; &lt;p&gt;it’s also good when you refactor your code and end up changing namespaces and class names.&lt;/p&gt; &lt;p&gt;to install the extension. click on the extension manager in the option menu.&lt;/p&gt; &lt;p&gt;then search for PowerCommands and select and install it from the list.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_thumb.png" width="540" height="375"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;once the installation is done, click on tools then click on option menu.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_thumb_1.png" width="537" height="391"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;from the options dialog box select PowerCommands and in the left hand side check the options you desire.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Cool-Extension-for-Visual-Studio-2010_C011/image_thumb_2.png" width="531" height="309"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;and you are good to go.&lt;/p&gt;</description><pubDate>Wed, 30 May 2012 03:51:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/cool-extension-for-visual-studio-2010</guid></item><item><title>How to flag system/image file types in Nintex Analytics 2010</title><link>http://old.taslimi.me:80/how-to-flag-system-image-file-types-in-nintex-analytics-2010</link><description>&lt;p&gt;When you are after some statistics in SharePoint, say number of user activities, you want to exclude activities on certain file types. For example we normally are not interested on activities on the webpart or xml file but we are rather interested in activities on docx or xlsx files. &lt;/p&gt; &lt;p&gt;Nintex Analytics 2010 enables to mark the files that you normally want to exclude from your reports as either System file or Image file. it then gives you parameters in some reports to exclude activities on the file types which are flagged as system or image files from the result.&lt;/p&gt; &lt;p&gt;this is a very powerful feature of&amp;nbsp; NA2010 which gives an extra flexibility to design and use your reports.&lt;/p&gt; &lt;p&gt;in this video I show you how to flag various file types as either system or image file type.&lt;/p&gt;&lt;iframe height="360" src="http://www.youtube.com/embed/iFbt2OydZGc" frameborder="0" width="640" allowfullscreen=""&gt;&lt;/iframe&gt;</description><pubDate>Thu, 03 May 2012 12:55:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-flag-system-image-file-types-in-nintex-analytics-2010</guid></item><item><title>How to configure drill down report in Nintex Analytics 2010</title><link>http://old.taslimi.me:80/how-to-configure-drill-down-report-in-nintex-analytics-2010</link><description>&lt;p&gt;Time to time we need to be able to connect couple of report to make an end to end usage story of reports.&lt;/p&gt;
&lt;p&gt;Fortunately Nintex Analytics 2010 fully support drill down functionality and most of the out of the box report are configured to drill down to a related report.&lt;/p&gt;
&lt;p&gt;but if you need to configure your own custom report to drill down to a report, don&amp;rsquo;t worry it&amp;rsquo;s quite easy in NA2010.&lt;/p&gt;
&lt;p&gt;In this video I show you how you can configure drill down reports in few minutes.&lt;/p&gt;
&lt;p&gt;&lt;iframe height="360" src="http://www.youtube.com/embed/hvw2RCXJdcY" frameborder="0" width="640" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/p&gt;</description><pubDate>Thu, 03 May 2012 12:11:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-configure-drill-down-report-in-nintex-analytics-2010</guid></item><item><title>How to create a new report in Nintex Analytics 2010</title><link>http://old.taslimi.me:80/how-to-create-a-new-report-in-nintex-analytics-2010</link><description>&lt;p&gt;in this video I show you how to create a new report in Nintex Analytics 2010. I’ll show you:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;how to select a dataset for your report  &lt;li&gt;how to configure report parameters  &lt;li&gt;How set the report name, description, icon and other properties  &lt;li&gt;How to customize chart visualization  &lt;li&gt;How to customize table visualization&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;iframe height="480" src="http://www.youtube.com/embed/J9aQfW0I_cI" frameborder="0" width="640" allowfullscreen=""&gt;&lt;/iframe&gt;</description><pubDate>Thu, 26 Apr 2012 13:31:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-create-a-new-report-in-nintex-analytics-2010</guid></item><item><title>Nintex Analytics 2010 Out of the box reports-Sites&amp;Pages</title><link>http://old.taslimi.me:80/nintex-analytics-2010-out-of-the-box-reports-sites-pages</link><description>&lt;p&gt;in this video I walk you through the reports which are available out of the box in Sites&amp;amp;Reports category of Nintex Analytics 2010.&lt;/p&gt; &lt;iframe width="640" height="480" src="http://www.youtube.com/embed/SjeMIF8Bpys" frameborder="0" allowfullscreen=""&gt;&lt;/iframe&gt;</description><pubDate>Sat, 21 Apr 2012 11:51:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/nintex-analytics-2010-out-of-the-box-reports-sites-pages</guid></item><item><title>How To Install Nintex Analytics 2010</title><link>http://old.taslimi.me:80/how-to-install-nintex-analytics-2010</link><description>&lt;p&gt;one of the best thing about Nintex Analytics 2010 is the installation experience. like other Nintex products, the installation experience is fast and easy. you just need to let Nintex Analytics know a few settings and it will take care of the rest.&lt;/p&gt; &lt;p&gt;in the following video I’ll show how to install Nintex Analytics 2010 on your environment.&lt;/p&gt;&lt;iframe height="480" src="http://www.youtube.com/embed/g3Zag0Nb7JM" frameborder="0" width="640" allowfullscreen=""&gt;&lt;/iframe&gt;</description><pubDate>Wed, 18 Apr 2012 14:40:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-install-nintex-analytics-2010</guid></item><item><title>How to trigger a Nintex Workflow from a Nintex Analytics report schedule</title><link>http://old.taslimi.me:80/how-to-trigger-a-nintex-workflow-from-a-nintex-analytics-report-schedule</link><description>&lt;p&gt;well we all know that Nintex Analytics provides a great insight to our SharePoint environments through the vast number of reports it provides out of the box.&lt;/p&gt; &lt;p&gt;But how can we turn these information into some actions? the good news is that Nintex Analytics 2010 integrates well with Nintex Workflow which would enable us to make some decision and execute a set up process based on the outcome of a report.&lt;/p&gt; &lt;p&gt;Nintex Analytics 2010 has got the capability to trigger a Nintex Workflow as part of report schedule. the report will pass all the information to the workflow and leaves it upto the workflow to take some action –if required- based on the data.&lt;/p&gt; &lt;p&gt;for example there is report avaiable out of the box in Nintex Analytics 2010 called Content Storage by Site which displays total disk storage used by each site.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_thumb_1.png" width="673" height="383"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;let’s say that in your organization a each site belongs to a department and IT department bills them based on their disk usage.&lt;/p&gt; &lt;p&gt;to automate this you can easily create a workflow which generates and emails the bill for each department once the report schedule is ran. &lt;/p&gt; &lt;p&gt;The workflow need to be a site workflow. so let’s create a Nintex Workflow called Bill Departments by clicking Site Actions =&amp;gt; Nintex Workflow 2010 =&amp;gt; Create Site Workflow. the next step is to define the variables that report will pass to the workflow.&lt;/p&gt; &lt;p&gt;By default, the following five report columns will passed by the report to the workflow as a Workflow variable. &lt;p&gt;· &lt;b&gt;ScheduleInfo&lt;/b&gt; – The run schedule of the report e.g. Once per month &lt;p&gt;· &lt;b&gt;ReportID&lt;/b&gt; – The report ID &lt;p&gt;· &lt;b&gt;ScheduleStartTime&lt;/b&gt; – The start time of the schedule &lt;p&gt;· &lt;b&gt;ScheduleEndTime&lt;/b&gt; – The end time of the schedule  &lt;p&gt;· &lt;b&gt;ExecutionID&lt;/b&gt; – The execution ID for the schedule that triggers the workflow &lt;p&gt;And if you chose to run the workflow for each result, then report will prefix all the columns in the result with “ReportData” and passes them to the workflow as workflow variable. to find out what are columns available in the the report you can click the chart/table designer in the report design mode and then click on Data Settings tab. you will see all available columns in this tab.&amp;nbsp; for example our report has got the following columns:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_12.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_thumb_5.png" width="457" height="330"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you chose to run the workflow for each result which we want so, then report will prefix all the columns in the result with “ReportData” and passes them to the workflow as workflow variable. for example the this report will pass the following parameters to the workflow:&lt;br&gt;&lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;SiteId, &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;WebId, &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;Files, &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;FilesRelative, &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;SizeRelative, &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;Size etc..&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;in this case we just need to use &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;SiteId and &lt;font color="#000000"&gt;&lt;strong&gt;ReportData&lt;/strong&gt;Size. so we need to create a variable for each of them in the workflow:&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_14.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_thumb_6.png" width="438" height="330"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Please note that, the name of the variable created in the workflow is case sensitive and should be ReportData followed by column name and NOT column display name. &lt;p&gt;we can proceed and design our workflow using these two parameters. please note that the workflow will be executed per each record in the result which in this case is a site.&lt;/p&gt; &lt;p&gt;once we are done with designing the workflow we need to publish it and make it ready to be triggered by the report schedule.&lt;/p&gt; &lt;p&gt;let’s assume that you need to bill departments each month. so we would configure the report schedule to run first of each month&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/How-to-trigger-a-Nintex-Workflow-from-a-_FCE9/image_thumb_2.png" width="432" height="304"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;and that’s all we needed to do. next time the report schedule runs it will trigger the workflow for each record in the result of the report execution.&lt;/p&gt;</description><pubDate>Tue, 17 Apr 2012 08:52:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/how-to-trigger-a-nintex-workflow-from-a-nintex-analytics-report-schedule</guid></item><item><title>Using Unity with ASP.NET WEB API Controller</title><link>http://old.taslimi.me:80/using-unity-with-asp.net-web-api-controller</link><description>&lt;p&gt;Support for Ioc containers is backed into ASP.NET WEB API and uses the service locator pattern dependency resolver by default.&lt;/p&gt; &lt;p&gt;the default service locator implements the &lt;strong&gt;IDependencyResolver&lt;/strong&gt; interface. This interface has two methods. &lt;ul&gt; &lt;li&gt;&lt;strong&gt;GetService&lt;/strong&gt;: Creates one instance of a specified type.  &lt;li&gt;&lt;strong&gt;GetServices&lt;/strong&gt;: Create a collection of objects of a specified type.&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;in order to use Microsoft Unity framework with ASP.NET WEB API we need to map these to methods to Resolve and ResolveAll methods of Utity. to do so first add the following method to your global.asax.cs or your bootstrapper class&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;Public &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RegisterDependencies(IUnityContainer container)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;            GlobalConfiguration.Configuration.ServiceResolver.SetResolver(&lt;/pre&gt;&lt;pre class="alt"&gt;                t =&amp;gt;&lt;/pre&gt;&lt;pre&gt;                {&lt;/pre&gt;&lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;                    {&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;return&lt;/span&gt; container.Resolve(t);&lt;/pre&gt;&lt;pre&gt;                    }&lt;/pre&gt;&lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (ResolutionFailedException)&lt;/pre&gt;&lt;pre&gt;                    {&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;                    }&lt;/pre&gt;&lt;pre class="alt"&gt;                },&lt;/pre&gt;&lt;pre&gt;                t =&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                {&lt;/pre&gt;&lt;pre&gt;                    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    {&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;return&lt;/span&gt; container.ResolveAll(t);&lt;/pre&gt;&lt;pre class="alt"&gt;                    }&lt;/pre&gt;&lt;pre&gt;                    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (ResolutionFailedException)&lt;/pre&gt;&lt;pre class="alt"&gt;                    {&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre class="alt"&gt;                    }&lt;/pre&gt;&lt;pre&gt;                });&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;


&lt;p&gt;this is the method which maps the GetService and GetServices methods to Resolve and ResolveAll methods.&lt;/p&gt;
&lt;p&gt;the next and final step is to plug in this method to the framework. to do so you just need to call this method from the method in which you construct your unity container. in my case I create a separate method to take care of this:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; IUnityContainer BuildUnityContainer()&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            var container = &lt;span class="kwrd"&gt;new&lt;/span&gt; UnityContainer();&lt;/pre&gt;&lt;pre&gt;            RegisterMappers(container);&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;strong&gt;&lt;font style="background-color: #ffff00"&gt;RegisterDependencies(container);&lt;/font&gt;&lt;/strong&gt;&lt;/pre&gt;&lt;pre&gt;            container.RegisterControllers();&lt;/pre&gt;&lt;pre class="alt"&gt;            DependencyResolver.SetResolver(&lt;span class="kwrd"&gt;new&lt;/span&gt; UnityDependencyResolver(container));&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; container;&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;and you are done. you should be able to use your Ioc container with ASP.NET WEB API now.&lt;/p&gt;</description><pubDate>Sun, 15 Apr 2012 00:39:00 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/using-unity-with-asp.net-web-api-controller</guid></item><item><title>Hosting ASP.NET WEB API</title><link>http://old.taslimi.me:80/hosting-asp.net-web-api</link><description>&lt;p&gt;You may want to host you HTTP Service i.e. ASP.NET WEB API in a console app. well it can be easily done.&lt;/p&gt; &lt;p&gt;to show this lets create a console app and add reference to the following assemblies:&lt;/p&gt;&lt;pre&gt;System.Web&lt;/pre&gt;&lt;pre&gt;System.Web.Http&lt;/pre&gt;&lt;pre&gt;System.Web.Http.Common&lt;/pre&gt;&lt;pre&gt;System.Web.Http.SelfHost&lt;/pre&gt;&lt;pre&gt;System.Web.Http.WebHost&lt;/pre&gt;&lt;pre&gt;System.Net;&lt;/pre&gt;&lt;pre&gt;System.Net.Http.Formatting;&lt;/pre&gt;&lt;pre&gt;System.Net.Http.Headers;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;this step is optional but for just touching on Json.net I am going to install Json.net using Nuget. &lt;/p&gt;&lt;pre&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_thumb.png" width="605" height="110"&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now lets add a CarInfo class to return it in our controller&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CarInfo&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; DateTime releaseDate = DateTime.UtcNow;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; availableColors = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;  &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;          {         &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;          { 1, &lt;span class="str"&gt;"yellow"&lt;/span&gt;},   &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;          { 2, &lt;span class="str"&gt;"red"&lt;/span&gt; },   &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;          { 3, &lt;span class="str"&gt;"black"&lt;/span&gt; }, &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;          };&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            get&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"BMW X6"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; DateTime ReleaseDate { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; releaseDate; } }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; IDictionary&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; AvailableColors { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; availableColors; } }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;


&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And let’s create our home controller as bellow:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; HomeController : ApiController&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="rem"&gt;// GET /api/&amp;lt;controller&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; CarInfo Get()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; CarInfo();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;as you see our controller has got just one method which responds to the Get request.&lt;/p&gt;
&lt;p&gt;we also need a little helper class to integrate JSon.net to our application. please note as mentioned above using Json.net is optional.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; JsonNetFormatter : MediaTypeFormatter&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; JsonSerializerSettings jsonSerializerSettings;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; JsonNetFormatter(JsonSerializerSettings jsonSerializerSettings)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.jsonSerializerSettings = jsonSerializerSettings ?? &lt;span class="kwrd"&gt;new&lt;/span&gt; JsonSerializerSettings();&lt;/pre&gt;&lt;pre&gt;            SupportedMediaTypes.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MediaTypeHeaderValue(&lt;span class="str"&gt;"application/json"&lt;/span&gt;));&lt;/pre&gt;&lt;pre class="alt"&gt;            Encoding = &lt;span class="kwrd"&gt;new&lt;/span&gt; UTF8Encoding(&lt;span class="kwrd"&gt;false&lt;/span&gt;, &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; CanReadType(Type type)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; type != &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(IKeyValueModel);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; CanWriteType(Type type)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Task&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; OnReadFromStreamAsync(Type type, Stream stream, &lt;/pre&gt;&lt;pre&gt;HttpContentHeaders contentHeaders, FormatterContext formatterContext)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            var serializer = JsonSerializer.Create(&lt;span class="kwrd"&gt;this&lt;/span&gt;.jsonSerializerSettings);&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; Task.Factory.StartNew(() =&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (var streamReader = &lt;span class="kwrd"&gt;new&lt;/span&gt; StreamReader(stream, Encoding))&lt;/pre&gt;&lt;pre class="alt"&gt;                {&lt;/pre&gt;&lt;pre&gt;                    &lt;span class="kwrd"&gt;using&lt;/span&gt; (var jsonTextReader = &lt;span class="kwrd"&gt;new&lt;/span&gt; JsonTextReader(streamReader))&lt;/pre&gt;&lt;pre class="alt"&gt;                    {&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;return&lt;/span&gt; serializer.Deserialize(jsonTextReader, type);&lt;/pre&gt;&lt;pre class="alt"&gt;                    }&lt;/pre&gt;&lt;pre&gt;                }&lt;/pre&gt;&lt;pre class="alt"&gt;            });&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; Task OnWriteToStreamAsync(Type type, &lt;span class="kwrd"&gt;object&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;, Stream stream, &lt;/pre&gt;&lt;pre&gt;HttpContentHeaders contentHeaders, FormatterContext formatterContext, TransportContext transportContext)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            var serializer = JsonSerializer.Create(&lt;span class="kwrd"&gt;this&lt;/span&gt;.jsonSerializerSettings);&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; Task.Factory.StartNew(() =&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (var jsonTextWriter = &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;new&lt;/span&gt; JsonTextWriter(&lt;span class="kwrd"&gt;new&lt;/span&gt; StreamWriter(stream, Encoding)) { CloseOutput = &lt;span class="kwrd"&gt;false&lt;/span&gt; })&lt;/pre&gt;&lt;pre class="alt"&gt;                {&lt;/pre&gt;&lt;pre&gt;                    serializer.Serialize(jsonTextWriter, &lt;span class="kwrd"&gt;value&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;                    jsonTextWriter.Flush();&lt;/pre&gt;&lt;pre&gt;                }&lt;/pre&gt;&lt;pre class="alt"&gt;            });&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;


&lt;p&gt;ok it’s time to create actual host to host our service. you just need to add few lines of code to the main method of the program&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;// Set up server configuration    &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            HttpSelfHostConfiguration config = &lt;span class="kwrd"&gt;new&lt;/span&gt; HttpSelfHostConfiguration(&lt;span class="str"&gt;"http://localhost:8081"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;            config.Routes.MapHttpRoute(&lt;span class="str"&gt;"Default"&lt;/span&gt;, &lt;span class="str"&gt;"{controller}"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; { controller = &lt;span class="str"&gt;"Home"&lt;/span&gt; });&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;           &lt;/pre&gt;&lt;pre&gt;            JsonSerializerSettings serializerSettings = &lt;span class="kwrd"&gt;new&lt;/span&gt; JsonSerializerSettings();&lt;/pre&gt;&lt;pre class="alt"&gt;            serializerSettings.Converters.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; IsoDateTimeConverter());&lt;/pre&gt;&lt;pre&gt;            config.Formatters[0] = &lt;span class="kwrd"&gt;new&lt;/span&gt; JsonNetFormatter(serializerSettings);&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="rem"&gt;// Create server   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            var server = &lt;span class="kwrd"&gt;new&lt;/span&gt; HttpSelfHostServer(config);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;// Start listening   &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            server.OpenAsync().Wait();&lt;/pre&gt;&lt;pre class="alt"&gt;            Console.ReadLine();&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
to test the application open Fiddler and create a request as below:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_thumb_1.png" width="813" height="392"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;basically you need to set the address to &lt;a title="http://localhost:8081/Home" href="http://localhost:8081/Home"&gt;http://localhost:8081/Home&lt;/a&gt; and content-type to Content-Type: application/json; charset=utf-8. once you create the request click on execute and you should be getting the following response back&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/Hosting-ASP.NET-WEB-API_13135/image_thumb_2.png" width="815" height="461"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;as you see we get Json representation of the CarInfo object.&lt;/p&gt;
&lt;p&gt;it was quit simple, wasn’t it?&lt;/p&gt;</description><pubDate>Sun, 18 Mar 2012 11:26:50 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/hosting-asp.net-web-api</guid></item><item><title>SQL syntax formatter</title><link>http://old.taslimi.me:80/sql-syntax-formatter</link><description>&lt;p&gt;Well it’s really pity that neither VS2010 nor SQL development studio provide SQL syntax formatter. but anyway there good news is that there are sites like &lt;a href="http://www.tsqltidy.com"&gt;http://www.tsqltidy.com&lt;/a&gt;&amp;nbsp; out there which would this for you for free.&lt;/p&gt; &lt;p&gt;but that was not enough for me. i wanted to have tool with me to do this even when i am not connected to the internet–although does not happen that often &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/wlEmoticon-winkingsmile_2.png"&gt; - &lt;/p&gt; &lt;p&gt;Since i use &lt;a href="http://notepad-plus-plus.org/" target="_blank"&gt;Notepad++&lt;/a&gt; as my text editor, i tought there might be a plug in for it. so searching online i found &lt;a href="http://poorsql.com" target="_blank"&gt;T-SQL formatter&lt;/a&gt; plug in. &lt;/p&gt; &lt;p&gt;it’s not still a perfect formatter but in almost 90% of the times it’s done a great job for me. &lt;/p&gt; &lt;p&gt;so if you also need a SQL formatter you may want to try this.&lt;/p&gt; &lt;p&gt;To install it, open Notepad++, click on Plugins Menu and from the Plugin Manager menu click on Mange Plugins sub menu.&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_thumb.png" width="651" height="198"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;then from the Plugin Manager dialog box, select Poor Man’s T_Sql Formatter can click on install&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_thumb_1.png" width="646" height="441"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;it will ask you to restart the application click yes and next time you run Notepad++ you’ll have good SQL formatter plugin installed:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/SQL-syntax-formatter_D1DD/image_thumb_2.png" width="632" height="142"&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 16 Mar 2012 04:27:42 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/sql-syntax-formatter</guid></item><item><title>Invisible character when parsing DateTime</title><link>http://old.taslimi.me:80/invisible-character-when-parsing-datetime</link><description>&lt;p&gt;Today we faced a crazy situation. we have a piece of code in one of our applications which parses date and time value entered into a text box. Being lazy/smart developers we normally copy paste the sample value from the help file in order to test it. but crazy part was that when we copy paste it, .net could not parse the value throwing exception saying that the string was not in correct format. but if we typed exactly the same value it would work! aha let me copy paste both values into notepad and compare them char by char. ok they are exactly the same. &lt;/p&gt; &lt;p&gt;to cut the story short after spending some times on the issue we noticed that there is an invisible character at the beginning of the value copied from the help file. then we quickly created a console app to get the char code of the character. and yes that’s a valid unicode character with 8203 code called “&lt;a href="http://www.fileformat.info/info/unicode/char/200b/index.htm" target="_blank"&gt;Zero Width Space (U+200B)&lt;/a&gt;”.&lt;/p&gt; &lt;p&gt;having found the problem we could easily fix our help files and remove this character from them. &lt;/p&gt; &lt;p&gt;here is the small piece of code to remove the Zero Width Space character from a string.&lt;/p&gt; &lt;div id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; pattern = &lt;span style="color: #006080"&gt;@"\u200B"&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; Regex regex = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Regex(pattern);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; var matches = regex.Matches(content);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; Console.WriteLine(&lt;span style="color: #006080"&gt;"Found {0} Matches"&lt;/span&gt;, matches.Count);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; content = regex.Replace(content, &lt;span style="color: #006080"&gt;""&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Hope this saves you some time in future.&lt;/p&gt;</description><pubDate>Wed, 14 Mar 2012 21:56:08 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/invisible-character-when-parsing-datetime</guid></item><item><title>Make a call to a JSON/XML ASP.Net WEB API from server code</title><link>http://old.taslimi.me:80/make-a-call-to-a-json-xml-asp.net-web-api-from-server-code</link><description>&lt;p&gt;There is plenty of articles out there on how to make a ajax call to a asp.net web api service. but what if you want to make a call to the same service from a server code? this can happen because of various reasons like when you want to offer a service and use IP validation.&lt;/p&gt;
&lt;p&gt;anyway this is quite simple to call a service exposed by ASP.net WEB API either using JSON or XML. and it is like calling a WCF or XML web service from a server side code without adding a reference to the service.&lt;/p&gt;
&lt;p&gt;Lets assume that our ASP.net WEB API provide a service to and and return flights using a given FlightSearchRequest object.&lt;/p&gt;
&lt;h4&gt;FlightSearchRequest&lt;/h4&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; FlightSearchRequest&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; DepartureAirportCode { get; set; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ArrivalAirportCode { get; set; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;WEB API Method&lt;/h4&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;        [HttpPost]&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; IEnumerable&amp;lt;Flight&amp;gt; GetFlights(FlightSearchRequest flightRequest)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Flight&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Flight { Id=1, AirlineCode = &lt;span class="str"&gt;"EK"&lt;/span&gt;, Price = 350 }, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Flight { Id=2, AirlineCode = &lt;span class="str"&gt;"LX"&lt;/span&gt;, Price = 280 },&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;                };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;        }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;and here is the code to call the service:&lt;/p&gt;
&lt;h4&gt;Using JSON&lt;/h4&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;            HttpWebRequest request;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;            HttpWebResponse hwResponse;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; url = &lt;span class="str"&gt;"http://127.0.0.1:26030/api/MyAPI/GetFlights"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; responseBody = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; requestBody = &lt;/pre&gt;
&lt;pre class="alt"&gt;			&lt;span class="str"&gt;"[{\"DepartureAirportCode\":\"MEL\",\"ArrivalAirportCode\":\"LHR\"}]"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;           &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;                &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] byteData = UTF8Encoding.UTF8.GetBytes(requestBody.ToString());&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;                request = (HttpWebRequest)HttpWebRequest.Create(url);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;                request.ContentType = &lt;span class="str"&gt;"application/json;charset=utf-8"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;                request.UserAgent = &lt;/pre&gt;
&lt;pre&gt;	&lt;span class="str"&gt;"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; BOIE9;ENUS)"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt;                request.Accept = &lt;span class="str"&gt;"*/*"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt;                request.Method = &lt;span class="str"&gt;"POST"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt;                request.ContentLength = byteData.Length;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt;                &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt;                &lt;span class="rem"&gt;// Write data &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (Stream postStream = request.GetRequestStream())&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt;                    postStream.Write(byteData, 0, byteData.Length);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt;                }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt;                &lt;span class="rem"&gt;// Get response &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (HttpWebResponse response = request.GetResponse() &lt;span class="kwrd"&gt;as&lt;/span&gt; HttpWebResponse)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt;                    &lt;span class="rem"&gt;// Get the response stream &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt;                    &lt;span class="kwrd"&gt;using&lt;/span&gt; (var reader = &lt;span class="kwrd"&gt;new&lt;/span&gt; StreamReader(response.GetResponseStream()))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt;                    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt;                        responseBody = reader.ReadToEnd();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt;                    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt;                }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;to make the same call using XML you just need to change the ContentType to application/xml and also change the request body to an xml format&lt;/p&gt;
&lt;h4&gt;Using XML&lt;/h4&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;            HttpWebRequest request;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;            HttpWebResponse hwResponse;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; url = &lt;span class="str"&gt;"http://127.0.0.1:26030/api/MyAPI/GetFlights"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; responseBody = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; requestBody = &lt;/pre&gt;
&lt;pre class="alt"&gt;				&lt;span class="str"&gt;"&amp;lt;Product&amp;gt;&amp;lt;Id&amp;gt;6&amp;lt;/Id&amp;gt;&amp;lt;Name&amp;gt;Jackson&amp;lt;/Name&amp;gt;&amp;lt;/Product&amp;gt;"&lt;/span&gt;;         &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;                &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] byteData = UTF8Encoding.UTF8.GetBytes(requestBody.ToString());&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;                request = (HttpWebRequest)HttpWebRequest.Create(url);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;                request.ContentType = &lt;span class="str"&gt;"application/xml;charset=utf-8"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;                request.UserAgent = &lt;/pre&gt;
&lt;pre class="alt"&gt;	&lt;span class="str"&gt;"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; BOIE9;ENUS)"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;                request.Accept = &lt;span class="str"&gt;"*/*"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt;                request.Method = &lt;span class="str"&gt;"POST"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt;                request.ContentLength = byteData.Length;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt;                &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt;                &lt;span class="rem"&gt;// Write data &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (Stream postStream = request.GetRequestStream())&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt;                    postStream.Write(byteData, 0, byteData.Length);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt;                }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt;                &lt;span class="rem"&gt;// Get response &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt;                &lt;span class="kwrd"&gt;using&lt;/span&gt; (HttpWebResponse response = request.GetResponse() &lt;span class="kwrd"&gt;as&lt;/span&gt; HttpWebResponse)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt;                {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt;                    &lt;span class="rem"&gt;// Get the response stream &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt;                    &lt;span class="kwrd"&gt;using&lt;/span&gt; (var reader = &lt;span class="kwrd"&gt;new&lt;/span&gt; StreamReader(response.GetResponseStream()))&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt;                    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt;                        responseBody = reader.ReadToEnd();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt;                    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt;                }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;now the more I play with WEP API the more I like it &lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/d8d1b66746e0_B535/wlEmoticon-smile_2.png"&gt;&lt;/p&gt;</description><pubDate>Mon, 12 Mar 2012 02:21:54 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/make-a-call-to-a-json-xml-asp.net-web-api-from-server-code</guid></item><item><title>ASP.Net WEB API VS WCF Service</title><link>http://old.taslimi.me:80/asp.net-web-api-vs-wcf-service</link><description>&lt;p&gt;Well as soon as i heard and read about asp.net web api, i was very excited about it but in between i had that mmmmm moment. i was like, this is great but what about WCF? I am not going to create any WCF services anymore?  &lt;p&gt;so I had think again about it but could not find any concrete answer as these two are overlapping in many areas. so I had to do a bit more R&amp;amp;D about the differences and I came across &lt;a href="http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx" target="_blank"&gt;this blog post from Matt Milner&lt;/a&gt;. &lt;p&gt;the post has got very fair point on when to use WCF services and when to use ASP.net web api. but in nutshell I think for most of our feature service development for web –over http-, we are going to use ASP.net web api and it kind of make sense as it’s much easier to setup and use. &lt;p&gt;here is blog post address: &lt;p&gt;&lt;a href="http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx"&gt;http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sun, 11 Mar 2012 12:00:42 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/asp.net-web-api-vs-wcf-service</guid></item><item><title>The Visual Studio 2011 Fakes Framework</title><link>http://old.taslimi.me:80/the-visual-studio-2011-fakes-framework</link><description>&lt;p&gt;I was just reading &lt;a href="http://www.peterprovost.org/blog/post/Whats-New-in-Visual-Studio-11-Beta-Unit-Testing.aspx" target="_blank"&gt;this blog post&lt;/a&gt; about Unit Testing Improvement in Visual Studio 2011 and noticed that there is something new called Fakes Framework.&lt;/p&gt; &lt;p&gt;I didn’t get it first time so I had to read it again and also had to read &lt;a href="http://msdn.microsoft.com/en-us/library/hh549175(v=vs.110).aspx" target="_blank"&gt;this MSDN article&lt;/a&gt; to get my head around it. I mean I was getting so excited about it that I had to read it twice to make sure I have understood it properly. then I went like wow that’s great. now I can test old SharePoint code without TypeMock. &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.taslimi.me/Media/Default/Windows-Live-Writer/The-Visual-Studio-2011-Fakes-Framework_1319A/wlEmoticon-smile_2.png"&gt;&lt;/p&gt; &lt;p&gt;basically according to MSDN there are two new feature in the Fakes Framework:&lt;/p&gt; &lt;h2&gt;Stub &lt;/h2&gt; &lt;p&gt;types Stub types make it easy to test code that consumes interfaces or non-sealed classes with overridable methods. A stub of the type T provides a default implementation of each virtual member of T, that is, any non-sealed virtual or abstract method, property, or event. The default behavior can be dynamically customized for each member by attaching a delegate to a corresponding property of the stub. A stub is realized by a distinct type which is generated by the Fakes Framework. As a result, all stubs are strongly typed.  &lt;p&gt;Although stub types can be generated for interfaces and non-sealed classes with overridable methods, they cannot be used for static or non-overridable methods. To address these cases, the Fakes Framework also generates shim types.  &lt;h2&gt;Shim &lt;/h2&gt; &lt;p&gt;types Shim types allow detouring of hard-coded dependencies on static or non-overridable methods. A shim of type T can provide an alternative implementation for each non-abstract member of T. The Fakes Framework will redirect method calls to members of T to the alternative shim implementation. The shim types rely on runtime code rewriting that is provided by a custom profiler. &lt;p&gt;according to the blog post mentioned above the Stubs are not like Mocking framework but I am still not sure why I would need a Mocking framework when I can use Stub feature! will spend some more time on this and will update this post. &lt;p&gt;but the Wow part for me was the Shim. it seems Microsoft Pex and Molls has given the required motivation for the VS team to include the Shim feature. it has always been a very difficult task to test non abstract classes like the ones provided in SharePoint. even using TypeMock or Pex was not an easy task. &lt;p&gt;but Shim sounds very promising. although the syntax is not still quite easy to use-or at least I have not figured it out in last few hours- but it’s a great start.  &lt;p&gt;here is a small code sample which should throw an Application Exception if it’s first day of year 2000. &lt;p&gt;&amp;nbsp; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Y2KChecker {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Check() {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (DateTime.Now == &lt;span class="kwrd"&gt;new&lt;/span&gt; DateTime(2000, 1, 1))&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ApplicationException(&lt;span class="str"&gt;"y2kbug!"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&amp;nbsp; &lt;p&gt;lets say we want to make sure that the following code will throw an Application Exception if current date is 01/01/2000.&amp;nbsp; but to test this we need to provide an alternative implementation for DateTime.Now as DateTime.Now will always return current system date and time which would never satisfies the if condition.
&lt;p&gt;as you know we cannot Mock DateTime.Now with mocking framework and here is where Shim comes to picture to provide an alternative return value for DateTime.Now:
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (ShimsContext.Create()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="rem"&gt;// hook delegate to the shim method to redirect DateTime.Now&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="rem"&gt;// to return January 1st of 2000&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    ShimDateTime.NowGet = () =&amp;gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; DateTime(2000, 1, 1);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    Y2KChecker.Check();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;now I see the light at the end of all those old SharePoint code which are dying to be unit tested.
</description><pubDate>Sat, 10 Mar 2012 11:11:06 GMT</pubDate><guid isPermaLink="true">http://old.taslimi.me:80/the-visual-studio-2011-fakes-framework</guid></item></channel></rss>