<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-592338512444000546</id><updated>2025-04-18T18:07:47.123-07:00</updated><category term="EPPlus"/><category term="HTTP POST"/><category term="POST request"/><category term="REST Services"/><category term="API documentation"/><category term="ASP.NET WebAPI documentation"/><category term="Automating the document generation process"/><category term="BDD"/><category term="Code Maintainability"/><category term="Excel Named Ranges"/><category term="Geolocation"/><category term="HTML5"/><category term="JSON Serialization"/><category term="NSpec"/><category term="Nuget"/><category term="Orientation property of cell"/><category term="Personalisation"/><category term="Public API documentation"/><category term="SOLID"/><category term="SVC trace Viewer"/><category term="Software Design"/><category term="TDD"/><category term="TfL"/><category term="WCF Traces"/><category term="X509 certificates"/><category term="local storage"/><category term="log4net trace tool"/><category term="london transport"/><category term="transport for london"/><category term="transport modes"/><title type='text'>Intelligent Factory</title><subtitle type='html'>Dot NET useful code snippets for developers</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-2039555289250431065</id><published>2016-04-28T01:54:00.000-07:00</published><updated>2016-04-28T01:54:52.872-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="local storage"/><category scheme="http://www.blogger.com/atom/ns#" term="london transport"/><category scheme="http://www.blogger.com/atom/ns#" term="Personalisation"/><category scheme="http://www.blogger.com/atom/ns#" term="TfL"/><category scheme="http://www.blogger.com/atom/ns#" term="transport for london"/><category scheme="http://www.blogger.com/atom/ns#" term="transport modes"/><title type='text'>Personalisation </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
How to create Personalised / Customised Views on your website&amp;nbsp;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
There are many reasons why one would want to create customised views of the website, they frequently visit. Users are mostly interested in only a small section of the website and are always desperate to get the information with minimum clicks.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Why personalised views&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
As a user, I am interested only on notifications, alerts or disruptions that affect me. Hence, I wish to get that information in the quickest possible way. This creates a strong proposition for one to create personalised websites.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
How can we do it&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
We can leverage the power of local storage to create personalised views for each and every user. This has many advantages compared to Single Sign-On Users.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
1) Local storage lies on the client side and hence is fast compared to fetching view-specific data from the database on the server&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
2) Local storage can be easily cleared and the customised view can be easily reconstructed with local storage afresh.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
3) Practically no infrastructure support is required&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
4) Development time is reduced considerably due to above reasons&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Who has done it&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Transport for London (TfL) has shown the way in this direction. Its award winning website attracts over 20 million visitors a month, which shows the scale of its operations. Recently, TfL has launched the Personalisation feature on its website.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLENlSJf9314kLqpDXQ03wu2X2s1ZDe8cXV-zr8WQOfp2LcJQCN2raYpS97aalooNKNWFIi2aT10Quq1gxBjEUouMMqS5J8QcjQYy6pVCPWr_ura3gW86Q_OkBjtCX2mU4FqcgylrcoQE/s1600/Pers1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;71&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLENlSJf9314kLqpDXQ03wu2X2s1ZDe8cXV-zr8WQOfp2LcJQCN2raYpS97aalooNKNWFIi2aT10Quq1gxBjEUouMMqS5J8QcjQYy6pVCPWr_ura3gW86Q_OkBjtCX2mU4FqcgylrcoQE/s400/Pers1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
If you now launch the &lt;a href=&quot;https://tfl.gov.uk/&quot; target=&quot;_blank&quot;&gt;TfL website&lt;/a&gt;, you will notice a &quot;Star&quot; icon at the extreme right. Clicking on the &quot;star&quot; starts your personalisation &quot;journey&quot;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
What all can I personalise and how does it look&lt;/h3&gt;
&lt;div&gt;
If the user has not favourited any part of the website then it will be presented with a list of options that user can &#39;favourite&#39;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
First Time User Mode&lt;/h4&gt;
&lt;div&gt;
This is the mode when the user has not customised any part of the website.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjaIKFjciTsTvnlderqASlyTiguO4AaBs3ytUqxo51_XdKggpi3ALJNTQCM8SHCg_jiY9flX_d76a79o0d4zJHphAn2fIgj7SlZYUU5ZifLM9d1pMOMs5nPeA9MB7rRuHsOUeoFwYqPow/s1600/FTU.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;355&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjaIKFjciTsTvnlderqASlyTiguO4AaBs3ytUqxo51_XdKggpi3ALJNTQCM8SHCg_jiY9flX_d76a79o0d4zJHphAn2fIgj7SlZYUU5ZifLM9d1pMOMs5nPeA9MB7rRuHsOUeoFwYqPow/s400/FTU.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In this mode, the user is presented the option to favourite any or all of the tube lines (including London Overground, TfLRail and DLR), buses, Roads, River buses, Trams and Emirates Cable car.&lt;/div&gt;
&lt;div&gt;
So, you can see that as a user, you can customise your views for all these modes of transport from the website.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Add / Edit Mode:&lt;/h4&gt;
&lt;div&gt;
In this mode, users can add or edit the modes for which they wish to view disruptions. Clicking on the &quot;Lines&quot; link presents the option to add or edit the tube lines.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmXN3og5dgpEFnmopJ9NAGFKm-RLabIpIJ9Ef6ig8nd_-Bex_Le9Cpn0PE-AGaHQxQiJjOiFDeyeLK5VKwncMrUbyy0zTLlFF8AB4AgvmE6jScpQKYBTDWFVRTDH8VBEw-hJopCTzWVZ8/s1600/Add_Edit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmXN3og5dgpEFnmopJ9NAGFKm-RLabIpIJ9Ef6ig8nd_-Bex_Le9Cpn0PE-AGaHQxQiJjOiFDeyeLK5VKwncMrUbyy0zTLlFF8AB4AgvmE6jScpQKYBTDWFVRTDH8VBEw-hJopCTzWVZ8/s640/Add_Edit.png&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As you can see tube lines favourited would be &quot;starred&quot;. &quot;Starred&quot; lines would be added to your customised view and any disruptions on those lines would be visible to you across the website.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Status mode:&lt;/h4&gt;
&lt;div&gt;
In this mode, all the favourited lines are visible alongwith their &quot;status&quot; information. If there is any disruption on your favourited lines then those will be visible in this mode.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhorZBzsfz6rjj_218cM6GyQNCs56tPTQJ3R_RO4ABheXjX1QJ1p9xBOwMTqkgmEDi3Wj0La97sBmUzLHDn-JFr-U3fEx2jJSI-po1WgUoycDGXcPNZ3bOaKLRhyphenhyphenhoyuZkYXaPWjWMAni8/s1600/StatusPanel.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhorZBzsfz6rjj_218cM6GyQNCs56tPTQJ3R_RO4ABheXjX1QJ1p9xBOwMTqkgmEDi3Wj0La97sBmUzLHDn-JFr-U3fEx2jJSI-po1WgUoycDGXcPNZ3bOaKLRhyphenhyphenhoyuZkYXaPWjWMAni8/s400/StatusPanel.png&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Base on the above, &lt;b&gt;you will appreciate that this personalised feature reduces the real-estate of the website by providing users only the information they are interested in&lt;/b&gt;. Moreover, showing all the customised views as an overlay across the website enhances the visual appeal of the website. As the website is fully responsive, it caters to most of the mobile devices by providing a comparable user experience (UX) as a native app !&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Can I get customised view on home page&lt;/h3&gt;
&lt;div&gt;
TfL has smartly thought out the possible places where customised views would increase user-acceptability of personalisation feature. As a result they have elevated customised views on the Home Page (Landing page) as well.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY6kLK0r1ykitXDCtwEv8s_ji7S8FPDREaqNiWjhAjxs8GkHX9gnBhghLewfdGseeK5KeJobUfX3owfmkRQwQTV42Jsqgd8zjMEIO7HA7SVggk_4Sa3ZZlEGuOqRPFlqAw4BZdLCnJk7g/s1600/HomePage.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY6kLK0r1ykitXDCtwEv8s_ji7S8FPDREaqNiWjhAjxs8GkHX9gnBhghLewfdGseeK5KeJobUfX3owfmkRQwQTV42Jsqgd8zjMEIO7HA7SVggk_4Sa3ZZlEGuOqRPFlqAw4BZdLCnJk7g/s640/HomePage.png&quot; width=&quot;304&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This completes the personalisation journey for 1 mode of transport and as you can see how it enhances the user engagement by providing features that &#39;you&#39; are interested in.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
All the modes of transport can be added to your views in a similar way except for buses. So, next time we will take a look at the buses.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Note: This blog post is not endorsed by TfL in any way and am just one of the developers on this project. It is my endeavour to share my learnings from my work and highlighting the concepts through websites or data available in public domain.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So, play with it, like it, drop in your comments.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/2039555289250431065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2016/04/personalisation.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2039555289250431065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2039555289250431065'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2016/04/personalisation.html' title='Personalisation '/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLENlSJf9314kLqpDXQ03wu2X2s1ZDe8cXV-zr8WQOfp2LcJQCN2raYpS97aalooNKNWFIi2aT10Quq1gxBjEUouMMqS5J8QcjQYy6pVCPWr_ura3gW86Q_OkBjtCX2mU4FqcgylrcoQE/s72-c/Pers1.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-7869339726416585705</id><published>2015-05-16T12:20:00.000-07:00</published><updated>2015-05-16T12:22:06.027-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="API documentation"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET WebAPI documentation"/><category scheme="http://www.blogger.com/atom/ns#" term="Automating the document generation process"/><category scheme="http://www.blogger.com/atom/ns#" term="Public API documentation"/><title type='text'>API Documents page using Swagger</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Creating APIs to be consumed by 3rd party applications (public API) have become very important especially with the explosive growth witnessed by mobile apps. Exposing RESTful end points for consumption by mobile apps (or any application) involves lot of testing to generate stable APIs.&lt;br /&gt;
When the endpoints are to be consumed by other public applications then a strong and simplified documentation with sample usage becomes all the more important. Following up with the consumers regarding the usage is the last thing one would want to do after the development of RESTful services.&lt;br /&gt;
&lt;br /&gt;
As you services evolve during the development phase, keeping up with the documentation poses a real challenge. It becomes increasingly difficult to be sure whether the document is a true reflection of the APIs, meaning whether the document is &#39;live&#39;.&lt;br /&gt;
&lt;br /&gt;
To make the document generation process less painful and ensuring that it is always &#39;live&#39;, several tools have been developed. One such tool, which I found useful is &#39;Swagger&#39;. This tool allows your API to be documented in real-time and that too without writing a single line of code. Now, how cool is that !&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Pre-requisites&lt;/u&gt;: I am assuming that you already have an ASP.NET WebApi project created and that you are able to access some of the RESTful endpoints. For Swagger to work, your controller must be derived from ApiController base class.&lt;br /&gt;
My WebApi would be a self hosted one so the following steps are valid for self hosted services.&lt;br /&gt;
&lt;br /&gt;
1) Please install the swashbuckle nuget package in your web api project either using the Package Manager console or &#39;Manage Nuget Packages&#39; control menu.&lt;br /&gt;
PM&amp;gt; install-package swashbuckle&lt;br /&gt;
Then, install swashbuckle.core package in similar way.&lt;br /&gt;
PM&amp;gt; install-package swashbuckle.core&lt;br /&gt;
&lt;br /&gt;
After installing the above packages, a new .cs file names &quot;SwaggerConfig&quot; would be created in the App_Start folder. This file contains the code to activate your WebApi.&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. Now run your WebApi project and browse the following URL,&lt;br /&gt;
&quot;http://localhost:&amp;lt;your port no.&amp;gt;/swagger/&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJx5RXqAZIcT4AXjB4hjsnZVDiD_9sAYZMcppD8uVQJXOh1dBKFbcpUYFWC4xaAF-imnly7nZcvZeTDSaq41K0TFnyK7b-oBvkmLrmHH_3m0UTM6QkCoYuwQ-4PU_vmXiGtYYhYiPhMVk/s1600/Swagger.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;191&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJx5RXqAZIcT4AXjB4hjsnZVDiD_9sAYZMcppD8uVQJXOh1dBKFbcpUYFWC4xaAF-imnly7nZcvZeTDSaq41K0TFnyK7b-oBvkmLrmHH_3m0UTM6QkCoYuwQ-4PU_vmXiGtYYhYiPhMVk/s400/Swagger.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
The highlighted text is the name of the controllers in my Web Api. If you Expand Operations then you also have the facility to invoke the API and check the result.&lt;br /&gt;
&lt;br /&gt;
Now, you will never have to maintain the documents for your public APIs. It is all embedded in your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/7869339726416585705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2015/05/api-documents-page-using-swagger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7869339726416585705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7869339726416585705'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2015/05/api-documents-page-using-swagger.html' title='API Documents page using Swagger'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJx5RXqAZIcT4AXjB4hjsnZVDiD_9sAYZMcppD8uVQJXOh1dBKFbcpUYFWC4xaAF-imnly7nZcvZeTDSaq41K0TFnyK7b-oBvkmLrmHH_3m0UTM6QkCoYuwQ-4PU_vmXiGtYYhYiPhMVk/s72-c/Swagger.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-2216405203856947311</id><published>2013-07-09T04:24:00.003-07:00</published><updated>2013-07-09T04:26:09.901-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BDD"/><category scheme="http://www.blogger.com/atom/ns#" term="NSpec"/><category scheme="http://www.blogger.com/atom/ns#" term="Nuget"/><category scheme="http://www.blogger.com/atom/ns#" term="TDD"/><title type='text'>Unit testing philosophies - TDD and BDD</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I am sure nobody denies the benefits of unit testing. Until 2-3 years ago everybody agreed that unit testing is definitely beneficial for the project, but very few had mechanisms (or tools) in place to do the same.&lt;br /&gt;
With Visual studio 2010 and MS Test Unit testing framework in place, it has now become very easy to write and maintain unit test cases within the same solution as your project.&lt;br /&gt;
MS Test unit tests can be executed singularly or in a group and the results of the test are available in the Test results window. The test result is actually a file with .trx extension located in &#39;TestResults&#39; folder inside your project folder. One can easily export the .trx file into an html file by means of a command line utility freely available from codeplex at this location,&amp;nbsp;&lt;a href=&quot;http://trxtohtml.codeplex.com/&quot;&gt;http://trxtohtml.codeplex.com/&lt;/a&gt;&lt;br /&gt;
The html file can then be sent over an email, which can be viewed in a browser.&lt;br /&gt;
&lt;br /&gt;
TDD:&lt;br /&gt;
Test Driven Development, is a unit testing mechanism wherein a class&#39; methods are tested. Testing philosophy is Fail, code, re-factor. It is important to note that this philosophy reduces the dead or unnecessary code from the project, which means less code and hence less maintenance.&lt;br /&gt;
However, TDD approach is more understandable by the developers and is mainly testing the methods of a class. For a non technical PM it is difficult to get all the information from TDD test results. Hence, there remains a disconnect between a PM and the development team.&lt;br /&gt;
&lt;br /&gt;
BDD:&lt;br /&gt;
Behavior Driven Development aims at abstracting the testing, one level up from just class methods testing (in TDD) to testing the scenarios. These scenarios can be same as Use cases which everyone is familiar with since UML was introduced. Hence this form of testing is easily understood by BA and PM from the end-user perspective.&lt;br /&gt;
One of the popular BDD frameworks for .NET is NSpec which is freely available via the Nuget manager.&lt;br /&gt;
Lets go through a sample to understand it better.&lt;br /&gt;
&lt;br /&gt;
I am interested in testing the Account class, which is as below,&lt;br /&gt;
&lt;br /&gt;
class Account&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public double balance { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public int &amp;nbsp;AccountType { get; set; } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Account()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public bool CanWithdraw(double withdrawAmount)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool bReturn = false;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (balance &amp;gt; withdrawAmount)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bReturn = true;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return bReturn;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
And the BDD tests can be written as follows,&lt;br /&gt;
class describe_contexts : nspec&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Account account;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; void describe_Account()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context[&quot;when withdrawing cash&quot;] = () =&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; before = () =&amp;gt; account = new Account();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context[&quot;account is in credit&quot;] = () =&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; before = () =&amp;gt; account.balance = 500;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; it[&quot;the account dispenses cash&quot;] = () =&amp;gt; account.CanWithdraw(60).should_be_true();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context[&quot;account is overdrawn&quot;] = () =&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; before = () =&amp;gt; account.balance = -500;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; it[&quot;the account does not dispense cash&quot;] = () =&amp;gt; account.CanWithdraw(60).should_be_false();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
And to run this test, type the following command in the Package Manager Console,&lt;br /&gt;
PM&amp;gt; nspecrunner &amp;lt;Project name&amp;gt;\bin\debug\&amp;lt;Project name&amp;gt;.dll&lt;br /&gt;
&lt;br /&gt;
You will be surprised to see how easy it is understand the output of this test.&lt;br /&gt;
&lt;br /&gt;
describe contexts&lt;br /&gt;
&amp;nbsp; describe Account&lt;br /&gt;
&amp;nbsp; &amp;nbsp; when withdrawing cash&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; account is in credit&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the account dispenses cash&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; account is overdrawn&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the account does not dispense cash&lt;br /&gt;
&lt;br /&gt;
Thats it. It is very much readable and understandable by anyone. Which means that these tests can then form the basis for your requirements document which can then be shared with all the project stakeholders.&lt;br /&gt;
So now we have the power of integrating the project documents in your solution that can be maintained on the fly.&lt;br /&gt;
&lt;br /&gt;
Hope you&#39;d appreciate this article and going forward, would adopt more and more of BDD in your projects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/2216405203856947311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2013/07/unit-testing-philosophies-tdd-and-bdd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2216405203856947311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2216405203856947311'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2013/07/unit-testing-philosophies-tdd-and-bdd.html' title='Unit testing philosophies - TDD and BDD'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-5649187508594060117</id><published>2013-04-10T01:32:00.001-07:00</published><updated>2013-05-09T15:15:17.284-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Code Maintainability"/><category scheme="http://www.blogger.com/atom/ns#" term="Software Design"/><category scheme="http://www.blogger.com/atom/ns#" term="SOLID"/><title type='text'>Well Designed and Maintainable Code - Points to consider</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Well designed and maintainable code-base helps in reducing the cost of development (including Change Requests and code enhancements).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;(A) What makes a code-base well designed and maintained?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Every software application is developed with an intention of solving a problem. The problem is specified by means of requirements (SRS). It is in the interest of all the stakeholders that the requirements are elicited to the maximum extent possible.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;As explained above, if a software is developed against a set of requirements (or use cases if UML is used) then it must be possible to test each and every requirement implemented by the software, distinctly. Testability ------ (1)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Since a software implements a pre-defined set of requirements, technically, it is possible to write the entire application in one single file !!! But then is that a good approach?&amp;nbsp; (If I were to develop a library).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Hence, it is always, better to divide the entire application into smaller parts (layers/modules). So Separation of Concerns (layers) is another key---- (2)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Each module in the software should cater only to a specific functionality. Single responsibility Principle--- (3)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;All the modules in the software must be loosely coupled and highly cohesive inorder to create a maintainable application. The impact of a change in one module must be minimal on other modules---------- (4)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Often developers&amp;nbsp; are faced with same kind of problems and scenarios across a multitude of applications. In such scenarios, it is often better to go for tried-and-tested solutions. i.e. Design Patterns -------- (5)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Apart from the above, sufficient documentation by means of code comments and project artefacts, adherence to consistent naming convention, principles of OOP (viz. polymorphism,&amp;nbsp; encapsulation, Inheritance must be used whereever necessary) ---- (6)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;But, if somebody is taking a technical interview then simple answers are not understood by the interviewers. So explain them as follows,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;A well designed and maintainable software exhibits following principles,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;1) &lt;u&gt;&lt;b&gt;S&lt;/b&gt;&lt;/u&gt;ingle Responsibility Principle -&amp;nbsp; Every class must serve one responsibility&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;2) &lt;u&gt;&lt;b&gt;O&lt;/b&gt;&lt;/u&gt;pen/Close Principle - A module must be open for extension but closed for modification&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;3) &lt;u&gt;&lt;b&gt;L&lt;/b&gt;&lt;/u&gt;iskov Substitution - instances of derived classes should be able to replace all the base class references without breaking the code&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;4) &lt;u&gt;&lt;b&gt;I&lt;/b&gt;&lt;/u&gt;nterface Segregation - prefer client specific interfaces over one generic interface.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;5) &lt;u&gt;&lt;b&gt;D&lt;/b&gt;&lt;/u&gt;ependency Inversion - All the modules should be based on abstractions and not concrete classes. Use dependency injection instead of creating instances of temporary &#39;Helper&#39; classes.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;To summarise, a maintainable software must be &lt;u&gt;&lt;b&gt;SOLID&lt;/b&gt;&lt;/u&gt; in design.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;(B) What underlying principles or qualities do you look for in a system of classes that tells you they are well designed and maintainable?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;A software consists of modules/components that act in cohesion to produce the necessary functionality. Now, every module is implemented by means of a set of classes (in OOP languages, structural languages like &#39;C&#39; do not support &#39;class&#39;).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Classes must be written so that it adheres to the principles of OOP. For instance, having all the data members of the class as &#39;public&#39; is possible but it is a bad practice and strongly discouraged. Data Hiding&amp;nbsp; -------- (1)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Classes can be inherited from other classes to maximise the code re-use and create a hierachy of similar classes. &#39;Is-A&#39; relationship, inheritance ------ (2)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;If the developer has a reason for not allowing a class to be inherited then he can do so by decorating his class using &#39;sealed&#39; attribute ( in C#) Usage of appropriate attributes ----(3)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;As far as possible, creating &#39;new&#39; objects of a class within another class must be avoided. Instead inject the dependency by means of constructor/.NET property.------- (4)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;No Hardcoding of any sort in the classes ---------------- (5)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Limiting one class to one .cs file is a good practice ------ (6)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 13pt; margin-bottom: 10pt; margin-left: 0pt; margin-right: 0pt; text-indent: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: 11pt;&quot;&gt;Apart from the above, code comments, naming convention and testability (unit testing) of classes still holds true and that cannot be relaxed.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/5649187508594060117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2013/04/well-designed-and-maintainable-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/5649187508594060117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/5649187508594060117'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2013/04/well-designed-and-maintainable-code.html' title='Well Designed and Maintainable Code - Points to consider'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-7586395279255728314</id><published>2013-02-18T07:57:00.001-08:00</published><updated>2013-02-19T01:25:48.930-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTTP POST"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON Serialization"/><category scheme="http://www.blogger.com/atom/ns#" term="POST request"/><category scheme="http://www.blogger.com/atom/ns#" term="REST Services"/><title type='text'>Implementing POST requests in .NET </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Data transfer between the client and server takes place over the sockets and in byte format. Which means that anything a client needs to send to a server must be converted into bytes either implicitly or explicitly.&lt;br /&gt;
POST requests differ from other HTTP requests (apart from PUT) in the concept that in POST request, the client sends data in the &#39;body&#39; of the HTTP packet. Hence we should understand how to send this data on the client side and at the same time how do we extract the body from the HTTP packet on the server side for further processing. Most of the sites only speak about the GET requests which are far simpler to consume by any client. It is the POST/PUT requests which needs to be understood very well.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, the data needs to be sent as a stream of bytes hence if you need to transfer an object of a class then it must be serialized into a stream of bytes by serialization. This post relates with JSON (de)serialization.&lt;br /&gt;
&lt;br /&gt;
Lets take a look at some client and server side code in .NET.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Client Side:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
string endPoint = &quot;http://localhost:20909/surveyupload&quot;; // endpoint address to send the data on&lt;br /&gt;
var request = (HttpWebRequest)WebRequest.Create(endPoint);&lt;br /&gt;
request.Method = &quot;POST&quot;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
string PostData = Newtonsoft.Json.JsonConvert.SerializeObject(survey); // JSON serialization&lt;br /&gt;
&lt;br /&gt;
if (!string.IsNullOrEmpty(PostData))&lt;br /&gt;
{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte[] byteContent = Encoding.UTF8.GetBytes(PostData); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (var writeStream = request.GetRequestStream())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; writeStream.Write(byteContent, 0, byteContent.Length);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using (var response = (HttpWebResponse)request.GetResponse())&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; var responseValue = string.Empty;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (response.StatusCode != HttpStatusCode.OK)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var message = String.Format(&quot;Request failed. Received HTTP {0}&quot;, response.StatusCode);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ApplicationException(message);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// grab the response&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (var responseStream = response.GetResponseStream())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (responseStream != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (var reader = new StreamReader(responseStream))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;responseValue = reader.ReadToEnd();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Server side:&lt;/u&gt;&lt;br /&gt;
The following method is your sample function implemented on the server side, that maps to the endpoint request made from client.&lt;br /&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;
&lt;br /&gt;
public string GetFile(System.IO.Stream data)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string JSONInString = string.Empty;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (StreamReader reader = new StreamReader(data))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JSONInString = reader.ReadToEnd();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reader.Close(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Deserialize the streamed byte data into the object of known type as below&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SurveyData ReceivedData = JsonConvert.DeserializeObject&amp;lt;SurveyData&amp;gt;(JSONInString);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ReceivedData != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &quot;Success&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &quot;Failed&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. It is very easy to implement the POST requests in .NET. The above client requests can be further elaborated depending upon the requirement. This may involve adding additional headers, modifying content-types, user-agent, etc. properties of the Http request.&lt;br /&gt;
&lt;br /&gt;
For details regarding the importance of REST services, please refer to,&amp;nbsp;&lt;a href=&quot;http://intelligentfactory.blogspot.co.uk/2012/09/rest-services-primer-all-about-rest.html&quot;&gt;http://intelligentfactory.blogspot.co.uk/2012/09/rest-services-primer-all-about-rest.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/7586395279255728314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2013/02/implementing-post-requests-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7586395279255728314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7586395279255728314'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2013/02/implementing-post-requests-in-net.html' title='Implementing POST requests in .NET '/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-307355406857541202</id><published>2012-10-31T09:19:00.000-07:00</published><updated>2013-02-19T01:26:13.462-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Geolocation"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML5"/><title type='text'>Geolocation sample in HTML5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Geolocation is an interesting feature deployed by numerous mobile applications. It allows an application to find the location of mobile/device. And based on the location the application can provide various services or advertisements.&lt;br /&gt;
&lt;br /&gt;
Geolocation in HTML5?&lt;br /&gt;
HTML5 allows one to use to geolocation services quite easily and within few minutes one should be able to see something working.&lt;br /&gt;
&lt;br /&gt;
lets see an example of how to use the geo location in HTML5.&lt;br /&gt;
&lt;br /&gt;
One needs to use the geolocation object exposed by the navigator in-order to &amp;nbsp;utilize its services. The geolocation object has 2 methods which provide the location information.&lt;br /&gt;
1) getCurrentPosition : to be used when the location information is required just once.&lt;br /&gt;
2)&amp;nbsp;watchPosition : to be used when one needs to monitor or track the location periodically.&lt;br /&gt;
&lt;br /&gt;
Both the methods have identical signatures. The arguments for each of the functions is as below,&lt;br /&gt;
a) Arg1 (Mandatory) : call back function, which will be called when the function call suceeds&lt;br /&gt;
b) Arg2 (Optional) : call back function, which will be called when the function call fails&lt;br /&gt;
c) Arg3 (Optional) : PositionOptions object&lt;br /&gt;
&lt;br /&gt;
The following code will show a button and on clicking the button the virtual globe should be visible. In Firefox one would see the info bar and a message box prompting the user to accept the location information.&lt;br /&gt;
&lt;br /&gt;
Paste the following code in the &amp;lt;body&amp;gt; of an html file.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;button onclick=&quot;GetMap()&quot;&amp;gt;Show map&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div id=&quot;mapDiv&quot; style=&quot;position: relative; width: 800px; height: 600px;&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var map = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function GetMap() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Replace YOUR_BING_MAPS_KEY with your own credentials.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Obtain a key by signing up for a developer account at&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; http://www.microsoft.com/maps/developers/ */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var cred = &quot;&amp;lt;Your BING KEY&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Initialize map&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map = new Microsoft.Maps.Map(document.getElementById(&quot;mapDiv&quot;),&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { credentials: cred });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Check if browser supports geolocation&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (navigator.geolocation) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; navigator.geolocation.getCurrentPosition(locateSuccess, locateFail);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&#39;I\&#39;m sorry, but Geolocation is not supported in your current browser.&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Successful geolocation&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function locateSuccess(loc) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Set the user&#39;s location&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var userLocation = new Microsoft.Maps.Location(loc.coords.latitude, loc.coords.longitude);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// do your operations&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Unsuccessful geolocation&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function locateFail(geoPositionError) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; switch (geoPositionError.code) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case 0: // UNKNOWN_ERROR&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&#39;An unknown error occurred, sorry&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case 1: // PERMISSION_DENIED&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&#39;Permission to use Geolocation was denied&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case 2: // POSITION_UNAVAILABLE&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&#39;Couldn\&#39;t find you...&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case 3: // TIMEOUT&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&#39;The Geolocation request took too long and timed out&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; default:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. Plain and simple to get location information in HTML5.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/307355406857541202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/10/geolocation-sample-in-html5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/307355406857541202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/307355406857541202'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/10/geolocation-sample-in-html5.html' title='Geolocation sample in HTML5'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-7389200236236910679</id><published>2012-09-09T13:30:00.001-07:00</published><updated>2013-02-19T01:26:56.835-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTTP POST"/><category scheme="http://www.blogger.com/atom/ns#" term="POST request"/><category scheme="http://www.blogger.com/atom/ns#" term="REST Services"/><category scheme="http://www.blogger.com/atom/ns#" term="X509 certificates"/><title type='text'>REST Services : A Primer. All About Rest Services</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Today we will understand how to consume the WCF REST services on the client side.&lt;br /&gt;
The theory of REST can be understood from numerous resources online. This post will explain how to make the different types of requests.&lt;br /&gt;
&lt;br /&gt;
Why REST?&lt;br /&gt;
Anyone who has worked with web-services and WCF is often confused as to why&amp;nbsp;one&amp;nbsp;should create RESTful services when SOAP has been easy and good to use for so long. So the short answer for using REST is less data traffic on the network. Every data packet to be sent over SOAP is packaged in a bulky header.&lt;br /&gt;
&lt;br /&gt;
The main verbs in a REST implementation are GET, PUT, POST. There are other verbs as well but they are infrequently used. One can try these requests by using a popular tool like WebFetch (we will discuss using the WebFetch tool in a later post)&lt;br /&gt;
&lt;br /&gt;
Lets go to some practical examples:&lt;br /&gt;
In many applications viz the secured ones, every client is issued a certificate so that every REST request from the client is authenticated and then authorised to perform the operation (specified by the verb)&lt;br /&gt;
&lt;br /&gt;
How to use the client certificates in REST:&lt;br /&gt;
HttpClient client = new HttpClient( &amp;lt;Url on which request is to be made&amp;gt; );&lt;br /&gt;
&lt;br /&gt;
string certLoc = &amp;lt;certificate location&amp;gt;;&lt;br /&gt;
string certPwd = &amp;lt;certificate pwd&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
X509Certificate2 cert = new X509Certificate2(certLoc, certPwd);&lt;br /&gt;
client.TransportSettings.ClientCertificates.Add(cert);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) The complete sample for GET request would look as below,&lt;br /&gt;
&lt;br /&gt;
using (HttpClient client = new HttpClient(
&amp;lt;Url on which request is to be made&amp;gt;&amp;nbsp;))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Initalise a response object&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HttpResponseMessage response = null;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string certLoc =&amp;nbsp;&amp;lt;certificate location&amp;gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string certPwd =&amp;nbsp;&amp;lt;certificate pwd&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X509Certificate2 cert = new X509Certificate2(certLoc, certPwd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.TransportSettings.ClientCertificates.Add(cert);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sRestAddress =&amp;nbsp;
&amp;lt;Url on which request is to be made&amp;gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.BaseAddress = new Uri(sRestAddress);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // encoding to be used. base64_UTF16_Encode is a user-defined function&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sBase64EncodedMembershipNumber = base64_UTF16_Encode(sMembershipNumber);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string authrorization = &quot;Basic&quot; + sBase64EncodedMembershipNumber + &quot;\r\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential(authrorization);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.DefaultHeaders.Accept.Add(&quot;text/xml\r\n&quot;);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string requestPath = &amp;lt;request path of the resource&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Make the request and retrieve the response&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; response = client.Get(sRestAddress + requestPath);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; response.Content.LoadIntoBuffer(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;return response.Content.ReadAsByteArray();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above code snippet shows how we can make a GET request and pass the client certificate and logging credentials along with the request. Response could either be in xml or pdf format and can be specified in the header by using the Accept type in the HTTP request.&lt;br /&gt;
&lt;br /&gt;
2) The PUT request would look like below,&lt;br /&gt;
&lt;br /&gt;
using (HttpClient client = new HttpClient( &amp;lt;Url on which request is to be made&amp;gt;&amp;nbsp;))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Initalise a response object&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HttpResponseMessage response = null;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string certLoc =&amp;nbsp;&amp;lt;certificate location&amp;gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string certPwd =&amp;nbsp;&amp;lt;certificate pwd&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X509Certificate2 cert = new X509Certificate2(certLoc, certPwd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.TransportSettings.ClientCertificates.Add(cert);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sRestAddress =&amp;nbsp; &amp;lt;Url on which request is to be made&amp;gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.BaseAddress = new Uri(sRestAddress);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // encoding to be used. base64_UTF16_Encode is a user-defined function&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sBase64EncodedMembershipNumber = base64_UTF16_Encode(sMembershipNumber);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string authrorization = &quot;Basic&quot; + sBase64EncodedMembershipNumber + &quot;\r\n&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential(authrorization);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.DefaultHeaders.Accept.Add(&quot;text/xml\r\n&quot;);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string requestPath = &amp;lt;request path of the resource&amp;gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // XML file which contains the data to be sent&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;XDocument doc = XDocument.Load(@&quot;C:\Personal\Test.xml&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HttpContent body = HttpContent.Create(doc.ToString(SaveOptions.DisableFormatting), Encoding.UTF8, &quot;text/xml&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; response = client.Put(sRestAddress + requestPath, body);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; response.Content.LoadIntoBuffer(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;return response.Content.ReadAsByteArray();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
The above code snippet shows how to send a PUT request to the server. PUT/POST requests are used to send data to the server. The exact type of verb to be used is decided by the author of the Server code and the requirement whether the state of server is to be changed or not.&lt;br /&gt;
&lt;br /&gt;
REST is fairly easy and simple to use.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/7389200236236910679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/09/rest-services-primer-all-about-rest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7389200236236910679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/7389200236236910679'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/09/rest-services-primer-all-about-rest.html' title='REST Services : A Primer. All About Rest Services'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-6642981826607401726</id><published>2012-08-02T12:33:00.001-07:00</published><updated>2013-02-19T01:27:18.605-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EPPlus"/><category scheme="http://www.blogger.com/atom/ns#" term="Excel Named Ranges"/><title type='text'>Excel Named ranges in EPPlus</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This post will explain the advantages of Named Ranges in Excel and how do we use it with EPPlus library.&lt;br /&gt;
This post would explain how to use the named ranges for reading/importing an excel programmatically(dynamically).&lt;br /&gt;
&lt;br /&gt;
A) What are Named Ranges?&lt;br /&gt;
In excel, it is possible to specify an address for a cell or a range of cells. The address of this/these cells is referred as named ranges.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMCqnRobjj_KY-YwMpXVPs4cYl4zhryE8tKIRoNYFHfwoBgP8KbI_EIfryxwv1gaHZVcogQCRd8wR9BpmAd1x790HjTQ8aSsN3LRr0TwuIlLk-OMKIKBtVacytIsa28lQRWtM9667u0O4/s1600/Excel1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMCqnRobjj_KY-YwMpXVPs4cYl4zhryE8tKIRoNYFHfwoBgP8KbI_EIfryxwv1gaHZVcogQCRd8wR9BpmAd1x790HjTQ8aSsN3LRr0TwuIlLk-OMKIKBtVacytIsa28lQRWtM9667u0O4/s1600/Excel1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
If you check the above image, cell A1 has a text value of &quot;Name&quot; and named range of it is&quot;NameField&quot;.&lt;br /&gt;
Named Range in other words are user-defined addresses of cells.&lt;br /&gt;
Now, since named ranges are addresses, basic rules of variable names apply. Like, it cannot begin with a number, cannot have a &#39;.&#39; character in the name, etc. Also, within a sheet, all the named ranges must have unique names.&lt;br /&gt;
&lt;br /&gt;
B) Writing named ranges using EPPlus:&lt;br /&gt;
Many engineering applications (software) provide feature of exporting and importing the excel file. The typical scenario will be to generate some kind of a template information in the form of an excel, exporting to the client from server.&lt;br /&gt;
The exported excel file can then be populated from the users and once that is done, the excel file can then be imported into the system by sending it to the server over a web.&lt;br /&gt;
&lt;br /&gt;
In such scenarios, importing an excel will be extremely easy only if we were to write the user defined addresses of the cells along with its text, while exporting. So that while reading we can read only our user-defined addresses.&lt;br /&gt;
&lt;br /&gt;
Assumption:&lt;br /&gt;
Users are aware of How to use EPPlus library and the popular APIs it exposes.&lt;br /&gt;
&lt;br /&gt;
ExcelRange range = ws.Cells[&quot;A1&quot;]; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ws is the worksheet name&lt;br /&gt;
ws.Cells[&quot;A1&quot;].Value = &quot;Name&quot;;&lt;br /&gt;
string sNamedRange = &quot;NameField&quot;;&lt;br /&gt;
ws.Names.Add(sNamedRange, range);&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. A1 cell in your generated excel file must have &quot;NameField&quot; as its address.&lt;br /&gt;
&lt;br /&gt;
Hope this post helps a lot of other developers. I had a tough time reading the excel file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/6642981826607401726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/08/excel-named-ranges-in-epplus.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/6642981826607401726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/6642981826607401726'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/08/excel-named-ranges-in-epplus.html' title='Excel Named ranges in EPPlus'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMCqnRobjj_KY-YwMpXVPs4cYl4zhryE8tKIRoNYFHfwoBgP8KbI_EIfryxwv1gaHZVcogQCRd8wR9BpmAd1x790HjTQ8aSsN3LRr0TwuIlLk-OMKIKBtVacytIsa28lQRWtM9667u0O4/s72-c/Excel1.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-6014224515356617404</id><published>2012-08-02T11:43:00.002-07:00</published><updated>2013-02-19T01:27:43.097-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EPPlus"/><category scheme="http://www.blogger.com/atom/ns#" term="Orientation property of cell"/><title type='text'>How to change the orientation of excel worksheet in EPPlus</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It is very easy to change the orientation of the Excel sheet while using EPPlus library. This is often necessary when one needs to check the print preview of the generated excel file.&lt;br /&gt;
&lt;br /&gt;
Suppose, your worksheet variable name is ws then,&lt;br /&gt;
ws.PrinterSettings.Orientation = eOrientation.Landscape.&lt;br /&gt;
&lt;br /&gt;
Thats it. It is a simple one-liner.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/6014224515356617404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/08/how-to-change-orientation-of-excel.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/6014224515356617404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/6014224515356617404'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/08/how-to-change-orientation-of-excel.html' title='How to change the orientation of excel worksheet in EPPlus'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-8389297628097150500</id><published>2012-07-27T06:06:00.002-07:00</published><updated>2012-07-27T06:06:18.883-07:00</updated><title type='text'>NPOI or EPPlus? Which is better?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my current project, I had a requirement to export and import the data to an excel file. There are plenty of free libraries available, but only NPOI and EPPlus are worth taking a look.&lt;br /&gt;
&lt;br /&gt;
After initial searching and experimentation, i have come&amp;nbsp;to the following conclusion. &lt;br /&gt;
Pls. note that these conclusions have been arrived at, only after my personal trials.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;NPOI&lt;/u&gt;&lt;br /&gt;
1) The library is good and extensive, but the API&#39;s are not at all intuitive and user friendly&lt;br /&gt;
2) Performance in terms of time and memory, is a big disappointment. &lt;br /&gt;
3) The only advantage in favour of NPOI, according to me, is its ability to generate xls and xlsx files.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;EPPlus&lt;/u&gt;&lt;br /&gt;
1) The library is very well written and API&#39;s are user-friendly, very much identical to Interop.excel&lt;br /&gt;
2) Performance is big big gain while using EPPlus. Thousands of cells can be read/written in a matter of seconds.&lt;br /&gt;
3) It can generate file only in xlsx format. No facility of xls. But one can always download the Microsoft Compatibility pack to overcome this problem.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/8389297628097150500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/npoi-or-epplus-which-is-better.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/8389297628097150500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/8389297628097150500'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/npoi-or-epplus-which-is-better.html' title='NPOI or EPPlus? Which is better?'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-8883674232471373981</id><published>2012-07-18T03:22:00.000-07:00</published><updated>2013-02-19T01:28:13.722-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SVC trace Viewer"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF Traces"/><title type='text'>WCF Service Traces using SVC Trace Viewer</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In WCF projects, one would invariably need some kind of mechanism to ascertain whether the data is sent/received over the communication channel. One can definitely use fiddler for monitoring the data traffic over an http channel. But, WCF tracing provides a nifty way of verifying whether the data has been received/sent from WCF side.&lt;br /&gt;
&lt;br /&gt;
It is easy to add the Tracing information in the WCF project. One would just need to add the diagnostics element in the web.config / app.config&amp;nbsp;file of the WCF hosting project.&lt;br /&gt;
A sample element structure is shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;system.diagnostics&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sources&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source name=&quot;System.ServiceModel&quot; switchValue=&quot;Information&quot; propagateActivity=&quot;true&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;listeners&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name=&quot;corr&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/listeners&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;source name=&quot;System.ServiceModel.MessageLogging&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;listeners&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name=&quot;corr&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/listeners&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sources&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sharedListeners&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name=&quot;corr&quot; type=&quot;System.Diagnostics.XmlWriterTraceListener&quot; initializeData=&quot;c:\personal\Service.svclog&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/add&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sharedListeners&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/system.diagnostics&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&quot;c:\personal\Service.svclog&quot; is the absolute file path for the log file that will be generated from the WCF traces. &lt;br /&gt;
Navigate to the file location and view the log file in the SVC Trace Viewer for easy debugging.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/8883674232471373981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/wcf-service-traces-using-svc-trace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/8883674232471373981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/8883674232471373981'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/wcf-service-traces-using-svc-trace.html' title='WCF Service Traces using SVC Trace Viewer'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-2186169831595079067</id><published>2012-07-06T12:23:00.000-07:00</published><updated>2013-02-19T01:28:34.658-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="log4net trace tool"/><title type='text'>Logging using log4net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In almost every application (windows or web based) one needs to monitor the health of the system. Meaning, every application invariably maintains an audit trail which can be inspected by the development team in-order to understand the application flow and rectify the errors (if any).&lt;br /&gt;
&lt;br /&gt;
I have been addressing the above requirement by implementing a singleton, thread-safe logger class for such purposes.&lt;br /&gt;
&lt;br /&gt;
But recently, I learnt a much easier way to do the logging using a freely available library named as log4net.&lt;br /&gt;
&lt;br /&gt;
log4net dll can be downloaded from&amp;nbsp;&lt;a href=&quot;http://logging.apache.org/log4net/download_log4net.cgi&quot;&gt;Log4net&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
1) Inorder to use log4net we need to configure the expected behavior in the app.config or web.config files (depending upon the application type)&lt;br /&gt;
I am explaining only the web.config part here. But the same holds good for app.config.&lt;br /&gt;
&lt;br /&gt;
1.1) Create a new section node under the &amp;lt;configSections&amp;gt; &amp;nbsp;in the web.config file as shown below&lt;br /&gt;
&amp;lt;section name=&quot;log4net&quot; type=&quot;log4net.Config.Log4NetConfigurationSectionHandler, log4net&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.2) Now, create a log4net node in the web.config file,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;log4net&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;!-- Console Appender --&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;appender name=&quot;ConsoleAppender&quot; type=&quot;log4net.Appender.ConsoleAppender&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;layout type=&quot;log4net.Layout.SimpleLayout&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/appender&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;!-- File Appender --&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;appender name=&quot;RollingLogFileAppender&quot; type=&quot;log4net.Appender.RollingFileAppender&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;file value=&quot;&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;StaticLogFileName value=&quot;false&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;lockingModel type=&quot;log4net.Appender.FileAppender+MinimalLock&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;appendToFile value=&quot;true&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;rollingStyle value=&quot;Composite&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;maxSizeRollBackups value=&quot;10&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;maximumFileSize value=&quot;10MB&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;datePattern value=&quot;.yyyy-MM-dd&#39;.lo\g&#39;&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;encoding value=&quot;unicodeFFFE&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;conversionPattern value=&quot;%date [%thread] %-5level %logger [%property{NDC}] - %message%newline&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/layout&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/appender&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;root&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;level value=&quot;ALL&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;appender-ref ref=&quot;RollingLogFileAppender&quot;/&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/root&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/log4net&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The best part of log4net is that you can have multiple appenders for logging the data. Also, several processes can log to the same file, provided you do the correct settings in the &amp;lt;lockingModel&amp;gt; node.&lt;br /&gt;
&lt;br /&gt;
So, as per the above settings,&lt;br /&gt;
we are asking log4net library to create a Rolling log file, with lockingModel type as MinimalLock [for multiple processes to log to same file], each file size to be of 10MB and maximum file backups to be maintained as 10.&lt;br /&gt;
Further, the file name should end with &quot;.yyyy-MM-dd.log&quot;. where yyyy-MM-dd represents the file creation date.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Usage:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
log4net.Appender.IAppender[] AppenderList = D2DELLogger.ms_log.Logger.Repository.GetAppenders();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (var item in AppenderList)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (item.Name == &quot;RollingLogFileAppender&quot;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ((log4net.Appender.RollingFileAppender)(item)).File = Path.Combine(System.Configuration.ConfigurationManager.AppSettings[&quot;LogFilePath&quot;].ToString(), &quot;D2DLogs\\D2DTrace.log&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ((log4net.Appender.RollingFileAppender)(item)).ActivateOptions();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
Note: We are calling ActivateOptions() method, because the configuration properties are being modified in the preceding line. [ in a real world scenario, every application would be developed to have a customizable file name, hence we modify the file name that was configured via. the web.config file].&lt;br /&gt;
&lt;br /&gt;
Hope this post helps everyone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/2186169831595079067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/logging-using-log4net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2186169831595079067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2186169831595079067'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/logging-using-log4net.html' title='Logging using log4net'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-2254358828526333087</id><published>2012-07-03T02:02:00.001-07:00</published><updated>2012-07-03T02:02:31.296-07:00</updated><title type='text'>Method extensions and Useful Enum Method Extension</title><content type='html'>In many of the projects, there is a requirement to get the string values from the enum definition.&lt;br /&gt;
One attribute that can be used off-the-shelf is [Flags] attribute. But this attribute gives only the string representation of the enum variable, which means you cannot have spaces or long strings.&lt;br /&gt;
&lt;br /&gt;
So to overcome this, one can write a handy enum extension for this.&lt;br /&gt;
Consider the following enum,&lt;br /&gt;
&lt;br /&gt;
internal enum XlColumnHeaders&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [StringValue(&quot;Section&quot;)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlSection = 1,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [StringValue(&quot;Question Text&quot;)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlQuestionText = 2,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [StringValue(&quot;Free Text&quot;)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlFreeText = 3,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [StringValue(&quot;Yes No&quot;)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlYesNo = 4,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
Now whenever I wish to get a string representation of xlSection, I should get &quot;Section&quot;. Similarly, for xlQuestionText I should get &quot;Question Text&quot; [Note: the space between the 2 words].&lt;br /&gt;
&lt;br /&gt;
To achieve the above result, Create a static class with a public static method as follows.&lt;br /&gt;
static class StringEnum&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static string GetStringValue(this Enum value)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type type = value.GetType();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get fieldinfo for this type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FieldInfo fieldInfo = type.GetField(value.ToString());&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the stringvalue attributes&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; typeof(StringValueAttribute), false) as StringValueAttribute[];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Return the first if there was a match.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return attribs.Length &amp;gt; 0 ? attribs[0].StringValue : null;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Usage&lt;/u&gt;:&lt;br /&gt;
XlColumnHeaders temp = new XlColumnHeaders();&lt;br /&gt;
temp = XlColumnHeaders.xlQuestionText;&lt;br /&gt;
temp.GetStringValue();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// this would return &quot;Question Text&quot;&lt;br /&gt;
&lt;br /&gt;
Hope this post is helpful.</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/2254358828526333087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/method-extensions-and-useful-enum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2254358828526333087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2254358828526333087'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/07/method-extensions-and-useful-enum.html' title='Method extensions and Useful Enum Method Extension'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-592338512444000546.post-2755733925282205415</id><published>2012-06-30T04:24:00.004-07:00</published><updated>2012-06-30T04:24:54.792-07:00</updated><title type='text'>Creating drop down options in a cell in Excel using Silverlight 5 and C#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
How to create an Out of Browser&amp;nbsp;Silverlight&amp;nbsp;Application for generating Excel? How to create a drop down (combo-box) cell programmatically in Silverlight?&lt;br /&gt;
&lt;br /&gt;
In my current project, I wanted to create a template form in excel that the user can create on his local disk. And later on populate the data according to his wish.&lt;br /&gt;
&lt;br /&gt;
Depending upon the questions in the template, the cells should be customized. E.g. If the question&#39;s answer could have 2 choices, say Yes/No then the cell corresponding to such a question must show a drop down for answer choices Yes/No, all done programmatically, behind the scenes.&lt;br /&gt;
&lt;br /&gt;
Assumptions:&lt;br /&gt;
1) Silverlight 5 is used&lt;br /&gt;
2) Visual Studio 2010 is the development environment.&lt;br /&gt;
3) A Silverlight 5 project is created and the reference to Microsoft.CSharp is already added.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;A) How to create a out-of-browser Silverlight application?&lt;/span&gt;&lt;br /&gt;
What is an out-of-browser application: An out-of-browser application (web application) is one which allows &amp;nbsp;users of that application to access the local hard disk. The exact definition could be easily found on several sites.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Configuring Out-of-Browser settings in VS2010&lt;/u&gt;:&lt;br /&gt;
For the already created Silverlight project, open the project properties by right clicking the mouse. Select the Silverlight tab on the left.&lt;br /&gt;
In Silverlight build options: Select the appropriate Silverlight Target Version, in our case Silverlight 5&lt;br /&gt;
Then, tick the &quot;Enable running application out of browser&quot; check box. This would enable the &quot;out-of-browser Settings&quot; button. click on that.&lt;br /&gt;
In the Out-of-browser settings new window tick the &quot;Require elevated trust when running outside the browser.&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Click OK.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;B) How to create a drop down in the cell&lt;/span&gt;&lt;br /&gt;
In silverlight we have to use the AutomationFactory for creating an Excel Application object. Here is the code for it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dynamic ExcelApp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExcelApp = AutomationFactory.GetObject(&quot;Excel.Application&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExcelApp = AutomationFactory.CreateObject(&quot;Excel.Application&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // control visibility of the excel tool&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExcelApp.Visible = true;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dynamic m_Workbook = ExcelApp.workbooks;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_Workbook.Add();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dynamic m_WorkSheet = ExcelApp.ActiveSheet;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dynamic cell = null;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now the tricky part is to do the drop down. And here is the code snippet for creating a drop down in cell [2,2] with options Yes and No.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dynamic list = new List&amp;lt;string&amp;gt;();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; list.Add(&quot;Yes&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; list.Add(&quot;No&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;dynamic flatList = string.Join(&quot;,&quot;, list.ToArray());&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell = m_WorkSheet.Cells[2, 2];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell.Validation.Delete();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell.Validation.Add( 3, //XlDVType.xlValidateList, &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3, //XlDVAlertStyle.xlValidAlertInformation, &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1, //XlFormatConditionOperator.xlBetween, &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flatList,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Type.Missing);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell.Validation.IgnoreBlank = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell.Validation.InCellDropdown = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will find many links that use the&amp;nbsp;&lt;span style=&quot;font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Questions/187985/Microsoft-Office-Interop-Excel-Class-can-be-used-i#&quot; id=&quot;_GPLITA_0&quot; in_hdr=&quot;null&quot; in_rurl=&quot;http://www.textsrv.com/click?v=R0I6MTQxNjI6NjgwOm1pY3Jvc29mdDoyNGUzNWIxZTMzNmUxNWNkNjc3NjNjZDI2ZWUzMWI1Yzp6LTEyMDktNDQ3MzE6d3d3LmNvZGVwcm9qZWN0LmNvbQ%3D%3D&quot; style=&quot;color: purple; font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot; title=&quot;Powered by Text-Enhance&quot;&gt;Microsoft&lt;/a&gt;&lt;span style=&quot;font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;.Office.Interop.Excel class library for excel Data validation but sadly I did not find a way to reference this library in Silverlight 5.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;Hence, I had to hard-code the &lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;XlDVType.xlValidateList,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;XlDVAlertStyle.xlValidAlertInformation, and&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;XlFormatConditionOperator.xlBetween enums in the cell.Validation.Add( ) function above to get all working.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;So hope this solves a lot of head ache for others.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://intelligentfactory.blogspot.com/feeds/2755733925282205415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://intelligentfactory.blogspot.com/2012/06/creating-drop-down-options-in-cell-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2755733925282205415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/592338512444000546/posts/default/2755733925282205415'/><link rel='alternate' type='text/html' href='http://intelligentfactory.blogspot.com/2012/06/creating-drop-down-options-in-cell-in.html' title='Creating drop down options in a cell in Excel using Silverlight 5 and C#'/><author><name>Vishal K Agarwal</name><uri>http://www.blogger.com/profile/02074559254351012431</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>