DCSIMG

 Subscribe in a reader

January 2009 - Posts - Guy kolbis

January 2009 - Posts

image

According to Soma Microsoft recognize that developers are more and more doing a broader set of things. For example creating Databases, Tables, Stored Procedures and etc.

As a result Microsoft had announced a change in the licensing offering and a new integrated Visual Studio Team System 2008 Development Edition is available now.

"It brings the feature sets of Team Development Edition and Team Database Edition together and allows you to take advantage of the core tools for application development as well as the necessary tools for database development. This will provide you and your development team with an all-in-one tool to make it easy for you."

Visual Studio Professional customers can now enjoy the benefits of this combination of team editions by purchasing either a license of Visual Studio Team System 2008 Development Edition with an MSDN subscription or a license of Visual Studio Team System Database Edition with an MSDN Subscription. Once purchased, the bits will be available on the MSDN Subscriber download site.

If you purchase Team System Development Edition (Team Dev + MSDN), you will see Visual Studio Team System Database Edition (Team DB + MSDN) bits in your download list.

בדרך כלל כשאני מנסה לבטל מנוי, בין אם זה לעיתון או לכבלים או לכל דבר אחר אני חושש...חושש מהשיחה עם הנציגים שבצורה אגרסיבית ובכל כוחם מנסים למנוע את הביטול הזה.

קרה מצב שבו הייתי צריך היום לבטל את המנוי שלי לעיתון...זה לא בגלל המצב הכלכלי...אבל רציתי לבטל. חנה, ידידתי הטובה מאחת החברות להן אני מייעץ סיפקה לי עצה:

"פשוט תגיד שאתה עובר לחול"

איך לא חשבתי על זה?

התקשרתי, ביקשתי לבטל, הועברתי "למרכז המשכנעים".

מרכז המשכנעים: למה אתה רוצה לעזוב?

עניתי: אני עובר לחו"ל.

מרכז המשכנעים: "למה?"

אני: מה זה משנה? אני עובר!

מרכז המשכנעים: טוב תודה.

קצר וקולע!

תודה חנה.

The lock keyword in C# is used to synchronize threads and to allow a simple way to write thread-safe code. It has a really simple usage:

lock (syncObject)
{
    //do something
}

Behind the scenes the compiler will convert the code into:

Monitor.Enter(syncObject);
try
{
    //do something 
}
finally
{
    Monitor.Exit(syncObject);
}

Having said that, the lock keyword can be dangerous because it can lead to deadlocks. In this post I will supply a small solution to this problem:  "Lock with timeouts".

Consider this code:

