Monday, March 30, 2009

Logon Keyboard Layout in Vista

I'm using US Dvorak keyboard layout on all the computers. But my laptop was installed with US English default keyboard and now that is the default layout when Vista boots and displays the Welcome/logon screen. So I have to type the initial password in US English layout. After that, for example after lock-out, I type the password in US Dvorak layout. Since this behavior is becoming annoying here are tips on how to change the keyboard layout on boot screen in Vista.

The instructions below assume you have already updated your preferences for your windows account (language and keyboard).

  1. Open Regional and Language Options in Control Panel.
  2. Go to Administrative tab.
  3. If you have some other language used and want to change that, too, then under "Language for non-Unicode programs" select the desired locale.
  4. Under "Reserved accounts", click the "Copy to reserved accounts"
  5. Check "System accounts....." and click OK. Notice the sentence "The keyboard layout and display language for the Welcome screen are updated when you select system accounts."

Wednesday, March 25, 2009

HTML Help Workshop Error

After a while, today I used HTML Help Workshop to author a documentation in the form of a .CHM help file. I love the features HTML provides and find it easy and convenient way of creating notes, adding user interface images, bookmarks, external links, etc. HTML Help Workshop creates a Table of Contents based on the content of the HTML files included in the Help File project.
After I enabled the option to auto-generate ToC, I got the following error:

HHC6000: Error: An internal file could not be created. Make certain there is enough disk space on the drive where you are compiling your file.
HHC5007: Error: Fatal navigational compilation error. This is likely the result of an invalid contents (.hhc) file."

The reason for this is that I had no header tags within my HTML documents. So, the way to solve this issue, just add header tags (<h1>, <h2>, and so on) to organize the content. Help Workshop will do the rest during compilation and you will have a nice ToC created automatically. Just don't create your Table of Contents file and/or edit it.

Monday, March 23, 2009

Restore "New" Context Menu for .TXT File Extension

I just had an issue with .txt file extension. There was no entry in the New context menu in Windows Explorer so I could not create empty text files, which is very handy otherwise. I used the general guidelines, described in my previous post, to check the ShellNew registry key and everything appeared fine. Experimenting around with other keys showed that the file description was a problem.
In the .txt registry key itself, there is the "(Default)" string value that, in my case, contained "txt_empty_file" or something similar. Replacing this value with ".txt" restored the item in the New context menu and now I can, again, create empty text files on my system.

"New" Context Menu in Vista

New Menu - Context and File - Vista Forums
I lost "Text Document" from the list of available file types for creating through right-click, then New, context menu in Windows Server 2008. At the link above is the description on how to work with this context menu. Here is the summary:

HKEY_CLASSES_ROOT\(File Extension) contains the registry keys for all the file extensions (and more, for example the extension for a contact is .contact).
To display an item in the New context menu the extension key (for example ".txt") should have a sub-key named ShellNew. To hide a value from the context menu it is enough to rename ShellNew into something else (ShellNew*, for example).
To have a blank item, ShellNew key should contain a string value named NullFile.
To add an item with content or data, add a string value named Data and add the desired content to it.
To add an item that copies another file, add a string value named FileName and put the full file path into the value.

Saturday, March 21, 2009

Windows SteadyState

Here's a free Microsoft's software that pretty much looks like a decent tool to be used in public computers like internet cafe, public library, or a similar setting. I haven't tried it yet but I'm posting a note here so that I might one day. :) It should be fairly simple to test this software package in a virtual machine.

If any of the administrators of a public network have any experience with this (as opposed to some other software package for the same purpose), please let me know.

Windows SteadyState

Friday, March 20, 2009


Getting Started (LINQ to XML) - a wonderful new way to work with XML files. No hurdles with XmlReader, or navigating the DOM tree with XmlDocument manually. Linq to XML extends the functionality of the DOM by supporting the the Linq queries against the model. These queries are syntactically different to XPath but provide similar functionality.

This allows queries like

XDocument doc = XDocument.Load(dataPath + "nw_customers.xml");
foreach (XElement result in doc.Elements("Root").Elements("Customers"))
The common commands for working with XML files in Linq would be:
XDocument doc = XDocument.Load(dataPath + "nw_customers.xml");
var query = doc.Element("Root").Element("Customers").Elements();
foreach (XElement result in query)
Samples in C# are available for download on MSDN (link). These are the same samples that come with Visual Studio 2008.

