Dear visitor, thanks for stopping by! If you want, you can follow all updates on Snowball.be via RSS. You can also follow me on Twitter or Facebook. More interesting posts from other Microsoft Regional Directors can be found at The Region.
Gill Cleeren     .net | .NET 4 | C# | Silverlight | sl4 | VS2010     April 12, 2010    

After beta’s and one RC release, starting today, we can get our hands on Visual Studio 2010 RTM. Just hours ago, Microsoft held a keynote on the release of their flagship IDE, Visual Studio 2010. This release coincides with the release of .NET 4.0 and of course Silverlight 4, which has its official launch event tomorrow. This marks probably the largest release ever for developers from Microsoft.

 image

I need it badly

Visual Studio 2010 is like honey, developers swarm to it. It’s understandable that you want to get your hands on the bits. Where can you get them?
If you’re an MSDN subscriber, you’re in luck, as you can get all the bits from the MSDN subscription site. (http://msdn.microsoft.com/subscriptions)
If you are not, you have the following options:

image

 

Why you need it

If I wanted to make a list of reasons why you should be upgrading to Visual Studio 2010, I would be up all night I think. Since it’s quite late already, I’m going to make an all-but-complete list with my top features that make Visual Studio 2010 an not-to-miss upgrade. (For the complete list – you’re warned, it’s very complete – take a look here: http://msdn.microsoft.com/en-us/library/bb386063(VS.100).aspx)

The IDE looks really stylish!

Upon opening Visual Studio 2010 for the first time, you’ll immediately notice that something happened… Something big. No longer the traditional grey interface, but an exciting new look for the place you spend all your development hours in. Built entirely in WPF, the new shell offers plenty of extension points so you can make it feel even more like home.

image

New IDE features

I personally like the Navigate To function a lot (I blogged about it yesterday here: Visual Studio 2010 Tip- Navigate to functionality). Another one I like is the zoom in/out we can now do in the code editor. This is a real life-saver when doing demos on stage or when showing someone some code. Simply keep CTRL key pressed and rotate that mouse wheel of yours. For people who work on multiple monitors, Visual Studio now supports this much better!

Some other nice features:

  • Improved IntelliSense
  • Highlight references
  • Stub generation

New framework and languages

Visual Studio 2010 comes packed with new releases.

  • Silverlight 4 :) More on this at the launch event tomorrow!
  • C# 4.0 adds interesting new features to the language (more here). Also VB.net developers aren’t left outside in the cold, their favorite language gets an upgrade as well to Visual Basic 2010.
  • ASP.NET 4.0 as well as MVC 2 are born! If you want to get an overview of what’s new, download my talk of DevDays 2010 here. Most striking new features in WebForms 4 are client IDs, control over ViewState and more control over the HTML that’s being rendered.
  • Entity Framework makes a jump and goes straight to v4.
  • WCF and WF both get an upgrade to v4 as well.
  • TFS installation gets really simple using TFS Basic.
  • F# is now available for the functional programming needs.
  • SharePoint templates!

I want more

Not enough reading material for your brain? A free ebook is made available “Moving to Visual Studio 2010” here.

Warnings here!

Something to watch out for: currently, the Windows Phone 7 tools do not work with the RTM version of 2010. Read more on this here: http://forums.silverlight.net/forums/t/175181.aspx 

image

  Posted on: Monday, April 12, 2010 11:54:13 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     C#     July 24, 2008    

From Channel9, one of the most interesting vids at the moment!


C# 4.0: Meet the Design Team

What's the C# team up to these days? Who's on the C# 4.0 design team, anyway? With the looming problem of manycore facing developers now and certainly in the near future (to a much greater extent - programming for 80 core (asymmetric to boot) processors, anyone?). I thought it was time to find out what Anders et al are working on to get a clear sense of C#'s near (and not-so-near) future so I asked if I could come to one of their design meetings to have an informal chat (are we ever formal on C9?) and meet the people behind the next iteration of the most popular .NET programming language.

There are some new faces (and some old ones (not in terms of age, mind you ). As expected, merging functional constructs into imperative C# are still top of mind for the C# design team. Here, you'll meet some new programming language gurus and some old time Niners (you'll recall the great Eric Lippert. He was in fact the very first developer we interviewed for C9 back in 2004 - even though his was not the first interview posted, it was the first one shot and the one where Lenn, Jeff, Scoble, Bryn and myself looked at each other and said "wow, we are on to something here!".).

C# 4.0 will contain many new features that will help developers be, yeah, you've heard it before, more productive. There's also some very interesting work going on with adding dynamic constructs to the language, which is of course very interesting given the static nature of the C# language.

In this video you will not get any specific details since the C# team wants to reveal exactly what they've done at PDC 2008. That said, you'll still get a very clear sense of what they've been up to and where they're taking the language.

It's always a pleasure to chat with Anders and team. I think you'll enjoy this one. On a personal note, I was coming down with a cold during this interview so please excuse the asking of the same question more than once (though in a different context). Oh, the joys of cold medicine. You know, the same stuff Lenn was on when he conceived the idea of Channel 9 several years ago.


 

  Posted on: Thursday, July 24, 2008 11:03:51 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | .net 3.5 | C# | Microsoft     December 9, 2007    

Earlier this month, Microsoft posted the first "blueprint" of a series that will help developers more easily build Software plus Services (S+S) applications. The project was released as a project on CodePlex, the open-source community from Microsoft.

This first blueprint is intended for developing S+S applications with Outlook 2007. Microsoft plans to offer blueprints for other office business applications, e-commerce, media/community and mobility.

The Outlook + Services Blueprint download -- available as a single file or two files -- includes the S+S framework, source code, Outlook Plus Services add-in library, workflow and other guidance. The blueprint is designed to help developers expose data and integrate services into Outlook 2007. It requires Outlook 2007, SQL Server Express 2005 and Visual Studio 2005.

Within the S+S framework, developers open up an Outlook + Services Visual Studio project and learn how to extend the e-mail app based on the guidance provided in Overview, Workflow and Detail tabs (a step-by-step walk-through). Microsoft expects to distribute a "more sophisticated" developer example, dubbed "My eBay," which features eBay Web services, a custom ribbon interface and HTML from an eBay page, in short order.

Source: reddevnews.

  Posted on: Sunday, December 09, 2007 3:02:11 PM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .net | .net 3.5 | ASP.net | C# | Silverlight | Visual Studio.net     November 20, 2007    

Finally, we can present the RTM version of the Visual Studio 2008 RTM Training Kit.
This kit is a real goldmine, containing presentations, Hands-On-Labs, demo's... on all topics related to Visual Studio 2008.
Now you only have to find about 5 days to complete all that's in here, and you're set!


All the info is below:
The Visual Studio 2008 Training Kit has been updated for the RTM and has been released on the Microsoft.com Download Center for anyone to download and use.

The Visual Studio 2008 Training Kit contains a full 5-days of technical content including 20 hands-on labs, 28 presentations, and 20 scripted demos.   The technologies covered in the kit include:  LINQ, C# 3.0, VB 9, WCF, WF, WPF, Windows CardSpace, Silverlight, ASP.NET Ajax, .NET Compact Framework 3.5, VSTO 3.0, Visual Studio Team System, and Team Foundation Server. 

Originally developed for early adoption work with ISVs, it is now available to all. 

You can download the entire training kit from the download center here:  http://go.microsoft.com/?linkid=7602397.  The kit is just over 120MB compressed.   After downloading the kit, simply run the installation program to extract the contents to your local machine.  Once the installation process is complete, you will see an HTML page that allows you to navigate through the contents of the kit.  

  Posted on: Tuesday, November 20, 2007 10:51:38 PM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     ASP.net | C# | Microsoft | Visug | WPF     March 29, 2007    




I just got home of DevDays 2007 (and now already I'm typing a report...), and man, it was a fun ride! If you weren't there, you did miss out on  great sessions and great fun (and great little pies... still don't know what was in them, but they tasted great). In my DevDays report, I want to highlight some of my personal 'fav-moments', some nice little tools I learned about and show some of my pics I took (maybe you're on them somewhere...).

(I wasn't at the pre-conference, so no report on March 27th...)

 


Day 1
6.00 am. Very early... Must get up to avoid traffic jams.
7.30 am. Breakfast at ICC Gent, avoided all traffic jams (jeej).

The day began like usual with an opening keynote, given this year by David Chappell. He went over what he thought would be the most important Microsoft-related innovations for 2007. These included the .net 3.0 framework, Forefront, Security Center and Longhorn Server.
 
After that, I went to the Blend demo, given by Carrie Longson. She showed some XAML effects created easily using Expression Blend. After that, she showed some impressive applications created with WPF. One of these was an application created by Microsoft UK for the Londen Underground (the tube). It was able to give an overview of the trains, where they were, all rendered in real time. It was even possible to rotate the viewport, completely in 3D. The application, while very impressive, took only 3 weeks to create with WPF.

Jeff Prosise is the speaker I saw the most sessions of (you'll find him again later in this article). The first one on Asynchronous ASP.net was impressive. He showed how to (and how not to) program threaded ASP.net. Doing this correctly can create a vast scalability for your web application. I hope to find some time to blog on some of his thoughts on this subject (hold your breath).

Up next was the first of 2 sessions of Raj Pai. This first one on Linq (.net Language Intergrated Query framework) explained in depth the possibilities of this extension of C# that will be included in C# 3.0. While the syntax on some moments still feels weird (it's odd to see Select and From in your C# code sometimes, even if you've been playing with it for some time), the session was very clear.

Like I said, Jeff Prosise would come back in this article. The next session I attended, Optimizing and Extending ASP.net Ajax, was very helpful for me. I've doing quite a lot of Ajax in the last months, but 1 thing I didn't use a lot yet, is the Ajax Client Script Library (the javascript). This library is not documented very well at this moment, so it's sometimes hard to figure out what you can do with it, and even harder how to do it. Luckily, this session cleared some clouds in my brain, so I think I'm on my way with it now!

The last session of the day, Hardcore debugging of .net applications given by "Mr Type Fast" Ingo Rammer was easily the one where I learned the most. I didn't know what to expect from it, but the demo's of this session literally blew me away.
He started by showing how to use WinDbg (WinDebug). While this is not a .net debugger, it can be used (loading in some DLLs) to debug running (production) .net applications. I actually never knew this was possible. This program is not the most user friendly, but it can be a real time saver. It does however use a lot of commands, and so I hope this session will certainly be included with the DVD.
He went on showing some other interesting tools. ADPlus is another tool (command line) that can be used to create a memory dump on any PC, that can afterwards be analyzed using WinDbg. Using these 2 can give you insight on why an application crashes or hangs.
The last shown tool was HawkEye. The free version can be used to inspect any .net forms application: you can see all properties of any control (name, color...) on a forms application.

After that, Visug, the Belgian Visug Studio User Group (of which I'm the webmaster), organised a bowling in Gent. We started playing at 9 pm, but due to a blackout in a large part of Gent, we were forced to stop playing around 10 pm.

1 am: in bed ;-)

       

Day 2

6.00 am... you know the story...

The day started with the second session of Raj Pai, that closely intergrated with the session of day 1. In this session, he explained the new features of C# 3.0 (of which I'll be blogging in the coming weeks): extension methods, automatic properties, how LINQ works internally...

I was lucky enough to be able to attend 2 "sidemeetings" with 2 speakers, namely Raj Pai and Jeff Prosise.
At 11am, I met in person with Raj on the top floor, and together with some collegues of Ordina, we got to ask him questions on LINQ and C# 3.0 .
He explained in detail what went on behind the scenes when you run a LINQ statement. Seeing this more or less eased me! On my question on how you could debug a LINQ statement, he advised me to break the statement into pieces, and add a ToList() to each part. That way, you can easily see what each part of the statement actually returns.

Another question we asked was the following: how do you see LINQ in a DAL? Sadly, on this topic, they're actually still working themselves, and he promised that some white papers will be available soon.

I also asked his vision on the "over-use" of extension methods in C# 3.0. Using these methods, you can for example write your own System.String.In() method. Personally, I think this will make code review very hard. Raj agreed with me, and said there will be some patterns and practices available later on when to use these methods.

Due to this private session, I was unable to attend the session given by my collegue Kurt Claeys. I did hear nothing but positive comments afterwards, so Kurt: congrats!

The next session I attended was again one given by Jeff Prosise, this time on WPF/E.
This session was closely followed by my second private session, this time with Jeff. During this session, we talked on the future of the 3 web technologies Microsoft is currently using/developing: ASP.net 2.0, WPF/E and ASP.net Ajax. He thinks that all these will intergrate more in the future, certainly WPF/E and ASP.net Ajax.

He said that what we have seen so far of WPF/E is only a fraction of what it will really become. He believes that on some aspects, the final version will be better that it's competitor, Adobe Flash. He seemed very excited on some features that will be announced at Mix '07, including the final name. This session was not only fun, it gave a great insight in what web technology is evolving too.

In the last session of the day, Ingo Rammer explained some more of on profiling .net applications using CLR profiler and SQL profiler.

After this session, I went home, tired, but happy!
Great job guys!

The Ordina booth
My company Ordina was Platinum Sponsor of this event, and so we had a very large booth. On the following pics, you can see more of this.

 

All my DevDays 2007 pics can be found here: http://www.flickr.com/photos/gillcleeren/sets/72157600035030532/

What I brought home...
Het Computerwinkeltje, Belgium's largest computer book store, was also here, and they organised some book signing sessions. I just bought the new book on Powershell, Manning's Windows Powershell In Action , writte by Bruce Payette. I got my copy signed!

I also brought home the new book from Apress on LINQ.

  Posted on: Thursday, March 29, 2007 10:47:47 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming tools | WPF     March 25, 2007    

Last year, I had the opportunity to have a lunch meeting with Lutz Roeder. I was able to talk with him about life at Microsoft in Redmond, the creation of the Expression suite, and of course, Reflector, the very popular .net class browser, used by every .net programmer that respects himself!
Since a few weeks, the new version of this popular program was released, version 5 that is.
In this article, I’ll discuss some of the new functions and also some of the lesser known functions that were already in previous versions, so you can get the most out of this magnificent tool.

Obtaining the newest version
First, if you haven’t done already, download Reflector here:
http://www.aisto.com/roeder/dotnet or if you have an old version installed, you can have it auto-update via the Help menu. There are a great number of extensions available. These are put together on a codeplex site that can be found here: http://www.codeplex.com/reflectoraddins.

Getting started with version 5

One of the very handy new functions is the possibility to register Reflector with Explorer. This way, Reflector will become the default option for your DLL files.



Double-clicking on any .net DLL will open Reflector, and you’ll be able to see the contents of the assembly.
To do this, open a command window, browse to the directory where you have extracted Reflector and run the following command: Reflector /register .You should now get a message that registering went OK, as can be seen on the image below.

 

Assembly lists

If like me, you use Reflector a lot, perhaps on different projects, the list of assemblies in Reflector can become very long. On top of that, the memory use is way higher (I noticed that on my PC, don’t know if this is the case everywhere though) if you have more assemblies loaded in the browser.

There is however a feature that can help solve this annoyance: assembly lists. Press CTRL-L or File
à Open List to open the Assembly List Management dialog.


As you can see, I have a number of lists in my window. Each of these corresponds to a list of DLLs that will be displayed in the browser when loaded.
You can create a new list, which is blank by default. In the browser, you can then load assemblies that will only be displayed when that particular list is selected.

Code URL

Something completely new in version 5 is the so-called “Code URL” support.
Simply select any item in the browser and press Ctrl-Alt-C. This will copy the code-URI for that item in the following format (I selected System.Web.HttpCookie): code://System.Web:2.0.0.0:b03f5f7f11d50a3a/System.Web.HttpCookie.

If you have Reflector installed, clicking the following link in IE will fire up Reflector and immediately browse to the class/method/assembly described in the URL. You can test it with the following link: code://System.Web:2.0.0.0:b03f5f7f11d50a3a/System.Web.HttpCookie.
This feature can also come in handy to pass a link to a colleague, even over MSN!

.net 3.5 support

Even though it is still some months away, Reflector already offers support for .net 3.5. You can enable it via the Options window.

Included in .net 3.5 are C# 3.0 and LINQ. Reflector now includes full support for both of these.

Also, it now offers support for anonymous methods and nullable types.

The new assembly browser
The most important part of Reflector is of course the assembly browser itself. While it was already fast, it didn’t include the possibility to open multiple windows at the same time. That limitation is now gone! For example, you can open the Analyzer and the Disassembler at the same time.

Disassembler and Analyzer

Both the Disassembler and the Analyzer got some new functions in this new release.
The Disassembler now has a “Expand Methods” function, that, like the name says, will expand all functions right in the same window.

 

 

The result:

The Analyzer, which you can find by right-clicking an assembly, also has some new functions: Exposed by, Instantiated by and Assigned by.
These functions can greatly help you in funding where certain classes are used within the assembly.

BAML Disassembling

While Reflector is great, the extensions available for it make it even greater.
Personally, I do a lot of WPF, and it’s very handy to be able to read the XAML code for things you encounter on the net. For this, we now have the BAML Disassembler. You can read more on this extension here:
http://wpfwonderland.wordpress.com/2007/01/27/reflector-and-wpf-baml-disassembler-revisited/


  Posted on: Sunday, March 25, 2007 3:48:54 PM (Romance Daylight Time, UTC+02:00)   |   Comments [2]
         
Gill Cleeren     .net | ASP.net | C#     February 8, 2007    



DinnerNow

DinnerNow.net V1.0 is released.

DinnerNow is a fictious marketplace where customers can order food from local restaurants for delivery to their home or office. This sample is designed to demonstrate how you can develop a connected application using several new Microsoft technologies.

The demo utilizes several technologies including: IIS7, ASP.NET Ajax Extensions, Linq, Windows Communication Foundation, Windows Workflow Foundation, Windows Presentation Foundation, Windows Powershell, and the .NET Compact Framework.

The DinnerNow sample application is now available for download. You can download the entire DinnerNow sample code from CodePlex.

It's a free download, you can get it here.

  Posted on: Friday, February 09, 2007 12:11:55 AM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Enterprise Library     January 7, 2007    

For some of my latest projects, I have been using Enterprise Library for the Data Access Layer (combined with other technologies).
The week before Christmas, Tom Hollander, who leads development of the Enterprise Library, announced the first CTP of the enterprise library V3.0.
This weekend, I decided to do a first test drive with it, since a lot of features that are now included (or will be included in the final release) seem very useful in the creation of enterprise applications.
In this tutorial, I will explain the Validation Application Block, a complete new application block included in version 3 of the library. I’ll create some samples on how you can use the Validation block and I’ll also create a custom validator.

Installation of the enterprise library V3.0

As you probably guessed, to start using the EntLib V3.0, you should install the files. You can get the CTP from the all-new CodePlex.com site, entirely devoted to Enterprise Library. You should of course have Visual Studio 2005 installed on your PC. If you want to use the Guidance Packages, you’ll also need the Guidance Automation Extensions. You can read any further requirements in the Readme included in the download.
When installed, you can find the library under Microsoft Patterns and Practices. As you can see, one of the items there is the Enterprise Library Source Code Installer. You can use this to create more than one “working copies” of the code included in the EntLib. Run this, you’ll be needing this if you want to follow along with this tutorial. I extracted the files to “C:\EntLib3Src”.
In the folder, go to App Blocks à Src à Validation and open the project file you find here (Validation.csproj). To finish the installation, build the project. You’ll now have the DLLs needed to use the Validation Application Block.

OK, but what is this Validation block then?

Before I begin with the explanation on how to use the Validation Block, let me first introduce you to what it actually does and where it can be used.

From Tom Hollander’s Blog:
The Validation Application Block will include a comprehensive library of common validation rules that apply to primitive data types. For example, we'll include rules like string length, numeric range, date range, regular expressions and so on. However your applications will typically deal with more complex objects such as Customers or Orders (yes, here at Microsoft we assume every application is based on Northwind ;-), so while the built-in Validators should be great building blocks, you'll need to do some additional work to specify how these primitive rules apply to more complex objects. We plan on letting you do this in two primary ways: in configuration (which is ideal if you want the rules to be easily changed after deployment), or in code (which allows better encapsulation of rules and ensures the behavior won't change unless the code does).

You can do validation using configuration, or you can do it in code. In this tutorial, I’ll be focusing on the code-approach using attributes, mainly because there is no support yet in the “Enterprise Library Configuration-tool” for this at this moment.

Included in the library are a number of often needed validations: “not null”, string length, null… You can take a look at the included validators in the project you built earlier under Validation à Validators. In the final release, more will be added. In the first part of this tutorial, I’ll be using some of these to show you how it works.
Of course, this collection will never be enough for full-scale enterprise applications, so you have the possibility to write your own validators, as I’ll show later in this tutorial.

I’m convinced about the VAB! How can I use it?

OK, now that you know what the block is about, let’s start using it. As said, in this first part of my tutorial, I’ll use some of the included validators.

Create a new project in Visual Studio (I used a Winforms project and named it TestValidationApplicationBlock). While you’re at it, add a class library to the solution (for example: BLCustomers). This will be used as Business Layer in the sample application, and the objects in this layer will need to be validated using the Validation Application Block.

In the class library, add a new class, Customer for example. Add 2 properties, name and email for example (you can of course take whatever you want).

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using MyCustomValidators;

namespace BLCustomers
{
    public class Customer
    {
        private string name;
        private string email;

        public Customer() { }

        public Customer(string name, string email)
        {
            this.name = name;
            this.email = email;
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Email
        {
            get { return email; }
            set { email = value; }
        }
   }
}

To enable validation on this class, we first need to reference the necessary DLLs in this project. Right-click the “class library project” and select “Add reference”. Browse to where you built the enterprise library validation project, and in the bin folder, you’ll find 3 DLLs (Microsoft.Practices.EnterpriseLibrary.Common.dll, Microsoft.Practices.EnterpriseLibrary.Validation.dll and Microsoft.Practices.ObjectBuilder.dll). Reference these, and also create a reference to System.Configuration (which you’ll find under the .net tab).

Now, we want to add some validation on the name and email properties of the Customer class. As said, we’ll use attributes on the properties. For example, we want the name to be a string with a length greater than 0, and we want both the email and the name to be not null.

For this, we add the NotNullValidator and StringLengthValidator as attributes. The StringLengthValidator is overloaded: the first number stands for the lowerbound (we don’t want it to have a length of zero) and the second is the upperbound.
Notice the extra “using” to be able to use the Validator attributes.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using MyCustomValidators;

namespace BLCustomers
{
    public class Customer
    {
        private string name;
        private string email;

        public Customer() { }

        public Customer(string name, string email)
        {
            this.name = name;
            this.email = email;
        }

        [NotNullValidator]
        [StringLengthValidator(1, 100)]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [NotNullValidator]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
   }
}

At the moment, nothing actually triggers this validation yet. We can do this in several ways.
The simplest manner is using the Validation façade, included in the VAB, as shown next.

I have created a very simple interface in the Forms project, where the user can enter a name and email, as shown below.

1.JPG

In the click-event of the Validate button, the Customer instance is created. After that, the ValidateCustomer method is called, which is a method in the business layer. 

        private void btnValidate_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer(txtName.Text, txtEmail.Text);

            MessageBox.Show(customer.ValidateCustomer());
        }


Now, let’s take a look at the actual validation. This is performed in the business layer in the Customer class. Let’s look at the code.

        public string ValidateCustomer()
        {
            ValidationResults results = Validation.Validate(this);
            string message = string.Empty;

            if (!results.IsValid)
            {
                // if this is not valid, we'll loop through the results to create the message
                foreach (ValidationResult result in results)
                {
                    message += result.Message;
                }
            }
            if(message.Equals(string.Empty))
            {
                message = "The input is valid!";
            }
            return message;
        }

The ValidationResults is a collection of ValidationResult objects. When the Validate method is called, each attribute on every property is checked, and whenever one does not validate correctly, a new instance of ValidationResult is added to the collection. After the validation, you can loop through the collection to check the messages that were added (sort of “exception-messages” that are added). If all validation goes well, the IsValid method will return true.


This concludes the first way of doing validation: we have not used the configuration files (which is however done very often with the enterprise library). We did use attributes and the Validate method to check if the object was valid.

I said “the first way”… That means there are more ways of performing validation without using the configuration files? Yes, there is. In fact, this second method will look more familiar if you have used previous versions of the enterprise library.
Other application blocks often make use of Factory methods (like for example the data access application block). The VAB also has a way of doing this.

public string ValidateCustomerWithFactoryMethod()
        {
            string message = string.Empty;

            IValidator<Customer> validatorCustomer = ValidationFactory.CreateValidator<Customer>();

            ValidationResults results = validatorCustomer.Validate(this);

            if (!results.IsValid)
            {
                // if this is not valid, we'll loop through the results to create the message
                foreach (ValidationResult result in results)
                {
                    message += result.Message;
                }
            }
            if (message.Equals(string.Empty))
            {
                message = "The input is valid!";
            }
            return message;
        }


The result of the above code is the same.

Creating your own Validators

Up until now, we have used only the built-in validators. Nevertheless these are useful, a day will come (and if you’re developing large applications, it will come soon…) that they will not suffice. Therefore, the architecture of the VAB is open so you can easily create your own validators.
In this second part, I’ll show you how.

Let’s assume that we want to create an email validator. For the sake of simplicity, we’ll have it check if the string contains an “@” character.

To start, let’s create an additional project in our solution named MyCustomValidators. Make this project a class library too. Add the same references as you did with the BLCustomers project.

Create a class named EmailValidatorAttribute. This will be the attribute we’ll be adding to our Customer object later on.
For a class to be used as an attribute, it must among others things, inherit from Attribute. We’ll have it inherit from ValidatorAttribute, that already inherits from Attribute.

public sealed class EmailValidatorAttribute : ValidatorAttribute
    {
        public override IValidator CreateValidator()
        {
            return new EmailValidator(this.GetMessageTemplate());
        }
    }

Now, let’s create the actual EmailValidator class, which is where the actual validation will take place.

    public class EmailValidator : ValidatorBase
    {
        public EmailValidator()
            : this(null)
        { }

        public EmailValidator(string messageTemplate)
            : base(messageTemplate)
        { }

        protected override void DoValidate(object target, ValidationResults validationResults)
        {
            try
            {
                string converted = (string)target;
                if (!converted.Contains("@"))
                {
                    this.AddResult(validationResults, new ValidationResult(this.MessageTemplate));
                }
            }
            catch
            {
                this.AddResult(validationResults, new ValidationResult(this.MessageTemplate));
            }
        }

        protected override string GetDefaultMessageTemplate()
        {
            return "This is not a valid emailaddress since it does not contain the @ character";
        }
    }

It inherits from ValidatorBase, and overrides 2 methods in particular: DoValidate and GetDefaultMessageTemplate.
In the DoValidate method, the actual validation is done: here, I have written a few lines of simple code to check whether the passed string contains a “@”.
If the string does not include this character (and is therefore not an email address), a new instance of ValidationResult is added to the collection. The message that is included here is the string returned from GetDefaultMessageTemplate.

Now, we can use our own attribute. Return to the Customer class and add the EmailValidator-attribute to the email property.

        [NotNullValidator]
        [StringLengthValidator(1, 100)]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

When you run the application again, and you enter a string without a @ as email, you’ll get a message window with the message you included in the EmailValidator class.


I hope this will help you understand the Validation Application Block. If you have any questions, please feel free to post them.

  Posted on: Sunday, January 07, 2007 9:51:16 PM (Romance Standard Time, UTC+01:00)   |   Comments [4]
         
Gill Cleeren     .net | ASP.net | C# | DotNetNuke | Programming     January 1, 2007    

Lately, I have been doing a lot of projects with Dotnetnuke. I first started using it for my own use, but lately, I have used it to create some large portal sites for some of our customers.

To start with, let me first introduce Dotnetnuke (DNN). The very first sentence on the DNN homepage states the following: DotNetNuke is an Open Source Framework ideal for creating Enterprise Web Applications.

Let’s analyze this sentence, shall we? For starters, it’s a framework that you can use out-of-the-box to set up a portal site. Included in the download package are a number of modules that are sufficient to build an entire portal. Modules included vary from a simple HTML module to an entire forum and an image gallery. Of course, these are not enough to build an entire enterprise application. But DNN is very versatile, and so for every need, new modules can be build.
Since it’s an open-source project, it’s easy to tweak the framework where needed, to meet the needs of the application you are designing with it.

Sometimes, if an web-application is needed very fast, nothing comes close to use a portal framework like DNN. Lately, I have built the new Visug (Visual Studio User Group: www.visug.be ) site with DNN. We needed a site quickly, and DNN brought us the solution.
Some people I met are skeptical towards the use of DNN. The main concerns are mostly speed, reliability and not being in control. Personally, I admit that sometimes the latter can be true. I have had some problems with included features that are hard to override or undo. But since it’s open-source, I have been able to conquer them all.

One little thing, though. DNN is written in VB.net (the core and the core modules, that is). If you’re like me and you don’t program in VB.net, but still want to develop modules, you can do so in C#! Since Visual Studio 2005, it’s not a problem to have a solution with VB.net and C# files. Should you require to modify some core settings, you’ll have to write your code in VB.net, however.

So, now that I have been using DNN for several large projects, I have decided to share my knowledge on it via a series of articles.

In the first article, I will discuss how to install DNN and create the first portal with it. In the articles to come, I will show you how to create a module, how to skin the portal and how to extend DNN to use it to create full enterprise applications where DNN is used in a SOA environment. Stay tuned!

  Posted on: Monday, January 01, 2007 3:29:31 PM (Romance Standard Time, UTC+01:00)   |   Comments [2]
         
Gill Cleeren     .net | C# | Programming     December 26, 2006    

Since I didn't spend much time on the computer these last days, I hadn't noticed that last Friday, December 22nd, Enterprise Library V3.0 CTP was released! Shame on me ;-)

If you don't know what EntLib is, here's a short description: The patterns & practices Enterprise Library is a library of application blocks designed to assist developers with common enterprise development challenges. Application blocks are a type of guidance, provided as source code that can be used "as is," extended, or modified by developers to use on enterprise development projects.

I used it myself in 2 projects, and I'm very pleased with it.
In V3.0, some new features will (of course) be included, which will make it more complete. No complete lists is available, but here's an overview.

Core

  • Source Code installer
  • Partial Trust Support
  • Strong-Named Binary Assemblies

Validation Application Block

  • Core validation API
  • Minimal Validator Library
  • Attaching validators to objects via attributes
  • Attaching validators to objects via configuration
  • Not included yet (but in the works): Configuration tool support, complete validator library, integration with ASP.NET, Windows Forms, WCF etc.

Data Access Application Block

  • SQL Server Compact Edition Support
  • New Database.UpdateDatabase overload with updateBatchSize parameter

Configuration Tool

  • Visual Studio IDE integration
  • AppSettings support
  • Encryption support

Application Block Software Factory

  • Templates and recipes for creating application blocks and provider libraries
  • Preliminary documentation

Strong Naming Guidance Package

  • Recipes to assist in strong-naming and updating [InternalsVisibleTo] across multiple projects

If you're like me, you are gonna play with it already! So, download it here on the new Codeplex-site!

  Posted on: Tuesday, December 26, 2006 12:36:34 PM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming | WinFX | WPF | XAML     November 7, 2006    

The .NET Framework 3.0 has officially been released!  You can download the .NET Framework 3.0 components here:

If you use Vista, they are installed by default.

Th  If you have a previous CTP installed, please be sure to review the uninstall instructions

  Posted on: Tuesday, November 07, 2006 11:09:54 AM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Vista | Visual Studio.net | WinFX | WPF | XAML     November 2, 2006    

With Windows Presentation Foundation coming closer to its release date with Vista almost being upon us, more and more people are taking a look at programming in WPF… Lately, people searching on Google for WPF-related information is soaring. How do you know that, you might ask? Well, in my logs, I notice a steep increase in people landing on my blog who searched for information on WPF. That’s a good thing!! ?

However, what I do notice, is that there is still some confusion on some topics.  In this article, I want to help clear out the difference between the different application types in WPF/Vista. Since this is a major change with previous application models, lots of people, including me when I first heard about it, seem confused.

So, let’s get to it!

WPF has 2 main applications models: standalone and browser. On the other hand, it also has 2 types of navigation: menu-driven, which is what we’re all used to in traditional Windows applications and link-driven, which is the default for web applications. The first thing to note is that in WPF, both types of navigation can be used in either of the application models. Neat, isn’t it?
That basically means that you can create a web application as if it were a windows application, containing a menu to navigate around. Or, create a standalone desktop application that feels like a web application, with all buttons replaced by links.
No longer are you bound to one application model with is “natural” navigation model!

Standalone applications

When you want to create a “traditional” Windows application, you should choose to create “Windows Application (WPF)”.

The Windows Form now became a Window, each of these is declared as Window1.xaml. Notice that the build action for a Window file is automatically set to Page. What this means, is that the markup is turned into a special type of resource that can be identified uniquely by a Uniform Resource Identifier (URI). This way, WPF can load the window using a URI, as is done set the starting point in your App.xaml.

<Application x:Class="WindowsApplication2.App"
    xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml"
    >

This way, your application knows which window it has to load up first. This window is loaded modeless, meaning that it has no problems with you clicking anywhere else in the application.

Page’d applications

Should you want to create an application that mimics the web experience but still run as a standalone application, you should start by adding a Page(WPF).

Just like in the Window, you can add controls and content to the page. However, when you change the startupuri in the App.xaml to your newly added page, some things will change.

A window can host itself, like a form did in traditional Windows Forms programming. A HTML/ASPX page requires a browser. Now, we created a “standalone” application with the starting point set to a page. Kinda weird, right?

Well, the Application class in WPF is smart enough to detect if your startupuri is set to a page. It will then create a window to host your application.


Now, where does this “hosting window” come from?
When the startupuri is set to a XAML page or HTML page, Application  creates an instance of NavigationWindow to host them. This class derives from Window but extends it to make it look like a mini-browser window, providing navigation buttons at the top.

When content changes or when you click a link to navigate to another page, the previous content is added to the history. The management of the history itself is managed too by the NavigationWindow.

XAML Browser applications

The final type of application is the XAML browser application. While the previous type of application basically is a web application, being hosted in its own mini-browser, you can’t really take advantage of all the features modern browser have today. If that’s what you need, you should create a XAML browser application or XBAP.

To create one, you should choose new “XAML Browser Application (WPF)”. After that, you can copy all the code you created for that WPF standalone application to one or more pages, and your application is ready for the web!

One more thing you can do with XBAPs is publish them on a web- or intranet server. This is done using ClickOnce, which creates the executable along with 2 manifest files. One of these 2 has the extension XBAP, and that’s were the user navigates too. It then “downloads” the application to the local computer.

Because of the security risk, XBAPs are not installed and run in a security sandbox: some operations like writing to the registry are not allowed. Basically, XBAPs can only do things that are allowed for apps launched from the Internet zone, a restricted set of operations.

Conclusion
As you can see, the ways an application is build are different from what you are used to in traditional programming. I hope this guide is clear enough to help you choose the correct type when building a WPF application for Vista.
 

  Posted on: Thursday, November 02, 2006 4:01:59 PM (Romance Standard Time, UTC+01:00)   |   Comments [1]
         
Gill Cleeren     .net | ASP.net | C# | Programming     October 22, 2006    

Today, I was programming on the new www.visug.be of which I recently became the webmaster.
I needed a time picker control for ASP.net. I already downloaded Basic Date Picker, which includes a date picker for free and a time picker. Sadly, the time picker isn't free.

So I searched a little, and stumbled on a free library of custom controls which can be found here: http://www.eworldui.net/ .
It includes among others a very nice Time Picker control for ASP.net, that works under ASP.net 1.1 and 2.0.
Great controls, I must say!

  Posted on: Sunday, October 22, 2006 10:22:22 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | C# | Microsoft | Programming tools | WPF | XAML     October 20, 2006    

My article on WPF (Windows Presentation Foundation) triggers and styles is online on the MSDN website! You can read it here!

From MSDN:
In this article, Gill Cleeren focuses on the aspect of styles and triggers in Windows Presenation Foundation. Styles make it possible to create applications with a uniform look and with a high level of maintainability. Triggers allow WPF styles to change one or more properties in response of a user interaction. In this document, we will use both these technologies to create a richer user experience.

This is my first article on MSDN (more will come, now that I'm into it ;-) )

Here's a screenshot of the MSDN Belux site (Click for larger version)



Thanks to the MSDN Belux team, Wim Verhaegen and Tom Mertens.

  Posted on: Friday, October 20, 2006 1:38:00 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Programming     October 17, 2006    

The november issue is available, free for download as always!

This issue focuses on security and writing more secure code...

  Posted on: Tuesday, October 17, 2006 8:39:01 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Vista | WinFX     October 17, 2006    

Free training alert!!!

Microsoft Learning developed some free online training(Collection 5134 : Developing Rich Experiences with Microsoft® .NET Framework 3.0 and Visual Studio® 2005) that you can use for a limited time.
You will learn how to develop rich experiences using Windows Presentation Foundation, Windows Workflow Foundation, and Windows Communication Foundation.

This collection of 3 2-hour premium clinics teaches about the new capabilities provided by the .NET Framework 3.0. These clinics are for experienced Developers and Software Architects who are looking to adopt Microsoft's next generation technology within their solutions.

From: Collection 5134 : Developing Rich Experiences with Microsoft® .NET Framework 3.0 and Visual Studio® 2005

  Posted on: Tuesday, October 17, 2006 8:28:30 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming     September 29, 2006    

Regular expressions... I don't like them. Or, no, let me specify: I don't like to WRITE them. Tools like The Regulator help create them, but they're not easy to use.

I found a library in C# which contains a lot of predifined regular expressions: http://developer.coreweb.com/articles/Default15.aspx.
Enjoy ;-)

 

  Posted on: Friday, September 29, 2006 9:20:23 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C#     September 20, 2006    

I found a nice string manipulation library via www.ASP.net: you can access it here. Certainly a nice help if you have to work with strings a lot...

  Posted on: Wednesday, September 20, 2006 9:25:15 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     C# | Internet     September 12, 2006    

This guy is going to write a C# application every day of the month... One a day... For 30th days.

You can follow his life here.

Oh yes, he'll be programming in C# ;-)

  Posted on: Tuesday, September 12, 2006 9:01:47 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | Atlas | C# | Programming     September 11, 2006    

After a naming game, Atlas finally got its final name!

-Microsoft AJAX Library:  The client-side JavaScript library that works with any browser and also supports any server-side framework, not just ASP.NET.

-ASP.NET 2.0 AJAX Extensions: The server-side functionality that seamlessly integrates with ASP.NET and uses the same programming model familiar to existing ASP.NET developers.

Atlas will also ship in version 1.0 (final) before the end of the year!!!

Scott Guthrie has an entire article devoted to the Atlas roadmap. You can read it here.

  Posted on: Monday, September 11, 2006 10:43:40 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Visual Studio.net     September 7, 2006    

Today, I discovered a 'feature' of Visual Studio 2005.
In VS 2003, I used the //TODO comment a lot, so that a list of all my ToDo items would show up in the Task List.

Today, I was explaining to my collegue how to use this useful command... only to find out that it doesn't work in VS2005 anymore...

This is what MSDN has to say about it:
'Task List comments are not attached to the solution and project nodes displayed in Solution Explorer. For this reason, they do not appear when a solution is first opened. Rather, they are embedded within individual code files. Whenever a code file is opened for editing, any comments that begin with recognized tokens are displayed in the Task List. '

So, you can only see them when the file is open... not project-wide anymore :(

Anyone have another solution to this?

  Posted on: Thursday, September 07, 2006 9:57:16 AM (Romance Daylight Time, UTC+02:00)   |   Comments [2]
         
Gill Cleeren     .net | C# | Microsoft | Programming | Microsoft | Vista | Windows | WinFX | WPF     September 6, 2006    

Is today "Release Day" or something? So many new releases...

Let's begin with IronPython, which reached status 1.0:

IronPython 1.0 has been released to the .NET community and is available on CodePlex.  IronPython is an implementation of the Python dynamic programming language.  IronPython is built on top of the .NET Framework and is interoperable with other .NET languages.  Binaries, source code, and tutorials are available at CodePlex.

Click here to download IronPython at CodePlex.

Another release is Expression Web Beta 1:

We are pleased to present the Beta 1 release of Expression Web (formerly Expression Web Designer).

Expression Web is a professional design tool that helps you create and work with:

  • Standards-based Web sites
  • Sophisticated CSS-based layouts
  • Extensive CSS formatting and management
  • Rich data presentation
  • Powerful ASP.NET 2.0-based technology

To download, go here.

Still going strong ;-) Next is WCF, which reached RC1 also.

The release candidate 1 for the .NET Framework 3.0 is now available!  You can download the components for the RC1 here:

More info on RC1.


The Interactive Designer got updated, and now the September CTP is available:
Microsoft® Expression® Interactive Designer September 2006 Community Technology Preview (CTP) is a professional design tool used to create engaging, rich user interfaces for desktop and Web applications.

To download, go
here.

To finish, this one isn't actually released as of yet, but it's an interesting project being researched at MS:

Microsoft researchers are experimenting with an automatic code zapper for the company's Internet Explorer Web browser.

Researchers at the Redmond, Wash., company have completed work on a prototype framework called BrowserShield that promises to allow IE to intercept and remove, on the fly, malicious code hidden on Web pages, instead showing users safe equivalents of those pages.

The BrowserShield project—the brainchild of Helen Wang, a project leader in Microsoft Research's Systems & Networking Research Group, and an outgrowth of the company's Shield initiative to block network worms—could one day even become Microsoft's answer to zero-day browser exploits such as the WMF (Windows Metafile) attack that spread like wildfire in December 2005.
More here.

That's all folks ;-)

  Posted on: Wednesday, September 06, 2006 10:12:58 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | C# | Microsoft | Programming | Software | Microsoft | Visual Studio.net     August 31, 2006    
MS released XNA Game Studio Express (Beta), the first beta for this tool that can help every individual to become a game programmer.

From the site:
XNA Game Studio Express enables individuals and small teams to more easily create video games using new, optimized cross-platform gaming libraries for Windows and Xbox 360. This beta release targets the development of games for Windows. The final version of XNA Game Studio Express will be available this holiday season and will enable development of games which target Windows and upon purchase of a XNA Creators Club subscription, the Xbox 360 as well.

While we’re very proud of this Beta milestone, it does not represent all of the great features we are enabling in XNA Game Studio Express which will be available in final release form by this holiday. Some of the key feature areas that were not able to make it into this beta include:
- The XNA Framework Content Pipeline feature is not present in this release of XNA Game Studio Express (Beta). It will be made available in a future beta release of XNA Game Studio Express
- Support for retail Xbox 360 game development. This feature will be made available upon final release of XNA Game Studio Express later this holiday
- Additional starter kits and tutorials will be made available upon final release of XNA Game Studio Express

It's a free download of 91MB. You can find it here
  Posted on: Thursday, August 31, 2006 5:11:34 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | C# | Programming | WinFX | WPF | XAML     August 18, 2006    

In this tutorial, I'm going to explain several 2D effects that can be performed on images, using only XAML code. By the end of this tutorial, you'll know:

  • how to create image refections
  • how to skew images
  • how to drop shadows

So let's get to it!

Create an empty WinFX application. We'll use the Window1.xaml.
Make the background of the image somewhat darker, so we can better see the effects we'll create further on. For this, simply use the Window.Background property. Also, set the Height to 600 and Width to 800.

<Window x:Class="Reflection.Window1"
   xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Title="Reflection" Height="600" Width="800" 
   Background="#CCCCCC"
>


Add the image to your project
Select an image to include in your project. I'll do this tutorial with the image included in my project, but you can of course use any image you want. The image has to be included in your project. Once included, go to the properties window, and with the image selected in the solution explorer, set the "Build Action" to "Content" and "Copy to output directory" to "Copy always". This ensures that the image will be available when running the project.

Let's XAML
Finally, we're ready to do some XAML'ing (don't know if that is already a word, but I vote it should become one though!).
Since we will not be needing any advanced layout of the window, we'll use a simple StackPanel. By default, a stackpanel places all content it receives in 1 invisible vertical column. That's enough for this sample.

So, delete the <Grid> and </Grid> and replace them with <StackPanel> and </StackPanel>.

For the image effects, we'll need ... an image. Add an simple image element to begin with. Also, give it a name, we'll be needing this name later on. Use the following code:

<Image Source="image.jpg" Width="200" Height="300" x:Name="myImage"></Image>

We'll now start adding the reflection effect. For reflections, the VisualBrush is very handy.
What is the VisualBrush? It's a brush, like DrawingBrush, but it can paint with the contents of any other visual element that derives from Visual. Since Visual is the base class of all UI elements in WPF, you can paint with almost any markup in a VisualBrush.
Before we can reflect our image, we must add an element in which we can make the reflection appear. You can do this with a Rectangle, a Border...
For now, I'll use the Border. Add the Border element to the same StackPanel where you put the image. Since it's a StackPanel, the border is put below the Image (you can visualize this by setting the Background to some color).

<Border Width="210" Height="300"></Border>

Now, we'll use the recently introduced VisualBrush to fill the background of the Border with the contents of the image (this is why we needed to name the image!).
Add a VisualBrush to the Border like so:

<Border.Background>
   <VisualBrush Visual="{Binding ElementName=myImage}">
   </VisualBrush>
</Border.Background>


You should now see something like this:

Of course, for a reflection, we need a mirror effect. This can be achieved by adding a ScaleTransform on the VisualBrush. By providing a value of -1, the image will be flipped around the Y-axis.

<VisualBrush.Transform>
   <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="200" CenterY="150"></ScaleTransform>
</VisualBrush.Transform>

Now, to complete the reflection-part of this tutorial, we'll add an OpacityMask to the Border. With this in place, we can make the reflected image fade out into the backgroud, creating a nice effect.

<Border.OpacityMask>
   <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
      <GradientStop Offset="0" Color="Black"></GradientStop>
      <GradientStop Offset="0.6" Color="Transparent"></GradientStop>
   </LinearGradientBrush>
</Border.OpacityMask>

This again uses a LinearGradientBrush, with the color being Transparant from 0.6 on. This means that at 60% of the reflected image, nothing can be seen anymore.

We'll also add a border around the original image in this code. Add the following code around your image element:

<Border BorderBrush="White" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Center">
...
</Border>

Your code should now look like the following:

<StackPanel>
   <Border BorderBrush="White" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Center">
      <Image Source="image.jpg" Width="200" Height="300" Stretch="Fill" x:Name="myImage"></Image>
   </Border>
   <Border Width="210" Height="300">
      <Border.Background>
         <VisualBrush Visual="{Binding ElementName=myImage}">
            <VisualBrush.Transform>
               <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="200" CenterY="150"></ScaleTransform>
            </VisualBrush.Transform>
         </VisualBrush>
      </Border.Background>
      <Border.OpacityMask>
         <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <GradientStop Offset="0" Color="Black"></GradientStop>
            <GradientStop Offset="0.6" Color="Transparent"></GradientStop>
         </LinearGradientBrush>
      </Border.OpacityMask>
   </Border>
</StackPanel>

And the result should resemble this:



Skew and Shadows
In the latest part of this tutorial, I'm going to add a shadow to the original image, and skew both the images, to create a 3D effect.
First, the shadow. Shadows are created using a BitmapEffect. A bitmap effect takes visual content as input and produces a new surface by applying one or more image filters, such as a blur or a drop shadow. Currently, there are, among other, the DropShadowEffect, the BlurBitmapEffect and the EmbossBitmapEffect. More might be added later. We'll focus on the DropShadowEffect for now. Information on the other effects can be found in the Windows SDK.

Add the following code to the Border where the original images resides:

<Border.BitmapEffect>
   <BitmapEffectGroup>
      <DropShadowBitmapEffect Color="Black" Direction="20" ShadowDepth="25" Softness="1" 
         Opacity="0.5"/>
   </BitmapEffectGroup>
</Border.BitmapEffect>

This adds the dropshadow to the white border containing the image. These properties are self-explaining, so I'm not going any deeper into this.

Now, to finish, we have to skew both the image and the reflection to create the effect of depth. For this, we'll again use a transformation, this time a RenderTransform. The Angle-properties provided indicate the angle for the rotation.
The following code has to be added to the original image.

<Border.RenderTransform>
   <SkewTransform CenterX="0" CenterY="0" AngleX="0" AngleY="10" />
</Border.RenderTransform>

The reflection needs a re-centering, so we provide a value for the CenterX and CenterY properties.

The result you get should like the following:



I hope this WPF example can help you in creating great layouts with this fantastic new language!

The complete solution can be downloaded below.

ImageEffects.zip (120.66 KB)

Note that you need Visual Studio 2005/Visual C# Express with .net 3.0 installed. This code is tested with the June CTP.

 

  Posted on: Friday, August 18, 2006 11:15:10 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming | Visual Studio.net | WinFX | WPF | XAML     August 18, 2006    

I'm through with learning WPF (Windows Presentation Foundation), so now I'll have more time to write some samples for my blog, so everybode can start learning a little on WPF (that double-U-P-F ;-) ).

Today, I'm going to show you a small sample, in which I use a gradient and a storyboard to create a sort of a flashing circle. This could be used to draw the user's attention to something in the UI.

Here is the sample code:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
WindowTitle="www.snowball.be - WPF Examples" Background="White">
<DockPanel>
   <Ellipse Width="200" Height="200" Name="MyEllipse">
      <Ellipse.Fill>
         <RadialGradientBrush >
            <GradientStop Offset="0" Color="#CCCCCCCC" />
            <GradientStop Offset="0.5" Color="white" />
            <GradientStop Offset="1" Color="black"/>
         </RadialGradientBrush >
      </Ellipse.Fill>
   </Ellipse>
<DockPanel.Triggers>
   <EventTrigger RoutedEvent="Page.Loaded">
      <BeginStoryboard Name="MyBeginStoryBoard">
         <Storyboard Name="MyStoryBoard">
            <DoubleAnimation Storyboard.TargetName="MyEllipse" Storyboard.TargetProperty="(Ellipse.Height)" 
               From="0" To="200" AutoReverse="true"
               RepeatBehavior="0:0:10" BeginTime="0:0:0" />
            <DoubleAnimation Storyboard.TargetName="MyEllipse" Storyboard.TargetProperty="(Ellipse.Width)" 
               From="0" To="200" AutoReverse="true"
               RepeatBehavior="0:0:10" BeginTime="0:0:0" />
         </Storyboard>
      </BeginStoryboard>
   </EventTrigger>
</DockPanel.Triggers>
</DockPanel>
</Page>

First, I create an circle, which is actually an ellipse with identical width and height (one could also use the RadiusX and RadiusY properties, the result would be the same).

<Ellipse Width="200" Height="200" Name="MyEllipse">

Then, we use a Brush, in this case, the RadialGradientBrush, to create a gradient fill in the ellipse. No longer are the "GradientStops" or the "GradientStopsCollection" tags neccessary (they were in previous CTP's, but now they can be omitted).
To specify the colors, we use several GradientStop elements. The offset specifies where the color should "start". This is a relative value, and thus can't be more than 1. In this case, I specify 3 colors.

<GradientStop Offset="0" Color="#CCCCCCCC" />
<GradientStop Offset="0.5" Color="white" />
<GradientStop Offset="1" Color="black"/>

Now, to create the flashing effect, we have to use an animation. To start the animation, we use a trigger, in this case, an event trigger, which is routed to the Loaded event. This results in the trigger firing when the page loads.

<EventTrigger RoutedEvent="Page.Loaded">

For the animation itself, we use the storyboard. In this storyboard, which is like the name says, a series of steps that will be executed. You can compare it to a band of drawings that form a comic.
The storyboard thus consists of several animations. In this case, I use a DoubleAnimation, because the property I'm going to change, is of value Double: I'm going to alter the Height and Width property of the Ellipse. These are indeed Double values.

In the first animation, I specify that I want to animate the ellipse I created earlier, by setting the TargetName, and the property I want to change is the Height. In the From and the To properties, I specify what the values for the Height should be. In this case, I want the ellipse to pop up out of nothing, so I set the From to 0 and the To to 200.

The RepeatBehavior property specifies how long this animation should repeat, in this case, I set it to 10 seconds. Note that several animations can have different RepeatBehaviors: one can go one longer than the other. The BeginTime simply specifies when the animation should start: you can build in a delay.
Finally, the AutoReverse property indicates that WPF should reverse the animation after completed.

The second animation does essentially the same, but for the width.
Both these animations can't be grouped into one, which is a pity.

The result looks like this:



kick it on DotNetKicks.com
  Posted on: Friday, August 18, 2006 6:37:02 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Programming | Software | Visual Studio.net     August 17, 2006    

Already added 2 posts about new stuff today, so I'm going to bundle these last 2 for today...

Yesterday, while I was at Disneyland (you can see my pics on my Flickr account...), MS released SP1 for Visual Studio 2003. It's a 160MB download, and once installed, you can't return without uninstalling, so install with care!

Go here for the download.

Something I came across are Nuggets. In Disneyland, you might ask? Yes, there were Chicken Nuggets, but since this a technical blog, I'm not going to bother you with what I ate... I'm talking about MSDN nuggets, hosted by Microsoft UK.

Don't have the time to read a 10-page how-to article or watch a full length webcast? Try an MSDN Nugget, a webcast that takes you step-by-step to discovering new functionality or exploring a hot developer topic, all in 10-15 minutes. View them online now or download for later reference.

Head over here for a lot of good content!

  Posted on: Thursday, August 17, 2006 3:44:17 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | WinFX     August 17, 2006    

Last week, a collegue of mine told me about a video on the ADO.net entity framework over at Channel9. I watched it, and was very impressed.

Today, MS released the first CTP for this framework that is to be included later on in the .net framework. 

From the release notes:

This package is the first Community Technology Preview (CTP) of ADO.NET vNext and includes the preview build of the ADO.NET Entity Framework along with samples and whitepapers. The ADO.NET Entity Framework supports Object Relational Mapping scenarios using ADO.NET Entities, in this build you can:
- Query of persistent Entities using LINQ to Entities or Entity SQL
- Save new and dirtied entity instances through the object abstractions which also handle
o State management
o Identity resolution
o Change tracking
- Work with persistent object graphs and leverage a programming and query model where relationships are a first class concept
- Use optimistic concurrency and server generated values with persistent entities
- Program against persistent entities as values using the new Map Provider
- Get first hand experience with Entities and the Entity Data Model
- Work with mappings based on view maintenance concepts to support
o Entity Splitting (entities split across multiple tables)
o Table Per Hierarchy, Table Per Class and Table Per Type mappings
o Property renaming
o Conditional mappings

It's a small download, if you want to give it a try, head over to Microsoft downloads.

  Posted on: Thursday, August 17, 2006 3:31:15 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming | Visual Studio.net     August 14, 2006    

More and more languages seem to be getting "the .net treatment". Next on the list is PHP.
Microsoft is hosting a project on its CodePlex site to deliver a PHP language compiler for the .Net Framework.

The project's name is as Phalanger, the project reached Version 2.0 Beta 2 on July 30.

The primary goal of the project, released under Microsoft Shared Source Permissive License, is to enable full functionality of existing PHP scripts on .Net without any modification, Microsoft said.

Unlike the original PHP interpreter, Phalanger compiles scripts into MSIL (Microsoft Intermediate Language).

The object model in Phalanger is compatible with PHP 5.0, and it lets developers combine PHP objects with .Net ones.

In fact, developers can use a class written in PHP from a .Net application or to import a .Net class—that might be written in C# or Visual Basic—into PHP scripts.

Currently, one of the major features is to incorporate Phalanger in Visual Studio.net.

More on this can be found at CodePlex.com!

  Posted on: Monday, August 14, 2006 2:56:14 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming tools | Microsoft | Visual Studio.net     August 14, 2006    

Yesterday, Microsoft announced during the Gamefest 2006-event in Seattle, the XNA Game Studio Express. Like the name says, it is a development tool to allow developers, hobbyists and students to write games for the PC and XBox360.

Like the other express editions, it will be available for free, at least if you want to develop for the PC. If however you want to develop for the 360, a fee of 99 dollar is to be payed. This way, developers get access to the "Creators Club". Members of this club can build and test their games on the 360 platform. The distribution of these home-brewn games is probably to be done via the Xbox Live Arcade.

The mayor reason Microsoft wants to attract more people to developing games, is the current cost involved these days to develop a full-blown game. "Big" games cost big money and take up to 3 years to develop. Companies like EA, MS... don't dare to take risks to develop anything new, so the creativity is limited. Developers can't really try out new concepts. With these tools, more people are able to make their ideas into reality, perhaps opening up a whole new world for the game-industry.
Over time, MS hopes to have an entire community where people can distribute their games, and can express their opinion on other games, seperating the hits from the flops.

Now, about the launch date... Microsoft is expecting to launch the first CTP by the end of August. The final version will be released be released in November or perhaps December of this year!
The programming language used will be C#.

Microsoft is said to be doing this to keep get more people on the 360 platform, and keep them away from the PS3, which is due somewhere later this year.

  Posted on: Monday, August 14, 2006 12:25:31 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C#     August 8, 2006    

Some links for my students in summerschool in .net:

-Reflector: tool to disassemble compiled .net code (dll)
-Resharper: plug-in for Visual Studio
-MSDN event in Kinepolis!!
-Express editions of Visual Studio and SQL Server
-Third party controls: Infragistics
-Consolas font

If I forgot any, please make a comment and I'll add it.

  Posted on: Tuesday, August 08, 2006 1:14:23 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C#     August 4, 2006    

August has only just begun, but the September issue of the Visual Studio magazine is already here (not that we're complaining!!).



I haven't had the time to read anything, but this month, there are a lot of interesting articles IMO.
The one on Virtual Earth seems very interesting. In this article, the Virtual Earth API's and the Virtual Earth map control, a JavaScript component that provides all the functionality you need to draw maps, search for locations, and get driving directions, are explained.

The article on downloading files are needs reading! Here the author explains how you can force the browser to start a download window for some file-types, which would generally be opened in the browser, like for example, a JPEG.

  Posted on: Friday, August 04, 2006 8:37:42 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C#     August 3, 2006    

After a short period, Paint.net, one of the largest open-source .net projects out there, is once again updated, now up to version 2.70.

Some new stuff included in this version:

* New effect: Glow
* New effect: Bulge
* New effect: Polar Inversion
* New effect: Tile Reflection
* New effect: Twist

You can download this free imaging tool here.

  Posted on: Friday, August 04, 2006 12:15:44 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     ASP.net | C# | Microsoft | WPF     August 3, 2006    

MSDN Event: .NET Framework 3.0 Development

Learn about .NET Framework 3.0, the upcoming managed-code programming model which builds on and extends the .NET Framework.

The new version of the Framework offers you both practical solutions to today's software challenges and new opportunities to create software and services not possible now.

It enables you, as a developer or designer, to quickly create new applications and experiences that are more reliable and secure, visually stunning, smarter about information management, better connected, and more collaborative.

Hurry up, it's free training on the next-generation!! Subscribe here

  Posted on: Friday, August 04, 2006 12:05:43 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Microsoft | Programming | Vista | WinFX | WPF | XAML     July 11, 2006    

WPF not only stands for new fantastic tools for layout. There are also some very interesting new ways to implement databinding in your applications.
In this article, I’m going to show how you can easily build an RSS reader using the new databinding features in WPF.

How databinding works in WPF
In order not to go too fast, first, let me explain some basic concepts of databinding in WPF.

To keep data used in UI in sync with data in the datasource (for example a database), we can of course use properties. There is nothing wrong if you keep doing this under WPF.
However, WPF provides very handy binding features, that will make your life a lot easier!

We could bind the value of a textbox with the following code:
<TextBox Text="{Binding Path=Age}">
</TextBox>

Databinding under WPF uses a Binding object. The above code declares a textbox in XAML, and assigns the text-property the value of a property named Age of an object that it is bound to. This is done using the Path property. The Path property refers to the property of the object we are binding too.

To know to which object we are binding, we have the DataContext property. In WPF, every FrameworkElement and also every FrameworkContentElement has a DataContext property. It is of type object, so we can bind to whatever we like.
The binding does however have some interesting behaviour: if no DataContext is specified on the object itself (like with our textbox), it goes up the tree in which the controls are nested. So if we add our textbox in a Grid, it will look if this Grid has a DataContext. If not, it goes up higher…
This is of course very useful if we have more than one object (say 5 textboxes) binding to the same object.

Let me show you how to declare an object to which we’ll bind in XAML code (this uses the new syntax, so to run this, you have to upgrade to beta 2 or higher!)

<Window x:Class="Snowball.Window2"
    xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Snowball"
    Title="Snowball" Height="300" Width="300"
    >
  <Window.Resources>
    <local:Person x:Key="Gill" Name="Gill Cleeren" Age="27"/>
  </Window.Resources>
    <Grid DataContext="{StaticResource Gill}">
      
      <TextBox Text="{Binding Path=Name}">
      </TextBox>
    </Grid>
</Window>

And in the code-behind:
namespace Snowball
{
    public class Person
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private string age;

        public string Age
        {
            get { return age; }
            set { age = value; }
        }

        public Person()
        { }
    }
}

What I have done here, is creating a Person object in XAML. For this to work, you have to provide a default constructor.
First, we have to wire the CLR namespace to be known in XAML: xmlns:local="clr-namespace:Snowball".
Now, we can use the tag “local” to refer to the namespace in which the Person class resides.
Using the following line, we instantiate a Person using XAML:
<local:Person x:Key="Gill" Name="Gill Cleeren" Age="27"/>

The result is a textbox showing my name:

Note that if you try this in Visual Studio at the time of writing, you get an error viewing the design view. Don’t worry, when running, it all works fine.

Binding XML data to a list
Most of the time, we bind data to a list: a dropdown, a grid… In this part, I’m going to bind an RSS feed from my website www.snowball.be to a list.
To do this, we’ll need an XmlDataProvider.

Data can be accessed by using a Provider. Currently, 2 providers exist: the XmlDataProvider and the ObjectDataProvider.
An XmlDataProvider object must be declared within the resources, for example the resources of the grid:

<Grid.Resources>
        <XmlDataProvider x:Key="SnowballRSS" Source="
http://www.snowball.be/SyndicationService.asmx/GetRss" />
</Grid.Resources>


The x:Key assigns a name, which we can use in our code-behind.

We can now use this object as a datasource for a listbox, like this:

<ListBox ItemsSource="{Binding Source={StaticResource SnowballRSS}, XPath=//rss//channel//item }">
</ListBox.ItemTemplate>

We provide a value for the ItemSource, being an instance of Binding. For this Binding instance, we provide the Source property. Since we’re dealing with a resource that is defined in the XAML itself, we again use StaticResource and as value, the name of the dataprovider. A second attribute is the XPath expression, to locate the value we want to show in the listbox.

This is the result:



What happens, is that the entire XML tag is being read into a listitem. This is not desired, so we have to provide some kind of formatting, to tell WPF exactly what we want to show in the items.
This can be accomplished using a datatemplate.

We provide an instance of DataTemplate to be used as value for the ItemTemplate property of the listbox. In this datatemplate, we can specify what to show as listitem.
In the following code, I’m telling to make each listitem consist of a TextBlock. The text to be shown is taken from the surrounding Listbox (remember searching for the data up in the controltree?). In the data it finds, which is an XML tag with subnodes, we can to take the title as the value for the item.

<ListBox.ItemTemplate>
   <DataTemplate>
      <TextBlock Text="{Binding XPath=title}"></TextBlock>
   </DataTemplate>
</ListBox.ItemTemplate>

When we now run this, we get the following:



Much better, isn’t it?!

In the next part, we’re going to make the application a little bit more complete, providing a click event for the listbox, and making sure that some fields are filled in, again using databinding.

Adding the detailsform
We’ll now change the program somewhat to make it display the details of the item selected in the listbox.

We’ll add a Grid to make it easy to display 3 rows and 2 columns with textblocks, labels and textboxes.
This can be done with the following code:

<Grid>
   <Grid.RowDefinitions>
      <RowDefinition Height="30"></RowDefinition>
      <RowDefinition Height="30"></RowDefinition>
      <RowDefinition Height="*"></RowDefinition>
   </Grid.RowDefinitions>
   <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.2*"></ColumnDefinition>
      <ColumnDefinition Width="0.8*"></ColumnDefinition>
   </Grid.ColumnDefinitions>
   <TextBlock Grid.Row="0" Grid.Column="0">Title</TextBlock>
   <Label Grid.Row="0" Grid.Column="1"></Label>
   <TextBlock Grid.Row="1" Grid.Column="0">Link:</TextBlock>
   <Label Grid.Row="1" Grid.Column="1" ></Label>
   <TextBlock Grid.Row="2" Grid.Column="0">Article</TextBlock>
   <TextBox Grid.Row="2" Grid.Column="1"></TextBox>
</Grid>

After adding the Grid, we’ll also have to change the rest of the markup a little. Take a look at the sample code provided with this article to see the rest of the layout.

We now want the detail-fields display more info on the selected item in the Listbox.  Therefore, the Grid containing these fields should have its DataContext set to the item selected in the list. We do this with the following code:

<Grid DataContext="{Binding ElementName=RSSList, Path=SelectedItem}" >

The element is the name of the listbox, the path is once again the property within the source to which we’ll be binding the grid (and thus the detail fields).

Now, every time we select an item in the listbox, the grid has its datacontext set to this selected item. The fields can now get details as follows:


<Label Grid.Row="0" Grid.Column="1" Content="{Binding XPath=title}"></Label>

<Label Grid.Row="1" Grid.Column="1" Content="{Binding XPath=link}">
            </Label>

<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding XPath=description}"></TextBox>

The result should resemble the following:



Congratulations, you built your first databound application, using WPF databinding and a simple datatemplate!

In my next (large) article, we’ll be looking at the styling tools provided by WPF to make this application look TONS better!

RSS Reader.zip (45.32 KB)


kick it on DotNetKicks.com
  Posted on: Tuesday, July 11, 2006 3:56:47 PM (Romance Daylight Time, UTC+02:00)   |   Comments [2]
         
Gill Cleeren     .net | C# | Programming     July 11, 2006    

I was today a small project to write Excel files from .net. As you might (or might not...) know, you have to reference the Office DLL's for that.
I opened the project I made on a work-pc on my laptop, and all of a sudden, it didn't compile anymore.

The Microsoft.Office.Interop.Excel was missing. However, Office (and thus Excel) 2003 is installed on my system. After some googling (it's an official word know, so let's use it ;-) ), I found out that I probably installed Office 2003 before I installed the .net framework 1.1 (shame on me...). If you install in this order, the PIA's are not installed with a typical install.

The solution was simply run the Office setup, and install the .net Programmability Support. Problem solved... Another thing to remember when installing a new development PC!

  Posted on: Tuesday, July 11, 2006 11:55:48 AM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | ASP.net | C# | Programming     July 6, 2006    

The August 2006 issue of MSDN Magazine is now available online here. And for those of you on the go, a downloadable CHM file of the entire issue is available here


 

  Posted on: Thursday, July 06, 2006 9:59:26 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming     June 18, 2006    

For some time, I have been wondering how to create flashing, animated notify icons that appear in your taskbar. Windows has a lot of these, like for example MSN Messenger uses one when a person signs in. Or the flashing network icon when there is traffic going in or out.

I started thinking at first it used some kind of animated gif, but soon realized that that isn’t possible, since the NotifyIcon control in WinForms programs can only handle *.ico files or *.bmp files.

Now I found out how this actually works: the key element is the Timer control. It fires events at a regular interval, and what actually happens is that the icon is changed at these regular intervals.

To show “the magic”, I created a little demo-project.

First, create an array of icons:
private Icon[] icons = new Icon[4];

Then, load in the images. It’s actually creating an animated gif, only that now, you have to programmatically change between the steps.

icons[0] = new Icon("green.ico");
icons[1] = new Icon("red.ico");
icons[2] = new Icon("green.ico");
icons[3] = new Icon("red.ico");

Add a NotifyIcon and a Timer control to your program. Set the timer to an interval of 1000 (that is milliseconds).

Now, create the Tick event of the timer, to fire the event that will change the icon displayed in the NotifyIcon.
Since we have loaded the icons in an array, all we have to do is change the index in the array, and update the icon in the NotifyIcon accordingly.

private void timerChangeIcons_Tick(object sender, EventArgs e)
{
   animatedIcon.Icon = icons[currentIcon];
   currentIcon++;
      if (currentIcon == 4)
         currentIcon = 0;
}

Don’t forget to add the timer.Start() to the load of your form!

I did however notice something strange in the behavior of C#. It appears that icons created with for example PhotoShop or Paint throw an error when loaded: "Argument 'picture' must be a picture that can be used as a Icon”. This appears that have been a problem already in C# 1.0 and it is not addressed under C# 2.0.
To correctly display the created icons, you have to change the headers, based on Windows API documentation.
A workaround I found, is simply to open the icons in Visual Studio and save them again. This worked correctly afterwards.

The complete code can be found in the zip-file.

FlashingNotifyIcon.zip (14.98 KB)

kick it on dotnetkicks.com
  Posted on: Sunday, June 18, 2006 12:13:28 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Programming | Software | Windows     June 13, 2006    

The new issue of MSDN magazine is available. All articles can be read online for free here: http://msdn.microsoft.com/msdnmag/issues/06/07/default.aspx .



This month, among others, 2 articles in particular are a very good read: the one on Ajax (on which I'll be doing a presentation later this week at Ordina Lummen) and one on WinFX.

Did you also know that you can download a chm-copy of the magazine for free? Go here for this months issue or here for an entire archive on back-issues!

  Posted on: Tuesday, June 13, 2006 9:58:47 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     ASP.net | C# | Programming | Windows     June 12, 2006    

Tech Ed 2006 has taken off! Countless of speeches, demonstrations... are about to take place.

If you want to see the keynote, go here.

More on Tech Ed: http://www.microsoft.com/events/teched2006/default.mspx 

Oh and btw, it is also time for some new designs of laptops Intel showed to the public. You can see them here.

  Posted on: Monday, June 12, 2006 8:20:55 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | C# | Programming | Windows     June 8, 2006    

MSDN now has its official Wiki! Yes, it's true :-)
For the "official" announcement, you should take a look at Soma's blog (http://blogs.msdn.com/somasegar/archive/2006/06/08/622875.aspx).

In the MSDN Wiki beta, you can add code samples and content directly alongside the Visual Studio 2005 and the .NET Framework 2.0 documentation in a Community Content section that we have added to each documentation topic.  Right now the MSDN Wiki site only features English documentation, but we are planning to expand this functionality to the localized documentation in the future.

Pay a visit to them at: http://msdnwiki.microsoft.com/en-us/mtpswiki/default.aspx .

Great work, guys!

  Posted on: Thursday, June 08, 2006 11:02:01 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Programming     May 31, 2006    

I for sure didn't...

Let me explain the situation.
I'm building a multilanguage ASP.net 2.0 application at KBC Bank. The underlying database is Oracle 9i. This application uses masses of dates, all are in the format required by the database, MM/YY/DDDD.

A collegue of mine wrote some lines of code using a rowfilter to filter out some records from a dataset, retrieved from the Oracle database. So he used a simple DateTime.ToString(). This appeared to be working... until someone came along and tested it with Dutch IE browser settings.

This resulted in a 'String was not recognized as a valid DateTime' error.

After some research, I found that the RowFilter always uses SQL Server syntax when filtering out results, no matter if the data retrieved originates from Oracle or SQL Server.

An article on calendars on CodeProject says the following:
...The code forces a "MM/dd/yyyy" date format when constructing the RowFilter as required for date comparisons in such expressions. The filter is also constructed to take into account the possibility of time values within the DayField column. 

So, what did I do in the end? This:

dv.RowFilter = string.Format(
                   "{0} >= #{1}# and {0} < #{2}#",
                   this.DayField,
                   day.Date.ToString("MM/dd/yyyy"),
                   day.Date.AddDays(1).ToString("MM/dd/yyyy");


And that line saved the day :-)

  Posted on: Wednesday, May 31, 2006 11:27:17 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | ASP.net | C# | Programming     May 31, 2006    

Today, 2 interesting programs were suggested to me by collegues on the project I'm currently working on.

Up first is Snippet Compiler. It's a "small IDE", that enables you to do some quick tests on code. Instead of making a dummy project in VS, where you can test if for example myDateTime.ToShortDateString() also includes the hours, minutes and seconds, you just tap in the line(s) of code in Snippet Compiler. It then runs these lines as a Console application.

To get this free tool, go here.

The second interesting tool I discovered is "The Regulator". I had to a quite nasty regular expression, but with this open-source tool, it is much easier than sitting down and writing them by hand.

The homepage mentions the following:
It allows you to build and verify a regular expression against any text input, file or web, and displays matching, splitting or replacement results within an easy to understand, hierarchical tree.

For this application, go here.

These two applications are gonna be in my toolbox for sure ;-)

Oh and while I'm at it, did you know the VS 2005 version of Resharper, Resharper 2.0 was released. Go here: www.jetbrains.com/resharper

  Posted on: Wednesday, May 31, 2006 11:15:37 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | ASP.net | C# | Programming | Microsoft     May 4, 2006    

If you weren't there (like me... Vegas is a little too far ;-) ), you can now download or view all sessions of Mix06 online.

Go here to get them all! (There are some very interesting ones on Atlas!)

  Posted on: Thursday, May 04, 2006 11:49:27 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
2/4/2012   3:52:51 PM
 Welcome to Snowball.be
Hello and welcome to snowball.be!

My name is Gill Cleeren, I'm a Microsoft Regional Director and an MVP ASP.NET.
On Snowball.be, you'll find all kind news and articles on .net, ASP.NET, WPF, Silverlight and Microsoft in general.
More on me can be found on my about page.

Should you have any questions, don't hesitate to contact me by Send mail to the author(s) .

 Partner sites
 Most popular tags
.net (124) .net 3.0 (6) .net 3.5 (18) .NET 4 (18) .NET Show (1) ADO.net (4) ASP.net (53) ASP.net AJAX (4) ASP.NET MVC (3) Atlas (12) Azure (2) Blend (2) Book (5) Book review (4) C# (43) Case studies (1) Chopsticks (3) Community (10) Community Day (15) Consoles (1) Database (1) DevDays09 (4) DotNetNuke (4) Efficiency (57) Enterprise Library (5) Events (60) Expression (7) Games (3) Hardware (9) Internet (18) IT (1) jQuery (1) LightSwitch (3) Links (11) LINQ (4) Mac (2) Metro (1) Microsoft (75) Mix 07 (6) Mix 08 (4) Mix 09 (1) Mix 11 (1) Movies (4) MVP (5) MVP Summit 2008 (3) mvvm (1) Office 2007 (10) Other (8) PDC (22) PDC2008 (10) Personal (36) ppt (9) Programming (52) Programming tools (22) Regional Director (2) Silverlight (142) Silverlight Advent Calendar (24) sl4 (44) Slide decks (13) Snowball (13) Software (20) Microsoft (25) Speaking (14) SQL Server (10) TechDays (13) TechEd (14) telerik (6) Telerik (6) TFS (1) Twitter (1) Vista (73) Vista Tricks (9) Visual Studio.net (38) Visug (33) VS2010 (8) Wallpaper (2) WCF (2) Webcasts (9) Webinars (5) Windows (41) Windows 7 (5) Windows 8 (1) Windows Azure (2) Windows Mobile (3) Windows Phone 7 (2) WinFX (17) WinRT (1) WP7 (2) WPF (40) XAML (24)

 On this page
Developers cheering all over the world: Visual Studio 2010 is here!
C# 4.0 first impressions
Microsoft taking Software plus Services very serious
Visual Studio 2008 RTM Training Kit
DevDays 2007: the final verdict
All you need to know to get the most out of Reflector 5
DinnerNownet V1.0 Is Released
Enterprise Library V3.0: How to use the Validation Application Block
Start of DotNetNuke articles
Enterprise Library v3.0 December CTP released
.net 3.0 released
WPF tutorial: Different types of applications in Windows Presentation Foundation
ASP.net Timepicker control
That's me on MSDN ;-)
New issue of MSDN magazine available
Free training from Microsoft
Regular expressions library
A nice C# string library
One crazy C# programmer...
Atlas - be gone!
//TODO in VS 2005?
Lots of new releases
Microsoft XNA Game Studio Express (Beta) released
WPF tutorial: how to create great image effects with WPF/XAML
WPF Examples: a small example on animation and gradients
Visual Studio 2003 SP1 + Nuggets
ADO.net Entity Framework first CTP available now
PHP.net to come "soon"
Microsoft launching new developer tool for games
Links for starters
September issue of the MSDN magazine available
Paint.net: updated again
Free MSDN event in Belgium
WPF examples: Databinding in WPF: a simple RSS reader with XAML/WPF
Microsoft.Office.Interop.Excel not found
MSDN magazine August
Winforms how-to: Dynamically changing the icon shown in the taskbar
New isuue of MSDN magazine available
Tech Ed 2006 Keynote
MSDN: The Wiki
Did you know this about the RowFilter?
Two interesting tools that should be in your toolbox
Sessions Mix06 for download!
 This site
 Archives
Navigation
 Sitemap
 Blogroll OPML
 Disclaimer

All content is property of www.snowball.be. Nothing on this site can be copied or published elsewhere, unless otherwise stated.

This site is made by Gill Cleeren.

Questions? Opinions? Send mail to the author(s) E-mail