Last week I passed Exam 070-526 - Microsoft.NET Framework 2.0 - Windows-based applications.
Now I'm a Microsoft Certified Technology Specialist for .NET framework 2.0 Web and Windows applications
Sunday, March 16, 2008
Thursday, February 21, 2008
A small tip for Outlook Express users:
Few days ago I found out that Outlook does not warn us (with a suitable error message) when one of its archive maps (*.DBX file) is too big. In fact Outlook Express has an archive map per folder (inbox, outbox, sent items, ...).
For example: At the moment that 'Postvak IN.DBX' is too big (> 2Gb), Outlook Express will try to connect to the mail server, but returns a hexadecimal error which tell us that Outlook Express cannot connect to the server.
So, outlook express users, keep each folder in your OE mailbox smaller than 2 Gigs. Attention, if your inbox folder is too big, it is still possible to send mails when the 'OUTBOX.DBX' and 'Sent items' file is smaller than 2 Gigs!
No problems for Windows Vista users. In Vista you do not have Outlook Express, but Windows Mail. The new mail client stores its mails as files (*.eml) and not as database files. Don't think you can store the whole world in your mailbox, because all those mail files are stored in your windows profile folder!
Tuesday, January 01, 2008
Wednesday, December 26, 2007
Microsoft has released the Microsoft Sync Framework CTP 1 few weeks ago.
With the MS Sync Framework you can easily synchronize any application, any type of data, using any protocol over any network.
The steps below explains how you to synchronize a folder. In fact, you can use the following example to create a backup of a certain folder:
public void Backup()
/*1. Create or retrieve SyncId file (a Sync Id file contains a GUID to uniquely identify each folder*/
SyncId sourceSyncId = GetSyncId(Path.Combine(sourcePath, idFileName));
SyncId destinationSyncId = GetSyncId(Path.Combine(destinationPath,idFileName));
/* Adding synchronization options */
FileSyncOptions options = FileSyncOptions.ExplicitDetectChanges | FileSyncOptions.RecycleDeletes;
/* Adding synchronization filters: do not synchronize/backup the SyncId file.*/
FileSyncScopeFilter filter = new FileSyncScopeFilter();
filter.FileNameExcludes.Add(idFileName); // Exclude the generated SyncId file
/* Detect synchronization changes.*/
DetectChanges(sourceSyncId, sourcePath, filter, options);
DetectChanges(destinationSyncId, destinationPath, filter, options);
/* Synchronize (backup) source to destinationfolder*/
SyncFiles(sourceSyncId, destinationSyncId, sourcePath, destinationPath, filter, options);
In the Backup() method we used following supporting methods:
private void DetectChanges(SyncId syncId, string path, FileSyncScopeFilter filter, FileSyncOptions options)
using (FileSyncProvider provider = new FileSyncProvider(syncId, path, filter, options))
private void SyncFiles(SyncId sourceSyncId, SyncId destinationSyncId, string sourcePath, string destinationPath, FileSyncScopeFilter filter, FileSyncOptions options)
using (FileSyncProvider sourceProvider = new FileSyncProvider(sourceSyncId, sourcePath, filter, options))
using (FileSyncProvider destinationProvider = new FileSyncProvider(destinationSyncId, destinationPath, filter, options))
SyncAgent agent = new SyncAgent();
agent.LocalProvider = sourceProvider;
agent.RemoteProvider = destinationProvider;
//Upload = Synchronize files from LocalProvider to RemoteProvider
agent.Direction = SyncDirection.Upload;
private SyncId GetSyncId(string idFilePath)
SyncId replicaId = null;
//Try to read existing ReplicaID
using (StreamReader sr = File.OpenText(idFilePath))
string strGuid = sr.ReadLine();
replicaId = new SyncId(new Guid(strGuid));
//If not exist, Create ReplicaID file
if (replicaId == null)
using (FileStream idFile = File.Open(idFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
using (StreamWriter sw = new StreamWriter(idFile))
replicaId = new SyncId(Guid.NewGuid());
Saturday, December 22, 2007
In fact, WiX is the Open source toolset which generates Windows Installation packages or MSI files. WiX provides command line tools to build MSI packages.
Wikipedia describes the WiX toolset as follows:
The Windows Installer XML toolset (WiX), pronounced "wicks", is a free, open-source toolset that builds Windows Installer (MSI) packages from an XML document. It supports a command-line environment that developers may integrate into their build processes to build MSI and MSM setup packages. ...
The developer has to create an xml file with .Wxs extension. This file contains all files, folders, registry keys, SQL databases, IIS directories, users, shortcuts, … which must be included in the installation. Creating the .Wxs file is not that easy. Currently, there is no user-friendly application to create this file. There is already an Open Source project, called WixGUI, but they haven’t released anything yet ...
To build our MSI file with WiX, we need 2 executables: Candle.exe & Light.exe.
1.Candle compiles the .Wxs file into a .WixObj file. (intermediary xml file)
2.Light transforms the .WixObj into the final MSI package
You can create your own batch file with following commands:
light.exe -out Test.msi Test.wixobj
Did you ever heard about SharpDevelop? SharpDevelop is the Open Source Integrated Development Environment in contrast to Visual Studio IDE. SharpDevelop has also integrated WiX support. You can visually create your .Wxs file. You can also design custom installation dialogs and watching the result before executing the installation package. By pressing F5 (alias ‘Build solution’) the Candle and Light executables are automatically executed. So by building your solution, your MSI file will be created automatically!
SharpDevelop has Setup projects which has built-in WiX support:
In the Setup project you have a tree-structure with all files, directories, components, ... which can be added visually.
You can also view the resulting customized installation dialogs, without executing the installation package:
There is also a project, called Votive, which provides WiX support for Visual Studio .NET/2005/2008. This integration allows you to have intelliSense in the Wxs file, but you cannot create files, directories, etc… visually!
WiX online tutorials
Article on SharpDevelop and integrated WiX support
Tuesday, November 27, 2007
Monday, November 26, 2007
I am currently developing a mobile application for my customer. In that application the customer wants to create and modify pictures/drawings. Those pictures must be stored in a database as binary data.
There are two possible solutions:
Using the Microsoft Ink conrols
The Microsoft Ink controls are not included in the .NET framework. You must download the Microsoft Windows XP Tablet PC Edition Software Development Kit 1.7 to use the Microsoft.Ink namspace. After installation the Microsoft.Ink library will be installed in the GAC.
The Ink controls are especially developed for Tablet PCs. In fact the Ink controls provides a wrapper class around a COM component.
The namespace contains 4 Ink controls:
In our project, we are using the InkCollector to create and modify drawings. It is not necessary to use the Ink controls for text recognition. In fact it is also an out-of-the-box drawing surface to generate images.
We can store the drawings created by the Ink controls in:
When you need to modify the stored files, you must use a ISF/Xml file or Fortified gif image.
You can save the Ink as fortified Gif or ISF/Xml file by calling the Save method on the Ink property of the ink control.
byte fortifiedGif = anInkCollector.Ink.Save(PersistenceFormat.Gif)
When it is not necessary to modify the images in the future, you can access the Renderer property on the Ink control to generate a picture in a .NET ImageFormat (Gif, jpg, Bmp, Png, ...)
Click here to learn more about the Microsoft.Ink namespace.
Custom Paint solution
In fact, it seems to be quite easy, but writing a good custom paint is not easy at all. I conduct the possibilities and I survived following problems:
The more lines, points on the form, the more the form is flickering
Drawing too fast, do not result in a solid line, but in a range of dots.
The first problem can be easily resolved by a search on Google. (Code Project flicker-free drawing project). The second problem is tough!. In fact the MouseMove event does not fire for each movement an event. This result in a dotted line, not in a solid line ! We can use a Line-Drawing Algorithm, for example the 'Bresenham Line-Drawing algorithm.
You can download the Phoenix Paint project (Open source project under BSD license), author: http://grapefruitopia.com.
Both solutions provides a drawing tool. The Ink controls are specially created for Tablet PCs and uses the Ink Serialized Format to store drawings. On the other hand, the custom paint solution is more open. You determine the resolution, size, colors, format and compression.
The choice is up 2 you !
Monday, September 17, 2007
This weekend I read a nice about SandCastle article of Maarten Balliauw.
I also want to mention that besides the SHFB project, we can also use the XpertBuildDoc add-in for Visual Studio 2005. Which is also free and is also integrated into Visual Studio 2005.
You can download the add-in here
SandCastle June 2007 CTP
Francis Dion's blog