Jose R. Guay Paz

Most of the time on
ASP.NET, C# & SQL Server

Sponsors

this.blog.owner=

  • CSW Solutions
  • Follow Me
  • Works On My Machine

.NET Communities

  • INETA Latam

Blogs I Read

Websites I like

Windows 7 Testing & Deploying Tools

Still don’t have Windows 7 RC? Get it here: http://technet.microsoft.com/en-us/evalcenter/dd353205.aspx

This tools can help you manage your Windows 7 RC environment:

Microsoft® Assessment and Planning Toolkit

The Microsoft Assessment and Planning toolkit makes it easy for you to assess your current IT infrastructure in preparation for a Windows 7 migration. It includes the features previously provided with the Windows Vista Hardware Assessment Solution Accelerator, and delivers both system-wide readiness reports and drill-downs to specific PCs.

Application Compatibility Toolkit

The Microsoft Application Compatibility Toolkit 5.0 is a lifecycle management tool that helps you identify and manage your overall application portfolio. The toolkit can reduce the cost and time involved in resolving application compatibility issues, and help you deploy Windows 7 more quickly across your organization.

User State Migration Tool

The User State Migration Tool can help you improve and simplify your migration process. Capture desktop and application settings, user accounts, and users' files; then easily migrate them to a new Windows installation. You can use this tool for both side-by-side and wipe-and-load migrations. Click here to watch a video demonstration on how to migrate a user from a Windows XP environment to Windows 7.

Microsoft Deployment Toolkit

Microsoft Deployment Toolkit (MDT) 2008 unifies the tools and processes required for desktop and server deployment into a common deployment console with end-to-end guidance. MDT can help you reduce deployment time, standardize desktop and server images, limit service disruptions, reduce post-deployment help desk costs, and improve security and ongoing configuration management.

Code Metrics: An Introduction to Visual NDepend

In the second half of April I got an Email from Patrick Smacchia. I was very surprised, I mean, I’ve follow Patrick’s blog for some time and I though “this guy is really smart” so I was excited about getting in touch with him (starting from his side by the way), and while I’ve heard of his product Visual NDepend, I’ve actually never tried it and neither paid too much attention about the product itself. It was embarrassing because he was kind enough to offer me a Pro License to try it, evaluate it and see if it was functional and useful for me.

I said “Yes! Of course!”. Then started doing some research and reading and found about what was it for and how could I use it. Around that time, Scott Hanselman did his Hanselminutes Podcast 163 - Software Metrics with Patrick Smacchia so I was very excited and listened to the show about 3 times (sound was not that good, I think Patrick was not on a good phone line) and really got me into the code metrics thing.

image

So, here are my initial thoughts about Visual NDepend. I must say up front that I’m far from being an expert and that I have called this post “Introduction to Visual NDepend” for the same reason. I expect to use the tool more and be able to express myself in a more proper way in the near future.

I will start with the text from the Visual NDepend website:

NDepend is a tool that simplifies managing a complex .NET code base. Architects and developers can analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and master evolution by comparing different versions of the code.

The result is better communication, improved quality, easier maintenance and faster development.

