Home | Blog | Publications | Photos | Services | About | Contact

Blog Archive - November, 2009

Back to Blog index.

Sun, 29 Nov 2009 08:18:19 GMT:
The new location for the Microsoft C# FAQ

Since the earliest days of .NET, Microsoft has published a C# FAQ, created by Microsoft's own developers/engineers and related MVPs in the community. This FAQ answers common questions related to the language, the compiler, and the .NET Framework along the way. I also had the chance to contribute few entries to the list.

Now, somewhat recently, the C# FAQ disappeared from it's old location, and relocated to a new one. This time, the format is a blog based one, and thus the logical place is under MSDN Blogs.

To check out the new C# FAQ, visit http://blogs.msdn.com/csharpfaq/.

Thu, 26 Nov 2009 16:03:26 GMT:
Microsoft Technology Days in Kuopio and Jyväskylä

I've had the pleasure to tour with local Microsoft Finland to different cities and talk about the Microsoft technology stack and Visual Studio and .NET development in particular. So far, we've visited Turku and Kuopio, and tomorrow Friday we'll visit Jyväskylä.

The tour features a day-long seminar type of session about current development topics, and naturally demos of many different technologies on the web, desktop and cloud.

If you are in Jyväskylä tomorrow, feel free to stop by! To join, visit the registration page. Welcome!

Mon, 23 Nov 2009 17:34:57 GMT:
Windows 7 and taskbar icon progress indicators

Windows 7 is a popular topic among developers, and the improved taskbar is easily programmable. A common question seems to be: how do I create an application that can show a progress indication on its own taskbar icon? Luckily, the answer is very simple: by using the Windows API Code Pack, you only need two lines of code. One line sets the state ("color") of the taskbar progress indicator (none, normal=green, error=red, etc.) and another the actual progress as a fraction.

Here is a simple example:

TaskbarManager.Instance.SetProgressState(
  TaskbarProgressBarState.Normal);
TaskbarManager.Instance.SetProgressValue(
  40, 100); // 40/100 = 40%

That's all there is to it! The above code will naturally require Windows 7, and if you try to run the code in, say, Windows XP, you will get a PlatformNotSupportedException exception. However, it is very easy to check whether the taskbar features are supported: just check the TaskbarManager.IsPlatformSupported property. Then, the total code could be:

if (TaskbarManager.IsPlatformSupported)
{
  TaskbarManager.Instance.SetProgressState(
    TaskbarProgressBarState.Normal);
  TaskbarManager.Instance.SetProgressValue(
    40, 100);
}

PS. If you can read Finnish, I wrote a simple tips article about Windows 7 development with Windows API Code Pack. Check it out on the Finnish CodeZone.

Sat, 21 Nov 2009 12:23:33 GMT:
Say hello to Microsoft Help Viewer 1.0

Many Microsoft products use the Document Explorer alias Microsoft Help 2.0 to show documentation. Advancements are being made on that front as well, and Visual Studio 2010 will become available with a new, improved help system called Help 3.0, or more recently, Help Viewer 1.0.

New features are, among others, XHTML support, ZIP-based file format, and the primary viewer the web browser. For more information about this new help system version, check out the Help 3.0 Team Blog.

Thu, 19 Nov 2009 19:25:26 GMT:
From PDC 2009: Azure 1.0, new IE and Silverlight 4 plans

Microsoft's premier developer event, PDC, is about to end, and as could have been guessed, many new things were announced. The highlights are details about the next Internet Explorer version 9, Azure's 1.0 production version at the end of the year, and Silverlight 4 beta. Sounds cool!

For the next few months, there's plenty of new stuff to learn and master. The PDC is always a burst of indepth technical information, and this year is not an exception. Details about the new technologies will surely be discussed here and on the web in general. And that's a good thing!

Sun, 15 Nov 2009 14:14:48 GMT:
My wishlist for the Visual Studio's IDE

While preparing for a migration course into Visual Studio development, I found myself thinking that while the loved Visual Studio is overall very good, there are some small things that could make the IDE even better. Currently, my personal wish list looks like the following:

Do you have ideas that ought to make it to the Visual Studio IDE? Send me an e-mail, or better yet, report your ideas to the Connect web site (login required)! I'd be glad to hear your feedback.

Thu, 12 Nov 2009 16:15:14 GMT:
Custom file based logging in ASP.NET MVC

If you are developing ASP.NET MVC applications, then especially in the beginning, you might wish to know exactly which route your requests are handled with. Or, if you are using AJAX a lot, verifying the calls on the server side can be difficult unless you can attach Visual Studio to your application.