if (!Monitor.TryEnter(syncObject, TimeSpan.FromSeconds(5))
{
    throw new ApplicationException("Timeout waiting for lock");
}
try
{
    //do something 
}
finally
{
    Monitor.Exit(syncObject);
}

As you can see with this code I use Monitor.TryEnter and not the Monitor.Enter. That means that if within the given time-span I will not acquire a lock, I will through an exception and will prevent a deadlock possibility. If the compiler could generate this code from the lock keyword we could have use it for "Timed Lock". However, this is not the case.

This solution will insure that you will never have a deadlock that is caused by the lock keyword.

The TimedLock struct

The solution is based on Ian Griffiths post. To sum things up for you, here is what you need to do in order to implement TimedLock:

using System;
using System.Threading;

#if DEBUG
public class TimedLock : IDisposable
#else
public struct TimedLock : IDisposable
#endif
{
    public static TimedLock Lock (object o)
    {
        return Lock (o, TimeSpan.FromSeconds (10));
    }

    public static TimedLock Lock (object o, TimeSpan timeout)
    {
        TimedLock tl = new TimedLock (o);
        if (!Monitor.TryEnter (o, timeout))
        {
#if DEBUG
            System.GC.SuppressFinalize(tl);
#endif
            throw new LockTimeoutException ();
        }

        return tl;
    }

    private TimedLock (object o)
    {
        target = o;
    }
    private object target;

    public void Dispose ()
    {
        Monitor.Exit (target);

        // It's a bad error if someone forgets to call Dispose,
        // so in Debug builds, we put a finalizer in to detect
        // the error. If Dispose is called, we suppress the
        // finalizer.
#if DEBUG
        GC.SuppressFinalize(this);
#endif
    }

#if DEBUG
    ~TimedLock()
    {
        // If this finalizer runs, someone somewhere failed to
        // call Dispose, which means we've failed to leave
        // a monitor!
        System.Diagnostics.Debug.Fail("Undisposed lock");
    }
#endif

}
public class LockTimeoutException : Exception
{
    public LockTimeoutException () : base("Timeout waiting for lock")
    {
    }
}

In order to use it:

using (TimedLock.Lock(obj))
{
}

You can read the Ian's post here.

Charles Sterling wrote that Microsoft had published a new white paper on Team System Web Access Scalability Limits. image

According to Charles:

"This article explains the scalability limits of Team System Web Access and provides three workarounds to improve the total number of concurrent users that Web Access can support including a neat batch command that will recycle IIS and clean up the TSWA cache."

So I had to check it out and after digging it for a while, here are the top notes I derived:

  • It is not recommended to have more than 100 concurrent users using a single Web Access instance.
  • Each Web Access user uses a substantial amount of memory to store work item tracking objects in an ASP.NET session.
  • On 32 bit operating systems, a single process (such as Web Access) can use up to 2 GB memory, which means the total number of concurrent users will be limited to approximately 100 if each user session consumes about 20 MB memory.
  • A large number of concurrent users might cause lock contention issues with the metadata cache files.

The White Paper also contains information about the Load Tests that were executed against the Web Access and workarounds.

You can download it from here.

Last week I visited a customer which is located in England. One of the many things we did is configuring the Web Access. The web access allows users to most of the operations that are available in the Team Explorer using a web browser.

On thing that I really love is the work items view in the web access. One of the problems with the Team Explorer work items view (for instance when you execute a query) is that you cannot see the work items hierarchy. Let me explain that for a minute. Let say that your product manager has gathered a new requirement and added it to TFS as a requirement. Now lets say that from this requirement you have derived 2 Tasks, one for development and the other for testing. So, you have a requirement and 2 tasks that are related to it. In order to relate tasks to requirement, you need to link these tasks using the Links tab in the work item. In the Team Explorer it is hard to see the related / parent work items. However in the Web Access Work Items view, it is displayed really good, as you can see in the following image:

7

What do you think?

Problem Space

Network utilization is an important performance indicator, in fact, there are four critical performance indicators: CPU, Memory, IO and Network.

Having said that, how do you know that is your network utilization?

I am sure you know that the Task Manager allow you to see the network utilization

image

In Vista you can also use the Reliability and Performance Monitor

image

But, what about windows performance counters? How can it be that Microsoft did not publish any performance counter for Network Utilization?

If you are asking yourself "why do I need Network Utilization performance counter?", here is an example:

Microsoft Visual Studio Team Edition for Testers supplies a load testing tool. During the load test you can collect information about critical resources from all machines in the lab. This way you will collect information about the CPU, Memory, IO and Network. Understanding how your network behaves is important. The load test tool is using Microsoft performance counters to gather this information.

Having said that, it is obvious that there needs to be basic information about the network utilization, right?

The Solution

The solution will be to create a custom performance counter that will use the information that is available and will expose the network utilization.

Fortunately, Keyvan Nayyeri posted on the matter.

You can read about the solution here.

You can get the code here.

I have grown to love working with fiddler. Fiddler is a debugging proxy that allows you to monitor HTTP traffic (requests and responses).

Lately I have encountered an issue within Fiddler that prevented it from capturing HTTP requests that were addressed to the localhost.

After googling it I found Rick Strahl's post that share some light on the matter:

"If you’re using Fiddler with a localhost or 127.0.0.1 address you’ll find that Fiddler will not monitor requests. The reason for this is that local addresses typically bypass any proxies (and the network adapter in general) and so localhost or 127.0.0.1 doesn’t show up.

Luckily there’s an easy workaround for this: Instead of using a local address use the NetBios Machine name or the local IP address:

http://<machine name>/weblog/default.aspx

or

http://<ip address>/weblog/default.aspx

And voila you have access to local addresses."

In addition and for those of you who use Cassini (The Visual Studio Web Server) and want to capture HTTP requests, Rick says:

"What about the ASP.NET local Web Server (Cassini)? There’s a nasty hack for accessing Cassini requests through Fiddler:

http://127.0.0.1.:88/default.aspx

Notice the . after the 127.0.0.1 and before the port number. I’ve only have luck in using 127.0.0.1.  as the domain/address -localhost or the local machine name don’t work."

Another option of using Fiddler and Cassini is putting an extra line in the hosts file:

127.0.0.1 development

Than you can use http://development:<port>.

Additional Resources

I hope this will help.

Have you ever thought of selling your test cases?

I am pretty sure that most of you have not. This is not surprising because usually the Test Cases are written for internal usage and thus are not in such a quality that will allow you to "sell" them or even to "reuse" them internally, right?

Have you ever thought why nobody sells them?

I believe that there are several reasons, here are two of them:

  1. Never thought about Test Cases as an assets.
  2. The code is purely designed and implemented.

According to Microsoft, this is something they are thinking of. James Whittaker blogged about it and you can read about it here.

Think about it, creating libraries of test cases that can be reused by others...sounds interesting, no?

What do you think?

NOTE: Test Cases can be manual test cases that are composed using Excel, Word, Test Director and so forth, however I mean Automated Test Cases.

kolbis כתב בתאריך Monday, January 19, 2009 2:56 AM
תגים:, ,

So, you want to install team foundation server...It is about time :)