Also, from the website, here are the list of metrics NDepend can generate for you:

  • 12 metrics on application:
    NbLinesOfCode, NbLinesOfComment, PercentageComment, NbILInstructions, NbAssemblies, NbNamespaces, NbTypes, NbMethods, NbFields, PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered
  • 18 metrics on assemblies:
    NbLinesOfCode, NbLinesOfComment, PercentageComment, NbILInstructions, NbNamespaces, NbTypes, NbMethods, NbFields, Assembly level, Afferent coupling (Ca), Efferent coupling (Ce), Relational Cohesion(H), Instability (I), Abstractness (A), Distance from main sequence (D), PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered
  • 13 metrics on namespaces:
    NbLinesOfCode, NbLinesOfComment, PercentageComment, NbILInstructions, NbTypes, NbMethods, NbFields, Namespace level, Afferent coupling at namespace level (NamespaceCa), Efferent coupling at namespace level (NamespaceCe), PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered
  • 22 metrics on types:
    NbLinesOfCode, NbLinesOfComment, PercentageComment, NbILInstructions, NbMethods, NbFields, NbInterfacesImplemented, Type level, Type rank, Afferent coupling at type level (TypeCa), Efferent coupling at type level (TypeCe), Lack of Cohesion Of Methods (LCOM), Lack of Cohesion Of Methods Henderson-Sellers (LCOM HS), Code Source Cyclomatic Complexity, IL Cyclomatic Complexity (ILCC), Size of instance, Association Between Class (ABC) Number of Children (NOC), Depth of Inheritance Tree (DIT), PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered
  • 19 metrics on methods:
    NbLinesOfCode, NbLinesOfComment, PercentageComment, NbILInstructions, Method level, Method rank, Afferent coupling at method level (MethodCa), Efferent coupling at method level (MethodCe), Code Source Cyclomatic Complexity, IL Cyclomatic Complexity (ILCC), IL Nesting Depth, NbParameters, NbVariables, NbOverloads, PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered, PercentageBranchCoverage
  • 2 metrics on fields:
    Size of instance, Afferent coupling at field level (FieldCa)

    Now, what I did was start with a small project I have and run the tool to see what I could get with the default settings. The end result was stunning. Once you select the solution to work with, you get the following screen that shows all the projects in the solution and all the libraries it will analyze:

    image

    This is the analysis it will perform (which is of course customizable):

    image

    And the reporting options:

    image

    After running the analysis we get several results, for example:

    Application Metrics

    • Number of IL instructions: 13081
    • Number of lines of code: 1952
    • Number of lines of comment: 1184
    • Percentage comment: 37
    • Number of assemblies: 7
    • Number of classes: 58
    • Number of types: 60
    • Number of abstract classes: 0
    • Number of interfaces: 0
    • Number of value types: 0
    • Number of exception classes: 0
    • Number of attribute classes: 0
    • Number of delegate classes: 4
    • Number of enumerations classes: 2
    • Number of generic type definitions: 0
    • Number of generic method definitions: 0
    • Percentage of public types: 98.33%
    • Percentage of public methods: 72.07%
    • Percentage of classes with at least one public field: 0%

    The numbers are interesting, but up to this point too general. So following with the results report we get more information:

  • image

    The following view is kind of weird, but it shows graphically the size of the assemblies with its methods:

    image

    Also, the dependencies of the assemblies (in large projects this view is very important):

    image

    image

    Assemblies build order

    1. CEO.PublicSite.DataEntities
    2. CEO.PublicSite.DataAccess
    3. CEO.PublicSite.BusinessLogic
    4. CEO.PublicSite.BusinessFacade
    5. CEO.PublicSite.WebControls
    6. CEO.PublicSite.Web
    7. CEO.PublicSite.Utilities

    NDepend information and warnings

    07/04/2009 21:46:04 Begin analysis with NDepend v2.12.1.3123

    07/04/2009 21:46:04 Retrieve dependencies of your application.

    Don't load a previous analysis to compare with.

    Assemblies loaded from {C:\Windows\Microsoft.NET\Framework\v2.0.50727} mscorlib.dll v2.0.0.0 System.Data.dll v2.0.0.0 System.Configuration.dll v2.0.0.0 System.Xml.dll v2.0.0.0 System.dll v2.0.0.0 System.Web.dll v2.0.0.0

    Assemblies loaded from {C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5} System.Web.Extensions.dll v3.5.0.0

    Assemblies loaded from {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.Web\bin} CEO.PublicSite.BusinessFacade.dll v1.0.0.0 CEO.PublicSite.BusinessLogic.dll v1.0.0.0 CEO.PublicSite.Web.dll v1.0.0.0 CEO.PublicSite.DataAccess.dll v1.0.0.0 CEO.PublicSite.Utilities.dll v1.0.0.0 CEO.PublicSite.WebControls.dll v1.0.0.0 CEO.PublicSite.DataEntities.dll v1.0.0.0 Telerik.Web.UI.dll v2009.1.527.35

    71 source files parsed ; all source files found ; all source files in-sync with PDB

    0 CQL constraint has been extracted from code.

    No dependency cycle detected in assemblies referencement graph.

    07/04/2009 21:46:12 Analyse dependencies of your application.

    07/04/2009 21:46:13 Building the report (standard).

    WARNING: Assembly {CEO.PublicSite.Utilities} doesn't contain any type.

    WARNING: No application or tier assembly found in directory {C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.BusinessFacade\bin\Debug}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.BusinessLogic\bin\Debug}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.DataEntities\bin\Debug}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.DataAccess\bin\Debug}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.Utilities\bin\Debug}

    WARNING: No application or tier assembly found in directory {C:\Users\jrguay\Documents\Visual Studio 2008\Websites\CEO.PublicSite\CEO.PublicSite.WebControls\bin\Debug}

     

    The result of the CQL Queries and constraints are quite large so I’ll include only one:

    WARNING: The following CQL constraint is not satisfied. 10 methods on 895 tested match the condition. --> Group {Code Quality}

    // <Name>Quick summary of methods to refactor</Name>

    WARN IF Count > 0 IN SELECT TOP 10 METHODS /*OUT OF "YourGeneratedCode" */ WHERE 

                                              
    // Metrics' definitions
         (  NbLinesOfCode > 30 OR              // http://www.ndepend.com/Metrics.aspx#NbLinesOfCode
            NbILInstructions > 200 OR          // http://www.ndepend.com/Metrics.aspx#NbILInstructions
            CyclomaticComplexity > 20 OR       // http://www.ndepend.com/Metrics.aspx#CC
            ILCyclomaticComplexity > 50 OR     // http://www.ndepend.com/Metrics.aspx#ILCC
            ILNestingDepth > 4 OR              // http://www.ndepend.com/Metrics.aspx#ILNestingDepth
            NbParameters > 5 OR                // http://www.ndepend.com/Metrics.aspx#NbParameters
            NbVariables > 8 OR                 // http://www.ndepend.com/Metrics.aspx#NbVariables
            NbOverloads > 6 )                  // http://www.ndepend.com/Metrics.aspx#NbOverloads
         AND 

        
    // Here are some ways to avoid taking account of generated methods.
         !( NameIs "InitializeComponent()" OR
           
    // NDepend.CQL.GeneratedAttribute is defined in the redistributable assembly
    //
    $NDependInstallDir$\Lib\NDepend.CQL.dll
            // You can define your own attribute to mark "Generated".
            HasAttribute "OPTIONAL:NDepend.CQL.GeneratedAttribute")

    And lastly in the report, some Type metrics:

    image

     

    Conclusions

    • The results are quite impressive. The tool can give you a lot of metrics in different levels of the solution.
    • The information about assemblies metrics can give you a very detailed idea in how the assembly is built, how big is it, how are the classes and methods constructed, how they are related to other assemblies and how the types are related to other types within/outside the assembly, and more.
    • One of the most important views is the assembly dependencies, it tells you how each assembly is related to other assemblies by showing for every assembly which assemblies it depends on and which assemblies are referenced by.
    • The CQL queries gives you information about the quality of the code based on metrics definitions. (this definitions can be customized).
    • The type metrics provide detailed information about the types in the assemblies at different levels such as lines of code, lines of IL code, relation with other types, etc.
    • This first review shows me a lot of power in the analysis and reporting capabilities of Visual NDepend (not to mention I didn’t customize any of the default settings).

    I will continue to use the tool and write a second review of the integration with Visual Studio.

    Thanks.

    How To: Install Windows 7/Vista From USB Drive [Detailed 100% Working Guide]

    This guide works 100% for Vista & Windows 7 unlike most of the guides out there. I have seen many sites/blogs that have “Install Vista from USB guide” but either with incomplete steps or not working guide. I have also seen some guides that don’t’ use proper commands in this guide. After spending many hours I have come up with this 100% working guide.

    I just did this method on one of my friends machine and installed the new Windows 7 BETA. The main advantage is that by using USB drive you will be able to install Windows 7/Vista in just 15 minutes. You can also use this bootable USB drive on friend’s computer who doesn’t have a DVD optical drive.

    The method is very simple and you can use without any hassles. Needless to say that your motherboard should support USB Boot feature to make use of the bootable USB drive.

    Requirements:

    • Motherboard supporting USB Boot.
    • USB Flash Drive (Minimum 4GB).
    • Windows 7 or Vista installation files.

    Bootable USB drive

    Full story here.

    Enjoy!!

    News: Telerik Q2 2009 Webinar Week, Prize Details and Schedule

    image

    Smell that? That's a freshly baked release from Telerik that's just about ready to "officially" launch. The Q2 2009 release is one of the biggest releases in Telerik's history, again delivering simultaneous updates to all 7 Telerik product lines at one time. An update of this scale is bound to have lots new and interesting stuff, and we can't wait to put it in your hands so you can start playing with it. The official launch of Q2 2009 is Monday, July 6th, and to help you jump-off with the new bits and maximize your productivity with the Telerik tools, we'll be running another release "Webinar Week."

    But before I reveal the schedule for the Webinar Week, let me tell you about the prizes!
    There will be two ways to win prizes during the Q2 Webinar Week:

    1. Every webinar will award 1 or 2 (depending on the products covered) individual product suite licenses to the people that attend the live event. All you have to do to enter is show-up to the live event and you will be in the pool for a randomly selected winner at the conclusion of the webinar (winners will be notified via email, so don't register with a spam address unless you don't care to claim your prize).
    2. For every live webinar you attend during the webinar week, you will also be entered in the drawing for the Webinar Week Grand Prize: a Telerik Premium Collection license (valued at $1300) and a pass to the 2009 PNP Summit (a $1900 value)! The more webinars you attend live, the better your odds are at winning the prize valued at over $3000.
    Plus, to get things kicked-off with a bang, we will be giving away a Premium Collection license to the winner of the first live webinar drawing (instead of a individual suite license), so you definitely don't want to miss the live events.

    Full story in Todd Anglin’s Blog.

    Best Video I've Seen Today Will Make You Smile

    http://gizmodo.com/5231112/best-video-ive-seen-today-will-make-you-smile

    If this video doesn't bring a tear to your eyes and makes you smile for the rest of the day, you are a cold hearted bastard. Watch it from beginning to end—you won't regret it.

    This cover of Stand By Me was recorded by completely unknown artists in a street virtual studio all around the world. It all started with a base track—vocals and guitar—recorded on the streets of Santa Monica, California, by a street musician called Roger Ridley. The base track was then taken to New Orleans, Louisiana, where Grandpa Elliott—a blind singer from the French Quarter—added vocals and harmonica while listening to Ridley's base track on headphones. In the same city, Washboard Chaz's added some metal percussion to it.

    And from there, it just gets rock 'n' rolling bananas: The producers took the resulting mix all through Europe, Africa, and South America, adding new tracks with multiple instruments and vocals that were assembled in the final version you are seeing in this video. All done with a simple laptop and some microphones.

    I don't know about you, but it blew me away. Best version of Ben E. King's classic I've ever heard in my life. And I've probably heard between five and two billion of them. [Playing for Change—Thanks to my friend Fernando]

    O sole mio: Trio Ginoble-Boschetto-Barone - Live

    Well, what can I say… Enjoy the following video, really amazing! They’re just kids!!

    The ASP.NET Capsule #14: How to automatically send a DevExpress XtraReport via Email

    The following example demonstrates how to automatically send a report via e-mail. To do this, a report should first be exported into one of the available formats. In this example, a report is exported to PDF, since this format provides the best output quality (the PDF result is as close to a report's print result as possible).

    You can find the full sample (with C# and VB.NET code) on: http://www.devexpress.com/Support/Center/e/E16.aspx

    The following source code assumes you have a button with a click event handler named “Button1_Click”. The XtraReport class is named XtraReport1.

       1:  using System;
       2:  using System.IO;
       3:  using System.Net.Mail;
       4:  // ...
       5:   
       6:  using System.Windows.Forms;
       7:   
       8:  namespace SendReportAsEMailCS
       9:  {
      10:      public partial class Form1 : Form
      11:      {
      12:          public Form1()
      13:          {
      14:              InitializeComponent();
      15:          }
      16:   
      17:          private void button1_Click(object sender, EventArgs e)
      18:          {
      19:              try
      20:              {
      21:                  // Create a new report.                
      22:                  XtraReport1 report = new XtraReport1();
      23:   
      24:                  // Create a new memory stream and export the report into 
      25:                  // it as PDF.
      26:                  MemoryStream mem = new MemoryStream();
      27:                  report.ExportToPdf(mem);
      28:   
      29:                  // Create a new attachment and put the PDF report into 
      30:                  // it.
      31:                  mem.Seek(0, System.IO.SeekOrigin.Begin);
      32:                  Attachment att = new Attachment(mem, "TestReport.pdf", 
      33:                                                  "application/pdf");
      34:   
      35:                  // Create a new message and attach the PDF report to 
      36:                  // it.
      37:                  MailMessage mail = new MailMessage();
      38:                  mail.Attachments.Add(att);
      39:   
      40:                  // Specify sender and recipient options for the e-mail 
      41:                  // message.
      42:                  mail.From = new MailAddress("someone@somewhere.com", 
      43:                                              "Someone");
      44:                  mail.To.Add(new 
      45:                      MailAddress(report.ExportOptions.Email.RecipientAddress,
      46:                      report.ExportOptions.Email.RecipientName));
      47:   
      48:                  // Specify other e-mail options.
      49:                  mail.Subject = report.ExportOptions.Email.Subject;
      50:                  mail.Body = "This is a test e-mail message sent by an 
      51:                               application.";
      52:   
      53:                  // Send the e-mail message via the specified SMTP server.
      54:                  SmtpClient smtp = new SmtpClient("smtp.somewhere.com");
      55:                  smtp.Send(mail);
      56:   
      57:                  // Close the memory stream.
      58:                  mem.Close();
      59:                  mem.Flush();
      60:              }
      61:              catch (Exception ex)
      62:              {
      63:                  MessageBox.Show(this, "Error sending a report.\n" +
      64:                                         ex.ToString());
      65:              }
      66:          }
      67:      }
      68:  }
    DevExpress CodeRush Xpress for C# & VB.NET

    Mark Miller from DevExpress just posted an incredible article on CodeRush Xpress.

    Here is a part of it:

     

    Download CodeRush Xpress - free from Dev Express!

    CodeRush Xpress is a powerful developer productivity tool from Dev Express. The product is free, licensed by Microsoft on behalf of all developers working in Visual Studio 2008 in all paid-for product skus (e.g., Standard, Professional, Team System). Note however that CodeRush Xpress will not load in the Express Editions of Visual Studio.

    CodeRush Xpress includes features that support common developer tasks in the following areas:

    FeatureSummary

    CodeRush Xpress fully supports all language features of Visual Basic and C# in Visual Studio 2008. If a specific feature applies to only one of these two languages, it will be noted with one of these icons:

    VB C#

    More details on CodeRush Xpress functionality follow.

    NavigateFeatures

    Navigate

    CodeRush Xpress includes seven powerful navigation features to make getting to that important location fast and easy.

    Camel Case Navigation

    You can move among the lowercase-to-uppercase transitions using Camel Case Nav.

    To move right, hold down the Alt key and press the Right arrow key inside a camel case identifier.

    CamelCaseRight

    To move left, hold down the Alt key and press the Left arrow key inside a camel case identifier.

    CamelCaseLeft

    Camel Case Nav is useful when you want to rename an identifier and change the name in a manner that keeps a portion of the existing camel case identifier. For example, if an existing identifier was called "StartTasks" and you wanted to rename it to "StartFilteredTasks", you could use Camel Case Nav to instantly get the caret between the "Start" and "Tasks" parts before typing in the…

     

    Here is the full story: http://community.devexpress.com/blogs/markmiller/archive/2009/06/25/coderush-xpress-for-c-and-visual-basic-2008.aspx

    News: Welcome to Telerik Labs

    This is the place where you can evaluate and become part of all the exciting technologies, innovations and products Telerik is working on. Here you will have early access to numerous interesting demos and samples as well as future additions to our product line. Feel free to download, explore, comment or just play around.

    Telerik Labs Home Page: http://www.telerik.com/community/labs.aspx

    Featured Projects

    RadDock for WinForms Beta

    RadScheduler for Silverlight Beta

    BugTracker Demo – a Silverlight Drag & Drop and MVVM Showcase

    Telerik IntelliSense for Expression Blend

    Telerik Visual Style Builder for RadControls for ASP.NET AJAX

    News: Telerik Webinar: WebUI Test Studio

    image

    On Wednesday July 1st, Falafel Software is offering a FREE webinar on ArtOfTest's WebAii Framework and the Automation Design Canvas.

    The following subjects will be discussed and demonstrated:

    1. Browser Support
    2. Test Regions
    3. Silverlight automation
    4. Ajax Testing
    5. Best practices.

    The Webinar will be conducted over GotoWebinar.com and upon registration you will receive the choices of Audio (VOIP or Phone) in several countries.

    https://www2.gotomeeting.com/register/830223259

    More Posts Next page »