<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0AER305cCp7ImA9WhRaFEk.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849</id><updated>2012-02-17T12:58:26.328+10:30</updated><title>Tips for Microsoft Developers</title><subtitle type="html">A collection of tips and general info for Microsoft Developers</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://morrisbahrami.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>74</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/TipsForMicrosoftDevelopers" /><feedburner:info uri="tipsformicrosoftdevelopers" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;D0AER304cSp7ImA9WhRaFEk.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-8382219234773349617</id><published>2012-02-17T12:45:00.003+10:30</published><updated>2012-02-17T12:58:26.339+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-17T12:58:26.339+10:30</app:edited><title>Microsoft.Exchange.WebServices giving error</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MM7MjmpjVCzzuLyl_QNwyC1CpNs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MM7MjmpjVCzzuLyl_QNwyC1CpNs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MM7MjmpjVCzzuLyl_QNwyC1CpNs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MM7MjmpjVCzzuLyl_QNwyC1CpNs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Exchange Web Services (EWS) allows your application to communicate with the Exchange Server and access data which is normally available to the Microsoft Outlook such as availability, contacts, email etc.&lt;br&gt;&lt;br&gt;

Originally developing applications using EWS was through creating a web service proxy at your application and communicating with that web service proxy just as you would for any other web service consumption. With availability of  &lt;a href="http://msdn.microsoft.com/en-us/library/dd633709(v=exchg.80).aspx" &gt; EWS Managed API &lt;/a&gt; this task has become much easier. All you need now is adding Microsoft.Exchage.WebServices.dll library to your application which encapsulates much of SOAP communication and XML handling, defining an object of type ExchangeService, setting some of its properties and calling its methods. &lt;br&gt;&lt;br&gt;

There are lots of examples of using the above API on the web.&lt;br&gt;&lt;br&gt;
 Recently I was working on a project which partly required accessing Outlook data through EWS. I first used the traditional way of creating a web service proxy. That was giving me this error:&lt;br&gt;&lt;br&gt;
 
&lt;i&gt;Client found response content type of '', but expected 'text/xml'.&lt;/i&gt;&lt;br&gt;
&lt;i&gt;The request failed with an empty response.&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
Then I used Managed API which would gave me this error:&lt;br&gt;&lt;br&gt;
  
 &lt;i&gt;The response received from the service didn't contain valid XML.
&lt;/i&gt; 
&lt;br&gt;&lt;br&gt;
Both of these error messages point to the same problem, i.e. the application could not get the XML response it was expecting from the web service. I searched the web for this problem but couldn't find any useful answer.&lt;br&gt;&lt;br&gt;
 
 It turned out my Virus Checker (Avast) was blocking communication with EWS. As soon as I disabled Avast things worked!
 So if you have a similar experience while using EWS, it is worth stopping your Virus Checker for a while and see if that is the culprit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-8382219234773349617?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/KanyWwGR_Es" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/8382219234773349617/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=8382219234773349617" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8382219234773349617?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8382219234773349617?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/KanyWwGR_Es/microsoftexchangewebservices-giving.html" title="Microsoft.Exchange.WebServices giving error" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2012/02/microsoftexchangewebservices-giving.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEDR3Y9fSp7ImA9WhRbF0k.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-4406157320858972275</id><published>2012-02-08T11:49:00.000+10:30</published><updated>2012-02-09T09:57:56.865+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-09T09:57:56.865+10:30</app:edited><title>Starting SQL Server Management Studio from command line</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ls095wWfKIx9O-ZP-8EWZv-IjjQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ls095wWfKIx9O-ZP-8EWZv-IjjQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ls095wWfKIx9O-ZP-8EWZv-IjjQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ls095wWfKIx9O-ZP-8EWZv-IjjQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Sometimes you need to make changes to a client's database but when you remote login to their machine you don't see the SQL Server Management Studio on their desktop. You wish you could just type a command and get the SQL Server Management Studio coming up. For cases like this, these are the commands you can type in:&lt;br&gt;&lt;br&gt;

mmc   (for SQL Server 2000)&lt;br&gt;
sqlwb (for SQL Server 2005)&lt;br&gt;
ssms  (for SQL Server 2008)&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-4406157320858972275?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/tv_13c-Lwdk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/4406157320858972275/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=4406157320858972275" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4406157320858972275?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4406157320858972275?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/tv_13c-Lwdk/starting-sql-server-management-studio.html" title="Starting SQL Server Management Studio from command line" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2012/02/starting-sql-server-management-studio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUMQ3gycSp7ImA9WhRbFUU.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-971557686463487801</id><published>2012-02-02T16:14:00.001+10:30</published><updated>2012-02-07T13:24:42.699+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-07T13:24:42.699+10:30</app:edited><title>Development and Deloyment of Windows Service Applications</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sjJ9eEpaGFK-s8ngpB8IpmD2O18/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sjJ9eEpaGFK-s8ngpB8IpmD2O18/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/sjJ9eEpaGFK-s8ngpB8IpmD2O18/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sjJ9eEpaGFK-s8ngpB8IpmD2O18/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;This is a short walkthrough on writing a Windows Service application and its associated installer using VB.NET in Visual Studio 2010.&lt;br&gt;&lt;br&gt;

1. Start a new project of type Windows Service as shown below: 

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-PgFzpfLqs6Q/TyoTXQ4Ge_I/AAAAAAAAAHk/wH5aexLJ4rU/s1600/ws1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="222" width="320" src="http://4.bp.blogspot.com/-PgFzpfLqs6Q/TyoTXQ4Ge_I/AAAAAAAAAHk/wH5aexLJ4rU/s320/ws1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;

Refer to my &lt;a href="http://morrisbahrami.blogspot.com.au/2011/02/installing-missing-templates-in-visual.html#!http://morrisbahrami.blogspot.com/2011/02/installing-missing-templates-in-visual.html" &gt; previous post &lt;/a&gt; if you do not see Windows Service template.&lt;br&gt;&lt;br&gt;

2. This creates service1.vb file with two methods called OnStart() and OnStop(). A Windows Service is a long running application that periodically performs certain tasks. You would normally need to add a timer to this file which fires perodically and causes certain actions to take place. 

Following shows service1.vb file with Timer1 added to the class:

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-M-BDRsEOYAM/TyoXK3wL77I/AAAAAAAAAH8/ZCddW75R8NE/s1600/ws1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="155" width="320" src="http://3.bp.blogspot.com/-M-BDRsEOYAM/TyoXK3wL77I/AAAAAAAAAH8/ZCddW75R8NE/s320/ws1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


3. Set the properties of this timer in OnStart() as shown below:

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-S9vlkBSU2rA/TysZzUnAXEI/AAAAAAAAAI4/RjSI9pzgyQw/s1600/ws1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="57" width="320" src="http://3.bp.blogspot.com/-S9vlkBSU2rA/TysZzUnAXEI/AAAAAAAAAI4/RjSI9pzgyQw/s320/ws1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;

  
4. Create a handler for Timer1.Elapsed event as shown below:&lt;br&gt;

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-zKhwUo6taPw/TysYgPxprhI/AAAAAAAAAIs/UE9fYolWI8w/s1600/ws2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="26" width="320" src="http://3.bp.blogspot.com/-zKhwUo6taPw/TysYgPxprhI/AAAAAAAAAIs/UE9fYolWI8w/s320/ws2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;



5. Add an installer to this project by right clicking on the project and selecting Add &gt; New Item ...  &gt; Installer as shown below:

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Vt8-U-jG7nw/TyoacGgCEgI/AAAAAAAAAII/hNqv4U5LjJM/s1600/ws2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="222" width="320" src="http://3.bp.blogspot.com/-Vt8-U-jG7nw/TyoacGgCEgI/AAAAAAAAAII/hNqv4U5LjJM/s320/ws2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


6. If you open the project installer in the design tab you will see two components as shown below: 

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/--XorumAGI1Y/Tysha6iMOoI/AAAAAAAAAJE/58hCp7tPkek/s1600/ws2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="74" width="320" src="http://1.bp.blogspot.com/--XorumAGI1Y/Tysha6iMOoI/AAAAAAAAAJE/58hCp7tPkek/s320/ws2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;

7. Right click on ServiceInstaller1 and select Properties. There you can specify the Description of the service and also specify its StartType (Manual or Automatic).&lt;br&gt;&lt;br&gt;

8. Right Click on ServiceProcessInstaller1 and select Properties. There you can set the Account that the service will run under (normally LocalSystem). Note that a service runs unattended and needs to run under a specified account with the necessary rights.&lt;br&gt;&lt;br&gt;

9. Add a Setup project to the solution as shown below:

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-b5nyvjkvlDc/Tyod2roHbsI/AAAAAAAAAIU/c10D69ylII0/s1600/ws3.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="223" width="320" src="http://2.bp.blogspot.com/-b5nyvjkvlDc/Tyod2roHbsI/AAAAAAAAAIU/c10D69ylII0/s320/ws3.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


10. Right click on the newly added project (setup1) and select Add &gt; Project Output
and select the Windows service project. Select Primary Output and then click &lt;b&gt;OK&lt;/b&gt;.&lt;br&gt;&lt;br&gt;

11. Right click on setup1 project, point to &lt;b&gt;View&lt;/b&gt; then select &lt;b&gt;Custome Actions&lt;/b&gt;.&lt;br&gt;&lt;br&gt;

