Ken Vleminckx

I love deadlines. I like the whooshing sound they make as they fly by.
Extreme Programming

All about exteme programming..the rulezzz...

http://www.extremeprogramming.org/

- Ken

 

Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application Projects

The below tutorial helps explain how you can migrate existing VS 2005 Web Site Projects to use the new VS 2005 Web Application Project option.

http://webproject.scottgu.com/csharp/migration2/migration2.aspx

- Ken

The System.IO.Packaging namespace

Since I went to Devdays in Ghent, I wanted to make a xlsx (excel 2007) file. An excel 2007 file is just a zip container with a bunch of xml files.
Using the System.IO.Packaging namespace you can make such a package file.

Just add a reference to the windowsbase.dll assembly located in C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0 directory.

In fact to create an xlsx file, you first have to create a package. After creating the package, you have to make some relations.

  • workbook relation
  • worksheet relation
  • sharedstringrelation
  • styles relation (not neccessary if you do not want to use styles)

When the relations are created, you have to make the individual xml files.

At this moment I made a little assembly for converting a datatable to an xlsx file. In the following weeks, I will post some code snippets.

 - Ken

New blog
Helo, our new blog is born.
ADO.NET 2.0 Failover bug

The connection may time out before the first try to connect to the failover partner server when you try to connect to a SQL Server 2005 mirrored database by using an ADO.NET 2.0-based application. It seems that there is a problem connecting to the failover partner server using ADO.NET 2.0

Although this feature is not full suported, there is already a hotfix available. (not downloadable, you have to contact Microsoft for this topic)

- Ken

IT Pro Days 2006

MicMicrosoft Developer & IT Pro Days 2006 takes place on 7th and 8th March 2006. For the third consecutive time, both developers and IT professionals are the target audience. While there are different tracks for both target audiences, attendees are free to follow sessions from both tracks. The first day consists out of an opening keynote and 20 different technical sessions (4 times 5 parallel sessions). The second day consists out of 25 different technical sessions (5 times 5 parallel sessions) rosoft Developer & IT Pro Days 2006 takes place on 7th and 8th March 2006. For the third consecutive time, both developers and IT professionals are the target audience. While there are different tracks for both target audiences, attendees are free to follow sessions from both tracks. The first day consists out of an opening keynote and 20 different technical sessions (4 times 5 parallel sessions). The second day consists out of 25 different technical sessions (5 times 5 parallel sessions)

More information.

- Ken

A virtual encrypted harddisk.

I was always looking for a secure way to store my data. Now I found the best tool for it: Cryptainer from Cypherix.
The program will generate a virtual harddisk and everything you copy, paste,.. on it will be encrypted.

It's all protected with a phasphrase. It's also possible to put the virtual disk on a dvd-rom, usb stick,...back-up

With the free version you can make disks up to 25 Mb, but with the full version, you can make disks up to 250 GB.

More info on

http://www.cypherix.com/

- Ken

Change the Header (or footer) of an MS Word document.

Someone asked me to change the headers of a couple of MS Word documents. I could not do it manually because there were more than 8000 documents.
So I wrote a little program. I used the MS Office object model.

Just get a reference to "Microsoft Office 9.0 Object Library"

Dim objMsword As New Word.Application
Dim objHeader As Word.HeaderFooter
Dim arDocfiles() As String
Dim strDocFile As String

objMsword = New Word.Application

objMsword.Visible =
False
Clipboard.SetDataObject(Image.FromFile("header.jpg"))
arDocfiles = IO.Directory.GetFiles("C:\docfiles", "*.doc")

For Each strDocFile In arDocfiles

Dim objworddoc As Word.Document

objworddoc = objMsword.Documents.Open(strDocFile)
objHeader = objworddoc.Content.Sections.First.Headers.Item(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary)

objHeader.Range.Paste()

objworddoc.Save()
objworddoc.Close()

objworddoc = Nothing

Next

objMsword = Nothing

- Ken

Overclocking...

A guy from Japan overclocked his 3.8 Ghz P4 to more than 7 Ghz

You can read his blog here.

- Ken

Filters using stored procedures and XML

Sometimes when a user get a dataresult on a webpage, you want to give him the possibility
to set some filters. (fe. using some comboboxes which are populated from small definition tables, ex. tblCountrys, of tblTypes.)
For security and performance reasons we want to use stored procedures and no dynamically created sql string.

This small sample demonstrates a filter technique using XML to set some filters.
So in the GUI, you just have to make an XML string and give it as a parameter. It's is very easy to extend.

The sample uses the database pubs. In this case we are using a simple select statement.

CREATE PROCEDURE usp_GetFilteredPubInfo

@Filters varchar(2048) = null

AS

