Plunging into .NET Development

Weblog Pieter Gheysens
Microsoft .NET Development - C# - Enterprise Library - Visual Studio 2005 Team System - Compuware DevPartner - ...
 


Tuesday, March 22

Pricing Visual Studio 2005 / MSDN subscriptions

A week ago I was looking (without luck) for this information while I was preparing a proposal for a Visual Studio 2005 development-environment and now it's finally (officially) published ...

On March 21, 2005, Microsoft detailed pricing and licensing for Visual Studio 2005 as well as simplification of its Microsoft Developer Network (MSDN) subscriptions.

When Visual Studio 2005 will be finally released (probably around September 2005), 5 new MSDN (Premium) Subscriptions will be introduced :
  • Visual Studio 2005 Team Suite
  • Visual Studio 2005 Team Edition for Software Architects
  • Visual Studio 2005 Team Edition for Software Developers
  • Visual Studio 2005 Team Edition for Testers
  • Visual Studio 2005 Professional Edition
There will also exist a MSDN Professional Subscription for Visual Studio 2005 Professional : the solution for professional developers working alone or in small teams.

You can find a nice summary of all this (prices included) at this MSDN-page.

Thursday, March 17

Add search to your blog/website

It might be no surprise that Google has many special features to help you to find exactly what you're looking for. By starting a simple search from Google, you can see that the searchstring is entered into the url.



In Google you can use special keywords to customize your search. The keyword "site" followed by a colon enables you to restrict your search to a specific site. In the example below I searched for the word "DevPartner" in my entire blog-website.