12. Right click &lt;b&gt;Custom Action&lt;/b&gt; and select &lt;b&gt;Add Custom Action&lt;/b&gt;. &lt;br&gt;&lt;br&gt;

13. Double-click the application folder in the list box to open it, select &lt;b&gt;Primary Output&lt;/b&gt; from the Windows service project, and click &lt;b&gt;OK&lt;/b&gt;. The primary output is added to all four nodes of the custom actions: Install, Commit, Rollback, and Uninstall.&lt;br&gt;&lt;br&gt;

14. Build the setup project.&lt;br&gt;&lt;br&gt;

15. Right click on setup1 and select View &gt; User Interface. This allows you to delete or move up or down any of the windows that are shown during the installation. You can also modify the banner bitmap to brand the installation package.&lt;br&gt;&lt;br&gt;

16. Further tailoring of the installation pacakge (.msi) can be done using &lt;a href = "http://msdn.microsoft.com/en-us/library/windows/desktop/aa370557(v=vs.85).aspx" &gt;Orca utility&lt;/a&gt;.&lt;br&gt;
Orca is a table editing tool designed to edit .msi files and is part of 
&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6510"&gt; Windows Installer SDK&lt;/a&gt;. &lt;br&gt;&lt;br&gt;

17. Once a service is installed it can be managed by typing services.msc in the command line. That gives you the Service Control Manager where you can stop or start a service, change its mode of operation (Manual vs Automatic) or change the account under which the service runs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-971557686463487801?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/zNt1CufM4aE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/971557686463487801/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=971557686463487801" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/971557686463487801?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/971557686463487801?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/zNt1CufM4aE/development-and-deloyment-of-windows.html" title="Development and Deloyment of Windows Service Applications" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-PgFzpfLqs6Q/TyoTXQ4Ge_I/AAAAAAAAAHk/wH5aexLJ4rU/s72-c/ws1.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2012/02/development-and-deloyment-of-windows.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUARXkyfSp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-2104582746536455202</id><published>2012-01-07T21:18:00.000+10:30</published><updated>2012-02-04T15:57:24.795+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T15:57:24.795+10:30</app:edited><title>Using JQuery Ajax for Javascript Data Binding</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KC8a7wwChsBFumNjlfPdfHNQhV4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KC8a7wwChsBFumNjlfPdfHNQhV4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KC8a7wwChsBFumNjlfPdfHNQhV4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KC8a7wwChsBFumNjlfPdfHNQhV4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Even though With ASP.NET 4.0 we finally got ASP chart controls  in our standard tool box which can show data in a variety of formats, the client side Javascript based charts such as &lt;a href="http://www.highcharts.com"&gt; HighCharts&lt;/a&gt;,  &lt;a href ="http://www.jscharts.com"&gt; JSCharts&lt;/a&gt; or &lt;a href="http://code.google.com/apis/chart"&gt; Google Chart Tools &lt;/a&gt;  look a lot more impressive because of their animation and the interactive nature.  &lt;br&gt;&lt;br&gt;

Most of these tools are based on JQuery. To have a Javascript based chart on your page all you need to do is add a  reference to one of these Javascript files to your page, have a small Javascript code which specifies the attributes of a chart identified by a div in your page and you are done, that is off course, if you have static data.  If the data to be displayed in your chart is stored somewhere in a database, then you have the problem of data binding your Javascript objects. 
One approach to solve the data binding issue is to create a server control that gets the data from the database and generates the Javascript necessary for charting with the associated data in the server and then pushes that to the client. One example of this approach is &lt;a href="http://highcharts.codeplex.com" &gt;HighChart.Net &lt;/a&gt;. &lt;br&gt;&lt;br&gt;

A simpler approach is letting the Javascript get the data from database itself. This approach has two benefits;  firstly by using JQuery Ajax, communicating with a web server and populating the Javascript objects with the data received can be done with very little coding. Secondly, as you have direct access to the Javascript code instead of indirectly through a web server control, you can adjust the chart in whatever the Javascript object allows you to do. &lt;br&gt;&lt;br&gt;


Below are a few points to consider when taking this approach: &lt;br&gt;&lt;br&gt;
On the Web service if you are using asmx web service, make sure your web service class is decorated with the following line. &lt;br&gt;

&amp;ltSystem.Web.Script.Services.ScriptService()&amp;gt &lt;br&gt;
This allows Javascript Ajax  access the web service:&lt;br&gt;&lt;br&gt;


On the client side the following example shows how to get the Queue List  from QueueList web method of ChartDataSource web service and populate  the Options of a  Select element of the page (a drop down list) with that data. Note the jQuery.support.cors = true statement which allows cross domain requests. 
    &lt;br&gt;&lt;br&gt;

&amp;ltscript type="text/javascript"&amp;gt &lt;br&gt;
&lt;br&gt;

         function GetQueues() {&lt;br&gt;

             jQuery.support.cors = true;&lt;br&gt;

 
             $.ajax({&lt;br&gt;

                 type: "POST",&lt;br&gt;

                 url: "http://localhost/ChartDataSource/ChartDataSource.asmx/QueueList", &lt;br&gt;

                 data: '{}', &lt;br&gt;

                 contentType: "application/json; charset=utf-8", &lt;br&gt;

                 dataType: "json", &lt;br&gt;

                 success: AjaxSuccess, &lt;br&gt;

                 error: AjaxError &lt;br&gt;

             }); &lt;br&gt;

         } &lt;br&gt;
&lt;br&gt;


function AjaxSuccess(result) { &lt;br&gt;

            var select = document.getElementById("QueueList"); &lt;br&gt;

            select.options.length = 0; // clear out existing items  &lt;br&gt;

 
            var queueList = eval(result.d); &lt;br&gt;

            for (i in queueList) { &lt;br&gt;

                select.options[select.options.length] = new Option(queueList[i].QueueName, queueList[i].QueueID); &lt;br&gt;

            }&lt;br&gt;

        }&lt;br&gt;
&lt;br&gt;


 function AjaxFailed(result) { &lt;br&gt;

            alert(result.status + ' ' + result.statusText); &lt;br&gt;

        } &lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-2104582746536455202?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/oU7RpTeQA98" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/2104582746536455202/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=2104582746536455202" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/2104582746536455202?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/2104582746536455202?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/oU7RpTeQA98/using-jquery-ajax-for-javascript-data.html" title="Using JQuery Ajax for Javascript Data Binding" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2012/01/using-jquery-ajax-for-javascript-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIGQH4zeyp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-8714446413050036828</id><published>2011-11-09T12:08:00.000+10:30</published><updated>2012-02-04T16:02:01.083+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T16:02:01.083+10:30</app:edited><title>Dynamic DropDownList in a GridView</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6FhmXiN16uEyKymPzCZPYcUog8Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6FhmXiN16uEyKymPzCZPYcUog8Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6FhmXiN16uEyKymPzCZPYcUog8Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6FhmXiN16uEyKymPzCZPYcUog8Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Imagine a Gridview like the one shown below:
 
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Z8kyQlPJtr0/TrnXMBmPnzI/AAAAAAAAAFg/EUgQ0TH7C7E/s1600/1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="149" width="275" src="http://3.bp.blogspot.com/-Z8kyQlPJtr0/TrnXMBmPnzI/AAAAAAAAAFg/EUgQ0TH7C7E/s320/1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


In this example, Shirt can be Small or Medium and Coat can be Medium or Large.  The following figures show how we would select the size for Shirt or Coat:

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-ITl59oteHSM/TrnXRXgbibI/AAAAAAAAAFs/Z6o6G5abM80/s1600/2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="133" width="236" src="http://4.bp.blogspot.com/-ITl59oteHSM/TrnXRXgbibI/AAAAAAAAAFs/Z6o6G5abM80/s320/2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-O7rDm13VZmo/TrnXWAEAUpI/AAAAAAAAAF4/3gjNm17Vkkg/s1600/3.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="162" width="240" src="http://4.bp.blogspot.com/-O7rDm13VZmo/TrnXWAEAUpI/AAAAAAAAAF4/3gjNm17Vkkg/s320/3.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;

  
This is an example of a GridView with a DropDownList in which the entries in that DropDownList depend on the type of item. You need to pass the item (Coat or Shirt in this example) as a parameter to a SQL statement or stored procedure to get the size.
We have these three tables in our database:
 
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-AokPnEf5VqA/TrnYNd9IS1I/AAAAAAAAAGE/OrUo0LUPC_4/s1600/4.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="147" width="320" src="http://1.bp.blogspot.com/-AokPnEf5VqA/TrnYNd9IS1I/AAAAAAAAAGE/OrUo0LUPC_4/s320/4.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;



To achieve this using Visual Studio 2010, create an ASP.NET web application.
Add a GridView with one BoundField for Item and one TemplateField for the DropDownList as shown below:

 &lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-dm4TzxwhMPo/TrnYd9_bm2I/AAAAAAAAAGQ/8onhUzSGWjc/s1600/5.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="164" width="320" src="http://2.bp.blogspot.com/-dm4TzxwhMPo/TrnYd9_bm2I/AAAAAAAAAGQ/8onhUzSGWjc/s320/5.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


Now we need to set the Gridview DataSource first and on RowDataBound event of the GridView read the Item column and use it to determine the DataSource for the DropDownList.
To do that set the GridView DataSource in Page_Load() as shown below:
 
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-vGmCSrYtv2Y/TrnYujP7xxI/AAAAAAAAAGc/-0rGOTffsx4/s1600/6.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="82" width="320" src="http://1.bp.blogspot.com/-vGmCSrYtv2Y/TrnYujP7xxI/AAAAAAAAAGc/-0rGOTffsx4/s320/6.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