Thursday, March 19, 2009

AppJet: Instant Web Programming

AppJet is server-side JavaScripting host that allows easy creation of web applications. No SDK downloads nor content upload. The browser is the IDE! It offers permanent storage, links to FaceBook, AJAX functionality, and what not. A perfect toy to play with.

Here is a Shoutbox - a  typical Web 2.0 sample application that demonstrates read/write capabilities.

Library reference browser is here.

AppJet: Instant Web Programming

SpeedDisk and Offline Defragmentation

Finally I succeeded in performing an offline defragmentation on my laptop with Windows Vista. I had troubles trying to do that recently, as listed in one of my previous posts (link).

SpeedDisk had some conflicts when tried to perform an offline defragmentation. One was sptd.sys, installed by Daemon Tools, a software package that mounts image files and emulates a CD/DVD ROM player.
Another issue was inspect.sys, installed by Comodo Desktop Firewall.

Autoruns, from SysInternals, is a convenient tool for disabling the drivers from startup. It can be used to disable both sptd.sys and Comodo's inspect.sys on startup. Later it is also very convenient to include them back again.

After removing the conflicting drivers, SpeedDisk reported inconsistencies on the drive. To perform a system check (chkdsk) of a system drive under Vista, you have to reboot the system and press F8 during boot time to get the boot menu. There, you should select "Repair Your Computer", which is the first option.
Then, the system will boot in the Repair mode on a RAM disk. Meaning your system drive (usually C:) will not be used and will be available for a full system check. "Chkdsk c: /f" - a file system check without the search for bad sectors was enough to fix my issues.
After this, PerfectDisk was able to (finally) perform the offline defragmentation and sort out my system files. It was annoying watching them in JkDefrag split out all over the disk.

Update 2009-03-30:
Last night I upgraded Nod32 antivirus from version 3.0 to 4.0 and it seems to have solved all the problems with drive locking. Boot-time defragmentation now runs without having to disable either sptd.sys or Comodo!

Wednesday, March 18, 2009

Show Thumbnails as Icons in Windows Vista and Server 2008

I've been searching for a while how to restore the thumbnails of graphic files to be used as their preview in Windows Explorer. After installing IrfanView it replaced my graphic files icons with its icon of a red bear (or something). That was a bit annoying since I got very used to previewing the graphic files inside Windows Explorer when working on something that involves those images.
All kinds of things that worked with Windows XP are of no help here when using Vista or Windows Server 2008. But... I've finally found the answer.
To use thumbnails of graphic (image) files instead of their associated icons, go to Tools -> Folder Options in Windows Explorer. Go to tab View. The first option under Files and Folders is "Always use icons, never thumbnails". Uncheck this and, voila, the thing is solved.

Ramp Up - SharePoint

Ramp Up is a part of Microsoft Learning. They offer free introductory courses to Microsoft technologies. Very interesting ones were the Sharepoint-related two as I am getting more interested in Sharepoint lately. These two courses contain most of the basics one need to know and can be used as a great starting point if one wants to learn more.

Tuesday, March 17, 2009

Installing .Net Framework (and Service Packs) on Vista, problems with Windows Features

Such a small thing, like cropping an image file, can lead to so much trouble. I found an image online that I wanted to crop. To do that I would normally use Paint.Net. The issue is that I do not have it installed. So I go and download the latest version and get the error message trying to install it. It requires a .Net Framework 3.5 Service Pack 1 to install. Luckily, I had the SP on a USB stick with me so I go on to install that. After a dozen of times trying to install that one and failing, I finally realize it requires .Net Framework 3.0 Service Pack 1 to install.

Alright. I download the web setup of SP1 for .Net Framework 3.0 this time. Now, trying to install that one gives me a message that this product is not supported on Vista operating system. :S

I can not reinstall .Net Framework 3.0. The standalone installation tells me to go through Programs and Features and install Windows Features. But in Windows Features I do not have anything. The Turn Windows Features On or Off screen is blank. No features get listed. I have downloaded the .Net Framework cleanup tool in case I need to remove the frameworks.

