Friday, September 28, 2007

Translation engines

Microsoft has recently released an update to its search engine. Aside from the advertised improvements I was pleased to discover the addition of a translator tool as an alternative to Google Translate; it also has a URL that for me seems easier to remeber.

I've played a bit with French-English translation and to me the Live Translator seems better than Google's version.
For other languages, Google wins (e.g. try translating with both engines from Chinese "用部落格分享照片、影音、趣味小工具和最愛清單,盡情秀出你自己" describing Windows Live Spaces :-))

The translation of a webpage is really interesting. I like the side-by-side comparison, with phrase hightlighting. See for instance the translation of CNN's home page.



For me it's not going to be an immediate bye-bye Google, but from now on I'll check both engines when I'll need a translation...

Try it out for yourself at http://translator.live.com

Tuesday, September 25, 2007

Implementing custom source control glyphs for VSIP scc providers

It's the second time in the last month when someone asked me how to implement correctly the IVsSccGlyphs.GetCustomGlyphList function in their source control provider so they can expose custom source control glyphs.

So, this time I though I should implement the function myself and see what's going on...

Of course, on first try I've hit the same problems reported by the customers :-). It turned out quickly that the problems come either from not setting up correctly the image size in the imagelist, from not setting correctly the transparency color, or not declaring the interface on the correct service.

If you're interested, I've put the sample for download on my website: Visual Studio Source Control Provider with Custom Glyphs.

The sample is based on the SccProvider sample in VisualStudio SDK, so you can Windiff the 2 solutions and easily see the code additions.

Here is how to test the new code:
1. Build the solution in VS2005 and run it.
2. In Tools/Options set the Sample Source Control Provider as the active provider (at this point the shell should call you on IVsSccGlyphs.GetCustomGlyphList to get the custom glyphs suported by your scc provider).
3. Create a new solution, e.g. a ConsoleApplication C# project.
4. Add the solution to source control
5. Add a new file to the project or to the solution
6. The new file should appear in SolutionExplorer with the new "pending add" icon exposed by the package, like in the picture below.

Custom glyph exposed by the sample scc provider

Wednesday, September 19, 2007

The day Google became irrelevant

I keep reading posts and articles claiming that "Google is the best search engine".

The way I see it, it may still be the most popular search engine, but it's no longer "the best".
It has been beaten a while ago at usability by live.com for image search; it has been beaten in maps quality and features by local.live.com/VEarth, and recently it's not even longer "the best" for relevance of simple web searches...

You want the proof?

Here's a comparative search for a product mentioned in my previous blog post.



There's been more than 10 days since the post was created and google hasn't indexed it yet. To me this is even more unexplicable when I remember that blogger.com is also a Google-owned site. You'd think they'd index first the information on their own servers...

You may argue that Google's indexes have grown too big when compared with other search engines, that it has to make less frequent passes over the already indexed sites. Let's go with this theory and see what "less frequent" means.
Here's a comparative search for my wife's name.



There are now 2 month since my wife has changed jobs and Google still hasn't realized it. Flavia's contact info has been my site for at least 2 years now, yet it doesn't show up on Google in the top 50 results...

I'm sorry for those Microsoft haters out there who repeat ad nauseam "Google is the best", but at least to me, Google has lost its search relevance. I guess it's time for other search engines to step up and take the leadership.

Saturday, September 8, 2007

Cross Flow fan replacement for Infrant ReadyNAS 600

For safe(r) storage of my data I use an Infrant ReadyNAS 600 in RAID mode 1.

The model A of the device uses for cooling a cross-flow fan, which is silent, speed adjustable, and seemed cool looking at the time. While I kept good care of it (blowing it of dust every couple of weeks), after 2 years of use it showed fatigue signs (noise), and in one week it stopped working completely. The device can't work without the fan - the hard drives get easily to 60 degrees Celsius and the device powers itself down for protection.

Unfortunately, it isn't very easy to get a replacement for this fan. Newer ReadyNAS models use regular fans which are cheaper (and easier to buy, I'd add).

Infrant calls the cross flow fan for ReadyNAS 600 model RN06-FAN1 and a replacement should have been easily bought from their site http://www.shop-infrant.com/RN06-FAN1.htm. However, Infrant is now Netgear, and while the stock transitions the fan is no longer available for buying.

So I tried to buy the fan from other sources.

Looking on the fan in my device, it shows on its label:
Cross Flow Fan
JDH-03009A12
Jin Yin Shyang Ent.Co., Ltd.,Taiwan