Where GetItem() is defined as: 

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-HoSoU0SDo1k/TrnY_NjMoRI/AAAAAAAAAGo/zqf8zFVgHZs/s1600/7.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="100" width="320" src="http://4.bp.blogspot.com/-HoSoU0SDo1k/TrnY_NjMoRI/AAAAAAAAAGo/zqf8zFVgHZs/s320/7.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;
 

Then in the RowDataBound EventHandler of the GridView read the “Item” and use that to define the DataSource for the DropDownList as shown below:
 
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-QGOKpWDEwZI/TrnZOGkfqjI/AAAAAAAAAG0/q7C5S4c0ZVo/s1600/8.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="66" width="320" src="http://3.bp.blogspot.com/-QGOKpWDEwZI/TrnZOGkfqjI/AAAAAAAAAG0/q7C5S4c0ZVo/s320/8.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;


Where GetSize() function is defined as:
 
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-p_MISchv4bY/TrnZaZvfi7I/AAAAAAAAAHA/4xxXyU_OrXw/s1600/9.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="127" width="320" src="http://4.bp.blogspot.com/-p_MISchv4bY/TrnZaZvfi7I/AAAAAAAAAHA/4xxXyU_OrXw/s320/9.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;



That’s it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-8714446413050036828?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/598qnY8ZGD8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/8714446413050036828/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=8714446413050036828" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8714446413050036828?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8714446413050036828?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/598qnY8ZGD8/dynamic-dropdownlist-in-gridview.html" title="Dynamic DropDownList in a GridView" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-Z8kyQlPJtr0/TrnXMBmPnzI/AAAAAAAAAFg/EUgQ0TH7C7E/s72-c/1.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/11/dynamic-dropdownlist-in-gridview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEGR3g8cCp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-8788352872556274274</id><published>2011-10-19T10:51:00.000+10:30</published><updated>2012-02-04T16:03:46.678+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T16:03:46.678+10:30</app:edited><title>DependencyWalker</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/g_R_TFZ9UoUjy4iNnI-rvfd3y6Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g_R_TFZ9UoUjy4iNnI-rvfd3y6Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/g_R_TFZ9UoUjy4iNnI-rvfd3y6Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g_R_TFZ9UoUjy4iNnI-rvfd3y6Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;DependencyWalker form http://www.dependencywalker.com/ is an excellent utility which looks inside a given exe or dll file and lists the attributes of all modules making up that file. It is a free utility and is a very useful debugging tool when you come across errors such as “The application or dll  xxx is not a valid Windows image”, “The dynamic link library xxx.dll could not be found in the specified path”, 32 bit vs 64 bit application interoperability, or similar errors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-8788352872556274274?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/qTufjnOd3WU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/8788352872556274274/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=8788352872556274274" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8788352872556274274?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8788352872556274274?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/qTufjnOd3WU/dependencywalker.html" title="DependencyWalker" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/10/dependencywalker.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8CRn84fSp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-807378880570756107</id><published>2011-09-14T10:33:00.000+09:30</published><updated>2012-02-04T16:07:47.135+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T16:07:47.135+10:30</app:edited><title>OData Protocol and WCF Data Services</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FE1v6aiQbiKazQCgyJl-AxfHZdQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FE1v6aiQbiKazQCgyJl-AxfHZdQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FE1v6aiQbiKazQCgyJl-AxfHZdQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FE1v6aiQbiKazQCgyJl-AxfHZdQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;On 12 October I had a presentation at ADNUG (Adelaide Dot Net User Group) abour OData and WCF Datat Services. Below is the slides that I used for that presentation:



&lt;div style="width:425px" id="__ss_9247693"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/morrisBahrami/odata-and-wcf-data-services" title="OData and WCF Data Services" target="_blank"&gt;OData and WCF Data Services&lt;/a&gt;&lt;/strong&gt; &lt;iframe src="http://www.slideshare.net/slideshow/embed_code/9247693" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt; &lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/" target="_blank"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/morrisBahrami" target="_blank"&gt;morrisBahrami&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-807378880570756107?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/KQLB_9H82d0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/807378880570756107/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=807378880570756107" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/807378880570756107?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/807378880570756107?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/KQLB_9H82d0/odata-protocol-and-wcf-data-services.html" title="OData Protocol and WCF Data Services" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/09/odata-protocol-and-wcf-data-services.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcEQn04cSp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-7523899257816051830</id><published>2011-08-11T11:27:00.000+09:30</published><updated>2012-02-04T16:10:03.339+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T16:10:03.339+10:30</app:edited><title>NuGet and ELMAH</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/WdhjFtBdgQpEIOcY4OGO56EPnvs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WdhjFtBdgQpEIOcY4OGO56EPnvs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/WdhjFtBdgQpEIOcY4OGO56EPnvs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WdhjFtBdgQpEIOcY4OGO56EPnvs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://nuget.org" &gt;NuGet Package Manager&lt;/a&gt; is an excellent Visual Studio 2010 extension that makes it very easy to install and update open source libraries and tools in Visual Studio. &lt;br /&gt;
&lt;br /&gt;
When you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left.&lt;br /&gt;
&lt;br /&gt;
After installing NuGet, one of interesting packages to install is ELMAH (Error Logging Modules and Handlers) the description below is cut and paste from its site:&lt;br /&gt;
&lt;br /&gt;
ELMAH is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment. &lt;br /&gt;
Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilities without changing a single line of your code: &lt;br /&gt;
• Logging of nearly all unhandled exceptions. &lt;br /&gt;
• A web page to remotely view the entire log of recoded exceptions. &lt;br /&gt;
• A web page to remotely view the full details of any one logged exception, including colored stack traces. &lt;br /&gt;
• In many cases, you can review the original yellow screen of death that ASP.NET generated for a given exception, even with customErrors mode turned off. &lt;br /&gt;
• An e-mail notification of each error at the time it occurs. &lt;br /&gt;
• An RSS feed of the last 15 errors from the log. &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-7523899257816051830?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/rHUXEN0nh4A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/7523899257816051830/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=7523899257816051830" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7523899257816051830?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7523899257816051830?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/rHUXEN0nh4A/nuget-and-elmah.html" title="NuGet and ELMAH" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/08/nuget-and-elmah.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8DSXs9eip7ImA9WhdSGE8.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-1632570092949661459</id><published>2011-07-28T13:01:00.000+09:30</published><updated>2011-07-28T13:01:18.562+09:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-28T13:01:18.562+09:30</app:edited><title>Creating a Business Intelligence Center site in SharePoint Server 2010</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2ww-XY-HA5g6jrB4TGP5-teQDrg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2ww-XY-HA5g6jrB4TGP5-teQDrg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2ww-XY-HA5g6jrB4TGP5-teQDrg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2ww-XY-HA5g6jrB4TGP5-teQDrg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;The Business Intelligence Center in SharePoint 2010 provides a platform for Business Intelligence related presentation and management such as KPIs, Scorecards and dashboards.  To create a Business Intelligence Centre site on your SharePoint 2010 you need to activate some Site Collection features and some Site features. The locations of these settings are highlighted below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-aVMbUmTGMvs/TjDU6PvIsxI/AAAAAAAAAEo/2VgeHoVOUTo/s1600/a1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="285" width="320" src="http://3.bp.blogspot.com/-aVMbUmTGMvs/TjDU6PvIsxI/AAAAAAAAAEo/2VgeHoVOUTo/s320/a1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
On Site collection features list make sure these features are active: &lt;br /&gt;
&lt;br /&gt;
"PerformancePoint Services Site Collection features"&lt;br /&gt;
"SharePoint Server Enterprise Site Collection features"&lt;br /&gt;
"SharePoint Server Publishing Infrastructure"&lt;br /&gt;
&lt;br /&gt;
As shown below&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-82XG6kiKsLY/TjDV9i2MgAI/AAAAAAAAAEw/ZFQURaUcNiU/s1600/a2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="205" width="320" src="http://1.bp.blogspot.com/-82XG6kiKsLY/TjDV9i2MgAI/AAAAAAAAAEw/ZFQURaUcNiU/s320/a2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Make sure the corresponding features are also active in the Site Feature list as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-7yhcbU8Fqy8/TjDWhishEMI/AAAAAAAAAE4/fK6zM2EWrpM/s1600/a3.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="207" width="320" src="http://2.bp.blogspot.com/-7yhcbU8Fqy8/TjDWhishEMI/AAAAAAAAAE4/fK6zM2EWrpM/s320/a3.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now you can create a new site and select Business Intelligence Center as the template as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-MQXhxDmpN6M/TjDW8UvutYI/AAAAAAAAAFA/-CEFN0qvcRI/s1600/a5.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="198" width="320" src="http://2.bp.blogspot.com/-MQXhxDmpN6M/TjDW8UvutYI/AAAAAAAAAFA/-CEFN0qvcRI/s320/a5.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Here I have selected http://localhost/BI as the URL. Now if you go to that URL you see your Business Intelligence Center web page as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-BuPkwom7Sa8/TjDXUz9FEEI/AAAAAAAAAFI/KKSp8cIbZUA/s1600/a6.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="271" width="320" src="http://3.bp.blogspot.com/-BuPkwom7Sa8/TjDXUz9FEEI/AAAAAAAAAFI/KKSp8cIbZUA/s320/a6.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-1632570092949661459?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/Jo37P7EU5qc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/1632570092949661459/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=1632570092949661459" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1632570092949661459?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1632570092949661459?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/Jo37P7EU5qc/creating-business-intelligence-center.html" title="Creating a Business Intelligence Center site in SharePoint Server 2010" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-aVMbUmTGMvs/TjDU6PvIsxI/AAAAAAAAAEo/2VgeHoVOUTo/s72-c/a1.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/07/creating-business-intelligence-center.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMESHgzcSp7ImA9WhdSFkg.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-1941774040352527817</id><published>2011-07-26T14:37:00.000+09:30</published><updated>2011-07-26T14:46:49.689+09:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-26T14:46:49.689+09:30</app:edited><title>Displaying a SQL Server table as a List in SharePoint 2010</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fkvXqC1aQH2o5MJR5OclF5Oremw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fkvXqC1aQH2o5MJR5OclF5Oremw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fkvXqC1aQH2o5MJR5OclF5Oremw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fkvXqC1aQH2o5MJR5OclF5Oremw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;If you want to display a table (or a view or a stored procedure) data from your SQL Server database in your SharePoint 2010 which resides in a different server, these are the steps that you can take: &lt;br /&gt;
&lt;br /&gt;
1. Create a Secure Store Service (SSS)  using SharePoint 2010 Central  Administration as shown below:&lt;br /&gt;
First select “Manage Service Application”&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-_uaS1yoeDoM/Ti5KWVZHnRI/AAAAAAAAADY/NQoKhe_8tfM/s1600/ap1.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="198" width="320" src="http://1.bp.blogspot.com/-_uaS1yoeDoM/Ti5KWVZHnRI/AAAAAAAAADY/NQoKhe_8tfM/s320/ap1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Then select Secure Store Service&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-YrefcgSZmrQ/Ti5Kg8_ZrpI/AAAAAAAAADg/n04aJ3ZRg3w/s1600/ap2.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="296" width="320" src="http://1.bp.blogspot.com/-YrefcgSZmrQ/Ti5Kg8_ZrpI/AAAAAAAAADg/n04aJ3ZRg3w/s320/ap2.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
And follow the Wizard instructions. For the purpose of this simple example select the default values. Then set the credentials for the SSS. Let’s call this SSS_1.&lt;br /&gt;
&lt;br /&gt;
2. Create an External Content Type (ECT) using SharePoint Designer as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-_-_yC8cQgms/Ti5MXX10ncI/AAAAAAAAAEQ/vb87BneMHJo/s1600/ap4.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="203" width="320" src="http://2.bp.blogspot.com/-_-_yC8cQgms/Ti5MXX10ncI/AAAAAAAAAEQ/vb87BneMHJo/s320/ap4.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
For External System choose SQL Server :  &lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xrteU0130Ms/Ti5M-3Q7kzI/AAAAAAAAAEY/uUCnQrm4Ndg/s1600/ap6.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="202" width="320" src="http://3.bp.blogspot.com/-xrteU0130Ms/Ti5M-3Q7kzI/AAAAAAAAAEY/uUCnQrm4Ndg/s320/ap6.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You can choose tabels, view or stored procedures for your data source. For External System Authentication Mode select “Impersonate Windows Identity” and then select SSS_1 that you set up earlier for the Secure Store Application ID as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-sUMqX-HM_IQ/Ti5LPWZhNFI/AAAAAAAAAD4/85zssNehKvE/s1600/ap10.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="213" width="320" src="http://3.bp.blogspot.com/-sUMqX-HM_IQ/Ti5LPWZhNFI/AAAAAAAAAD4/85zssNehKvE/s320/ap10.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
3. After creating an ECT, there will be a Business Data Connectivity Service (BDC) in SharePoint Central Administration associated with this ECT. Open that BDC and give permissions to users as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-x3Pcfx55U4Q/Ti5LaQxInHI/AAAAAAAAAEA/Dz0iIEG30jA/s1600/ap11.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="241" width="320" src="http://2.bp.blogspot.com/-x3Pcfx55U4Q/Ti5LaQxInHI/AAAAAAAAAEA/Dz0iIEG30jA/s320/ap11.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
4. Create a list in SharePoint Designer of Type “External List” as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-EzU7Hrn5XhY/Ti5Nuclv4kI/AAAAAAAAAEg/s1sxwFDrTtI/s1600/ap9.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="230" width="320" src="http://1.bp.blogspot.com/-EzU7Hrn5XhY/Ti5Nuclv4kI/AAAAAAAAAEg/s1sxwFDrTtI/s320/ap9.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Select the content type as the ECT that was generated before.&lt;br /&gt;
&lt;br /&gt;
In this scenario the credential required to access this list is the credentials that you stored at SSS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-1941774040352527817?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/VudgAeIMIYc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/1941774040352527817/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=1941774040352527817" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1941774040352527817?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1941774040352527817?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/VudgAeIMIYc/displaying-sql-server-table-as-list-in.html" title="Displaying a SQL Server table as a List in SharePoint 2010" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-_uaS1yoeDoM/Ti5KWVZHnRI/AAAAAAAAADY/NQoKhe_8tfM/s72-c/ap1.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/07/displaying-sql-server-table-as-list-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8GR3s7eCp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-6453742318152403210</id><published>2011-07-19T12:42:00.000+09:30</published><updated>2012-02-04T16:23:46.500+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T16:23:46.500+10:30</app:edited><title>List of software items installed on the computers in your domain</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iKLxreK7R52mg6iKsWT0T-aQxK4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iKLxreK7R52mg6iKsWT0T-aQxK4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iKLxreK7R52mg6iKsWT0T-aQxK4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iKLxreK7R52mg6iKsWT0T-aQxK4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Win32_Product WMI class lists the software which were installed on a computer using Windows Installer. The example code below shows how to use this to get the name and version of those software items:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Imports Microsoft.Win32&lt;br /&gt;
Imports System.Management&lt;br /&gt;
...&lt;br /&gt;
Private Sub ScanSofware_Win32()&lt;br /&gt;
Dim queryString As String = "SELECT * FROM Win32_Product"&lt;br /&gt;
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(queryString)&lt;br /&gt;
&lt;br /&gt;
For Each mo As ManagementObject In mos.Get&lt;br /&gt;
Dim ProductName As String = mo("Name")       &lt;br /&gt;
Dim ProductVersion As String= mo("Version")           &lt;br /&gt;
Next&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
If you want to run a WMI related query on a remote computer in your domain then you need to use a version of the above code that takes a ManagementScope parameter as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Private Sub ScanSofware_Win32(ByVal scope As ManagementScope)&lt;br /&gt;
Dim queryString As String = "SELECT * FROM Win32_Product"&lt;br /&gt;
Dim query As ObjectQuery = New ObjectQuery(queryString)&lt;br /&gt;
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(scope, query)&lt;br /&gt;
&lt;br /&gt;
For Each mo As ManagementObject In mos.Get&lt;br /&gt;
Dim ProductName As String = mo("Name")       &lt;br /&gt;
Dim ProductVersion As String= mo("Version")           &lt;br /&gt;
Next&lt;br /&gt;
End Sub&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The scope passed to the above sub should contain the credentials of an identity that has access to that computer e.g. the Administrartor. The code below shows the case for "AdministratorName", "AdiminstartorPassword" and "DomainName":&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Private Function GetScope(ByVal computer As String) As ManagementScope&lt;br /&gt;
Dim connOptions As ConnectionOptions = New ConnectionOptions&lt;br /&gt;
connOptions.Username = "AdiminstartorName"  &lt;br /&gt;
connOptions.Password = "AdiminstartorPassword" &lt;br /&gt;
connOptions.Authority = "ntlmdomain:" &amp; ConfigurationSettings.AppSettings("DomainName") &lt;br /&gt;
&lt;br /&gt;
Return New ManagementScope("\\" &amp; computer &amp; "\root\cimv2", connOptions)&lt;br /&gt;
End Function&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
In this function "computer" is the name of the computer that you want to connect to.&lt;br /&gt;
&lt;br /&gt;
The main problem with Win32_Product is that it does not list all the software installed on a computer. It only lists softwares that were installed by Windows Installer. If you want to get the list of other software you need to read that from the registry key SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.&lt;br /&gt;
&lt;br /&gt;
The code below shows how to do that:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Private Sub ScanSofware()&lt;br /&gt;
Dim uninstallkey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"&lt;br /&gt;
Dim rk As RegistryKey = Registry.LocalMachine.OpenSubKey(uninstallkey)&lt;br /&gt;
Dim sk As RegistryKey&lt;br /&gt;
Dim skname() = rk.GetSubKeyNames&lt;br /&gt;
For counter As Integer = 0 To skname.Length - 1&lt;br /&gt;
&lt;br /&gt;
sk = rk.OpenSubKey(skname(counter))&lt;br /&gt;
&lt;br /&gt;
' Only get data where the DisplayName is not empty.&lt;br /&gt;
If sk.GetValue("DisplayName") &lt;&gt; "" Then&lt;br /&gt;
Dim ProductName As String = sk.GetValue("DisplayName")&lt;br /&gt;
Dim ProductVersion As String = sk.GetValue("DisplayVersion")&lt;br /&gt;
End If&lt;br /&gt;
Next&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
To run the above code on remote machines you need to impersonate the administrator before running the code. http://www.codeproject.com/KB/cs/zetaimpersonator.aspx shows how to define an Impersonator class that you can use for this purpose.&lt;br /&gt;
&lt;br /&gt;
Note that the password needs to be encrypted in your application to minimize the security risk. http://www.wizbay.com/post/2010/09/10/Encrypt-and-Decrypt-string-in-VBNet.aspx shows the Encrypt() and Decrypt() functions that you can use for this purpose.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-6453742318152403210?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/IQcdhgFCD2g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/6453742318152403210/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=6453742318152403210" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6453742318152403210?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6453742318152403210?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/IQcdhgFCD2g/list-of-software-items-installed-on.html" title="List of software items installed on the computers in your domain" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/07/list-of-software-items-installed-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4MR3wycSp7ImA9WhZaF0g.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-660513325539925395</id><published>2011-07-04T14:03:00.000+09:30</published><updated>2011-07-04T14:03:06.299+09:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-04T14:03:06.299+09:30</app:edited><title>Changing a table schema to dbo</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jLKTD5_ZawpsaKQ0x0tpGptvXqY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jLKTD5_ZawpsaKQ0x0tpGptvXqY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jLKTD5_ZawpsaKQ0x0tpGptvXqY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jLKTD5_ZawpsaKQ0x0tpGptvXqY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Quite often when a new table is created in the SQL Server database the schema is set to the windows account of the person who created that table. In such a case when you look at the tables in the database you see the newly created table as DOMAIN\UserID.TableName instead of dbo.TableName.&lt;br /&gt;
&lt;br /&gt;
In situations like this run the sp_changeobjectowner as shown below to change the schema owner to dbo:&lt;br /&gt;
&lt;br /&gt;
 EXEC sp_changeobjectowner '[Domain\UserId].TableName', 'dbo'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-660513325539925395?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/BoKj6b3BgUA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/660513325539925395/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=660513325539925395" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/660513325539925395?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/660513325539925395?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/BoKj6b3BgUA/changing-table-schema-to-dbo.html" title="Changing a table schema to dbo" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/07/changing-table-schema-to-dbo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8BR388cCp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-472847423634286420</id><published>2011-06-23T10:32:00.000+09:30</published><updated>2012-02-04T17:30:56.178+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T17:30:56.178+10:30</app:edited><title>Entity Framework</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CnDgi9RXTwniEgVkkHggcwazF7o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CnDgi9RXTwniEgVkkHggcwazF7o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CnDgi9RXTwniEgVkkHggcwazF7o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CnDgi9RXTwniEgVkkHggcwazF7o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;I had a presentation yesterday at work on Entity Framework. I thought of posting a summary of that here. Entity Framework is a Microsoft Technology to abstract the database details form application developers.  &lt;br /&gt;
