October 2005 - Posts

Apparently there is some excitement going on around the availability of the sidebar in Windows Vista. Although not present in the beta 1 version of Vista, it's still planned to ship it in Windows Vista. I still remember my early experiments with the sidebar and sidebar items (now otherwise known as gadgets) in the PDC 03 build of Longhorn (build 4053).

However, there's another - less known - "side"-aspect in Vista as well, called SideShow. Basically this technology enables tiny hardware devices for information display to be used from within the OS, samples being little LCD displays in laptop lids or in keyboards, etc. Although it's already available in beta 1 with an emulator in the SDK, I didn't have time to play with it but will definitely do in the near future (don't have my Vista-box over here). More information can be found on http://microsoftgadgets.com/sideshow.aspx.

Especially, from an end-user perspective, I like the mobile phone example mentioned on the linked page above:

A mobile phone. Useful for remotely controlling applications, such as moving to the next slide or reading speaker notes in Microsoft PowerPoint on your device from across a room.

Nowadays, I'm using a "remote clicker" to switch between slides on presentations but using a mobile phone to do this would have more style (and a higher geek-level :p).

Last but not least, Microsoft Connect participants can download Vista build 5231 now (which is not beta 2 but just an interim build, aka October CTP).

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

If you're interested in working with VHD files directly, e.g. for manipulation tools etc, you can acquire a license for the image format specification via http://www.microsoft.com/windowsserversystem/virtualserver/techinfo/vhdspec.mspx. From source:

This specification describes the Microsoft VHD format, currently used by Microsoft Virtual PC 2004 and Microsoft Virtual Server 2005, including details of how to read and modify the contained data. By providing this information, Microsoft seeks to foster innovation by partners and customers and further enhance interoperability, security, and operational efficiency for customers.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Time to introduce C# 3.0 now! In this coding webcast, we'll discover the features of C# 3.0, including:

- the var keyword
- extensions methods
- lambda expressions
- queries
- easy initialization of types

The webcast is 45 minutes in length and pretty low-level. No Visual Studio tools are used (only Notepad :p) and ildasm.exe will be our guide. Nevertheless, I feel comfortable that this webcast should be of interest to any C# developer around the globe. You can watch it over here.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Heard about LINQ already? LINQ stands for Language Integrated Query and is one of the most exciting announcements made on the PDC earlier this year. Instead of writing long posts about it right now, let's just show you by means of a coding webcast. More stuff will follow pretty soon, explaining the C# 3.0 features and LINQ internals. Later on, I'll cover DLINQ and XLINQ too.

In order to start playing with LINQ, download the tech preview first. Once you've done so, you're ready to watch my webcast on LINQ.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

In a - partially on-demand - 30 minutes coding webcast, I'm showing how to use managed code (C#) to interact with Active Directory and to manipulate objects in Active Directory. I'm showing how to:

  • Query Active Directory for objects based on search criteria.
  • Use the ldp.exe support tool of Windows Server 2003.
  • Create user accounts, set various attributes on it and provide a password.
  • Adding a user to a group.

You can find the webcast over here. Enjoy it!

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

During EMEA@PDC trip to the PDC in September, we had to find something to keep ourselves busy (more than 11 hours flight from Amsterdam to Los Angeles) :-). Wim Verhaegen, sitting next to me, brought a book with Sudoku puzzles he bought on the airport before our (delayed) departure. It was the first time I heard about the thing but after a while we were in the middle of thinking how to automate solving such a puzzle in C# (to geek or not to geek). No laptops involved, just thinking. A few weeks ago, when I was reading my aggregated blog feeds, I noticed a post by Brad Abrams on the same subject: solving Sudoku puzzles somewhere on an altitude of 35000 feet. That was the time I decided to open up my Visual Studio 2005 environment and code our algorithmic ideas in C# 2.0. After a couple of delays to publish the code, here it finally is: download (requires VS2005 or MSBuild).