I found it very useful to search into a specific blog-archive or into a specific website. This and some JavaScript is all you need to build the search-capability into you own webpages [Update : I've added a KeyPressEvent on the inputBox]:

    1 <html>

    2 <head>

    3     <title>Search Google</title>

    4 

    5     <script type="text/javascript">

    6     function SearchGoogleByEvent(event)

    7     {

    8         //keyCode for EnterKey = 13

    9         if (event.keyCode == 13)

   10         {

   11             SearchGoogle();

   12         }

   13     }

   14 

   15     function SearchGoogle()

   16     {

   17         var currentSearchString = document.getElementById('SearchString');

   18         window.navigate('http://www.google.com/search?q='

   19             + currentSearchString.value

   20             +  '+site%3Akinnie.blogspot.com');

   21     }

   22     </script>

   23 

   24 </head>

   25 <body>

   26 

   27 <h1>Search My Blog</h1>

   28 

   29 <input type="text" name="inputSearchString" id="SearchString"

   30     OnKeyPress="SearchGoogleByEvent(event);">

   31 

   32 <input type="button" value="Search My Site" OnClick="SearchGoogle();">

   33 

   34 </body>

   35 </html>



Another interesting Search Feature by Google is the "link" keyword. The query link:URL shows you pages that point to that specific URL.

Update : be careful if you want to add a "google-search" to your blog/website. Read blogpost of David Cumps for more details.

Wednesday, March 9

Performance Tuning

Yesterday and today, I spent a lot of time on improving performance for specific methods in our application. Normally and hopefully tomorrow-morning (I must be present around 5 o'clock at work !!!) we will go into production with a new release of our application and for the first time we will use .NET Remoting to connect to other sub-applications in different AppDomains. We used already remoting for communication between our client-application and our server-application.

I simplified the situation in the following images. First we were planning to deploy our application on Server 1 and another application on Server 2.



Remoting is used between client and Server 1 and between Server 1 and Server 2. We also - because of bad performance - tried to deploy the other application on Server 1 and this happened to be the best solution in terms of performance for our application.



Remoting is still used between the two different AppDomains. We were quite surprised that the penalty of the network connection between Server 1 and Server 2 (situation 1) was so remarkable. The other application will still be deployed on another server, but this will be for other purposes. We only need the other application for data-collection and that's why it can be duplicated on Server 1.

In terms of performance, the .NET remoting plumbing normally provides the fastest communication between different application servers when you use the TCP channel and the binary formatter, but in situation 1 it really decreased performance because network traffic to other machines/servers increased a lot and network-traffic became our bottleneck.

Performance of certain method calls were also reviewed and luckily DevPartner came back to the rescue and I was able to pinpoint some bottlenecks with this excellent performance profiling-tool. DevPartner lets you really dig into the source code where you're able to see how many times a line of code is executed and how long it takes.

I was able to reduce the execution time (on my local development machine) of a certain procedure to less than 200 seconds instead of almost 400 seconds [almost 50% performance-gain] by applying custom caching of data-objects in hashtables and by sending bulk sql-statements (instead of separate sql-statements) to our database. The procedure is primarily responsible for converting data into xml-messages (with a lot of data-lookup) and for sending them finally to a message-handling process. In the scenario above, almost 400 messages were selected for sending. This message-sending stuff is done in a loop and becomes very data-consuming when a lot of messages are selected to send (everything works pretty fast when selected message-group is small). Before, all needed data was each time fetched in the loop while now only new data will be fetched (caching) in the loop and some data will be pre-fetched with a bulk sql-statement. This performance-boost was absolutely what we needed to not jeopardize our future release(s). We cannot afford a long execution time (time-out) for these important operations.

Differencing Disks in Virtual PC

David Cumps did an interesting post about differencing disks in Virtual PC. A base image (parent) of a virtual pc can be shared with other - unlimited - virtual machines (children). Disk differencing works by storing only the changes (delta) to an original image in a new VPC virtual hard-disk. I will certainly give this a try at home!

Advantages :
  • Your base image stays intact
  • Saving deltas means a lot less storage space
  • Setting up a new virtual machine (based on a base image) is lightning fast
In the comments on his post, David has also a solution for auto-updates by Windows.

Tuesday, March 8

Post Conference DVD TechEd 2004

A few weeks ago I requested a post conference DVD of TechEd 2004 (Amsterdam) on the contact-pages of the TechEd 2005 website. Normally I should have obtained it automatically because I attended TechEd 2004 but this was clearly not the case. Anyway, I received the DVDs yesterday and they contain all PowerPoint presentations and Windows Media Files of all conference sessions! I will surely take a closer look at some interesting sessions I could not attend ...

Don't forget to request your copy if you didn't get your post conference DVD of TechEd 2004!

Sunday, March 6

Line Chart Component [GDI+] - part 2

In part 2 (read part 1) I will try to highlight some other features of the chart component.
  • Colors



    The comboboxes are filled with all non-system colors and the labels next to the comboboxes display dynamically the selected color. Below you can find the code for filling the main area combo box. The other comboboxes are filled in the same manner.

                Array allColors = Enum.GetValues(typeof(KnownColor));

                ArrayList listOfColors = new ArrayList();

                string tmpColor;

     

                KnownColor tmpKnownColor;

                foreach (object color in allColors)

                {

                    tmpKnownColor = (KnownColor) color;

                    if (!Color.FromKnownColor(tmpKnownColor).IsSystemColor)

                    {

                        //Add only non-system colors to arraylist

                        listOfColors.Add(tmpKnownColor.ToString());

                    }

                }

     

                this.cmbMainArea.DataSource = listOfColors;

                this.cmbChartArea.DataSource = listOfColors.Clone();

                this.cmbCurve.DataSource = listOfColors.Clone();

                this.cmbGrid.DataSource = listOfColors.Clone();

     

                //Main Area

                tmpColor = ConfigurationSettings.AppSettings["BrushMainArea"].ToString();

     

                for (int i=0; i < cmbMainArea.Items.Count; i++)

                {

                    if (tmpColor == cmbMainArea.Items[i].ToString())

                    {

                        cmbMainArea.SelectedIndex = i;

                        break;

                    }

                }


    KnownColor is an enumeration of all available colors. The array allColors will consist of all "KnownColors" and the arrayList listOfColors will contain all non-system colornames that will eventually be shown in the combobox. The dataSource of the comboBoxes are then set to the listOfColors or a clone of it. Eventhandling is enabled for setting the backColor of the labels.

            private void cmb_SelectedIndexChanged(object sender, System.EventArgs e)

            {

                ComboBox cmb = (ComboBox) sender;

     

                switch (cmb.Name)

                {

                    case "cmbMainArea" :

                        this.lblColorMain.BackColor = Color.FromName(cmb.Text);

                        break;

                    case "cmbChartArea" :

                        this.lblColorChart.BackColor = Color.FromName(cmb.Text);

                        break;

                    case "cmbCurve" :

                        this.lblColorCurve.BackColor = Color.FromName(cmb.Text);

                        break;

                    case "cmbGrid" :

                        this.lblColorGrid.BackColor = Color.FromName(cmb.Text);

                        break;

                }

            }



  • Refresh of chart
    When the button is clicked all changes in the settings are pushed to the chart component.

            private void buttonUpdate_Click(object sender, System.EventArgs e)

            {

                //Update marges

                this.graph.UpdateMarges(Convert.ToInt32(this.txtTop.Text),

                        Convert.ToInt32(this.txtBottom.Text),

                        Convert.ToInt32(this.txtLeft.Text),

                        Convert.ToInt32(this.txtRight.Text));

     

                //Update colors

                this.graph.UpdateColors(cmbMainArea.Text, cmbChartArea.Text, cmbCurve.Text, cmbGrid.Text);

     

                //Invalidate

                this.groupBoxGraph.Visible = false;

                this.groupBoxGraph.Visible = true;

            }


            public void UpdateMarges(int top, int bottom, int left, int right)

            {

                this.marginTop = top;

                this.marginBottom = bottom;

                this.marginLeft = left;

                this.marginRight = right;

            }

     

            public void UpdateColors(string mainArea, string chartArea, string lineColor, string gridColor)

            {

                this.brushMainArea = new SolidBrush(Color.FromName(mainArea));

                this.brushChartArea = new SolidBrush(Color.FromName(chartArea));

                this.currentCurve.Color = Color.FromName(lineColor);

                this.brushGrid = new SolidBrush(Color.FromName(gridColor));

            }


    To repaint the usercontrol I first used the Invalidate-method of the graph component, but this didn't do the trick [I should further investigate why this didn't work]. So I used the visibility-property of the groupBox to trigger the paint-method.
Other features, like tooltips and scaling will be highlighted in another post ...

Wednesday, March 2

ASP.NET 2.0 on tour

Today the ASP.NET 2.0 tour arrived in Brussels, but because of heavy snowfall the speakers (David Platt and Dave Webster) were stuck in Copenhagen where they also did the ASP.NET tour. Their flight was delayed and they finally got here at noon. The morning-sessions were replaced by Prashant Sridharan (Senior Product Manager for Visual Studio) who specially came over at night from the Netherlands were he will give the keynote session for DevDays 2005. He gave here two interesting sessions about Visual Studio 2005. A lot of attention was paid to the key differences between the various products (product line overview).
  • Express Products
    Hobbyists, Students, Enthusiasts, Novices
  • Visual Studio 2005 Standard Edition
    Web Professionals, VB6 Developers, Part-Timers
  • Visual Studio 2005 Professional Edition
    Solo Professionals, Consultants
  • Visual Studio 2005 Team System
    Project Managers, Testers, Architects, Enterprise Developers
Visual Studio 2005 Team System will be the Rolls-Royce enterprise development tool because it will provide tools to support the entire software development team.
  • Team Architect
  • Team Developer
  • Team Test
  • Team Foundation
Like Team System, Visual Studio 2005 Professional will also contain Team Architect, Team Developer and Team Test but Team System will also include Team Foundation which will deliver a series of management tools : Team Build, Version Control, Work Item Tracking, Team Reporting, Project Portal, Integration Services and Project Management.

Other sessions I attended in the afternoon :
  • Moving from ASP.NET 1.1 to ASP.NET 2.0 [Dave Webster]
    Info about new compilation model and demos about side-by-side execution of 1.1 and 2.0 applications.
  • Introduction to ASP.NET 2.0 and Visual Studio 2005 [David Platt & Dave Webster]
    ASP.NET 2.0 will be a major release that includes significant new features that will define a new level of functionality. A lot of work has done to increase the productivity of developers. New cool features were shown like the GridView-control, databinding, login-controls, master pages, themes, configuration management, site navigation, database cache invalidation, ... All standard ASP.NET 2.0 controls are now built with a rich UI adapter extensibility architecture that enables rich customization of output for different browsers and devices. I also enjoyed the "fast" talk of David Platt : he certainly knows how to entertain an audience with some funny remarks/stories.
  • Personalization & Membership in ASP.NET 2.0 [Gunther Beersaerts & Bart De Smet]
    The last presentation of the day was about customizing Membership, Profiles, User Role Management, Web Parts, ... in short : building highly personalized dynamic web applications.
The day started with a re-arranged program/schedule, but I must say that the content and speakers were excellent! Nice job! For me, ASP.NET 2.0 was better delivered than on the Dev & IT Pro Days. The MSDN Events are not to be missed and that's also the reason why so many people (more than 1000) showed up today and they will come back if this quality is sustained.

Tuesday, March 1

MCSD .NET

Yesterday I passed my last exam (070-300) for becoming Microsoft Certified Solution Developer (MCSD) for .NET. It took me almost 2 years to take all necessary exams.
  • 31/03/2003 : 070-306
    Developing and Implementing Windows-based Applications with Microsoft Visual Basic .NET and Microsoft Visual Studio .NET
  • 23/07/2003 : 070-305
    Developing and Implementing Web Applications with Microsoft Visual Basic .NET and Microsoft Visual Studio .NET
  • 22/06/2004 : 070-310
    Developing XML Web Services and Server Components with Microsoft Visual Basic .NET and the Microsoft .NET Framework
  • 25/10/2004 : 070-229
    Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition
  • 28/02/2005 : 070-300
    Analyzing Requirements and Defining Microsoft .NET Solution Architectures
Working full-time as a consultant for a client makes it often difficult to plan/schedule the exams but after all it's not so bad that some time has elapsed between the different exams : it lets you in a way gradually grow in the .NET environment. I also think that the MCSD-certificate has a more theoretical value and that a lof of attention still has to be paid on the practical experiences. This doesn't mean that the exams are a waste of time, because they let you dig into topics you've never worked with before in practice and they give you a broader view of the possibilities you have in .NET. The combination of theory (what is possible and how should I apply it in an ideal situation) and practice (what have I learnt from the past) makes a good developer!