&lt;br /&gt;
Some of the problems with the traditional approach in developing database connected applications are:&lt;br /&gt;
&lt;br /&gt;
1. The developer needs to know the underlying database schema.&lt;br /&gt;
2. Code and SQL statements are mixed. &lt;br /&gt;
3. Errors in SQL statements are only detected during run-time, not compile time.&lt;br /&gt;
4. Developers need to construct SQL statements to join tables.&lt;br /&gt;
&lt;br /&gt;
Object Relational Mapping (ORM) tries to construct object models for data in the database so instead of dealing with rows in tables you deal with objects and collections. NHibernate was a popular approach to ORM for .Net community. Entity Framework is Microsoft’s approach which is currently in its 4.0 version.&lt;br /&gt;
&lt;br /&gt;
In Visual Studio 2010, when adding a data source of the type database you need to choose the database model: either the old Dataset or the new Entity Data Model (EDM). When specifying EDM using the EDM wizard you select the table, view or stored procedures you want to bring into your model.&lt;br /&gt;
&lt;br /&gt;
Entities are object representation of tables. They add inheritance to simple tables and they support complex data (objects, other entities). They also detect associations between entities based on foreign keys in tables.  Entities do not have behaviour only properties (they have limited behaviour). They live within collections and have association with other entities.&lt;br /&gt;
&lt;br /&gt;
There are two ways to query EDM: Entity SQL (eSQL) and LINQ to Entity.&lt;br /&gt;
&lt;br /&gt;
In eSQL all references to entities require alias like:&lt;br /&gt;
&lt;br /&gt;
     SELECT T.column FROM Table1 AS T&lt;br /&gt;
&lt;br /&gt;
The * wild card is not supported. Instead you use:&lt;br /&gt;
&lt;br /&gt;
SELECT VALUE T From Table1 AS T&lt;br /&gt;&lt;br /&gt;
Navigation properties also replace JOIN.&lt;br /&gt;
An example of LINQ to Entity is shown below:&lt;br /&gt;
Dim context = new XEntities()&lt;br /&gt;
Dim people = from p in context.People _&lt;br /&gt;
                         where p.LastName = “King” _&lt;br /&gt;
                         select p&lt;br /&gt;
For Each (Dim person in people) listKings.Items.Add(person.FirstName)&lt;br /&gt;
Next &lt;br /&gt;
&lt;br /&gt;
Other benefits of EDM are:&lt;br /&gt;
1. Data Driven Design or Model First Support: EDM allows you to define the model first then generate the database based on that.&lt;br /&gt;
2. POCO (Plain Old CLR Objects) Support: You can have your own custom data classes using EDM with no XML (edmx).&lt;br /&gt;
3. EDM can pluralize or singularize entities and entity set names for you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-472847423634286420?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/wK42FijhGYA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/472847423634286420/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=472847423634286420" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/472847423634286420?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/472847423634286420?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/wK42FijhGYA/entity-framework.html" title="Entity Framework" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/06/entity-framework.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QCQ38yfCp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-1424816784466611808</id><published>2011-06-21T11:11:00.000+09:30</published><updated>2012-02-04T17:39:22.194+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T17:39:22.194+10:30</app:edited><title>Change Data Capture (CDC) in SQL Server 2008</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/l0z6MkOTu0n3lmoLERF2IMawElg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l0z6MkOTu0n3lmoLERF2IMawElg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/l0z6MkOTu0n3lmoLERF2IMawElg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l0z6MkOTu0n3lmoLERF2IMawElg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Consider a scenario in which you want to update a database table based on changes made to the corresponding table in another database. For example you have an Account table in database1 and you want the Account table in database2 to be updated every night with changes made to the original table in database1. You can develop an SSIS package that looks into these two tables and if there is any change updates the Account table in database2 accordingly. But what if the Account table is a very big table with hundreds of thousands of entries.  Doing a comparison line by line would take a long time.  If you are lucky and the Account table has a column indicating the last modified data and time, then you can filter your data for a time span (say a day) of change then this comparison can be done in reasonable time. The problem is your Account table may not have such a column and it cannot be added because you don’t own that table to be able to change it.  In situations like that the Change Data Capture (CDC) feature in SQL Server 2008 can come to rescue. &lt;br /&gt;
&lt;br /&gt;
CDC looks at the transactions logs and detects any changes to tables you have identified within certain period of time. To enable CDC your login account needs to have the right privilege or you may need to ask the DBA to enable that for you. You also need to have the SQL Server Agent enabled and running.&lt;br /&gt;
&lt;br /&gt;
To enable CDC you type:&lt;br /&gt;
&lt;br /&gt;
EXEC sys.sp_cdc_enable_db;&lt;br /&gt;
GO&lt;br /&gt;
&lt;br /&gt;
Then tell CDC to watch for changes in Account table:&lt;br /&gt;
&lt;br /&gt;
EXEC sys.sp_cdc_enable_table&lt;br /&gt;
 @source_schema = N’dbo’&lt;br /&gt;