Luckily, you can use so-called action filters in your MVC applications. Actions filters are attributes that implement the IActionFilter interface and descend from the ActionFilterAttribute class. This interface supports two methods, one of which is suitable for logging all the calls that come to a certain action method or a controller as a whole.

Here is a simple code example of a class that is able to implement file based logging:

using System.IO;
using System.Web.Routing;
...
public class LogCallAttribute : ActionFilterAttribute
{
    private void LogMessageToFile(string msg)
    {
        const string LogFileName =
            @"C:\Temp\MyMvcApp.log";
        File.AppendAllText(LogFileName,
            DateTime.Now.ToLocalTime() + ": "
            + msg + ".\r\n");
    } 

    public override void OnActionExecuting(
        ActionExecutingContext filterContext)
    {
        RouteValueDictionary route =
            filterContext.RouteData.Values;
        string location =
            route["controller"] + "/" +
            route["action"];
        LogMessageToFile("In action " + location);
    }
} 

With this class in your MVC project, you can then utilize the attribute in two ways, at the controller level or the action method level like this:

[LogCall]
public class HomeController : Controller
...
[LogCall]
public ActionResult About()
{
    return View();
}

Sounds simple? It is!

Mon, 09 Nov 2009 16:14:25 GMT:
From TechEd Europe: Microsoft purchases Teamprise from SourceGear

Microsoft's annual TechEd Europe is currently underway, and news are starting to flow. So far, I believe the most important bit of news is that Microsoft has qcquired Teamprise from SourceGear. Teamprice "enable[s] developers using the Eclipse IDE or operating on multiple operating systems, including Unix, Linux and Mac OS X, to build applications with Microsoft Visual Studio Team Foundation Server."

More news to follow, I'm sure!

Mon, 09 Nov 2009 16:00:25 GMT:
Visual Studio 2010 Beta 2 Training Kit (+ Windows 7 Kit)

Are you using Visual Studio 2010 Beta 2 already? If you are, why not take the best out of this new beta? The 'net has numerous resources available, but personally I like distilled packages of information. Frequently, the Training Kits are just what I'm after, and the Visual Studio 2010 and .NET Framework 4 Training Kit from late October is no exception. Recommended downloading.

Also, in case you are interested in Windows 7 development, check out the recent Windows 7 Training Kit For Developers.

Sun, 08 Nov 2009 08:28:04 GMT:
Spec Explorer helps you detect problems in your specifications

Microsoft has recently announces a new MSDN Labs project: Spec Explorer 2010. According to Microsoft, Spec Explorer is a "tool that extends Visual Studio for modeling software behavior, analyzing that behavior by graphical visualization, model checking; and generating standalone test code from models."

Thus, the tool can analyze your visual specifications (think for instance state machines)and point out problems in them. Also, testing code can be generated automatically.

Actually, Spec Explorer is not new, it has been around since 2004. But, this new 2010 version has been greatly improved, and thus worth the first look, or if you are already familiar with the tool from old days, a definite second look.

Check out the introductory video on Channel 9.

Thu, 05 Nov 2009 15:23:26 GMT:
Two articles to read: security in .NET 4.0 and SQL Server disaster recovery

The recent issues of MSDN Magazine and Technet Magazine feature two interesting articles for the techinal/developer audience. First, there's an article about the new security features in .NET Framework 4.0, and then there is an article about how to recover SQL Server data after a disaster.

Recommended reading!

Mon, 02 Nov 2009 15:42:42 GMT:
What is the Visual Studio 2010 Lab Management feature?

Hello, November! If you have already downloaded and started using Visual Studio 2010 Beta 2, you are probably enjoying the new and improved features. In the Team System (or should we say, Team Foundation Server from now on) there is a completely new feature called Lab Management, which I haven't seen implemented in other Windows development tools before.

The idea of Lab Management is to help developers and testers test their applications automatically in virtual machines. Lab Management uses virtual machine provisioning with the help of System Center Virtual Machine Manager (SCVMM), and can launch and tear down virtual machines automatically and run your tests in them as you prefer.

This can bring tremendeous time savings in testing, as you don't anymore need to manually set up testing machines, either physical or virtual. Instead, you can use Lab Management to automatically run tests on say, Windows XP, Vista and Windows 7. Or, on multiple IIS web server versions, if that's what you need.

Sounds like a novel implementation to me, though the idea of virtual machine automation is not completely new, as demonstrated by my article from November, 2008.

 

› Blog Archive