DECLARE @tab_Filters Table (FIELDNAME varchar(50), FIELDVALUE varchar(50))
DECLARE @idoc int

-- Parse the xml data if present
IF not @Filters is null
BEGIN
EXEC sp_xml_preparedocument @idoc OUTPUT, @Filters

INSERT INTO @tab_Filters
SELECT    *
FROM       OPENXML (@idoc, '/FILTERS/FILTER',1)
             
WITH (FIELDNAME varchar(50), FIELDVALUE varchar(50))
END

DECLARE @CountPubNames int
DECLARE @CountTypes int
DECLARE @CountCity int

-- Count the amount of filters
SELECT @CountPubNames =  COUNT(FIELDVALUE) FROM @tab_Filters WHERE FIELDNAME = 'PubName'
SELECT @CountTypes    =  COUNT(FIELDVALUE) FROM @tab_Filters WHERE FIELDNAME = 'Type'
SELECT @CountCity     =  COUNT(FIELDVALUE) FROM @tab_Filters WHERE FIELDNAME = 'City'

-- Your select instruction and for each filter, you test if the count is zero. if there are values, you use them in your subquery.
--
In most of the cases, you will
select title, type, pub_name, city, state
from titles, publishers
where titles.pub_ID = publishers.pub_id
and (@CountPubNames=0 OR (pub_name in (SELECT FIELDVALUE FROM @tab_Filters WHERE FIELDNAME = 'PubName')))
and (@CountTypes=0    OR (type     in (SELECT FIELDVALUE FROM @tab_FIlters WHERE FIELDNAME = 'Type')))
and (@CountCity=0     OR (city     in (SELECT FIELDVALUE FROM @tab_FIlters WHERE FIELDNAME = 'City')))

GO

Execute the following:

exec usp_GetFilteredPubInfo

exec usp_GetFilteredPubInfo '<FILTERS><FILTER FIELDNAME="Type" FIELDVALUE="business"/><FILTER FIELDNAME="City" FIELDVALUE="Berkeley"/></FILTERS>'

- Ken

SQL Server 2005 Beta and Visual Studio 2005 Beta
At this moment I am installing the Beta versions of SQL Server 2005 and Visual Studio 2005. This week I will post a few things about those new versions.

- Ken 
The Belgian Electronical ID

At the end of this year, almost 3 million belgian people will have the new electronical ID. Of course a lot of companies are already testing this new smartcard. It's specially designed for signing electronical documents en authorize people. In the future microsoft will also use this card to identify a msn messenger user.

I already tested the card with an usb smartcard reader.
The following data is stored on the card:
Address, BeginValidity, EndValidity, Birthplace, birthdate, Nationality, Sex, Firstname , lastname, Secondname, a unique card id, your unique belgian id, ... some other data and a few certificates.
Also a jpg picture is stored on the card.

At this moment, the belgian goverment provides an ActiveX control to read the information.

- Ken

Cebit 2005

On the 13th of March 2005 we (Ken, Erik and me) went to Cebit in Hannover.
The departure was planned on 4 o'clock in the morning (or do I need to say saturday night ;-)), but somebody's mobile phone/alarm was not working, so we started our trip around 4:50.

We arrived at Cebit (the Messe) after approx. 5 hours of driving and talking about WOW. Conclusion of our talk: "Paladins are the mounts of gnomes and a level 16 gnome is more powerful then a level 25 paladin."
Parking was 6 euros for a dirty place somewhere in the woods near the Messe.

We checked the Cebit map to see what we will visit. No financial stuff, so we went for technology, communication and future stuff.

Communication was networking, wireless stuff, mobile phones, mobile phones, batteries, mobile phones, ....
The technology hall was 80% of the time occupied by, the new hype, .... MP3 players  and MP3 and even more MP3 players and more and...
I think we have seen 1 million different MP3 players.
There was also one big gaming hall (sponsored by samsung and ATI). Where they took a picture of the three of us in front of some strange dudes from star trek, "I think".

 

Change the current culture for your entire website.

Just specify a current culture in your web.config file. In this case we specify it on an application level:

<configuration>
  <system.web>
    <globalization culture="nl-BE" uiCulture="nl-BE" />
  </system.web>
</configuration>

It is as easy as that :)

So when you now execute the following code:

now.ToLongDateString will return maandag 28 februari 2005 (instead of monday...)

Read it all here

- Ken

Auto Rai 2005 - The Netherlands

I went to the AutoRai in the Netherlands (Amsterdam) yesterday. Hamburg-Mannheimer invited me to the Jaguars' VIP room.

A lot of amazing sportcars! The Ferrari enzo (+/- 990.000 €), Porche Carrera GT and also my dreamcars 'Dodge Viper' and 'Honda S2000' (see image below).

View the entire image gallery.

- Ken

More Posts Next page »