,@source_name = N’Account’&lt;br /&gt;
,@role_name= N’cdc_Admin’&lt;br /&gt;
,@capture_instance = N’database1_Account’&lt;br /&gt;
, @support_net_changes = 1;&lt;br /&gt;
&lt;br /&gt;
The last option above support_net_changes tells CDC to only keep track of the final value of entry and not the intermediate values.&lt;br /&gt;
&lt;br /&gt;
When you enable CDC on Account table SQL creates a shadow table called csc.database1_Account_CT. This table has all the columns in Account plus some extra metadata columns for CDC use. &lt;br /&gt;
&lt;br /&gt;
For a good example of using CDC API look at&lt;br /&gt;
http://wiki.sdn.sap.com/wiki/display/BOBJ/SQL+Server+2008+CDC&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-1424816784466611808?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/HXpO81L_-1s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/1424816784466611808/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=1424816784466611808" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1424816784466611808?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/1424816784466611808?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/HXpO81L_-1s/change-data-capture-cdc-in-sql-server.html" title="Change Data Capture (CDC) in SQL Server 2008" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/06/change-data-capture-cdc-in-sql-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcFRHk_fCp7ImA9WhRUF0Q.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-7318011574701773617</id><published>2011-06-15T10:57:00.000+09:30</published><updated>2012-01-29T11:00:15.744+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-29T11:00:15.744+10:30</app:edited><title>sp_who and sp_who2</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0DzVD-9Hk0oGt1MJBdEbdeOg2uo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0DzVD-9Hk0oGt1MJBdEbdeOg2uo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0DzVD-9Hk0oGt1MJBdEbdeOg2uo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0DzVD-9Hk0oGt1MJBdEbdeOg2uo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;There is a very useful system stored procedure called sp_who on SQL Server that lists the users and processes running on the system. It comes handy when you want to know the loading on the SQL Server or see if any process is blocked.&lt;br /&gt;
&lt;br /&gt;
You run:&lt;br /&gt;
&lt;br /&gt;
exec sp_who&lt;br /&gt;
&lt;br /&gt;
The result will be similar to the following list:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-xQhIGvYz-JM/TfgKLAvoQ8I/AAAAAAAAADM/0KX9b7bJ--o/s1600/Capture.PNG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="145" width="320" src="http://3.bp.blogspot.com/-xQhIGvYz-JM/TfgKLAvoQ8I/AAAAAAAAADM/0KX9b7bJ--o/s320/Capture.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
You can filter the data returned to show only those processes that are not idle. If you specify a particular user like sp_who [@login_name =] 'login' then you get processes for that user, otherwise all processes for all users will be listed.&lt;br /&gt;
&lt;br /&gt;
Look at http://msdn.microsoft.com/en-us/library/aa260384(v=sql.80).aspx to get the meaning of each column in the list.&lt;br /&gt;
&lt;br /&gt;
There is another stored procedure called sp_who2 that gives some more information like total CPU time for each process, total amount of disk reads for each process, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-7318011574701773617?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/1D8a4jRQEm4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/7318011574701773617/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=7318011574701773617" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7318011574701773617?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7318011574701773617?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/1D8a4jRQEm4/spwho-and-spwho2.html" title="sp_who and sp_who2" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-xQhIGvYz-JM/TfgKLAvoQ8I/AAAAAAAAADM/0KX9b7bJ--o/s72-c/Capture.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/06/spwho-and-spwho2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04FQH87eyp7ImA9WhRbE04.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-8153310714673786664</id><published>2011-05-08T19:02:00.000+09:30</published><updated>2012-02-04T17:48:31.103+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T17:48:31.103+10:30</app:edited><title>ASP.NET MVC</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Bedw39cCMftgd3x4qhgnQKhrPAQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Bedw39cCMftgd3x4qhgnQKhrPAQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Bedw39cCMftgd3x4qhgnQKhrPAQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Bedw39cCMftgd3x4qhgnQKhrPAQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;In a previous &lt;a href="http://morrisbahrami.blogspot.com.au/2011/04/business-applications-with-silverlight.html" &gt; post &lt;/a&gt; I talked about Silverlight Business applications template in Visual Studio 2010. Visual Studio 2010 also provides a template for developing ASP.NET MVC applications. Microsoft has added support for MVC in response to popularity of new web development platforms like Rails On Ruby. What these platforms provide which ASP.NET web forms were missing are:&lt;br /&gt;
&lt;br /&gt;
  1. MVC: Structuring the web applications into three layers Model, View and Controller. This structure provides a cleaner separation between different concerns making it easier to develop or test each layer separately.&lt;br /&gt;
&lt;br /&gt;
  2.  REST (Representational State Transfer) : REST provides a simple pure HTML based solution to accessing web pages and web services removing the distinction between the two. By using REST framework the application is described in terms of URIs for entities and HTTP methods for operations on those entities. For example you GET http://www.test.com/Employee/35 to get the employee number 35.&lt;br /&gt;
&lt;br /&gt;
 3. No ViewState. Web forms use ViewState to impose a state to HTTP which is inherently stateless. The drawback of using ViewState is that it makes applications complicated and slow, as the ViewState which can get large is size would need to be passed back and forth between the client and the server.&lt;br /&gt;
&lt;br /&gt;
 4. Convention over Configuration: This is a software design concept aiming to simplify the software development process. With this methodology the platform auto generates plumbing code for you based on some naming conventions and you only need to add or modify that code if you want to change your application from the one generated for you.&lt;br /&gt;
&lt;br /&gt;
When it comes to coding, there are major differences between ASP.NET MVC and traditional web forms. Some of these differences in coding are listed below:&lt;br /&gt;
&lt;br /&gt;
1. The main difference is the default routing system for displaying views and defining controls.  There is a convention on what to name and where to put views and controls. That defines a default routing system which is declared in Global.asax file.&lt;br /&gt;
&lt;br /&gt;
2. Forms do not run at server any more so no more &amp;ltform runat=”server”&amp;gt . MVC is aimed at using element as originally defined in HTML.&lt;br /&gt;
&lt;br /&gt;
3. There is no POSTBACK handling, so no more check for Page.IsPostback. IsPostback property was used extensively in web form as a way of keeping the state of the web page view. MVC provides a routing mechanism to achieve the same goal without using IsPostBack property.&lt;br /&gt;
&lt;br /&gt;
4. As stated before there is no more ViewState.&lt;br /&gt;
&lt;br /&gt;
5. Validation rules are applied to the model not the view. By using System.ComponnetModel.DataAnnotation namespace you can declare validation rules simply by adding the appropriate attribute to the property. Below shows an example:&lt;br /&gt;
[Required(ErrorMessage=”Please Enter Name”)]&lt;br /&gt;
Public String Name { get; set;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-8153310714673786664?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/ZovliofqgQU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/8153310714673786664/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=8153310714673786664" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8153310714673786664?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8153310714673786664?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/ZovliofqgQU/aspnet-mvc.html" title="ASP.NET MVC" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/05/aspnet-mvc.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YCSHs7eyp7ImA9WhZXEU8.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-4601147126075515623</id><published>2011-04-28T14:57:00.000+09:30</published><updated>2011-04-30T11:36:09.503+09:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-30T11:36:09.503+09:30</app:edited><title>Business Applications with Silverlight 4</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SPyQrqNDgtKLnis6igcz9yx94sA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SPyQrqNDgtKLnis6igcz9yx94sA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SPyQrqNDgtKLnis6igcz9yx94sA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SPyQrqNDgtKLnis6igcz9yx94sA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;I read an excellent book by Chris Anderson titled “Pro Business Applications with Silverlight 4” during Easter break. For those with not much experience with Silverlight here are a few points to consider:&lt;br /&gt;
&lt;br /&gt;
1. &lt;b&gt;Why Silverlight:&lt;/b&gt;&lt;br /&gt;
-  It provides a platform for developing Rich Internet Applications (RIAs). Compared with traditional web based applications, RIAs are more responsive and have richer look and feel. That is because the browser hosting RIAs has added plug-ins which enables it to use the local computer for enhanced performance.&lt;br /&gt;
&lt;br /&gt;
-  As this plug-in can be added to any browser on any platform, Silverlight like Java can run on Windows, Mac or Linux based computers using any browser such as Internet Explorer, Firefox, Safari or Chrome.&lt;br /&gt;
&lt;br /&gt;
-  Development is based on XAML (XML Application Markup Language) with the code behind in VB.NET or C# instead of a combination of ASP.NET, HTML and JavaScript.&lt;br /&gt;
&lt;br /&gt;
-  Silverlight applications can run offline as well as online.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. &lt;b&gt;Silverlight Business application.&lt;/b&gt;&lt;br /&gt;
Visual Studio 2010 with Silverlight 4 SDK has a project template for Silverlight Business Applications. This template uses the following technologies:&lt;br /&gt;
&lt;br /&gt;
2.1 It uses RIA Services. The solution within the template has two projects. One is the Silverlight (client) project and the other one the web (server) project. RIA Services is used to communicate between these two. RIA is a WCF based communication mechanism with the added feature that the code written for server is “projected” onto the client, so the business logic or validation code written for the server does not need to be written again for the client. It also provides support for authentication and authorization process.&lt;br /&gt;
&lt;br /&gt;
Services provided by RIA services are called domain services. Domain operations on these domain services typically expose data to the client and accept changes in a CRUD (create-read-update-delete) pattern. This CRUD based code is generated automatically.&lt;br /&gt;
&lt;br /&gt;
2.2 It uses Model-View-ViewModel architecture which is a variation of MVC (Model View Controller) pattern. The View provides the UX (user Experience) functionality. The Model represents the data and The ViewModel exposes that data to the View in an easily manageable form.&lt;br /&gt;
&lt;br /&gt;
2.3 You can easily use ADO.NET Entity Data Model for models in your application. A Wizard walks you through generating entity models (captured in edmx files) from the database used by the application. Entity Framework represents data as objects and provides a layer of abstraction for data access. Instead of accessing data directly from database, you access objects representing that data through this framework. You can query this object model using LINQ to Entities.&lt;br /&gt;
&lt;br /&gt;
2.4 It uses Navigation framework so much of the support code for defining pages and navigating between them is already provided. Each page is represented by a view. A view which is represented by a XAML file is an object inheriting form Page class and hosted by a Frame control.  Navigation framework supports Deep Linking so hyperlinks can point to a specific page or section of the website rather than main page. It also enables Friendly URIs through URI mapping.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-4601147126075515623?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/iZKZAresokY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/4601147126075515623/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=4601147126075515623" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4601147126075515623?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4601147126075515623?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/iZKZAresokY/business-applications-with-silverlight.html" title="Business Applications with Silverlight 4" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/04/business-applications-with-silverlight.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8CRHc6cCp7ImA9WhRbE0k.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-7385345356913627812</id><published>2011-04-16T15:22:00.000+09:30</published><updated>2012-02-04T19:44:25.918+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T19:44:25.918+10:30</app:edited><title>Getting hardware and software details of the computers in your domain</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ih-B2wOoe4ES8XgbLIPLlj2dx1w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ih-B2wOoe4ES8XgbLIPLlj2dx1w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ih-B2wOoe4ES8XgbLIPLlj2dx1w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ih-B2wOoe4ES8XgbLIPLlj2dx1w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://anyurl.com" rel="tag" style="display:none"&gt;CodeProject&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/aa394084(v=VS.85).aspx" &gt; WIN32 classes&lt;/a&gt; can be used as shown in the simple example below to get the hardware and software specs of a computer:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Private Sub GetOperatingSystemDetails()&lt;br /&gt;
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")&lt;br /&gt;
&lt;br /&gt;
For Each mo As ManagementObject In mos.Get&lt;br /&gt;
Dim OsName As String = mo("name")&lt;br /&gt;
Dim Version As String = mo("version")      &lt;br /&gt;
Dim SerialNumber As String = mo("serialNumber")        &lt;br /&gt;
Next&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
In the above example we only used one of WIN32 classes (Win32_OpratingSystem) and for that we only read three properties out of more than 60. &lt;br /&gt;
&lt;br /&gt;
To use this example code, you need to add a reference to System.Management in your project and import that.&lt;br /&gt;
&lt;br /&gt;
In a previous post &lt;a href="http://morrisbahrami.blogspot.com/2011/04/vbnet-program-to-list-all-computers-in.html"&gt;A VB.NET program to list all computers in your domain&lt;/a&gt; I showed how you can get the list of computers in your domain. You can combine traversing through computers in your domain as shown in that post with use of Win32 classes to get details of those computers. To run Win32 related commands on remote computers you need to have the required privilege. In addition to that, those computers also need to have RPC and WMI services running.&lt;br /&gt;
&lt;br /&gt;
The following example shows how to read the above three values we had for the first example from another computer in your domain:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Public Sub GetOperatingSystemDetails (ByVal computer As String)&lt;br /&gt;
Dim options As ConnectionOptions = New ConnectionOptions()&lt;br /&gt;
options.Username = "USERNAME"  ' Select User Name&lt;br /&gt;
options.Password = "PASSWORD"   ' Select password&lt;br /&gt;
‘ You can also specify Kerberos instead of ntlm below&lt;br /&gt;
options.Authority = "ntlmdomain:Domain"   '  Select Domain&lt;br /&gt;
&lt;br /&gt;
Dim scope As ManagementScope = New ManagementScope("\\" &amp; computer &amp; "\root\cimv2", options)&lt;br /&gt;
&lt;br /&gt;
scope.Connect()&lt;br /&gt;
&lt;br /&gt;
Dim query As ObjectQuery = New ObjectQuery("SELECT * FROM Win32_OperatingSystem")&lt;br /&gt;
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(scope, query)&lt;br /&gt;
Dim queryCollection As ManagementObjectCollection = mos.Get&lt;br /&gt;
&lt;br /&gt;
For Each mo As ManagementObject In queryCollection&lt;br /&gt;
Dim OsName As String = mo("name")&lt;br /&gt;
Dim Version As String = mo("version")&lt;br /&gt;
Dim SerialNumber As String = mo("serialNumber")&lt;br /&gt;
Next&lt;br /&gt;
End Sub&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-7385345356913627812?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/jKCPGw0r2DA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/7385345356913627812/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=7385345356913627812" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7385345356913627812?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/7385345356913627812?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/jKCPGw0r2DA/getting-hardware-and-software-details.html" title="Getting hardware and software details of the computers in your domain" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/04/getting-hardware-and-software-details.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEACRHw6eCp7ImA9WhZRFEQ.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-40342716161994740</id><published>2011-04-11T14:09:00.000+09:30</published><updated>2011-04-11T14:09:25.210+09:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-11T14:09:25.210+09:30</app:edited><title>A VB.NET program to list all computers in your domain</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RQg0b3Vli8F5uFuF1qECU3L1rxM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RQg0b3Vli8F5uFuF1qECU3L1rxM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RQg0b3Vli8F5uFuF1qECU3L1rxM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RQg0b3Vli8F5uFuF1qECU3L1rxM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;You can type the "net view" DOS command to get the list of computers or shared resources in your workgroup. If you want to achieve a similar thing in the code the following example can help.&lt;br /&gt;
&lt;br /&gt;
Add System.DirectoryServices and System.Net references to your project and import them. The following code lists all "computers" in your domain. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Public Function GetComputers() As String&lt;br /&gt;
Dim result As String = ""&lt;br /&gt;
&lt;br /&gt;
' Get the domin name&lt;br /&gt;
Dim ipproperties As NetworkInformation.IPGlobalProperties = NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()&lt;br /&gt;
Dim domain As String = ipproperties.DomainName&lt;br /&gt;
&lt;br /&gt;
Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain)&lt;br /&gt;
domainEntry.Children.SchemaFilter.Add("computer")&lt;br /&gt;
&lt;br /&gt;
For Each computer As DirectoryEntry In domainEntry.Children&lt;br /&gt;
    result = result &amp; computer.Name &amp; Environment.NewLine&lt;br /&gt;