Other than Brad's code, my solution is:

  • ready for Sudoku puzzles of all kinds of dimensions (read: almost ready, because the main function can't work with digits higher than 9 in the current build);
  • not doing any guessing or backtracking, it's only using logical reasoning (see below) to (try to) find a solution;
  • based on a variety of concepts (mapped to classes), including Cell and Unit (see blow).

This also means that my "Sudoku Solver" is not really a solver, it's a simplifier. Based on two theorems, it tries to fill in cells which can only have one remaining value:

  1. If the cell is the only cell in a unit that still has the possibility to contain a specific value, it should have this value.
  2. If a cell has only one possibility left (based on elimination through the units it belongs to), it should take that possibility as its value.

Basically, every cell of the puzzle belongs to three units: a row, a column and a tile. For example: A 3x3 Sudoku has 9 rows, 9 columns and 9 tiles. All 81 cells belong to exactly one of each kind of unit. During initialization, cells are created and linked in the associated units. Then, every cell is updated to have a "possibility list" of remaining possibilities. All cells start with all possibilities open (e.g. 1-9). By looking at known cells in the cell's units (row, column, tile) possibilities can be reduced. This kind of "possibility lists" helps to develop rule 2 reductions. In order to support rule 1 reductions, every unit has a list of "possibility counts". For every digit the Sudoku can contain (e.g. 1-9), the cells count of cells that hace that digit as a remaining possibility is maintained (e.g. if a column has 3 cells where 1 occurs in the possibility list, that column will have a mapping 1->3 to indicate that there are 3 cells that have 1 as a possibility). The reduction logic checks every unit for possibility counts that have dropped to 1, which means there's only one cell left in the unit that has a particular digit as its possibility.

For Brad's puzzle, the application reduces the Sudoku only slightly (although most - if not any of them - Sudokus in the local newspapers over here are solved completely using these two theorems). Here's the output:

9 0 6 5 0 7 0 2 0
8 0 0 0 0 0 3 7 0
0 0 0 3 0 2 0 0 0
0 6 0 0 0 0 0 0 2
0 9 0 0 7 0 0 4 0
2 0 0 0 0 0 0 9 0
0 0 0 4 0 3 0 0 0
0 1 3 0 0 0 0 0 4
0 4 0 1 0 5 2 0 7

Unknown cells: 54


9 3 6 5 0 7 0 2 0
8 0 0 0 0 0 3 7 0
0 0 0 3 0 2 0 0 0
0 6 0 0 0 0 0 0 2
0 9 0 2 7 0 0 4 0
2 0 0 0 0 0 0 9 0
7 0 0 4 0 3 0 0 0
5 1 3 7 2 0 0 0 4
6 4 0 1 0 5 2 3 7

Unknown cells: 46


The Sudoku hasn't been solved completely. Below you'll find open possibilities for each unknown cell.
0,4 - 1,4,8
0,6 - 1,4,8
0,8 - 1,8
1,1 - 2,5
1,2 - 1,2,4,5
1,3 - 6,9
1,4 - 1,4,6,9
1,5 - 1,4,6,9
1,8 - 1,5,6,9
2,0 - 1,4
2,1 - 5,7
2,2 - 1,4,5,7
2,4 - 1,4,6,8,9
2,6 - 1,4,5,6,8,9
2,7 - 1,5,6,8
2,8 - 1,5,6,8,9
3,0 - 1,3,4
3,2 - 1,4,5,7,8
3,3 - 8,9
3,4 - 1,3,4,5,8,9
3,5 - 1,4,8,9
3,6 - 1,5,7,8
3,7 - 1,5,8
4,0 - 1,3
4,2 - 1,5,8
4,5 - 1,6,8
4,6 - 1,5,6,8
4,8 - 1,3,5,6,8
5,1 - 5,7,8
5,2 - 1,4,5,7,8
5,3 - 6,8
5,4 - 1,3,4,5,6,8
5,5 - 1,4,6,8
5,6 - 1,5,6,7,8
5,8 - 1,3,5,6,8
6,1 - 2,8
6,2 - 2,8,9
6,4 - 6,8,9
6,6 - 1,5,6,8,9
6,7 - 1,5,6,8
6,8 - 1,5,6,8,9
7,5 - 6,8,9
7,6 - 6,8,9
7,7 - 6,8
8,2 - 8,9
8,4 - 8,9

A brute-force (read: guessing and backtracking) algorithm can be used to search further on the reduced puzzle that my program spits out.

Notes:

  • I've been thinking about a better design for the application based on events to do the bookkeeping when something changes but have not been implementing this yet. It might come later although.
  • If anyone can think of another theorem to reduce a puzzle based on certainties (no guessings), please let me know.

Enjoy (but avoid to become a Sudoku addict)!

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Still hesitating to come over to sunny Barcelona in the West-European rainy fall in November this year? Let this unique offer be another reason to register now. All delegates receive a FREE copy of:

  • Windows Server 2003 R2 - Every delegate will receive it in his delegate bag. More info here.
  • Virtual Server 2005 R2 - Delegates can collect this software from the ATE demo station. More info here.

Likely, I'll be on the ATE for Virtual Server 2005 again, so come around and see me there. And if you want to know more about that mysterious dark component in SQL Server 2005 called "Notification Services" that you've undoubtly always selected during installations of the available betas without knowing what it's all about, pay Lukasz Pawlowski and me a visit on the Chalk-&-Talk session CHT063 entitled "SQL Server 2005 Notification Services Demystified".

Also check out my previous post on "IT Forum 2005 Barcelona on its way" for more information about this great Microsoft EMEA event.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

For the third year in row, I've received the MVP award of Microsoft, for the "Visual Developer - Visual C#" category. Time to celebrate (1-2-3 done) :d.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

In my previous post titled "Netsh madness" I expressed my intention to create a simple tool to change network settings on Windows Server 2003 for both my home office and a remote location. Because netsh didn't solve the problem completely, I decided to try to find my luck in WMI, with success. In this post, I'll outline the steps to do this in Visual Studio:

  1. Download the WMI Extensions for Visual Studio .NET 2003. In Visual Studio 2005, this will come with the product.
  2. Create a new Visual Studio project, e.g. a Windows Forms app.
  3. Go to the Server Explorer, , Management Classes, Network Adapters and locate the network adapter of your choice.
  4. Expand the node of the network adapter and expand Network Adapter Settings. The child of this node is a WMI instance of "Win32_NetworkAdapterConfiguration" and is the one you're looking for. Drag and drop it on a designer surface. (Tip: right-click to see the available methods on the management class and to test these).
  5. Now write code that calls the various management operation methods that are available. For this particular example, you'll be interested in EnableStatic, SetGateways and SetDNSServerSearchOrder.

A video capture of the entire process is available on my website, over here. This is my first video capture on my website and I guess I'll do some more of these later on. Notice the video capture was created using the Windows Media Encoder tool with no 3rd party tools involved. You can download Windows Media Encoder for free.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

I just tried to make some kind of cool script to change my networking settings in Windows Server 2003 according to the network where I'm connected (home office <-> office in Ghent). In both places I have to use a static IP, so I tried to do something with the netsh command. Setting the IP is easy:

netsh interface ip>set address name="Local Area Connection" static 192.168.0.101 255.255.255.0 192.168.0.1 1
Ok.

However, setting the DNS to the loopback address (when I'm at home, in my domain environment with DNS forwarding etc) doesn't work :-(...

netsh interface ip>set dns "Local Area Connection" static 127.0.0.1 primary
127.0.0.1 is not an acceptable value for addr.

Why, for godsake? Any suggestions are welcome :-).

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

More Posts « Previous page - Next page »