<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Programmer with Microsoft tools &#187; tools</title>
	<atom:link href="http://msprogrammer.serviciipeweb.ro/category/mini-tools-list/tools-mini-tools-list/feed/" rel="self" type="application/rss+xml" />
	<link>http://msprogrammer.serviciipeweb.ro</link>
	<description>A programmer journey through code, books and tools</description>
	<lastBuildDate>Mon, 14 May 2012 06:59:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VS 2010 Extensions</title>
		<link>http://msprogrammer.serviciipeweb.ro/2012/05/14/vs-2010-extensions/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2012/05/14/vs-2010-extensions/#comments</comments>
		<pubDate>Mon, 14 May 2012 04:50:00 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/2012/05/14/vs-2010-extensions/</guid>
		<description><![CDATA[Visual studion extensions that I use:
NuGet Package Manager 
Microsoft &#8211; Visual Studio Platform Team (Microsoft Corporation)
Productivity Power Tools 
Team Foundation Server Power Tools December 2011 
Web Standards Update for Microsoft Visual Studio 2010 SP1 
PowerCommands for Visual Studio 2010 
Web Essentials 
SQL Server Compact Toolbox 
EF 4.x POCO Entity Generator for C# 
EF 4.x DbContext [...]]]></description>
			<content:encoded><![CDATA[<p>Visual studion extensions that I use:</p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c">NuGet Package Manager </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/site/search?f%5B0%5D.Type=User&amp;f%5B0%5D.Value=Microsoft%20-%20Visual%20Studio%20Platform%20Team&amp;f%5B0%5D.Text=Microsoft%20-%20Visual%20Studio%20Platform%20Team">Microsoft &#8211; Visual Studio Platform Team (Microsoft Corporation)</a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef">Productivity Power Tools </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f">Team Foundation Server Power Tools December 2011 </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/a15c3ce9-f58f-42b7-8668-53f6cdc2cd83">Web Standards Update for Microsoft Visual Studio 2010 SP1 </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99">PowerCommands for Visual Studio 2010 </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f">Web Essentials </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1">SQL Server Compact Toolbox </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/23df0450-5677-4926-96cc-173d02752313">EF 4.x POCO Entity Generator for C# </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/7812b04c-db36-4817-8a84-e73c452410a2">EF 4.x DbContext Generator for C# </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981">Portable Library Tools 2 Beta </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/25622469-19d8-4959-8e5c-4025d1c9183d">Visual Studio 2010 SP1 SDK </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/46A20578-F0D5-4B1E-B55D-F001A6345748">GhostDoc </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/a56eddd3-d79b-48ac-8c8f-2db06ade77c3">Image Optimizer </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/1f6ec6ff-e89b-4c47-8e79-d2d68df894ec">Razor Generator </a></p>
<p><a href="http://visualstudiogallery.msdn.microsoft.com/a70ec2bf-8787-4da1-9b62-0f3a3f92758c">ReverseEquality </a></p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2012/05/14/vs-2010-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Azure tools</title>
		<link>http://msprogrammer.serviciipeweb.ro/2012/04/23/azure-tools/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2012/04/23/azure-tools/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 04:48:00 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[azure]]></category>
		<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/2012/04/16/azure-tools/</guid>
		<description><![CDATA[Azure storage Explorer : http://azurestorageexplorer.codeplex.com/&#160; &#8211; like in VS , but simpler and cleaner
Windows Azure ASP.NET Providers Sample : http://code.msdn.microsoft.com/windowsazure/Windows-Azure-ASPNET-03d5dc14 – utils for fast membership and roles. Small problem on local.
More samples here: http://code.msdn.microsoft.com/windowsazure/
And that will be all , after reading the documentation and understanding the concepts ( for example,if you understand the session problem [...]]]></description>
			<content:encoded><![CDATA[<p>Azure storage Explorer : <a title="http://azurestorageexplorer.codeplex.com/" href="http://azurestorageexplorer.codeplex.com/">http://azurestorageexplorer.codeplex.com/</a>&#160; &#8211; like in VS , but simpler and cleaner</p>
<p>Windows Azure ASP.NET Providers Sample : <a title="http://code.msdn.microsoft.com/windowsazure/Windows-Azure-ASPNET-03d5dc14" href="http://code.msdn.microsoft.com/windowsazure/Windows-Azure-ASPNET-03d5dc14">http://code.msdn.microsoft.com/windowsazure/Windows-Azure-ASPNET-03d5dc14</a> – utils for fast membership and roles. Small problem on local.</p>
<p>More samples here: <a title="http://code.msdn.microsoft.com/windowsazure/" href="http://code.msdn.microsoft.com/windowsazure/">http://code.msdn.microsoft.com/windowsazure/</a></p>
<p>And that will be all , after reading the documentation and understanding the concepts ( for example,if you understand the session problem in azure, then you will find a Session provider in the samples and use it)</p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2012/04/23/azure-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Kinect</title>
		<link>http://msprogrammer.serviciipeweb.ro/2012/03/05/kinect/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2012/03/05/kinect/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 06:24:00 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[kinect]]></category>
		<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/2012/03/05/kinect/</guid>
		<description><![CDATA[
I have the opportunity to borrow a Kinect hardware  &#8211; to make an application( I will make a simple anti-theft application).
The steps for developing in Kinect are:

Download the SDK from http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx – it contains the drivers also
Connect Kinect to USB , plug in the socket
Run the Kinect Explorer or Kinect Shape Game from Kinect SDK [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/Kinect_683B/image.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/Kinect_683B/image_thumb.png" border="0" alt="image" width="244" height="101" /></a><a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/Kinect_683B/image_3.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/Kinect_683B/image_thumb_3.png" border="0" alt="image" width="244" height="137" /></a></p>
<p>I have the opportunity to borrow a Kinect hardware  &#8211; to make an application( I will make a simple anti-theft application).</p>
<h2>The steps for developing in Kinect are:</h2>
<ul>
<li>Download the SDK from <a title="http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx" href="http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx">http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx</a> – it contains the drivers also</li>
<li>Connect Kinect to USB , plug in the socket</li>
<li>Run the <strong><em>Kinect Explorer </em></strong>or <strong><em>Kinect Shape Game </em></strong>from <strong><em>Kinect SDK Sample Browser </em></strong>installed at 1.  Ensure it works.</li>
<li>Read the <strong><em>Kinect Explorer </em></strong>source –it is SO clear!</li>
<li>Read documentation – finally, you should RTFM <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/Kinect_683B/wlEmoticon-winkingsmile.png" alt="Winking smile" /></li>
</ul>
<h2>Optional resources:</h2>
<ol>
<li><a title="http://kinectcontrib.codeplex.com/" href="http://kinectcontrib.codeplex.com/">http://kinectcontrib.codeplex.com/</a> – Visual Studio template for Skeleton, Audio, Video. Simple example that works ( simpler than <strong><em>Kinect Explorer !</em></strong>)</li>
<li> <a title="http://c4fkinect.codeplex.com/" href="http://c4fkinect.codeplex.com/">http://c4fkinect.codeplex.com/</a> – added methods to Kinect.</li>
<li><a title="http://kinecttoolbox.codeplex.com/" href="http://kinecttoolbox.codeplex.com/">http://kinecttoolbox.codeplex.com/</a> – detection of gesture.</li>
</ol>
<h2>Example 1: Integrating saving image in <strong><em>Kinect Explorer </em></strong>when a skeleton is detected</h2>
<p>Add reference to <strong><em>optional resource 2</em></strong>( either download , either via Nuget)</p>
<p>Search for  <strong><em>KinectAllFramesReady</em></strong> in <strong><em>KinectSkeletonViewer.xaml.cs</em></strong> and put this code</p>
<pre class="brush: csharp;">
						var takePic = this.skeletonData.Count(item =&gt; item.TrackingState == SkeletonTrackingState.Tracked) &gt; 0;

						if (takePic)
						{
							DateTime imgDate = DateTime.Now;
							string imageName = &quot;andrei&quot; + imgDate.ToString(&quot;yyyyMMdd_HHmmss&quot;) + &quot;.jpg&quot;;
							if (!File.Exists(imageName))
							{
								using (var image = e.OpenColorImageFrame())
								{
									if (image != null &amp;&amp; this.skeletonData.Length &gt; 0 &amp;&amp; this.skeletonData.Count(item =&gt; item.TrackingState != SkeletonTrackingState.NotTracked) &gt; 0)
										if (image != null &amp;&amp; takePic)
										{
											var x = image.ToBitmapSource();
											var b = Save(x, ImageFormat.Jpeg);

											var t = Task.Factory.StartNew(

												(img) =&gt;
												{

													imgDate = DateTime.Now;
													imageName = &quot;andrei&quot; + imgDate.ToString(&quot;yyyyMMdd_HHmmss&quot;) + &quot;.jpg&quot;;
													if (File.Exists(imageName))
														return;
													byte[] i = img as byte[];
													if (i != null)
													{
														File.WriteAllBytes(imageName, i);
													};
												}, b);
											//t.Start();
										}
								}
							}
					}
</pre>
<h2>Example 2 : Detecting circle by right hand in <strong><em>Kinect Explorer </em></strong>when a skeleton is detected</h2>
<p>Add reference to <strong><em>optional resource 3</em></strong>( either download , either via Nuget)</p>
<p>Download circleKB.save file and put in your project. Ensure “Copy to output directory” is “copy always/copy if newer”</p>
<p>Add a variable named</p>
<pre class="brush: csharp;">
TemplatedGestureDetector circleGestureRecognizer;
</pre>
<p>In <strong><em>KinectSkeletonViewer.xaml.cs </em></strong>in constructor put</p>
<pre class="brush: csharp;">
			using (Stream recordStream = File.Open(&quot;circleKB.save&quot;, FileMode.Open))
			{
				circleGestureRecognizer = new TemplatedGestureDetector(&quot;Circle&quot;, recordStream);
				circleGestureRecognizer.OnGestureDetected += new Action&lt;string&gt;(circleGestureRecognizer_OnGestureDetected);
//TODO : implement circleGestureRecognizer_OnGestureDetected : void circleGestureRecognizer_OnGestureDetected(string obj)
			}
</pre>
<p>Search for <strong><em>KinectAllFramesReady</em></strong> in <strong><em>KinectSkeletonViewer.xaml.cs</em></strong> and put this code</p>
<pre class="brush: csharp;">

foreach (Joint joint in skeleton.Joints)//existing code
							{
								Point mappedPoint = this.GetPosition2DLocation(depthImageFrame, joint.Position);//existing code
								jointMapping[joint.JointType] = new JointMapping//existing code
									{
										Joint = joint,
										MappedPoint = mappedPoint
									};
//new code from here:
									 if ((joint.TrackingState == JointTrackingState.Tracked) &amp;&amp; (joint.JointType == JointType.HandRight))
									{
											circleGestureRecognizer.Add(joint.Position, Kinect);
									}

							}
</pre>
<p>That will be all…<br />
If you have developed with Kinect, please share your sources as comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2012/03/05/kinect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programmer tools 2011</title>
		<link>http://msprogrammer.serviciipeweb.ro/2011/10/31/programmer-tools-2011/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2011/10/31/programmer-tools-2011/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 06:24:17 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/?p=856</guid>
		<description><![CDATA[List of programmer tools
I have re-installed the PC and I have been taken notice of what tools I have on the system now:

Magic Disc – can mount .iso files ( for  2 )
Visual Studio – must have for a easy developing path
Sql Server 2008 &#8211; primary database for me
7-zip  - archiver
Firefox ( plus addons, see [...]]]></description>
			<content:encoded><![CDATA[<p>List of programmer tools</p>
<p>I have re-installed the PC and I have been taken notice of what tools I have on the system now:</p>
<ol>
<li>Magic Disc – can mount .iso files ( for  2 )</li>
<li>Visual Studio – must have for a easy developing path</li>
<li>Sql Server 2008 &#8211; primary database for me</li>
<li>7-zip  - archiver</li>
<li>Firefox ( plus addons, see below)</li>
<li>Smtp4dev – to see messages</li>
<li>AspNetMVC3ToolsUpdateSetup</li>
<li>FreeCommander -  dual panels for windows explorer</li>
<li>Foxit reader – pdf viewer</li>
<li>Notepad ++ ( with hex addon)</li>
<li>Winmerge – files/ folders difference</li>
<li>Clean project – archive solution</li>
<li>SqlSearch from RedGate – fast search after names</li>
<li>SSMS tools – record every operation you do in sql server</li>
<li>EntityFramework41  &#8211; code first development</li>
<li>XUnit – automated testing + samples  to do BDD style</li>
<li>SSCERuntime_x86-ENU –SqlCompact provider. Works with EF4.1</li>
<li>SqlCe40Toolbox – SqlCompact viewer</li>
<li>NuGet.Tools.vsix – Nuget is awesome!</li>
<li>ImgBurn  &#8211; burn cd-s</li>
<li>consolas font  - see  1 and l ?</li>
<li>LogParser  &#8211; never know when you need to parse some files</li>
<li>Moq  &#8211; mocking tool</li>
<li>PreviewHandlerPack  -see c# code in preview window</li>
<li>Regulator and Regulazy – regular expression helpers</li>
<li>StringTemplate.NET  &#8211; templating generator. Maybe replaced by razor ?</li>
<li>NLog &#8211;  logging tool. Log4Net was pretty unreliable in .NET 4</li>
<li>FileHelpers – reading writing text data.</li>
<li>Tcmdwincearm – Total Commander for mobile. Free.</li>
<li>Jquery and Jquery UI.</li>
<li>DataTables – html tables supports sorting , filtering, others.</li>
<li>Windows Live Essential – blogging fast.</li>
<li>InsertFilePlugin – Live writer extension to insert files to upload.</li>
<li>OfficeOpenXMLPart4-MarkupLanguageReference  &#8211; markup for Office XML. Used with StringTemplate</li>
<li>SharpZipLib – knows how to zip multiple files.</li>
<li>AutoFixture – generating sample data</li>
<li>HtmlAgilityPack – parsing web pages</li>
<li>T4MVC – get rid of magic names for controllers, actions</li>
<li>Itextsharp – save as pdf</li>
<li>Ninject – DI provider</li>
<li>Hudson – continous integration</li>
<li>AutoMapper  &#8211; transferring data between DAL and BLL</li>
<li>Selenium – testing web interfaces</li>
<li>Svn  -source control</li>
<li>MVC Contrib – pages list and more</li>
<li>Msbuildtask from tigris – build make it easy</li>
<li>Psr – help made easy in Windows 7</li>
<li>Firefox addons here</li>
</ol>
<p><a href="https://addons.mozilla.org/en-US/firefox/collections/ignatandrei/ignatandrei/">https://addons.mozilla.org/en-US/firefox/collections/ignatandrei/ignatandrei/</a></p>
<p>For every tool search for it . The first link will give you all details.</p>
<p>You can have as pdf here:<a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2011/10/List-of-programmer-tools-2011.pdf">List of programmer tools 2011</a></p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2011/10/31/programmer-tools-2011/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MVC Zip Result</title>
		<link>http://msprogrammer.serviciipeweb.ro/2011/01/31/zip-result-mvc/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2011/01/31/zip-result-mvc/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 05:12:11 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[zipresult]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/?p=684</guid>
		<description><![CDATA[Sometimes you need to send to the user more than 1 file &#8211; or, maybe, the file is too large
The simplest way is : made a zip file that contains the others.
What do you need
1.  SharpzipLib from http://www.icsharpcode.net/opensource/sharpziplib/ ( or download via NuGet in VS)
2.  obtain the file(s) that you want as a [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to send to the user more than 1 file &#8211; or, maybe, the file is too large<br />
The simplest way is : made a zip file that contains the others.</p>
<p>What do you need<br />
1.  SharpzipLib from <a href='http://www.icsharpcode.net/opensource/sharpziplib/' target='_blank'>http://www.icsharpcode.net/opensource/sharpziplib/</a> ( or download via NuGet in VS)<br />
2.  obtain the file(s) that you want as a string or as a byte[] &#8211; let&#8217;s say you have a byte[] to store in a <b>str</b> variable<br />
3.  make in your action something like that:</p>
<pre class="brush: csharp;">
 var fcr = new ZipResult(&quot;Export.xls&quot;, str);
            fcr.AddFile(&quot;readme.txt&quot;,&quot;this zip file contains ..&quot;);
            return fcr;
</pre>
<p>4. copy the following code in your asp.net mvc projects:</p>
<pre class="brush: csharp;">

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Text;

namespace utilsResult
{
    public class ZipResult : FileResult
    {

        private Dictionary&lt;string, byte[]&gt; content = new Dictionary&lt;string, byte[]&gt;();
        public string FileNameZip;
        public ZipResult(string FileName, byte[] Contents)
            : base(&quot;application/octet-stream&quot;)
        {
            this.FileDownloadName = Path.GetFileNameWithoutExtension(FileName) + &quot;.zip&quot;;
            AddFile(FileName, Contents);
        }
        public void AddFile(string FileName,  byte[] Contents)
        {
            content.Add(FileName, Contents);
        }
        public void AddFile(string FileName,string Contents, Encoding e = null)
        {
            if (e == null)
                e = ASCIIEncoding.ASCII;

            content.Add(FileName, e.GetBytes(Contents));
        }

        protected override void WriteFile(HttpResponseBase response)
        {

            using (ZipOutputStream zos = new ZipOutputStream(response.OutputStream))
            {
                zos.SetLevel(3);
                zos.UseZip64=UseZip64.Off;

                foreach (var item in content)
                {
                    ZipEntry ze = new ZipEntry(item.Key);
                    ze.DateTime = DateTime.Now;
                    zos.PutNextEntry(ze);
                    int count=item.Value.Length;
                    zos.Write(item.Value, 0, count);

                }
            }
        }
    }
}
</pre>
<p>5. future improvements:<br />
Zip the file(s) in a dll project to made fully testable!</p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2011/01/31/zip-result-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EF Profiler and investigating object context</title>
		<link>http://msprogrammer.serviciipeweb.ro/2010/11/15/ef-profiler-and-investigating-object-context/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2010/11/15/ef-profiler-and-investigating-object-context/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 04:17:49 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[money]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[EF]]></category>
		<category><![CDATA[efprof]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/?p=547</guid>
		<description><![CDATA[Summary : EF Profiler worth his money !
Long Description :
I have finished a application with Entity Framework and POCO – and custom generated (.tt) files.
Now it was time to investigate performance  &#8211; and it was a terrific problem.
How EF Prof helped me :
1.  Displaying number of ObjectContext created and disposed in a Unit of Work [...]]]></description>
			<content:encoded><![CDATA[<p>Summary : EF Profiler worth his money !</p>
<p>Long Description :</p>
<p>I have finished a application with Entity Framework and POCO – and custom generated (.tt) files.</p>
<p>Now it was time to investigate performance  &#8211; and it was a terrific problem.</p>
<p>How EF Prof helped me :</p>
<p><strong>1.  D</strong>isplaying number of ObjectContext created and disposed in a Unit of Work and / or web page.</p>
<p><a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/11/image.png"><img style="display: inline; border-width: 0px;" title="image" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/11/image_thumb.png" border="0" alt="image" width="244" height="199" /></a></p>
<p><strong>2. D</strong>isplaying problem with the ObjectCOntext : using same context from multiple threads, alerts about code like  here :</p>
<p><a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/11/image1.png"><img style="display: inline; border-width: 0px;" title="image" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/11/image_thumb1.png" border="0" alt="image" width="206" height="244" /></a></p>
<p>The red dot is about querying the database from the view. The gray one is about selecting a whole table without selecting top 1000 rows(OK, it was a dictionary table, like the list of countries)</p>
<p><strong>3. W</strong>hen you want caching on your site , you can fast see this by seeing the difference between the number of queries and/or number of ObjectContext for the first time and the second one ( first time : 10, second time:2 or 0 <img src='http://msprogrammer.serviciipeweb.ro/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<p><strong>4. S</strong>ee most expensive queries as time – usually this is a good option to put an index on the “where” columns.More , you can see also non-unique queries (that you perform more than 1 time)</p>
<p><strong>5. I</strong>nvestigate easily all queries. Know what you want to optimize and where.</p>
<p>Improvements  :</p>
<p>1. Say where is the ObjectContext that is not closing.</p>
<p>Alternatives:</p>
<p>How to: View the Store Commands : <a title="http://msdn.microsoft.com/en-us/library/bb896348.aspx" href="http://msdn.microsoft.com/en-us/library/bb896348.aspx">http://msdn.microsoft.com/en-us/library/bb896348.aspx</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa173918%28SQL.80%29.aspx" target="_blank">Sql Profiler</a> : http://msdn.microsoft.com/en-us/library/aa173918%28SQL.80%29.aspx</p>
<p>(free ones :</p>
<p>http://sites.google.com/site/sqlprofiler/</p>
<p>http://code.google.com/p/sqlexpressprofiler/</p>
<p>)</p>
<p>But the job will be done by yourself!</p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2010/11/15/ef-profiler-and-investigating-object-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>file helpers</title>
		<link>http://msprogrammer.serviciipeweb.ro/2010/06/07/file-helpers/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2010/06/07/file-helpers/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 04:19:37 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[filehelpers]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/?p=246</guid>
		<description><![CDATA[More than one time you need to let users / application import bulk data in your system .
I have had many cases  &#8211; data is old data from old software, that is exported in some text files, usually csv.
In order to import fast the data, I used FileHelpers from http://www.filehelpers.com/
Let&#8217;s say you have the following [...]]]></description>
			<content:encoded><![CDATA[<p>More than one time you need to let users / application import bulk data in your system .</p>
<p>I have had many cases  &#8211; data is old data from old software, that is exported in some text files, usually csv.</p>
<p>In order to import fast the data, I used FileHelpers from <a title="http://www.filehelpers.com/" href="http://www.filehelpers.com/" target="_blank">http://www.filehelpers.com/</a></p>
<p>Let&#8217;s say you have the following data for an car evidence :</p>
<p>Date, StartMiles, Destination, EndMiles</p>
<p>And the data comes from an Excel  that has those columns. The requirements is the user can copy/paste from Excel data</p>
<p>When they copy the data comes in this form</p>
<p>01/01/2010     1000 Washington 1550</p>
<p>02/01/2010     1550 Dallas 2550</p>
<p>and so on.</p>
<p>It is clear that you :</p>
<ol>
<li> have a class with Date, StartMiles, Destination, EndMiles</li>
<li>accomodate for space &#8211; but how to perform various data separator ( we suppose that first is the day, then comes the month).</li>
</ol>
<p>Now the code in logical steps :</p>
<p>1. <strong>Accomodate for dates :</strong></p>
<pre class="brush: csharp;">
internal class ConvertDate : ConverterBase
{

        /// &lt;summary&gt;
        /// different forms for date separator : . or / or space
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;from&quot;&gt;the string format of date - first the day&lt;/param&gt;
        /// &lt;returns&gt;&lt;/returns&gt;

        public override object StringToField(string from)
        {
            DateTime dt;

            if (DateTime.TryParseExact(from, &quot;dd.MM.yyyy&quot;, null, DateTimeStyles.None, out dt))
                return dt;

            if (DateTime.TryParseExact(from, &quot;dd/MM/yyyy&quot;, null, DateTimeStyles.None, out dt))
                return dt;

            if (DateTime.TryParseExact(from, &quot;dd MM yyyy&quot;, null, DateTimeStyles.None, out dt))
                return dt;

            throw new ArgumentException(&quot;can not make a date from &quot; + from, &quot;from&quot;);

        }
}
</pre>
<p>2. <strong>Create the class that will hold one record:<br />
</strong></p>
<pre class="brush: csharp;">
    [IgnoreEmptyLines(true)]
    [DelimitedRecord(&quot;,&quot;)]
    internal class DestinationReader
    {
        //[FieldConverter(ConverterKind.Date,&quot;dd.MM.yyyy&quot;)]
        [FieldConverter(typeof(ConvertDate))]
        public DateTime Date;
        [FieldConverter(ConverterKind.Int32)]
        public int StartMiles;

        [FieldQuoted(QuoteMode.OptionalForBoth)]
        public string Destination;

        [FieldConverter(ConverterKind.Int32)]
        public int  EndMiles;
    }
</pre>
<p><strong>3. Now read the entire string:</strong></p>
<pre class="brush: csharp;">
            string Text = text that comes from the user
            string TextDelim = Text.Substring(10, 1);// the date has 10 chars - so the eleven is the separator
            while (Text.IndexOf(TextDelim + TextDelim) &gt; 0)//consolidate for 2 delimiters
            {
                Text = Text.Replace(TextDelim + TextDelim, TextDelim);
            }
            DelimitedFileEngine&lt;DestinationReader&gt; flh=new DelimitedFileEngine&lt;DestinationReader&gt;();
            flh.Options.Delimiter = TextDelim;

            var data =flh.ReadString(Text);
</pre>
<p>In data you have a list of DestinationReader<br />
So for any structured import of data use FileHelpers from <a title="http://www.filehelpers.com/" href="http://www.filehelpers.com/" target="_blank">http://www.filehelpers.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2010/06/07/file-helpers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium and testing WebInterfaces</title>
		<link>http://msprogrammer.serviciipeweb.ro/2010/05/24/selenium-and-testing-webinterfaces/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2010/05/24/selenium-and-testing-webinterfaces/#comments</comments>
		<pubDate>Mon, 24 May 2010 04:31:11 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/?p=237</guid>
		<description><![CDATA[On some cases you need to test the whole web interface. Why ? Suppose you have some Ajax call. You can test the call on server, but how do you ensure that user experience is OK ?
There are several testing projects for Web – for example selenium and Watin
I will show how to test with [...]]]></description>
			<content:encoded><![CDATA[<p>On some cases you need to test the whole web interface. Why ? Suppose you have some Ajax call. You can test the call on server, but how do you ensure that user experience is OK ?</p>
<p>There are several testing projects for Web – for example <a href="http://seleniumhq.org/">selenium</a> and <a href="http://watin.sourceforge.net/">Watin</a></p>
<p>I will show how to test with Selenium + NUNIT</p>
<ol>
<li>Download selenium from <a title="http://seleniumhq.org/" href="http://seleniumhq.org/">http://seleniumhq.org/</a> and download Firefox add-on from <a title="http://seleniumhq.org/projects/ide/" href="http://seleniumhq.org/projects/ide/">http://seleniumhq.org/projects/ide/</a></li>
<li>Start selenium with java -jar selenium-server.jar</li>
<li>Record the test with FF.</li>
<li>Create a usual NUnit test project and add a reference to ThoughtWorks.Selenium.Core.dll</li>
<li>The code can be like this :</li>
<pre class="brush: csharp;">
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;

namespace InvoiceTest
{
[TestFixture]
public class TestWeb
{
private ISelenium selenium;
private StringBuilder verificationErrors;

[SetUp]
public void SetupTest()
{
//java -jar selenium-server.jar
//selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, @&quot;*firefox d:\Program Files\Mozilla Firefox\firefox.exe&quot;,&quot;&lt;a href=&quot;http://localhost/&amp;quot;);&quot;&gt;http://localhost/&quot;);&lt;/a&gt;
selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, @&quot;*iexplore&quot;, &quot;&lt;a href=&quot;http://localhost/&amp;quot;);&quot;&gt;http://localhost/&quot;);&lt;/a&gt;
//selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, @&quot;*iexploreproxy&quot;, &quot;&lt;a href=&quot;http://localhost/&amp;quot;);&quot;&gt;http://localhost/&quot;);&lt;/a&gt;
selenium.Start();
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Console.WriteLine(verificationErrors.ToString());
Assert.AreEqual(&quot;&quot;, verificationErrors.ToString());
}

[Test]
public void FindTextAfterClickOnButton()
{

selenium.Open(&quot;/&lt;strong&gt;your application&lt;/strong&gt;&quot;);
selenium.Focus(&quot;&quot;);
selenium.WindowMaximize();
selenium.Type(&quot;the textbox&quot;, &quot;the text&quot;);
selenium.Click(&quot;button &quot;);
selenium.WaitForPageToLoad(&quot;30000&quot;);
try
{
Assert.IsTrue(selenium.IsTextPresent(&quot;&lt;strong&gt;new text from your application&lt;/strong&gt;&quot;));
}
catch (AssertionException e)
{
verificationErrors.Append(e.Message);
Console.WriteLine(e.Message);
}
}

}
}
</pre>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2010/05/24/selenium-and-testing-webinterfaces/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Entity Framework profiler</title>
		<link>http://msprogrammer.serviciipeweb.ro/2010/05/17/entity-framework-profiler/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2010/05/17/entity-framework-profiler/#comments</comments>
		<pubDate>Mon, 17 May 2010 04:14:00 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[efprof]]></category>
		<category><![CDATA[Entity framework]]></category>
		<category><![CDATA[profiler]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/2010/05/17/entity-framework-profiler/</guid>
		<description><![CDATA[Many times I’ve had problem with the following error when inserting objects with dates with Entity Framework :
System.Data.UpdateException An error occurred while updating the entries. See the inner exception for details.SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Ok, it&#8217;s my faute &#8211; but to remember each one date is too much [...]]]></description>
			<content:encoded><![CDATA[<p>Many times I’ve had problem with the following error when inserting objects with dates with Entity Framework :</p>
<p><span style="color: #ff0000;">System.Data.UpdateException An error occurred while updating the entries. See the inner exception for details.SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.</span></p>
<p>Ok, it&#8217;s my faute &#8211; but to remember each one date is too much for me&#8230;</p>
<p>The usual method was to start SqlProfiler, monitor the database and see how the sql is constructed. However, the database being used by all developers, it was not so simple to differentiate between all sql’s.</p>
<p>Other alternative was to log the entity framework generated sql’s . I have discovered <a href="http://ayende.com/blog/" target="_blank">Ayende Rahien</a> <a href="http://efprof.com/" target="_blank">Entity Framework profiler</a> . Simple to use , as is wrote <a href="http://efprof.com/Learn" target="_blank">here</a> in 2 simple steps</p>
<ol>
<li>add reference to HibernatingRhinos.Profiler.Appender.dll</li>
<li> put this</li>
</ol>
<pre class="brush: csharp;">
HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
</pre>
<p>and start the exe. That will be all.</p>
<p>Do not forget to remove it on release version!</p>
<p>Pros:</p>
<p>Easy to use, valuable information, good!</p>
<p>Cons :</p>
<p>Not free …</p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2010/05/17/entity-framework-profiler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Logging and instrumentation</title>
		<link>http://msprogrammer.serviciipeweb.ro/2010/04/19/logging-and-instrumentation/</link>
		<comments>http://msprogrammer.serviciipeweb.ro/2010/04/19/logging-and-instrumentation/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 04:05:00 +0000</pubDate>
		<dc:creator>Andrei Ignat</dc:creator>
				<category><![CDATA[full]]></category>
		<category><![CDATA[mini tools list]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://msprogrammer.serviciipeweb.ro/2010/04/19/logging-and-instrumentation/</guid>
		<description><![CDATA[Why
There are at least two reasons for an application to register what tfhe user do.
The first one and the most important is to see what is happening when a user has an error: what have been done, on which path did he go and what additional data(method parameters, usually) do you need for reproducing the [...]]]></description>
			<content:encoded><![CDATA[<h3>Why</h3>
<p>There are at least two reasons for an application to register what tfhe user do.</p>
<p>The first one and the most important is to see what is happening when a user has an error: what have been done, on which path did he go and what additional data(method parameters, usually) do you need for reproducing the bug.</p>
<p>The second one is to provide the application a way to record in-obtrusive messages for same actions that may seems not so right(check the event log for your computer for more examples <img src='http://msprogrammer.serviciipeweb.ro/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<h3>Requirements for a logging system</h3>
<p>The logging system should be:</p>
<p>1. Robust – if it can not write the message, it should not fail the entire app</p>
<p>2. Multi-write-data : it can write easily to multiple systems(such as databases, files on disk, send emails and so on)</p>
<p>3. Flexibility : the configuration of the logging system should be easy to modify. More, the modifications should be applied and “re-loaded” without re-compiling or re-starting the application</p>
<h3>An implementation</h3>
<p>For the implementation I will use log4net , <a href="http://logging.apache.org/log4net/">http://logging.apache.org/log4net/</a> that it is satisfies all three conditions.</p>
<p>We will do a console application that sends a random error</p>
<pre class="brush: csharp;">
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleDemo1

{

class Program

{

static void Main(string[] args)

{

long ticks = DateTime.Now.Ticks;

FirstFunction(ticks);

}

static void FirstFunction(long i)

{

if (i % 2 == 0)

{

throw new ArgumentException(&quot;from first function&quot;);

SecondFunction(i);

}

static void SecondFunction(long i)

{

if (i % 2 == 1)

{

throw new ArgumentException(&quot;from second function&quot;);

}

}

}

}
</pre>
<p>As you see this application will have an error no matter if the ticks are even or odd. Download project from here : http://msprogrammer.serviciipeweb.ro/wp-content/uploads/loggingDemo.zip</p>
<p>Now we will see how the log4net writes data and error to a physical storage, in order to can be retrieved later.</p>
<p>Download log4net, add reference to it and make the following 4 steps</p>
<p>1. add a config file (I will name it log4net.config ) and in properties put “Copy to output Directory” to “Copy always” .</p>
<p><a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/04/clip_image0024.jpg"><img style="display: inline; border: 0px;" title="clip_image002[4]" src="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/2010/04/clip_image0024_thumb.jpg" border="0" alt="clip_image002[4]" width="244" height="143" /></a></p>
<p>Examples of log4net config files you will find everywhere on internet . If you look at the project you will see a bunch of “appenders” : ConsoleAppender, RollingLogFileAppender , SmtpAppender . The appender appends the log to the storage provided (Console, File, Email ). You will find a list of appenders at <a href="http://logging.apache.org/log4net/release/sdk/log4net.Appender.html">http://logging.apache.org/log4net/release/sdk/log4net.Appender.html</a> and, if you do not found some appender you can wrote your own – just look at the source code.</p>
<p>For this application I want to use just ConsoleAppender and RollingFileAppender</p>
<pre class="brush: xml;">
&lt;root&gt;

&lt;level value=”DEBUG” /&gt;

&lt;appender-ref ref=”ConsoleAppender” /&gt;

&lt;appender-ref ref=”RollingLogFileAppender” /&gt;

&lt;/root&gt;
</pre>
<p>2. In order to see the file, put</p>
<pre class="brush: csharp;">

log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(&quot;log4net.config&quot;));
</pre>
<p>(for asp.net application ,put</p>
<pre class="brush: csharp;">

log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath(&quot;~/log4net.config&quot;)));
</pre>
<p>)</p>
<p>3. Add a variable to log the errors :</p>
<pre class="brush: csharp;">

private static readonly log4net.ILog _logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
</pre>
<p>4. Add a try/catch to log errors :</p>
<pre class="brush: csharp;">
try

{

FirstFunction(ticks);

}

catch (Exception ex)

{

if (_logger.IsErrorEnabled)

{

_logger.Error(&quot;see an error!&quot;, ex);

}

throw;

}
</pre>
<p>Now, if you run the ConsoleDemoLog4net project, then you will see how to exception is logged twice and you will find the currentlog.txt in the same folder as your application executable.</p>
<h3>Automatically instrument an application(dll, exe, asp.net)</h3>
<p>This was pretty good – but what about putting a log to every method to see where the application flow has been gone and with which arguments?</p>
<p>You can do this with postsharp / log4postsharp. Postsharp is … Log4Postsharp is …</p>
<p>Let’s make the application do this automatically.</p>
<p>We download Postsharp 1.0 (not 1.5!) from <a href="http://www.softpedia.com/progDownload/PostSharp-Download-114994.html">http://www.softpedia.com/progDownload/PostSharp-Download-114994.html</a> (you can found a more good paid version at <a href="http://www.sharpcrafters.com/downloads/">http://www.sharpcrafters.com/downloads/</a> )</p>
<p>Now we will do the following :</p>
<p>1. Add the log4net.config from the previous project</p>
<p>2. Add log4net , PostSharp.Public and PostSharp reference</p>
<p>3. Add to the main just:</p>
<pre class="brush: csharp;">
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(&quot;log4net.config&quot;));
</pre>
<p>Do NOT add the log4net code to intercept!</p>
<p>4. Modify AssemblyInfo.cs and put</p>
<pre class="brush: csharp;">
using Log4PostSharp;

[assembly: Log(AttributeTargetTypes = &quot;*&quot;, EntryLevel = LogLevel. Error, EntryText = &quot;postsharp :entering {signature} {paramvalues}&quot;, ExitLevel = LogLevel. Error, ExceptionLevel = LogLevel.Error, ExitText = &quot;postsharp :exit {signature} {paramvalues} =&amp;gt; {returnvalue}&quot;, ExceptionText = &quot;postsharp : error in {signature} &quot;)]
</pre>
<p>5. Add a text file named &lt;yourprojectname&gt;.psproj (in this case, ConsoleDemoPostSharp.psproj ) with the following content:</p>
<pre class="brush: xml;">
&lt;?xml version=”1.0″ encoding=”utf-8″ ?&gt;

&lt;Project xmlns=”http://schemas.postsharp.org/1.0/configuration”&gt;

&lt;SearchPath Directory=”bin/{$Configuration}”/&gt;

&lt;SearchPath Directory=”{$SearchPath}” /&gt;

&lt;SearchPath Directory=”lib” /&gt;

&lt;Tasks&gt;

&lt;AutoDetect /&gt;

&lt;Compile TargetFile=”{$Output}” IntermediateDirectory=”{$IntermediateDirectory}” CleanIntermediate=”false” /&gt;

&lt;/Tasks&gt;

&lt;/Project&gt;
</pre>
<p>6. Edit by hand the csproj file and add this :</p>
<pre class="brush: xml;">
&lt;PropertyGroup&gt;

&lt;DontImportPostSharp&gt;True&lt;/DontImportPostSharp&gt;

&lt;PostSharpDirectory&gt; ..\libs\ postsharp\&lt;/PostSharpDirectory&gt;

&lt;PostSharpUseCommandLine&gt;True&lt;/PostSharpUseCommandLine&gt;

&lt;/PropertyGroup&gt;

&lt;Import Project=&quot;$(PostSharpDirectory)PostSharp.targets&quot; Condition=&quot; Exists('$(PostSharpDirectory)PostSharp.targets') &quot; /&gt;
</pre>
<p>7. If there is a screen to ask you about a project modification, please tell “Load project normally”</p>
<p>So now , when it’s compiling , it says :</p>
<p>&#8220;D:\programe\youtube\loggingDemo\libs\postsharp\PostSharp.exe&#8221; &#8220;D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\ConsoleDemoPostSharp.psproj&#8221; &#8220;D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\obj\Release\Before-PostSharp\ConsoleDemoPostSharp.exe&#8221; &#8220;/P:Output=obj\Release\ConsoleDemoPostSharp.exe &#8221; &#8220;/P:ReferenceDirectory=D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp &#8221; &#8220;/P:Configuration=Release &#8221; &#8220;/P:Platform=AnyCPU &#8221; &#8220;/P:SearchPath=bin\Release\,obj\Release\, &#8221; &#8220;/P:IntermediateDirectory=obj\Release\PostSharp &#8221; &#8220;/P:CleanIntermediate=False &#8221; &#8220;/P:MSBuildProjectFullPath=D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\ConsoleDemoPostSharp.csproj &#8221; &#8220;/P:SignAssembly=False &#8221; &#8220;/P:PrivateKeyLocation= &#8221;</p>
<p>PostSharp 1.0 [1.0.12.469] &#8211; Copyright (c) Gael Fraiteur, 2005-2008.</p>
<p>EXEC : warning PS0064: A new version of PostSharp 1.0 is available. You have currently 1.0.12.469 and you could download the version 1.0.13.630 from http://www.sharpcrafters.com/postsharp/download.</p>
<p>info PS0035: C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe &#8220;D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\obj\Release\PostSharp\ConsoleDemoPostSharp.il&#8221; /QUIET /EXE /PDB &#8220;/RESOURCE=D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\obj\Release\PostSharp\ConsoleDemoPostSharp.res&#8221; &#8220;/OUTPUT=D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\obj\Release\ConsoleDemoPostSharp.exe&#8221; /SUBSYSTEM=3 /FLAGS=1 /BASE=19595264 /STACK=1048576 /ALIGNMENT=512 /MDV=v2.0.50727</p>
<p>ConsoleDemoPostSharp -&gt; D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\bin\Release\ConsoleDemoPostSharp.exe</p>
<p>Done building project &#8220;ConsoleDemoPostSharp.csproj&#8221;.</p>
<p>We then run the program and enjoy the power of PostSharp :</p>
<p>2010-04-17 23:29:12,705 [1] ERROR 2010-04-17 23:28:43,265 [1] ERROR D:\programe\youtube\loggingDemo\ConsoleDemoPostSharp\Program.cs ConsoleDemoPostSharp.Program [(null)] &#8211; postsharp :entering Void FirstFunction(Int64) &#8220;<strong>634071437232634478</strong>&#8221;</p>
<p>[more data]</p>
<p>So , as you see it gives you not only the trace , but also the value : <strong>634071437232634478</strong></p>
<p><strong> </strong></p>
<p>You can download code from <a href="http://msprogrammer.serviciipeweb.ro/wp-content/uploads/loggingDemo.zip">http://msprogrammer.serviciipeweb.ro/wp-content/uploads/loggingDemo.zip</a></p>
<h3>Additional resources</h3>
<p>Tracing : <a href="http://www.15seconds.com/Issue/020910.htm">http://www.15seconds.com/Issue/020910.htm</a></p>
<p>Enterprise logging : <a href="http://msdn.microsoft.com/en-us/library/cc309257%28v=MSDN.10%29.aspx">http://msdn.microsoft.com/en-us/library/cc309257%28v=MSDN.10%29.aspx</a></p>
<p>VS2010 with Dotfuscator : <a href="http://msdn.microsoft.com/en-us/library/ff460257.aspx">http://msdn.microsoft.com/en-us/library/ff460257.aspx</a></p>
<p>CCI metadata : <a href="http://ccisamples.codeplex.com">http://ccisamples.codeplex.com</a></p>
<p>Postsharp 2.0  improvements over 1.0  :  one of many examples here : <a href="http://www.sharpcrafters.com/blog/post/introducing-postsharp-2-0-1-notifypropertychanged.aspx" target="_blank">http://www.sharpcrafters.com/blog/post/introducing-postsharp-2-0-1-notifypropertychanged.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://msprogrammer.serviciipeweb.ro/2010/04/19/logging-and-instrumentation/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