This post is referring to those of you who already decided on Team Foundation Server and tools as an ALM supporting platform and want to set up the machines that will host the Team Foundation Server. For those of you who just want to play with it for either evaluation or for learning, I suggest you use a Virtual PC (an image) or a trail version.

The Basics

  1. Prepare one machine and virtual machine. The first machine will hold the team foundation server that will consist of both the application tier and the data tier. The virtual machine will be dedicated for the build server. I prefer using a virtual machine because I can control later on on the actual resources that will be allocated to the machine.
  2. The basic installation on the first machine will include MSSQL 2005, Windows Server 2003 with service pack 2, IIS 6.0 and the TFS.
  3. The basic installation on the virtual machine will include Windows Server 2003 with service pack 2 and the Team Build Service.

NOTE: This is the basic installation that will allow you to start working with TFS.

What Else?

Consider adding to the basic server installation some more advanced features:

  1. Team Server Proxy - If you are having issues with performance, or you are planning the capacity for your Team Foundation Server machine, consider using the proxy option that will help you with the source control performance.
  2. Team System Web Access with SP 1 - If you want to allow access the TFS work item tracking and etc. for either customers or from users that have no Team Explorer installation, make sure yo install the Web Access with Service Pack 1.
  3. Team Explorer - I found out that having the Team Explorer on the server is important useful and it is free.
  4. Power Tools & Sidekicks - Those tools are MUST. Configuring security, groups, editing the process templates and setting alerts are only some of the features. I find it very important to have it also on the server.

Didn't We Forget Something?

  1. Backup plan - it is important to create a backup plan that will allow you to restore the team foundation server at any time to any state. You will need to backup both the application tier and the data tier. In this case both tier reside on the same machine. You should backup both the Team Foundation Server Machine and the Team Build Machine.

NOTE: The following is my recommendations based on my experience.

Enjoy!

