Favicon

One of the first customization I made to my blog was to add a favicon. A favicon is an icon left to the URL in the address field of the browser.

On the web site http://www.favicon.cc you can generate an icon from a picture. It is easy to include it on the web page. Add the tag <link> (with necessary attributes) within the <head> tag of the html page, for example:

<head>

<title>Peter Nilsson’s .Net Blog</title>

<link rel=”shortcut icon” href=”http://www.peternilsson.me/favicon.ico”/>

</head>

Several sessions in a TransactionScope

I wanted to test concurrency control using optimistic locking in NHibernate and needed a unit test that generated a StaleObjectStateException. To do this I simulated two simultaneous client by two database sessions in the unit test. Both sessions read the same entity, thereafter they modified the content and saved the changes. The last save will cause a StaleObjectStateException, since it violates the ACID rules of the transaction. I run all my tests in a transaction scope and to be able to run several sessions in one transaction scope I had to change the settings for MSDTC on the database server.

1) Open the control panel.

2) Open “Administrative Tools->Component Services”.

3) In the left tree view, navigate to “Component Services->Computers->My Computer”.

4) Right click on “My Computer” and select properties.

5) Select “MSDTC” tab and click on “Security Configuration”.

6) Check “Network DTC Access”, “Allow Remote Client” and “Allow Inbound/Outbound”.

7) Restart service.

Changing format on USB memory stick

I needed some kind of portable device to store larger files. Looked on the Internet and found that there existed 16 GB memory sticks to a quite low price. Looked great and I went to the store and bought one. I had a file bigger than 8 GB that I need to back up. Guess if I was disappointed when I couldn’t copy it to the memory stick. It turned out that the default format was FAT32, which is limited to files of 4 GB. When I pressed RMB, it wasn’t possible to format the memory stick. Mentioned this for a colleague and he know how to change the format. It turned out to be a bit tricky. Here is how you can do it.

1) In the file explorer, use RMB to select properties of the memory stick.

2) Select the Hardware tab.

3) Select your USB device and press Properties.

4) Select the Policy tab.

5) Select Optimize for performance.

6) Now it is possible to format the memory stick to NTFS.