In the meantime, I found out I do not have .Net Framework 3.0 installed. This is weird. So I can not install the Visual Studio 2008 SP1, nor .Net Framework 3.5 SP1, nor .Net Framework 3.0 SP1. And I can not install the .Net Framework 3.0 because my Windows Features list is empty. Now I'm off to solve that issue.

There is a Knowledge Base article (KB 931712) that supposedly helps with this problem. The solutions there do not work, though.

Another solution claims to fix the problem of blank Windows Features list (link). This one depends on running the System Updates Readiness Tool from Microsoft. It also states that another solution - "reg delete HKLM\COMPONENTS /v StoreDirty" does not work, either.

Since the download for the System Updates Readiness Tool took a while, I was trying to fix the issues in CBS.log, listed after running "sfc /scannow", the first suggested solution. From the logs it seems I have a corrupted autochk.exe. The article (link) shows how to access Vista DVD installation files to restore the original versions of files. This solution is even worse, in download time, as it requires downloading 1GB from the Microsoft site. It is, nonetheless, a good solution for accessing the Windows installation images. But, to access the right installation files, I first have to slipstream the Service Pack 1 to my Vista installation. The instructions to do that are here.

After running the System Updates Readiness tool I had three failed entries in the CheckSUR.log (in %windows%\Logs\CBS folder) and none fixed. Now, the procedure is to run regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\ and delete the keys from there that are found as failed in the CheckSUR.log file. The issue now is that I can not delete these keys. To solve this (@#@#%$!#!@$%#$!@%) I have to set the security access permissions on the registry keys. First take ownership (right-click the key, select Permissions, click Advanced button, go to Owner tab and set yourself as the owner, replacing the permissions on child keys as well). Fortunately, I'm the administrator on the machine so I did not have to explicitly set that part, too. After taking ownership add full rights to yourself. I added them to the Administrators group. After that the keys were allowed to be deleted. Which I wholeheartedly did.

Opening the Windows Features took a bit longer than before, with hourglass rotating on the screen and my fingers knocking on the table and the tension growing in the air... Yes, the features were finally listed!

Installing .Net Framework 3.5 Service Pack 1 (which is cumulative) finally succeeded after this. There are additional updates, as listed in KB959209, of which I could install only the first one (for 3.5).

And, yes, after everything I could finally install Paint.NET and crop the image, finishing what I started yesterday.

Saturday, March 14, 2009

Open Source .Net Development Environment

SharpDevelop @ic#code

The above is the home page for an Open Source development environment for .Net languages (C#, VB.Net). There are Express versions of Visual Studio (separate environments for C#, VB.Net, web development, etc.) for free from Microsoft. The functionality is limited but still good enough for small to average development projects. And, the Express versions, coming from Microsoft, should always support the new .Net versions.
It is worth looking into differences between SharpDevelop and Visual Studio Express, though. The final version 3.0 of SharpDevelop, supporting .Net Framework 3.5, was published on 2009-02-10. It obviously lags the official releases from Microsoft but should be a decent and free alternative to expensive development environments.

Wednesday, March 11, 2009

Web Operating Systems

Web sites offering something similar to a web operating system are becoming more popular, offering more and more features.
Here are some of the services I tried (and some of them still use):

Microsoft Enterprise Library

Microsoft Enterprise Library has survived throughout the years. It has changed a lot, defying a bit the "consistency" principle. If you implement the library and later decide to upgrade to the latest version because a bug was fixed or a feature you need has just been added, it is quite possible that some other software will break. Unit Tests and refactoring are there to help but it is just additional work.

  • Library home page - link
Some related tutorials:
  • Design Guidelines for Exceptions (link)

Monday, March 09, 2009

Developer's Guide - Google Chart API - Google Code

Another interesting Web 2.0 API. Google provides charting API calls for public to graphically display data. Now that I have successfully implemented Yahoo Query Language in the Pipes and aggregated some numbers, it is time to do something about the graphical part, as well.

My next target will be to utilize Google Chart API to display market prices over a period of time. The prices would come from official sources, be aggregated through Yahoo Pipes, and then displayed graphically through Google Charts.

Developer's Guide - Google Chart API - Google Code

Regex Tools

After starting using Yahoo Pipes, I need a good Regex editor. Here are some of the tools.

  • Regulator (download)
  • Expresso (web site)
  • RAD Software's Regex Designer (link) - [I've used this one years ago]
  • RegEx Designer.Net (link)
  • Regex Coach (link)

Sunday, March 08, 2009

Yahoo Pipes

Pipes - Documentation

Here is an excellent idea - Yahoo! Pipes is rewiring the web. It is a service that allows for fetching and processing the data from the Internet and then presenting the output of that process. To simplify, I could process a web page of the weather forecast service and pick up only the current temperature. Then, that number could be presented on another page, aggregating the current temperatures in a few selected cities.
Of course, all of this can be done if your web server supports processing. Then, simply writing the same thing in ASP.Net or PHP or Python would allow for the same thing. But, Yahoo! Pipes allows the same thing for web sites that are built with pure HTML (and JavaScript, to be precise).
Since I'm still using the above technologies, I prefer to offload that work to a service like Yahoo! Pipes and keep the pages in pure HTML.

The example above is only one possible scenario. The data that can be processed includes RSS, JSON, HTML and other formats available on the Internet.
I'm off to studying the documentation. And, since I already have a few ideas on how to use the pipes, I'll be off to creating some pipes that concentrate the economic data. One of the first things could be the current official interest rate aggregator. (Update: the current interest rates are now available at my Forex page - here)

There is JSON2HTML tool available here, which can be used to visualize the output of a pipe.
RSS2HTML project (link) does the same with RSS.
Yahoo also provides Yahoo Query Language (YQL). The console is here. It is possible to query any data source it supports.
Dapper is another html scraping tool that can be used instead of Pipes, in case only html scraping is needed.

Friday, March 06, 2009

Include Page in Static HTML with Expression Web

I have found a satisfactory way to include common menus in my static-HTML web sites. Microsoft Web Expression 2.0 continues the FrontPage tradition and offers Include Page functionality. This does exactly what I was looking for. Expression Web supports webbots and one of them is the Include Page.
In the web page where you want to include external content it will only create a placeholder, a one line of code with a reference to the other file. The line looks like this

<!--webbot bot="Include" TAG="BODY" U-Include="aus_menu.html" -->

So, now, when it comes to this line, the Body contents from aus_menu.html will be included in the current page. When the page is saved, the full HTML will be saved in a file so it is available for offline browsing, too.
This is a great way to handle those common menus and now I can use that in the template, etc. Great.

The only issue I had with this approach was that I assumed that it will include the complete contents of the external file and so I created a text file with only the menu (ul) tag. The page including this did not show anything. After adding the full HTML syntax (html, head, and body tags) the menu appeared. It was taken out of the body tag, so everything works perfectly.

Here are some useful links on this topic:
A useful tip to watch out for is that Include Pages in FrontPage act as block-type HTML elements. This means they can not be inserted in the middle of a text paragraph (inline).

Thursday, March 05, 2009

Unit Test Patterns for .NET development

Unit Test Patterns for .NET development - Part I - .NET Unit tests Framework
Excellent article (or a series of articles) on Unit Testing for .Net development. This article focuses on Test Patterns:
The other articles in the series focus a bit more on mock objects and their usage in unit testing.

PURE - JavaScript Template Engine

In search for a templating solution for maintenance of a static-HTML-based web site, I came across PURE. It is a rendering engine written in JavaScript, which reads JSON objects and then renders the HTML.

Basically, any HTML can be used as a template. Class names and object IDs are used as template keys. Then, they can be manipulated as preferred and rendered into another HTML output. This, then, can be used as a new template and so on. Worth having a look.

I still don't know how to utilize it in the real world but it is a nice chewing gum for the brain. :)

PURE - JavaScript Template Engine

BK ReplaceEm Freeware download and review - search and replace tool from SnapFiles

This software is the best free search & replace utility. I am trying to find the easiest way to maintain a static-HTML web site. For now I am using Web Expression's template pages but these are not enough for what I want. They provide only one level of customization because of their approach. They have a template and a page based on that template. What I want is to use templates for providing the main menu to all pages but also to have groups of 5 or so pages share a common smaller menu. These smaller menus are different among these groups of pages. Now, to do that, one approach would be to use search & replace utility to change common portions of the web pages in the folder.

I will try that and see how it goes...

BK ReplaceEm Freeware download and review - search and replace tool from SnapFiles