Next&lt;br /&gt;
&lt;br /&gt;
Return result&lt;br /&gt;
&lt;br /&gt;
End Function&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to get the list of users instead of computers then change the line containing &lt;i&gt;Add("computer")&lt;/i&gt; to &lt;i&gt;Add("user").&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-40342716161994740?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/DuHMZONRAhI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/40342716161994740/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=40342716161994740" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/40342716161994740?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/40342716161994740?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/DuHMZONRAhI/vbnet-program-to-list-all-computers-in.html" title="A VB.NET program to list all computers in your domain" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/04/vbnet-program-to-list-all-computers-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUBRHw-fyp7ImA9WhRbE0k.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-2365694890526916612</id><published>2011-03-10T11:31:00.000+10:30</published><updated>2012-02-04T20:07:35.257+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T20:07:35.257+10:30</app:edited><title>Dynamic in C# 4</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8ry8YyWhr5nIF8tgFaaVDJQLKvg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ry8YyWhr5nIF8tgFaaVDJQLKvg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8ry8YyWhr5nIF8tgFaaVDJQLKvg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ry8YyWhr5nIF8tgFaaVDJQLKvg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Yesterday I had a presentation at ADNUG &lt;a HREF="http://tinyurl.com/6ba72zm"&gt;(Adelaide Dot Net User Group)&lt;/A&gt;.&lt;br /&gt;
It was a quick introductory note on the new "dynamic" keyword in .NET 4 and how it helps to write dynamic type code with the benefits that come with it. These are the slides I used.


&lt;div style="width:425px" id="__ss_11414528"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/morrisBahrami/dynamic-in-c-40" title="Dynamic in C# 4.0"&gt;Dynamic in C# 4.0&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse11414528" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=dynamic-120204033341-phpapp02&amp;stripped_title=dynamic-in-c-40&amp;userName=morrisBahrami" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="wmode" value="transparent"/&gt;&lt;embed name="__sse11414528" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=dynamic-120204033341-phpapp02&amp;stripped_title=dynamic-in-c-40&amp;userName=morrisBahrami" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/morrisBahrami"&gt;morrisBahrami&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-2365694890526916612?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/6LXGq0hQyHg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/2365694890526916612/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=2365694890526916612" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/2365694890526916612?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/2365694890526916612?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/6LXGq0hQyHg/dynamic-in-c-4.html" title="Dynamic in C# 4" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/03/dynamic-in-c-4.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMBQ3g_eSp7ImA9WhRbE0k.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-4880523184288825298</id><published>2011-03-01T12:08:00.000+10:30</published><updated>2012-02-04T20:10:52.641+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T20:10:52.641+10:30</app:edited><title>Installing Missing Templates in Visual Studio</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8CBI3GZWib_XYt6GkbLCAozul3E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8CBI3GZWib_XYt6GkbLCAozul3E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8CBI3GZWib_XYt6GkbLCAozul3E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8CBI3GZWib_XYt6GkbLCAozul3E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;If you have ever experienced that when you create a new project in Visual Studio (2008 or 2010) some templates are missing (a good example is Windows Serive Template) then follow these steps and you most likely get them:&lt;br /&gt;
&lt;br /&gt;
Open Visual Studio command prompt from &lt;br /&gt;
Start -&gt; All programs -&gt; Microsoft Visual Studio 2008 (or 2010) -&gt; Visual studio tool -&gt; Visual studio 2008 (or 2010) command prompt. &lt;br /&gt;
&lt;br /&gt;
When the command prompt comes up type &lt;br /&gt;
devenv /installvstemplates&lt;br /&gt;
&lt;br /&gt;
When its done, reopen Visual Studio and the templates should be there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-4880523184288825298?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/WSHNneVctco" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/4880523184288825298/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=4880523184288825298" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4880523184288825298?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4880523184288825298?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/WSHNneVctco/installing-missing-templates-in-visual.html" title="Installing Missing Templates in Visual Studio" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/02/installing-missing-templates-in-visual.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUDRH4yeCp7ImA9Wx9UGU8.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-6592485074799731164</id><published>2011-02-17T15:54:00.000+10:30</published><updated>2011-02-17T15:54:35.090+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-17T15:54:35.090+10:30</app:edited><title>The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/D0Sdcrnddn4fhe_dbfb-ggQnKW4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D0Sdcrnddn4fhe_dbfb-ggQnKW4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/D0Sdcrnddn4fhe_dbfb-ggQnKW4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D0Sdcrnddn4fhe_dbfb-ggQnKW4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;I had a web service with "Windows Autenticatin" setting and I could test that by checking the URL http://localhost/servicename/service1.asmx.&lt;br /&gt;
&lt;br /&gt;
I created a Web service consumer by adding a service reference to a project pointing to that URL. When running my web service consumer I was getting this error:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
To fix this problem I needed to update the section &amp;ltsystem.serviceModel&amp;gt of app.config that the compiler had added after adding the service reference. The modified section that worked is shown below:&lt;br /&gt;
  &lt;br /&gt;
   &amp;ltsystem.serviceModel&amp;gt  &lt;br /&gt;
    &amp;ltbindings&amp;gt  &lt;br /&gt;
      &amp;ltbasicHttpBinding&amp;gt  &lt;br /&gt;
        &amp;ltbinding name="Service1Soap"&amp;gt  &lt;br /&gt;
          &amp;ltsecurity mode="TransportCredentialOnly"&amp;gt  &lt;br /&gt;
            &amp;lttransport clientCredentialType="Ntlm" proxyCredentialType="None"  &lt;br /&gt;
               realm="" /&amp;gt  &lt;br /&gt;
            &amp;ltmessage clientCredentialType="UserName" algorithmSuite="Default" /&amp;gt  &lt;br /&gt;
          &amp;lt/security&amp;gt  &lt;br /&gt;
        &amp;lt/binding&amp;gt  &lt;br /&gt;
      &amp;lt/basicHttpBinding&amp;gt      &lt;br /&gt;
    &amp;ltclient&amp;gt  &lt;br /&gt;
      &amp;ltendpoint address="http://localhost/servicename/service1.asmx"  &lt;br /&gt;
             binding="basicHttpBinding" bindingConfiguration="ListsSoap"  &lt;br /&gt;
    &amp;lt/client&amp;gt  &lt;br /&gt;
  &amp;lt/system.serviceModel&amp;gt&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-6592485074799731164?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/zoWci5AmLoQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/6592485074799731164/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=6592485074799731164" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6592485074799731164?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6592485074799731164?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/zoWci5AmLoQ/http-request-is-unauthorized-with.html" title="The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'." /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/02/http-request-is-unauthorized-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcMQn48eSp7ImA9Wx9UFkk.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-6727541635131653047</id><published>2011-02-14T11:44:00.000+10:30</published><updated>2011-02-14T11:44:43.071+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-14T11:44:43.071+10:30</app:edited><title>Getting Outlook Contacts</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lexGbd5025G4TX6oJjuqKzre13Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lexGbd5025G4TX6oJjuqKzre13Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lexGbd5025G4TX6oJjuqKzre13Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lexGbd5025G4TX6oJjuqKzre13Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;By adding a reference to Microsoft.Office.Interop.Outlook in your project, you can easily access Outlook data. Below is a simple example of displaying Contacts from Outlook:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports Outlook = Microsoft.Office.Interop.Outlook&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits Form&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
    End Sub&lt;br /&gt;