Microsoft had release a new version for Windows Live Writer (version 14.0.8050.1202).

image

"Windows Live Writer makes it easy to share your photos and videos on almost any blog service. With Writer, you can preview everything you’re adding to your blog, and see exactly how the fonts, spacing, colors, and images will look, before you publish. It's fast and easy to make photos and videos look great on your blog. You can even create a photo album—just select the style you want and Writer takes care of the rest. Writer is already packed with useful features, but if you like to tinker, there are all sorts of plug-ins you can add to help you do even more."

You can download it here.

kolbis כתב בתאריך Friday, January 16, 2009 10:49 AM
תגים:,

TFS supports client credentials security, where a user must enter a valid username and password in order to connect to the Team Foundation Server. This is a basic level of security.

However, sometimes it is not enough and you also want to make sure that the machine that is being used to access the Team Foundation Server is also authorized.

Brian Harry wrote about how to configure Client Certificates to allow an additional level of security. You can read about it here.

I am off to a customer that is located at Norwich. This will be the second time I will visit England. However this time I am going to stay over the weekend. I am due to return to Israel on the 22nd.

I am looking for ideas on what to do there over the weekend. I have a car and a GPS...Any suggestions? So, if you have any offer, please share it with me.

Thanks

I am off to a customer that is located at England. I am going to support the customer in the process of migrating to Team Foundation Server. Now let me clarify that. Migrating to TFS is not only about installing the server and migrate to Team Source Control, it is much more.

Yes, installing TFS is much easier than it was on the 2005 version, and in most cases a well capable system administrator can perform do it by himself. So, why choosing us?

The job of migration include many aspects, the most important one in my opinion is to be able to see the big picture, To be able connect and think about every aspect application lifecycle.

Personally, I love the fact that I am able to help customers fix and support their software development management. Allowing them to practice Agile development, XP, SCRUM, CMMI and etc.

This is not something you "Install", it is something you practice!

Team System is big. There is the source control, the build engine, the Work Item tracking, the reports and there are the VS clients, the Developer, the tester, the DBA, the architect, the team explorer. These are all tools. But the tools are there to support methodology!

That is where we come in.

The consulting group in SRL (that include the ALM consulting group) is an elite group of people with the experience of over 50 projects in TFS migration that are capable of all of the above.

One thing I love about Amsterdam Airport is that you can find recharging locations to recharge your phone, laptop and so forth. We do not have it at Tel Aviv...So, 1 Amsterdam, 0 Tel Aviv.

While I was charging my laptop, I tried to connect to the Internet. Apparently, in Amsterdam you have to pay for it...where at Tel Aviv you get it for free!

1 : 1

Of course I am talking "geekly" wise...If you know what I mean... :)

James Whittaker say that testing is Hard and I quote:

“Software testing is complicated by an overload of variation possibilities from inputs and code paths to state, stored data and the operational environment. Indeed, whether one chooses to address this variation in advance of any testing by writing test plans or by an exploratory approach that allows planning and testing to be interleaved, it is an impossible task. No matter how you ultimately do testing, it’s simply too complex to do it completely."

James suggests a new approach for testing called Exploratory Testing. According to James, Exploratory Testing is:

"...exploratory techniques have the key advantage that they encourage a tester to plan as they test and to use information gathered during testing to affect the actual way testing is performed."

This can prove to have some key advantages over plan-first methods. James gives a good explanation:

"...imagine trying to predict the winner of the Super Bowl or Premier League before the season begins … this is difficult to do before you see how the teams are playing, how they are handling the competition and whether key players can avoid injury. The information that comes in as the season unfolds holds the key to predicting the outcome with any amount of accuracy. The same is true of software testing and exploratory testing embraces this by attempting to plan, test and re-plan in small ongoing increments guided by full knowledge of all past and current information about how the software is performing and the clues it yields in the testing results."

I am looking forward to see how to practice that.

What do you think?

More Posts Next page »