A net search shows the JDH03009A12 fan is only available on http://www.x-cool.biz/product_info.php/products_id/1118 which is a Chinese-only site. I tried buying the fan from the site with the help of 2 Chinese-speaking coworkers, but the site has such a bad design I didn't succeed placing an oder (also the site is not secure - doesn't use SSL, and buying from here is a bit shady). The site is owned by Li Yahuiy (yahuiyli AT hotmail.com and yahuiyli AT yahoo.com) which has other auctions for the JDH-03009A12/RN06-FAN1 fan on yahoo site. However, the guy doesn't seem to speeak English, and at least for me, using Google beta translations for every mail is not an option.

Fortunately, I obtained a temporary fan replacement from Infrant (more on this later). The new fan has this info on its label:
Chiefly
CCB13898S12L
Sleeve Bearing
Chiefly Choice Co., Ltd

See here both fans (old and temporary replacement):


A search for the new model/company finds it on another Taiwanese site http://www.chiefly-choice.com.tw/DCB13898-SPECIFICATION-DATA.htm, but they don't seem to sell it either.

Anyway, this gave me more confidence I'll be able to find similar fans in the future. It looks like I'll just have to find another cross flow fan, 12V, with dimension 130X45X40.6mm (overall) and 108X32mm(mounting holes). Preferably, this should use 0.12-1.13A.

I did a quick search and it looks like there are other models that fit the description:
CRHD-030 Series on www.camyork.com.tw (still Taiwan)
DF30098V12 models on www.sofasco.com (Finally a site in U.S.)

While the connector is not the same, the voltage/amperage and dimentions match, so I guess that after changing the connector these fans can be used as replacement without problem.

Hopefully the fan will also be available again from Netgear site, after the stock transfer...

Friday, August 17, 2007

About SourceSafe physical file names and file numbers

If you worked long enough with SourceSafe, you probably heard by now about the physical file names associated with files and projects from a SourceSafe database. The SourceSafe command line ss physical can be used to display the physical file name associated with a logical file or folder from the VSS database.

If you look at the the free SourceSafe tools from the www.ezds.com site you'll find a SSNPL utility whose description says that every SourceSafe file has a number, a physical file name, and a logical file name; ssnpl converts from one to the other.

If you asked yourself why is the number good for, the answer is simple: when storing a reference to a physical file in another database file, VSS will use the file number instead of the physical file name, because it requires less space on disk.

So, the question that remains is how does VSS generate these physical file names, and what is this file number calculated?

Let's start our investigation by creating a new database ("mkss.exe C:\temp\vss"). The database is initially empty, and in the data folder there is only one file, data\a\aaaaaaaa. If you use the "ss.exe physical $/" command you'll find out that AAAAAAAA physical name is used by the database root.

From this MSDN article you'll find that the content of the data\aaaaaaaa.cnt file in the SourceSafe database reflects the physical name of the last file added to the database. Indeed, the initial content of this file is 'AAAAAAAA' - sign that last created file or folder was the database root.

Let's add a file into the database. You'll see that the content of the aaaaaaaa.cnt file is now BAAAAAAA, and SourceSafe has created a new file on disk, data\b\baaaaaaa.

Let's continue adding one-by-one new files into the database and each time look at the content of the aaaaaaaa.cnt to see how the new physical files are named. It's easy to see the files are named BAAAAAAA, CAAAAAAA, DAAAAAAA, etc., each file ending up in the data subfolder identified by the first letter of the filename - (data\b\baaaaaaa, data\c\caaaaaaa, data\d\daaaaaaa), etc. After the last letter of the alphabet is reached (ZAAAAAAA), the filenames wrap back, using the second letter: ABAAAAAA, BBAAAAAA, CBAAAAAAA, etc., with files being created on disk in data\a\abaaaaaaa, data\b\bbaaaaaa, data\c\cbaaaaaa, etc.
So, the SourceSafe naming scheme and location of physical files uses a 26-way hashtable to distribute the files on disk in the a-z subfolders of the data folder.

If you run the SSNPLtool on the files added into the database ("ssnpl.exe $/ C:\temp\vss\data", etc.) you'll see their numbers are incremental: 0 (the database root), then 1, 2, 3, 25, 26, 27, .... etc. for each added file.

