<rss version="2.0"><channel><title>Blog</title><item><title><![CDATA[Imperativeness of agile methodology in software development]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=99472747-5012-430d-801b-552e8457c3bf#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT face=Verdana></FONT> </P>
<P><FONT face=Verdana>There is a nice article on DevX about why to use Agile development.  This article starts with brief description of three main types software development methodologies [Waterfall, Cowboy Coding & Agile]</FONT></P>
<P><FONT face=Verdana>Further this article elaborates working of agile methodology. This includes sprint planning, execution using scrum, tight feedback loops etc. </FONT></P>
<P><BR><FONT face=Verdana>Read complete article on </FONT><A href="http://www.devx.com/webdev/Article/45368" target=_blank><FONT face=Verdana>http://www.devx.com/webdev/Article/45368</FONT></A><BR></P>]]></description></item><item><title><![CDATA[Get list of installed softwares on machines in your network]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=a5fccf36-0ab4-474f-a8a6-08b40710c9d5#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<FONT size=2>
<P><FONT face=Tahoma>I was looking for a way to get list of softwares installed in machines in our network for verifying something. I did not wanted to go & login in each machine & then collection list of softwares from add / remove programs. </FONT></P>
<P><FONT face=Tahoma>So I decided to write a small program that will do this for me. </FONT></P>
<P><FONT face=Tahoma>This is how we can do it. List that you see in add remove program is stored in Machine registry at path <FONT color=#800000 size=2><FONT color=#800000 size=2>SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall <FONT color=#000000> under local machine</FONT>.</P></FONT></FONT></FONT>
<P><FONT face=Tahoma>So your program will connect to registry of each machine specified & read the list. Then compile that list by removing list items such as Updates / Fixes etc as per requirement.</FONT></P>
<P><FONT face=Tahoma>Below function will enumerate the softwares installed in a text file & also will display it on console application. </FONT></P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>static</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> WriteSoftwareListToFile(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> MachineName , </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> ReportFileName)</P>
<P>{</P>
<P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>StreamWriter</FONT></FONT><FONT size=2> sw;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>File</FONT></FONT><FONT size=2>.Exists(ReportFileName))</P>
<P>{</P>
<P>sw = </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>File</FONT></FONT><FONT size=2>.AppendText(ReportFileName);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2>
<P>{</P>
<P>sw = </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>File</FONT></FONT><FONT size=2>.CreateText(ReportFileName);</P>
<P>}</P>
<P>sw.WriteLine(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"\r\nSoftwares installed on "</FONT></FONT><FONT size=2> + MachineName + </P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>" on "</FONT></FONT><FONT size=2> + </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DateTime</FONT></FONT><FONT size=2>.Now.ToShortDateString() + </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>" "</FONT></FONT><FONT size=2> + </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DateTime</FONT></FONT><FONT size=2>.Now.ToLongTimeString());</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//Registry path which has information of all the softwares installed on machine</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> uninstallKey = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"</FONT></FONT><FONT size=2>;</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))</P></FONT></FONT><FONT size=2>
<P>sw.WriteLine(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"\r\nSoftware Name \t Software Version"</FONT></FONT><FONT size=2>);</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>try</P></FONT></FONT><FONT size=2>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>using</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>RegistryKey</FONT></FONT><FONT size=2> rk =</P>
<P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>RegistryKey</FONT></FONT><FONT size=2>.OpenRemoteBaseKey(</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>RegistryHive</FONT></FONT><FONT size=2>.LocalMachine, MachineName).</P>
<P>OpenSubKey(uninstallKey))</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>foreach</FONT></FONT><FONT size=2> (</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> skName </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>in</FONT></FONT><FONT size=2> rk.GetSubKeyNames())</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>using</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>RegistryKey</FONT></FONT><FONT size=2> sk = rk.OpenSubKey(skName))</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> SoftwareName = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> SoftwareVersion = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>try</P></FONT></FONT><FONT size=2>
<P>{</P>
<P>SoftwareName = sk.GetValue(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"DisplayName"</FONT></FONT><FONT size=2>).ToString();</P>
<P>SoftwareVersion = sk.GetValue(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"DisplayVersion"</FONT></FONT><FONT size=2>).ToString();</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>catch</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>NullReferenceException</FONT></FONT><FONT size=2> exNull)</P>
<P>{</P>
<P>SoftwareName = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty;</P>
<P>SoftwareVersion = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (SoftwareName != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>.Empty)</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//Exclude Updates , Fixes </P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (!(SoftwareName.Contains(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Security Update for Windows"</FONT></FONT><FONT size=2>) ||</P>
<P>SoftwareName.Contains(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Hotfix for"</FONT></FONT><FONT size=2>) ||</P>
<P>SoftwareName.Contains(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Update for"</FONT></FONT><FONT size=2>) ||</P>
<P>SoftwareName.Contains(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"Update for Windows"</FONT></FONT><FONT size=2>)))</P>
<P>{</P>
<P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Console</FONT></FONT><FONT size=2>.WriteLine(SoftwareName + </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>" "</FONT></FONT><FONT size=2> + SoftwareVersion);</P>
<P>sw.WriteLine(SoftwareName + </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"\t"</FONT></FONT><FONT size=2> + SoftwareVersion);</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>catch</FONT></FONT><FONT size=2> (</FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Exception</FONT></FONT><FONT size=2> Ex)</P>
<P>{</P>
<P>sw.WriteLine(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"\r\n Exception :"</FONT></FONT><FONT size=2> + Ex.Message);</P>
<P>}</P>
<P>sw.Close();</P>
<P>}</P>
<P><FONT face=Tahoma><FONT color=#000000></FONT></FONT> </P>
<P><FONT face=Tahoma><FONT color=#000000>You can call this functions for all require machines in your network like below. Please note if you are running the application your domain ID need to have registry read access for all the machines your are accessing.</FONT></FONT></P>
<P><FONT face=Tahoma><FONT color=#000000> </P><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>static</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> Main(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>[] args)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>[] Machines = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2>[]</P>
<P>{</P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName1"</FONT></FONT><FONT size=2>,</P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName2"</FONT></FONT><FONT size=2>,</P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName3"</FONT></FONT><FONT size=2>,</P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName4"</FONT></FONT><FONT size=2>,</P>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName5"</FONT></FONT><FONT size=2>,</P></FONT><FONT size=2>
<P></FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"MachineHostName6"</FONT></FONT><FONT size=2> };</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> FILE_NAME = </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"SoftwareList_"</FONT></FONT><FONT size=2> + </FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>DateTime</FONT></FONT><FONT size=2>.Now.ToShortDateString().Replace(</FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>"/"</FONT></FONT><FONT size=2>, </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>""</FONT></FONT><FONT size=2>) + </FONT><FONT color=#800000 size=2><FONT color=#800000 size=2>".log"</FONT></FONT><FONT size=2>;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2> (</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> i = 0; i < Machines.Length; i++ )</P>
<P>WriteSoftwareListToFile(Machines[i], FILE_NAME);</P>
<P></FONT><FONT color=#008080 size=2><FONT color=#008080 size=2>Console</FONT></FONT><FONT size=2>.ReadLine(); </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// To make the o/p readable.</P></FONT></FONT><FONT size=2>
<P>}</P></FONT></FONT></FONT></FONT>]]></description></item><item><title><![CDATA[VMWare -  Error - the vmware authorization service is not running]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=96185754-e204-4a63-a391-6f95b4092f56#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT face=Tahoma>I have windows vista home premium on my laptop. One day suddenly my VMWare started giving error "the vmware authorization service is not running " while starting virtual machine. I googled on internet & found KB Item on VMWare site    </FONT><A href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007131"><FONT face=Tahoma>http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007131</FONT></A></P>
<P><FONT face=Tahoma>It said, go to compute management & give admin rights to VMWare user & then reinstall the VMWare . Looks easy.  I started following steps . But wait.. where is familiar screen of user management.  Windows Vista Home Premium do not have provision to use GUI user management consol. Thats not fair !! </FONT></P>
<P><FONT face=Tahoma>Google one more time & here you go. </FONT><A href="http://social.technet.microsoft.com/Forums/en/itprovistasecurity/thread/e3d50d7f-deba-4a79-b347-72ed3d14d940"><FONT face=Tahoma>http://social.technet.microsoft.com/Forums/en/itprovistasecurity/thread/e3d50d7f-deba-4a79-b347-72ed3d14d940</FONT></A><FONT face=Tahoma> </FONT></P>
<P><FONT face=Tahoma>Lot of good information is mention on this thread about user management using command line. Use below command to list users on computer & get exact name of VMWareUser</FONT></P>
<P><FONT face=Tahoma><FONT color=#000080 face=Arial>> NET USERS</FONT>  </FONT></P>
<P><FONT face=Tahoma>Syntax for adding for adding or removing user from group is </FONT></P>
<P><FONT color=#000080 face=Arial>NET LOCALGROUP <<groupname>> <<user name>> {/ADD | /DELETE}</FONT></P>
<P><FONT face=Tahoma>So below command should give admin right to VMWare user </FONT></P>
<P><FONT color=#000080 face=Arial>>NET LOCALGROUP Administrators __vmware_user__ /add</FONT></P>
<P><FONT face=Tahoma>But Ooops !! Got an error.</FONT></P>
<P><FONT color=#800080 face=Arial>System error 5 has occurred.</FONT></P>
<P><FONT color=#800080 face=Arial>Access is denied.</FONT></P>
<P><FONT face=Tahoma>I am logged in as admin user still why would I get this error ?  Okey.. this is access error so my command line console is not having enough rights . Thanks to Windows Vista's User Account Control </FONT></P>
<P><FONT face=Tahoma>Now right click on Command Prompt Menu & Run it as an Administrator. Now I was able to add VMWare user to administrators group from command line.  I have not yet reinstalled the VMware but I am still getting the same error. "the vmware authorization service is not running ". To to try something more , I right clicked VMWare Workstation & Ran it as administrator. I was able to start my workstation .</FONT></P>
<P><FONT face=Tahoma>:) that was simple ..</FONT></P>
<P><FONT face=Tahoma></FONT> </P>
<P><FONT face=Tahoma></FONT> </P>
<P><FONT face=Tahoma></FONT> </P>]]></description></item><item><title><![CDATA[Add chart / graphs in ASP.net application / website]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=2d303c64-3285-4b78-82d1-8ce715107026#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT face=Tahoma>There are lots of commercial graph or chart controls for ASP.net. But if you are looking for free chart / graph components below mentioned components may be useful for your needs. </FONT></P>
<UL>
<LI><FONT face=Tahoma><STRONG>Zed Graph</STRONG><BR>The best ever I could find is Zed Graph. <BR>It has nice features <BR>Free Source Code or Binaries can be downloaded from <BR></FONT><A href="http://sourceforge.net/projects/zedgraph/" target=_blank><FONT face=Tahoma>http://sourceforge.net/projects/zedgraph/</FONT></A><FONT face=Tahoma> </FONT></LI></UL>
<P><FONT face=Tahoma>      There is a good tutorial available to use this component <BR></FONT>         <A href="http://www.codeproject.com/KB/graphics/zedgraph.aspx" target=_blank><FONT face=Tahoma>http://www.codeproject.com/KB/graphics/zedgraph.aspx</FONT></A><FONT face=Tahoma> </FONT></P>
<P><FONT face=Tahoma>         One simpler example for ZedGraph for ASP.net is available at Sailing Kay’s blog<BR></FONT>            <A href="http://sailingkay.blogspot.com/2007/03/zedgraph.html" target=_blank><FONT face=Tahoma>http://sailingkay.blogspot.com/2007/03/zedgraph.html</FONT></A><FONT face=Tahoma> </FONT></P>
<UL>
<LI><FONT face=Tahoma>For very Simple HTML Graphs rendered via ASP.net. <BR>This is very simple horizontal bar chart. It dynamically creates html table with cells background color gives look of a bar chart.<BR></FONT><A href="http://www.codetoad.com/asp.net_graph.asp" target=_blank><FONT face=Tahoma>http://www.codetoad.com/asp.net_graph.asp</FONT></A><FONT face=Tahoma> </FONT></LI></UL>
<P><FONT face=Tahoma>This article references to ASP.net 2.0 development.</FONT></P>
<P><FONT face=Tahoma></FONT> </P>]]></description></item><item><title><![CDATA[Microsoft Ramp Up]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=9fa3d9f5-bcad-4df1-a44a-7e84c98769bc#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT face=Tahoma>Ramp Up is free community based learning program recently started by Microsoft.</FONT></P>
<P><FONT face=Tahoma>Microsoft offers various learning tracks in this program.</FONT></P>
<UL>
<LI><FONT face=Tahoma>Web Development with ASP.NET </FONT>
<LI><FONT face=Tahoma>Learn ASP.NET: for PHP Developers </FONT>
<LI><FONT face=Tahoma>Move from ASP to ASP.NET </FONT>
<LI><FONT face=Tahoma>Develop Windows Mobile 6 Applications </FONT>
<LI><FONT face=Tahoma>SharePoint for Developers - Part 1 </FONT>
<LI><FONT face=Tahoma>SharePoint for Developers - Part 2 </FONT>
<LI><FONT face=Tahoma>Visual Studio 2008 </FONT>
<LI><FONT face=Tahoma>For the VS 2002/2003 Developer: Learn VS 2005 </FONT>
<LI><FONT face=Tahoma>For the VB 6.0 Developer: Learn VB 2005 </FONT>
<LI><FONT face=Tahoma>For the Java Developer: Learn .NET </FONT>
<LI><FONT face=Tahoma>Developer Basics <BR></FONT></LI></UL>
<P><FONT face=Tahoma>One can opt for any track depending on their background & start learning new Micrsoft technologies.</FONT></P>
<P><FONT face=Tahoma>URL for Ramp Up program is <A href="http://msdn.microsoft.com/rampup" target=_blank>http://msdn.microsoft.com/rampup</A> </FONT></P>]]></description></item><item><title><![CDATA[Use your IT skills to earn money]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=fc330b4c-5561-4e82-b72c-2490bcfe72ab#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P>Online Jobs , Freelancing  , and lot more</P>
<P> </P>
<a href="http://www.odesk.com/referrals/track/rbagal"><img src="http://www.odesk.com/images/banners/banner_buyer_468x60.gif" alt="The On Demand Global Workforce - oDesk" width="468" height="60" /></a>]]></description></item><item><title><![CDATA[How to write a message to MSMQ and read a message from MSMQ ( C# , .net )]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=304648b2-29e5-45d5-b2a4-3d7bf5972ab6#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><SPAN id=lblDesc>This is a very very basic bare-bones tutorial on writing to and reading from an MSMQ queue.<BR><BR>The example methods are both using a private local queue and use the default XMLFormatter.<BR><BR>First create the private queue:<BR>-Open the Computer Management Console<BR>-Navigate to Message Queuing under Services and Applications<BR>-Expand Message Queueing, right-click on Private Queues and create a new private queue.<BR><BR>If you don't see the Message Queueing option under Services and Applications, you don't have MSMQ installed on the machine. To install it, choose Add/Remove Windows Components and check Message Queueing and proceed with the installation.<BR>  <BR>To write to a queue:<BR>1. Specifiy the path to the queue - for a local private queue, the path should be in the form ".\private$\<queue name>" - replace <queue name> with the actual queue name e.g. ".\private$\testqueue"<BR><BR>2. Create a message of the type you wish in a Message object.<BR>3. Create the queue object, supplying the path to it as a parameter.<BR>4. Call the Send method on the queue, supplying the Message object created as a parameter.<BR><BR>The code should look something like the method below:<BR><BR><FONT color=#0000ff size=2>
<P>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> InsertInQueue()</P>
<P>{<BR>    </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> msg = "Test Queue Object"; <FONT color=#008000>//message contents</FONT></P>
<P></FONT><FONT color=#0000ff size=2>   string</FONT><FONT size=2> queuepath = ".\\private$\\testqueue"; <FONT color=#008000>//path to queue</FONT></P>
<P>    MessageQueue myQueue = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MessageQueue(queuepath); <FONT color=#008000>//create queue object</FONT></P>
<P>    Message myMsg = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> Message(msg); <FONT color=#008000>//form Message object</FONT></P>
<P></FONT><FONT color=#0000ff size=2>   try</P></FONT><FONT size=2>
<P>   {</P>
<P>     myQueue.Send(myMsg); <FONT color=#008000>//write message to queue</FONT></P>
<P></FONT><FONT color=#0000ff size=2>    return</FONT><FONT size=2> "Success";</P>
<P>   }</P>
<P></FONT><FONT color=#0000ff size=2>  catch</FONT><FONT size=2>(Exception ex)</P>
<P>   {</P>
<P></FONT><FONT color=#0000ff size=2>    return</FONT><FONT size=2> ex.Message;</P>
<P>   }</P>
<P>}<BR><BR>To read a message from a queue:<BR><BR>1. Specifiy the path to the queue<BR>2. Create the queue object, supplying the path to it as a paramater.<BR>3. Specify the formatter, either on the queue or by creating separate formatter object.<BR>4. Read the message from the queue, by calling the Receive method on the queue.<BR>5. Convert the message body as appropriate and return the value.<BR><BR>Sample code is shown below demonstrating how to read from a queue:<BR><BR><FONT color=#0000ff size=2></P>
<P>public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>string</FONT><FONT size=2> ReadFromQueue()</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2>  string</FONT><FONT size=2> queuepath = ".\\private$\\testqueue"; <FONT color=#008000>//specify queue path</FONT></P>
<P>   MessageQueue myQueue = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> MessageQueue(queuepath); <FONT color=#008000>//create queue</FONT><BR></P>
<P></FONT><FONT color=#0000ff size=2>  <FONT color=#008000>//specify typenames - this is needed by the formatter, to enable it to read the message contents</FONT><BR>  string</FONT><FONT size=2>[] typenames = {"System.String"}; <BR></P>
<P></FONT><FONT color=#008000 size=2>  //The line below specifies the formatter on the queue<BR>  //myQueue.Formatter = new XmlMessageFormatter(typenames);<BR></P></FONT><FONT size=2>
<P>  <FONT color=#008000 size=2>//read message from queue </FONT><BR>  Message myMsg = myQueue.Receive(</FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> TimeSpan(0, 0, 5)); </P>
<P>  XmlMessageFormatter fmt = </FONT><FONT color=#0000ff size=2>new</FONT><FONT size=2> XmlMessageFormatter(typenames);<BR></P>
<P></FONT><FONT color=#008000 size=2>  //The line below is valid if the formatter is specified on the queue, as shown above<BR>  //return myMsg.Body.ToString();<BR></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2> <FONT size=+0> <FONT color=#008000>//Since we've selected to specify a separate formatter, we need to read the contents<BR> //of the message using the formatter</FONT><BR></FONT>  return</FONT><FONT size=2> fmt.Read(myMsg).ToString();</P>
<P>}</P>
<P></FONT><BR>PS: <STRONG>You must reference System.Messaging for all this to work.<BR></STRONG></P></FONT></SPAN>]]></description></item><item><title><![CDATA[Check free disk of your servers / computers on network]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=b2d7bfe2-ff1c-48e0-96c5-19f249850df7#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT face=Tahoma size=2>Since few days I was facing a problem that some of the servers were short of free space due to disk full.</FONT></P>
<P><FONT face=Tahoma size=2>I was looking for quick & simple way to monitor free space on server. </FONT><FONT face=Tahoma size=2>I found some sripts on internet & modified it to suit my requirement .</FONT></P>
<P><FONT face=Tahoma size=2>Below script connects to all listed servers using WMI query , creates a report on c:\ . It can also email the report if you want. </FONT></P>
<P><FONT face=Tahoma size=2>How to use this script ?</FONT></P>
<UL>
<LI><FONT face=Tahoma size=2>Copy below code in notepad </FONT></LI>
<LI><FONT face=Tahoma size=2>List names of computers / server in arrServers .</FONT></LI>
<LI><FONT face=Tahoma size=2>Set flag for email true / false & settings for email server </FONT></LI>
<LI><FONT face=Tahoma size=2>Save file as HDDSpaceCheck.vbs file.  </FONT></LI>
<LI><FONT face=Tahoma size=2>Double click vbs file . It shall show report in minute or so depending on number of servers.</FONT></LI>
<LI><FONT face=Tahoma size=2>You can use windows scheduled task to schedule this activity & get email notification .</FONT></LI></UL>
<P><FONT face=Tahoma size=2></FONT> </P>
<P><FONT face=Verdana>' ******************** Start of Script *************</FONT></P>
<P><FONT face=Verdana>' Author : Rahul S Bagal  07/13/2009<BR>' This Script Checks Free Disk space in servers defined in "arrServers "</FONT></P>
<P><BR><FONT face=Verdana>' Define Names of servers to be checked for disk space<BR>arrServers = Array("Server1","Server2","Server3","Server4") </FONT></P>
<P><FONT face=Verdana>' Email Settings </FONT></P>
<P><FONT face=Verdana>Const SendEmail = True    ' Turn this flag to false you you do not wish to receive the report in email<BR>const DisplayReportOnScreen  =  True  ' Turn this flag if you do not want to open the created report file.  </FONT></P>
<P><FONT face=Verdana>strServer = "MailserverName"<BR>intPort = 25<BR>strFrom = "</FONT><A href="mailto:DoNotReply@domain.com"><FONT face=Verdana>DoNotReply@domain.com</FONT></A><FONT face=Verdana>"   ' Set from Email address for email reports<BR>strTo = "</FONT><A href="mailto:YourName@domain.com"><FONT face=Verdana>YourName@domain.com</FONT></A><FONT face=Verdana>"       ' Set to email address where you wish to receive email </FONT></P>
<P><FONT face=Verdana>' Report File defination <BR>Const ForReading = 1<BR>Const ForWriting = 2 <BR>Const ForAppending = 8</FONT></P>
<P><FONT face=Verdana>' This is the file name where email <BR>strFilePath = "C:\HDDRerport" & Month ( now ) & Day(now) & year(now) & ".txt" </FONT></P>
<P><BR><FONT face=Verdana>'The WMI query bit...<BR>For i = LBound(arrServers) To UBound(arrServers)<BR> strBody = strBody & "Please find below a report on local disks for server : " & arrServers(i) & vbCrLf & vbCrLf<BR> On Error Resume Next<BR> Set objWMI = GetObject("winmgmts:\\" & arrServers(i) & "\root\cimv2")<BR> Set colDisks = objWMI.ExecQuery("Select * from Win32_LogicalDisk Where DriveType=3")' Where DeviceID = '" & strDiskLetter & "'")<BR> If Err.Number = 0 Then<BR>  For Each objDisk in colDisks<BR>   strBody = strBody & "Drive " & objDisk.DeviceID & " - " & vbTab & "Total Size(MB): " & bytesToMB(objDisk.Size) _<BR>    & vbTab & vbTab & "Free Space(MB): " & bytesToMB(objDisk.FreeSpace) & vbtab & " Free Space ( % ) : " & round( bytesToMB(objDisk.FreeSpace) / bytesToMB(objDisk.Size) * 100 , 2 ) & vbcrlf<BR>  Next<BR> Else<BR>  strBody = strBody & "!ERROR! connecting to " & arrServers(i) & ". " & Err.Number & " - " & Err.Description<BR>  Err.Clear<BR> End If<BR> strBody = strBody & vbCrLf & vbCrLf<BR>Next</FONT></P>
<P><FONT face=Verdana>' Write to File </FONT></P>
<P><FONT face=Verdana>Set objFSO = CreateObject("Scripting.FileSystemObject")<BR>Set objTextFile = objFSO.OpenTextFile _<BR>    (strFilePath , ForWriting , True)<BR>objTextFile.WriteLine("Server Disk Space Report" & vbCrLf )<BR>objTextFile.WriteLine(strBody )<BR>objTextFile.Close<BR>set objFSO = nothing</FONT></P>
<P><FONT face=Verdana>'email Section</FONT></P>
<P><FONT face=Verdana>if SendEmail = True then  <BR> On Error Goto 0<BR> Set objMail = CreateObject("CDO.Message") <BR> With objMail<BR>  .Subject = "Server Disk Space Report"<BR>  .From = strFrom<BR>  .To = strTo <BR>  .TextBody = strBody<BR>  .Configuration.Fields.Item("</FONT><A href="http://schemas.microsoft.com/cdo/configuration/sendusing"><FONT face=Verdana>http://schemas.microsoft.com/cdo/configuration/sendusing</FONT></A><FONT face=Verdana>") = 2 '2 = use a specified SMTP server, 1 = use local SMTP service<BR>  .Configuration.Fields.Item("</FONT><A href="http://schemas.microsoft.com/cdo/configuration/smtpserver"><FONT face=Verdana>http://schemas.microsoft.com/cdo/configuration/smtpserver</FONT></A><FONT face=Verdana>") = strServer 'Your SMTP Server<BR>  .Configuration.Fields.Item("</FONT><A href="http://schemas.microsoft.com/cdo/configuration/smtpserverport"><FONT face=Verdana>http://schemas.microsoft.com/cdo/configuration/smtpserverport</FONT></A><FONT face=Verdana>") = intPort 'Server port<BR>  .Configuration.Fields.Update<BR>  .Send<BR> End With<BR>end if </FONT></P>
<P><FONT face=Verdana>Set objMail = Nothing<BR>Set objWMI = Nothing<BR>Set colDisks = Nothing<BR>Set objNet = Nothing</FONT></P>
<P><BR><FONT face=Verdana>' Display report if flag is set</FONT></P>
<P><FONT face=Verdana>if DisplayReportOnScreen = True then <BR> Dim WshShell <BR> Set WshShell = WScript.CreateObject("WScript.Shell")<BR> WshShell.Run strFilePath <BR> Set WshShell = nothing<BR>end if</FONT></P>
<P><FONT face=Verdana>Function bytesToMB(intbytes)<BR> bytesToMB = FormatNumber((intbytes / 1024) / 1024,,,,-1)<BR>End Function<BR></FONT></P>
<P><FONT face=Verdana>' ******************** End of Script *************</FONT></P>]]></description></item><item><title><![CDATA[Oracle 9i - PL/SQL Programming guide]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=1e19883e-6642-4953-8ecf-8683caad3d42#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P>Oracle is one of the most popular database in IT industry. From today, we are posting few basic but essential articles about programming using the Oracle PL/SQL.</P>
<P><A href="/main/oracle.aspx">Click here to goto Oracle index page.</A></P>]]></description></item><item><title><![CDATA[Application Security Tips]]></title><link><![CDATA[http://www.24x7code.com:80/main/Default.aspx?pg=949c7e6c-ede6-4661-97be-52646197a3ff&detail=e8b9d4aa-6417-444c-9ed5-bae8a333a346#dc6cbb3b-2098-4324-9d9d-dde3f92dd02b]]></link><description><![CDATA[<P><FONT size=2 face=Tahoma>A series of new articles has been published on 24x7code.com regarding securing application against vulnarabilities. Articles are being published as tips on various subjects such as </FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Tahoma><FONT size=2><A href="/main/sql_injection.aspx">How to Avoid SQL Injection attack<SPAN style="mso-spacerun: yes">  </SPAN></A></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Tahoma><FONT size=2><SPAN style="mso-spacerun: yes"></SPAN></FONT></FONT><FONT face=Tahoma><FONT size=2><A href="/main/threats.aspx">Threats and Countermeasures: S.T.R.I.D.E</A><SPAN style="mso-spacerun: yes">  </SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Tahoma><FONT size=2><A href="/main/input_validation.aspx">Input Validation</A><SPAN style="mso-spacerun: yes">  </SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Tahoma><FONT size=2><A href="/main/session_management.aspx">Session Management</A><SPAN style="mso-spacerun: yes">  </SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT face=Tahoma><FONT size=2><A href="/main/authentication.aspx">Authentication Mechanism</A><SPAN style="mso-spacerun: yes">  </SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=2 face=Tahoma><A href="/main/cross_site_scripting.aspx">Cross Site Scripting Vulnerabilities</A></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><A href="/main/applicationsecurity.aspx"><FONT size=2 face=Tahoma>Click here to goto index of these articles</FONT></A></P>
<P> </P>]]></description></item></channel></rss>