&lt;br /&gt;
    Private Sub getContacts_Click(ByVal sender As Object, ByVal e As EventArgs) Handles getContacts.Click&lt;br /&gt;
        ' Obtain an instance of the Outlook application&lt;br /&gt;
        Dim app As Outlook.Application = New Outlook.ApplicationClass()&lt;br /&gt;
&lt;br /&gt;
        ' Access the MAPI namespace&lt;br /&gt;
        Dim ns As Outlook.NameSpace = app.GetNamespace("MAPI")&lt;br /&gt;
&lt;br /&gt;
        ' Get the user's default contacts folder&lt;br /&gt;
        Dim contacts As Outlook.MAPIFolder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)&lt;br /&gt;
&lt;br /&gt;
        ' Iterate through each contact&lt;br /&gt;
        For i As Integer = 1 To contacts.Items.Count&lt;br /&gt;
            ' Get a contact&lt;br /&gt;
            Dim contact As Outlook.ContactItem = DirectCast(contacts.Items(i), Outlook.ContactItem)&lt;br /&gt;
            txtResults.Text += contact.FullName + " (" + contact.BusinessTelephoneNumber &amp; ")" &amp; Environment.NewLine&lt;br /&gt;
            Application.DoEvents()&lt;br /&gt;
        Next&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-6727541635131653047?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/lDaz7ykGOUM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/6727541635131653047/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=6727541635131653047" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6727541635131653047?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/6727541635131653047?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/lDaz7ykGOUM/getting-outlook-contacts.html" title="Getting Outlook Contacts" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/02/getting-outlook-contacts.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIDRXw5eip7ImA9WhRbE0g.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-4280474097138055432</id><published>2011-02-10T14:05:00.000+10:30</published><updated>2012-02-04T21:36:14.222+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T21:36:14.222+10:30</app:edited><title>Accessing SQLite Data</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/csaPDUhbNPc9O5n-2J9XbOyxCag/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/csaPDUhbNPc9O5n-2J9XbOyxCag/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/csaPDUhbNPc9O5n-2J9XbOyxCag/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/csaPDUhbNPc9O5n-2J9XbOyxCag/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;SQLite is a small embedded relational database management system used by some browsers and applications to store their data.&lt;br /&gt;
&lt;br /&gt;
If you want to access this data you need to download and install System.Data.SQLite from http://sqlite.phxsoftware.com. That will allow you to reference System.Data.SQLite in your project. Accessing SQLite data then becomes very similar to the way you would normally access SQL Server data.&lt;br /&gt;
&lt;br /&gt;
The following is an example in which we assume the data file is C:\data_file.db:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Imports System.Data.SQLite&lt;br /&gt;
&lt;br /&gt;
private sub ReadData()&lt;br /&gt;
&lt;br /&gt;
Dim connection As SQLiteConnection = New SQLiteConnection("Data Source=C:data_file.db;FailIfMissing=True")&lt;br /&gt;
&lt;br /&gt;
Dim cmd As SQLiteCommand = New SQLiteCommand&lt;br /&gt;
md.Connection = connection&lt;br /&gt;
cmd.CommandType = Data.CommandType.Text&lt;br /&gt;
cmd.CommandText = "select name from software"&lt;br /&gt;
connection.Open()&lt;br /&gt;
Dim myReader As SQLiteDataReader = cmd.ExecuteReader()&lt;br /&gt;
 While myReader.Read()&lt;br /&gt;
 txtResult.Text = txtResult.Text &amp; myReader.GetString(0) &amp; Environment.NewLine&lt;br /&gt;
 End While&lt;br /&gt;
connection.Close()&lt;br /&gt;
End Sub&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-4280474097138055432?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/nu1LtReJSYk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/4280474097138055432/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=4280474097138055432" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4280474097138055432?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/4280474097138055432?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/nu1LtReJSYk/acessing-sqlite-data.html" title="Accessing SQLite Data" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/02/acessing-sqlite-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4ERnszfip7ImA9WhRbE0g.&quot;"><id>tag:blogger.com,1999:blog-4763239387887280849.post-8227910362510437727</id><published>2011-02-10T11:15:00.000+10:30</published><updated>2012-02-04T21:41:47.586+10:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-04T21:41:47.586+10:30</app:edited><title>A Simple VB.NET Console Timer Application</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5EktN0UGp-v4Qh3GTQq9sYKOxE4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5EktN0UGp-v4Qh3GTQq9sYKOxE4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5EktN0UGp-v4Qh3GTQq9sYKOxE4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5EktN0UGp-v4Qh3GTQq9sYKOxE4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;Recently I needed a simple example of a console application that performs a function periodically, everey say x seconds, and I wanted that to be in vb.net.&lt;br /&gt;
&lt;br /&gt;
When I googled the subject I came across lots of links which were using System.Threading.Timer or System.Forms.Timer classes. That was not what I was looking for. Since the idea of this blog is to show stuff that you normally wouldn't easily find by googling, it seemed a good candidate to include here, so here it is:&lt;br /&gt;
&lt;br /&gt;
  &lt;MTAThread()&gt; _&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim timer As System.Timers.Timer = New System.Timers.Timer()&lt;br /&gt;
        AddHandler timer.Elapsed, AddressOf SubToRunPeriocally &lt;br /&gt;
        timer.Interval = x ' i.e. Run this every x milliseconds&lt;br /&gt;
        timer.Enabled = True&lt;br /&gt;
        timer.AutoReset = True&lt;br /&gt;
&lt;br /&gt;
        ' Infinite loop&lt;br /&gt;
        While True&lt;br /&gt;
&lt;br /&gt;
        End While&lt;br /&gt;
&lt;br /&gt;
    End Sub&lt;br /&gt;
 &lt;br /&gt;
  Private Sub SubToRunPeriocally()&lt;br /&gt;
     ' Do what you need to do periodically&lt;br /&gt;
 End Sub&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4763239387887280849-8227910362510437727?l=morrisbahrami.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TipsForMicrosoftDevelopers/~4/YPaHW8QnFUE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://morrisbahrami.blogspot.com/feeds/8227910362510437727/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4763239387887280849&amp;postID=8227910362510437727" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8227910362510437727?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4763239387887280849/posts/default/8227910362510437727?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TipsForMicrosoftDevelopers/~3/YPaHW8QnFUE/simple-vbnet-console-timer-application.html" title="A Simple VB.NET Console Timer Application" /><author><name>Morris Bahrami</name><uri>http://www.blogger.com/profile/01738881990530035716</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_jqkOMRwVvIA/ScHYYAyupfI/AAAAAAAAAAM/HPvdN7UkgRo/S220/me.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://morrisbahrami.blogspot.com/2011/02/simple-vbnet-console-timer-application.html</feedburner:origLink></entry></feed>