It's failry easy now to deduce how the numbering scheme works:

  • each file added into the database gets next available number in sequence: 0, 1, 2, etc.
  • the physical file names are composed of 8 letter characters, using letters A-Z: [L0][L1][L2][L3][L4][L5][L6][L7]
  • the number associated with a file is: (L0 - 'A') + 26 * (L1 -'A') + 26^2 * (L2 - 'A') + 26^3 * (L3 - 'A') + ....

Basically the physical file name is a base-26 representation of the file number, with each base-26-digit represented in A-Z range instead of 0-9A-P.

You should be now able to convert easily between the file numbers and physical file names.

As for the mapping between physical file names and logical paths in the database, that is a bit more complex, so I'll leave it for another time...

Thursday, August 16, 2007

Terminal Service client not using saved credentials

I had this problem for quite a while now, and it finally bothered me enough to go and search for a solution...

I use TS client to connect with smartcard from my home Vista machine to various machines at work through a Terminal Services Gateway.

When I'm connecting to Windows 2003 or Longhorn machines I am only required to input my smartcard pin and this is enough to authenticate me. However, when connecting to my alinc02 Vista machine, things are not that smooth. On this machine, TS asks my smartcard pin, after that it fails with the following message: "Your credentials did not work. Your system administrator does not allow the use of saved credentials to log on to the remote computer because its identity is not fully verified. Please enter new credentials."

'Your credentials did not work. Your system administrator does not allow the use of saved credentials to log on to the remote computer' error message

Of course, after typing my domain user and password the connection succeeded, but why was this dialog necessary?

I've searched the net for the exact error message but I could not find a solution. So I ended up asking the experts...

It turned out that my issue was described in this article from Terminal Services Team Blog, under Scenario 1 (Problems using saved credentials with Vista RDP clients - Connecting from home to a TS server through a TS Gateway server). There was also a solution proposed, too. However, since I was connecting to a Vista machine, I could not use the recommended solution (tsconfig.msc is only available on servers and I could not get to work on my Vista machine the applet copied from a Longhorn machine).

Fortunately there is a solution by altering the TS settings on the client side (this solution is not as secure as using certificates on server for server authentication).
In Vista, the Credential Security Support Provider protocol (CredSSP) adds a couple of group policy settings that are described in detail in MSDN CredSSP group policy settings page.

What I needed to do was:

1. Log on to your local machine as an administrator.
2. Start Group Policy Editor - "gpedit.msc" and accept the UAC prompt.
3. Navigate to "Computer Configuration\Administrative Templates\System\Credentials Delegation".
4. Double-click the "Allow Saved Credentials with NTLM-only Server Authentication" policy.
5. Enable the policy and then click on the "Show" button to get to the server list.
6. Add "TERMSRV/" to the server list, in my case TERMSRV/alinc02.redmond.corp.microsoft.com. Using one wildcard (*) in a name is allowed. For example to enable the setting on all servers in "microsoft.com" domain you can type "TERMSRV/*.microsoft.com".
7. Confirm the changes by clicking on the "OK" button until you return back to the main Group Policy Object Editor dialog.
8. At a command prompt, run "gpupdate" to force the policy to be refreshed immediately on the local machine (although this changed for me after a while)

Modify the 'Allow Saved Credentials with NTLM-only Server Authentication' TS Client group policy

With this policy enabled, the login to my alinc02 machine now requires only the smartcard pin, same as the other machines.

(I was told that if I'm not an admin then I may need to set in the rdp file
enablecredsspsupport:i:0, but this was not necessary in my case - setting it just got rid of the error message and replaced it with a regular Vista logon prompt)

Since we're speaking of group policies, it worth mentioning another setting here, "Allow Delegating Default Credentials", which helps making TS connections to a remote server (in the same domain) without being prompted at all for credentials (current Windows user's credentials are used for the remote server). For more information on this see Mahadev Alladi's blog article which inspired the settings in my case, too.

Wednesday, August 1, 2007

Visual Source Safe 2005 GDR CTP is available

Yesterday Microsoft released the Visual Source Safe 2005 GDR CTP.
(GDR stands for "General Distribution Release" and is a single, cumulative package composed of one or more files used to address a problem in a product - much like a Service Pack. GDRs are intended for public consumption and are made available on external websites)

You can read the KnowledgeBase article detailing the release and download the CTP from this address
http://www.microsoft.com/downloads/details.aspx?FamilyID=faf41edd-924d-449f-aefc-9c86dd499720&displaylang=en

Richard Berg has published in his blog a better list of the bugs fixed with this GDR.