Friday, June 19, 2009

Recently I came across a problem from one of my friends. Whenever he browses to Yahoo! in Internet Explorer it was showing Google's favourite icon (Favicon) in browser address bar. He was confused. I then found the answer to the problem, which I am giving below.

When you navigate to a site, IE downloads the favicon and caches it in the temporary internet files folder, where the this favicon will be assigned a unique name and mapped to its URL. So for example, if you navigate to www.bing.com, IE will download the favicon from http://www.bing.com/favicon.ico and cache it as favicon[1].ico somewhere in the temporary internet files folder, and map it to http://www.bing.com/favicon.ico.

Now if you somehow remove this favicon file from the temporary internet files folder, without removing the mapping to its URL, then the cache entry http://www.bing.com/favicon.ico will point to a non-existent file. Now say you navigate to http://my.yahoo.com, and IE downloads the favicon from http://my.yahoo.com/favicon.ico to the SAME favicon[1].ico file in the temporary internet file folder, then the cache entry http://www.bing.com/favicon.ico will be mapping to the yahoo favicon.So the next time you go on http://www.bing.com, IE will query the cache and incorrectly think that the favicon for this site has already been downloaded and is available on file. It will load the favicon[1].ico for http://my.yahoo.com, and hence the wrong favicon will be displayed.

Ordinarily you cannot remove a file from the Temporary internet files folder without also removing the file’s mapping. But you can do this by running the del /s command in  command line or possibly by using 3rd party cache cleaning tools. Note that cleaning your temporary internet files folder through IE or the Internet Options Dialog will restore everything back to normal.

Internet Explorer Delete Temporary Internet Files

 
Monday, April 13, 2009

webpage-performance

There are lot of performance improving tips out there in the Internet on how to speed up web pages. Recently I came across these references and tools that will be useful.

  1. Steve Souders from Google presents "Even Faster Web sites"
  2. YSlow from Yahoo!. A firefox add-on that analyzes web pages and tells you why they're slow based on the rules for high performance web sites
  3. More website optimization tips here
  4. Webpage performance analyzer here
 
Friday, October 17, 2008

Mozilla in their upcoming Firefox 3.1 release is introducing an experimental feature "Geode". Geode is about browser (and server) automatically deducing your location and provide appropriate location based information. Though Location-aware applications are present in Mobile Phones using Cell-Tower Triangulation or GPS, this is the first major effort to do something similar on the PCs.

Geode provides an early implementation of the W3C Geolocation specification and location information will be provided by one or more user selectable service providers and methods - GPS-based, WiFi-based, manual entry, etc. What I was curious is how they deduct location information using Wi-Fi. It seems they use a technology from a company called SkyHook, whose hybrid positioning system (XPS) is a software-only location solution that allows any mobile device with Wi-Fi, GPS or a cellular radio (GSM/CDMA) to determine its position with an accuracy of 10 to 20 meters. Click on the video below to see how it works - basically they are building huge database of Wi-Fi access points and correlating them with Latitude/Longitude information from other sources like GPS for each access point profiled.

Skyhook's hybrid positioning system (XPS) - How it works?

All these are transparent to developers and users, for developers it is just a Javascript call like the one shown below:

navigator.geolocation.getCurrentPosition(function(pos) {
  alert( pos.latitude + ", " + pos.longitude );
})

Before these initiatives web applications were limited to deducing user's location based on your IP. Technology is not standing still with IP based deduction, earlier they were limited to US cities, now database are more complete and are able to identify cities world over including India.

Related links: ZoneInfo database, GeoNames

 
Friday, September 05, 2008

If you have tried to do a decent chart or graph or any line drawings in HTML/CSS you would have felt extremely frustrated, more so you want it to be cross-browser compatible. Though SVG and VML have been around for years, the support for them is not uniform between browsers. Recently in a newsletter from Sitepoint I came across Raphaël - a small JavaScript library (less than 19Kb in filesize) written by Dmitry Baranovskiy of Atlassian, that allows you to create and manipulate vector graphics in your web pages. It's simple to use and supports Internet Explorer 6.0+, Safari 3.0+, Firefox 3.0+, and Opera 9.5+. Internally Raphaël uses VML in IE and SVG in the other browsers.

Raphaël is published under MIT License which basically allows you to use the code in both commercial and non-commercials applications and even redistribute freely (as in free beer).

CurrentSprocket

To do the above graph, you need to write only 30 lines of Javascript. Check it out.

 
Thursday, July 03, 2008

Last few days there has been buzz around Adobe's announcement of collaboration with Google and Yahoo! to improve the ability of search engines to index Flash files better - which are normally .SWF binary files. Instead of coming with open XML based file formats Adobe has chosen to offer an "optimised" (basically a server component) version of Flash Player that sits on a search engine's server and checks for Flash at the same time as HTML.

Compare this with Microsoft's Silverlight. Silverlight applications are packaged in a XAP file (which are simply a zip) format and any static textual content is in the XAML files. XAML files are nothing more than a well-defined XML file, this means even today without any special API search engines can index Silverlight Applications. In addition Silverlight apps supports deep linking which is important for facilitating relevance, very much like HTML's nested links concept. For more details see this post here by Microsoft's Nikhil Kothari on how Silverlight by design is Search Engine friendly.

Anyways, this is a very important step that Adobe that has announced. Flash is currently the entrenched player in the RIA space having more than 95% of market share. This has resulted in enormous amount of content being out there in the Web in Flash file formats. These have been so far out of reach of Search Engines and any attempt by Adobe to make it reachable is welcome. And any competition here between Adobe and Microsoft is also a welcome one.

 
Tuesday, July 01, 2008

Few weeks back I was with a developer doing a code-review for one of his application. The application was a Windows Forms Application written in C# that monitors several running jobs and reports on any event/failure found in the log file.

Many gaps came up in the review which made me thinking (me thinking is surprising isn't it), hence this post. The abstractions in the form of frameworks and IDEs that are available today make programming definitely accessible but at what cost. Do they make a formal (structured) learning of programming unnecessary?. Are today's engineers getting away by not following any coding disciplines like the one's enforced by my mentor(s) and teachers when I learned programming. Before I continue this rattle and list the items let me clarify, I am not intending this post to be a comprehensive check list - it just happens to be the issues I noticed in this particular incident. I have grouped few of my findings in sections.

Reading a configuration file

  • When reading a configuration file (like .config/xml) to load values, validate whether the file exists. If file is not present either load default values and proceed  (or) exit gracefully. Having a simple try/catch  block doesn't mean you have handled all exceptions and you no further work
  • Try not to read the entire file to memory. In .NET this will be for example using StreamReader.ReadToEnd method. Think about what will happen if you the file has been corrupted or wrongly replaced with a 10GB video file. You will crash the machine by running out of memory. In typical configuration files especially for your applications you can identify the maximum likely size which will be say few MBs. So in .NET try to use StreamReader.ReadLine for as many lines as you will need
  • Similarly don't load the entire XML into XMLDOM (like by using XmlDocument) where it is not necessary. Instead try to use XmlReader which is a stream based XML processor and doesn't take up memory (many times of the full XML filesize)

UI Related items

  • While designing design the work flow and the steps with the user of the application in mind. Think about the likely steps the user will follow. Do not design with your code flow as the steps. In this application this meant not having to select a configuration file and global settings screen as first step in the Tab order. Instead have the first screen after application launch as the one the user will use repeatedly

In an earlier project I gave the complete UI design specification in Visio format to a developer that avoided all the iterations and confusions. You can read about that in this earlier post.

 
Friday, June 20, 2008

In the last two to three quarters we are seeing a huge surge in SharePoint projects and as a result the demand of SharePoint developers is sky rocketing. Initially we were thinking this to be a local (India) phenomena but when I talk to many of my contacts in the industry worldwide and check out articles in the Internet, it turns out to be a worldwide phenomena.

Below are some random resources on SharePoint that might be useful for developers:

 
Wednesday, June 11, 2008

I have come across Developers and System Engineers who have trouble with networking time and again. The principle reason I have observed is a lack of thorough understanding of the underlying TCP/IP layer. Most engineers assume that if they know what is an IP Address, Subnet and DHCP they know networking. How wrong can they be?. This gets more complicated with the introduction of IPv6,  Security and Performance features newly introduced in Windows Vista and Windows Server 2008.

Till now the hurdle in solving this was availability of easily accessible and digestible materials on the subject. Today thanks to one of my fellow MVPs who pointed me to this resource from Microsoft - a free book on "TCP/IP Fundamentals for Windows". It is available both for online viewing and downloadable as a PDF file. Don't let the 559 page count scare you, the book is easily readable with some effort. I highly recommend downloading the PDF file and saving - it will be a worthy reference.

 
Friday, May 23, 2008

Last few days I had a firewall issue in my desktop that made web browsing irregular. It was a peculiar problem, I was able to browse few sites like Google, Vishwak.COM but not others. I had to keep running the same diagnostic commands many times to take values to be sent to my support team. Finally I ended up writing this handy tool that copies to clipboard diagnostic informations from IPConfig, Tracert, Ping & WebGet commands. This information can be used for further investigation or email to support. I also added features to FlushDNS, Renew IP & Turn Auto Tuning (Vista and Windows Server 2008) OFF/ON.

diagnose tool screenshot

While developing the tool over two half-a-days I learnt quite a few APIs and a bit of C# coding. This included how to call a console command like IPCONFIG /ALL and capture the output to a string from a C# application, get the Internet Explorer Proxy settings, Call Network Properties applet, create an install with VS 2008 & how to paste a code snippet in WLW.

   1: private string DoConsoleAndCapture(string sInput)
   2: {
   3:  
   4: string sOutput = "";
   5: ProcessStartInfo pi = new ProcessStartInfo("cmd.exe", "/c " + sInput );
   6: pi.WindowStyle = ProcessWindowStyle.Minimized; 
   7: pi.RedirectStandardOutput = true;
   8: pi.UseShellExecute = false;
   9: Process p = Process.Start(pi);
  10: p.WaitForExit();
  11: //p.Start();
  12: TextReader t = p.StandardOutput;
  13: sOutput = t.ReadToEnd();
  14: t.Close();            
  15: p.Close();
  16:  
  17: return sOutput; 
  18: }

The experience of using Visual Studio 2008 was interesting as it has been few years since I coded something end to end. I wish the coding surface to become more intelligent in terms of offering help on discovering commands and APIs that the developer is looking for. When VB6 came a decade or so back the help feature that it had was revolutionary and the wealth of information MSDN provided was without par in the industry. Now with Web & Internet Search prevalent the present IDE calls for a complete rethinking and revamp - unfortunately I don't feel the tools have come there yet. What I am talking here is not about wizards, smart tags or even intellisense but about how the tool helps a developer to learn/discover necessary APIs/solve the problem at hand.

 
Monday, January 21, 2008
 MVP Award 2008

MVP Award for the year 2008
 MVP Award 2007
MVP Award for the year 2007

I have been a Microsoft Regional Director (RD) from 1999 and I am happy to write here that Microsoft has renewed me as an RD for another two years. The RD program is a honorary title conferred to select professionals around the world who are passionate on Microsoft technologies. Over 140 software architects, developers, trainers and other professionals are selected by Microsoft as Regional Directors. The first thing to know is that, while we’re officially recognized by Microsoft and often receive inside information about forthcoming technologies, we are completely independent. We are not Microsoft employees.

Apart from being a RD, last year (2007) I was named as a Microsoft Most Valuable Professional (MVP) as well. I was given MVP in the category of Visual Developer - Solutions Architect. Recently, I was renewed as a MVP for this year as well. This entitles apart from other benefits, membership to a very lively exclusive email alias participated by all MVPs.  You can check out my MVP Profile here.

 
Tuesday, December 25, 2007

Microsoft recently announced their new virtualization technology  "Hyper-V" (codename Viridian) as part of Windows Server 2008 that will replace Microsoft Virtual Server 2005. I wanted to understand the differences between the two virtualization products and how to use Hyper-V. In my search, I came up with the following list of references and understandings.

Rough Technology differences between Hyper-V and earlier products:
One way to think about these new chip technologies is that they introduce a “-1” ring essentially to the usual four rings in the x86 CPU architecture. With the VPC and Virtual Server offerings, they use a trick called ring compression where the kernel of the VM is placed into Ring 1, instead of the expected Ring 0. This is so that the host can absolutely ensure that VMs are running in their own sandbox and can’t gain access to any resources of the host or other VMs. There is something like 14-17 CPU instructions in the x86 instruction set that can’t be executed directly because of sandbox violation. Hence, the need to place the child VM’s kernel into Ring 1 so that the host can place itself in Ring 0 to intercept those calls to protect them directly or to emulate them. By introducing a “-1” ring, the hypervisor lives here and controls the access to the various virtual machines. So, with the introduction of a hypervisor living in ring -1, the need for ring compression of child VMs is essentially removed. At least, this is one way to think about. They hypervisor itself is not a complete OS, per se. The hypervisor is a VERY thin and small, trusted computing base.

Hyper-V, codenamed Viridian Architecture from Wikipedia Technical References:

 

VM Additions for Linux

Earlier Microsoft Virtual PC and Microsoft Virtual Server 2005 didn't have VM Additions for Linux, recently Microsoft released fully supported VM Additions for Linux (Download from here).

 
Thursday, December 06, 2007

I was in lookout today for a small footprint / compact / embedded database engines suitable for .NET applications (mainly web) and found the following candidates. This is just a list compiled from the Internet.

  1. Microsoft Access (JET Engine) - Very Popular from Windows 3.1 days due to the fact it is out-of-box in most versions of Windows OS.
  2. Microsoft SQL Server 2005 Express - The plus here is that it is easy to upgrade to full-fledged SQL Server as Express edition uses the same file format and is binary compatible. Also ships with a free management tool "SQL Server Management Studio"
  3. Microsoft SQL Server 3.5 Compact - Can be embedded easily with less than 2MB in distribution size. Works with Windows Mobile as well.
  4. SQLite - A free / no license extremely lightweight Database engine which is less than 250KB in distribution size. There is no server process that needs to be started, stopped, or configured here. A detailed article here.
  5. VistaDB - Quite popular, 3rd party, commercial Database Engine that can be easily embedded. Written in NET Managed Code.

In the above list, other than VistaDB all the other are free (as in free beer) to deploy/distribute.

 
Friday, November 30, 2007

My everyday work laptop is a lightweight Sony Vaio TX57GN around 1.25Kg, having a Core Solo CPU, 1.5GB RAM, 4200RPM HDD, Vista its speed is sub-optimal and I can only use it for email and browsing. Even then I am not complaining and actually I love it especially on my travels. This changes when I have to do demos (customer presentations or Microsoft events) I got to run multiple virtual machines and at that time CPU muscle, RAM and Speed are crucial. So few months back I decided to buy a second laptop for demos alone and eventually settled down on Dell Vostro 1400. That was the time (August '07) Dell had introduced Vostro series in USA, the price of USD 1740 (with taxes) for the configuration was attractive so I immediately purchased it and got it through one of my colleagues coming to India.

Dell Vostro 1400 configuration

  • Vostro 1400, Intel Core 2 Duo T5470, 1.6GHz, 800Mhz FSB 2M L2 Cache
  • 14.1 inch Wide Screen XGA LCD
  • 4GB, DDR2, 667MHz
  • Mobile Intel 965 Express Chipset
  • Intel Integrated Graphics Media Accelerator X3100
  • 160GB 7200RPM SATA Hard Drive
  • Windows Vista Business    
  • 24X COMBO CD-RW/DVD for Vostro
  • Dell Wireless 1390 802.11g
  • Warranty Support, 2 Year Extended

The laptop scores good on Vista Benchmarks and performs well with multiple VPCs and Vista Aero interface. Dell shipped the laptop (strangely) with Vista 32Bit OS, so it showed only 3.5GB of RAM. This week I decided to upgrade the machine to Vista x64, so I got it formatted and installed Vista Ultimate x64. Now the laptop shows 4GB RAM, but most of the devices (as expected) were not installed with drivers. Luckily Wi-Fi worked and after running Windows Update which download 150MB of 42+ updates and a reboot, most of the devices including Graphics card got installed. The Ethernet card proved tricky with no drivers available either from Microsoft's Windows Update or from Dell support site. Dell doesn't provide drivers for Windows x64 OS for any of the devices in their Vostro series Laptop. After some searching I found the driver from Broadcom's support site for the LAN card and now everything is working fine.

Download Vista x64 Ethernet Driver for Dell Vostro 1400 laptop from here.

 
Monday, November 19, 2007

I came across these two references today.

One was Web Browser Standards Summary that summarizes the level of support for web standards and maturing technologies in popular web browsers. It covers the Internet Explorer, Firefox, and Opera web browsers, with focus on the HTML, CSS, DOM, and ECMAScript technologies.

Web Browser Standards Summary

Second one is the Audio interview with Chris Wilson, the Platform Architect for Internet Explorer at Microsoft. "Chris has been building web browsers for as long as there have been web browsers, and it was a pleasure to sit down with him at the end of the final day of the conference. In his talk at the conference, Moving the Web Forward, Chris gave the audience a glimpse into the realities of developing the most popular web browser in the world. With over 500,000,000 users to answer to, the words Don’t break the Web have become an overriding mantra for the company in its work to develop the next version of Internet Explorer (currently known as IE.Next)".

 
Saturday, November 17, 2007

Microsoft announced recently a new Sync Framework. This is a CTP release that is targeted for release in Q2 2008 and it supports P2P and Online/Offline synchronization of data. Currently though customers require Outlook like Offline/Online Sync scenario, it means developers doing custom coding. The Sync Framework is claimed to support P2P sync of any type of file including contacts, music, videos, images and settings. And has built-in support for synchronizing relational databases, NTFS/FAT file systems, Simple Sharing Extensions for RSS/ATOM, devices and web services.

I welcome having a standard framework for doing this repetitive job, it also removes the complexity of handling multiple connection types, scenarios, fail over, retry, etc. Download CTP from here.

image

 
Friday, September 14, 2007

If you are a web developer you might be familiar with the great free tool - Firebug. Firebug is an add-on for Mozilla Firefox that allows you to easily inspect the HTML DOM/CSS for a page, edit them inplace and many other useful tricks. Recently I came across another useful tool YSlow -which is an addon to Firebug. YSlow is from Yahoo! which analyzes web pages and tells you why they're slow based on the rules for high performance web sites. Check them out!

 
Thursday, August 30, 2007

Thanks to Scott Hanselman (my fellow RD) for this post where he had pointed to a four part series by Microsoft's Michael Kaplan on this topic. MichKa's post talks in detail with sample code on how you can embed fonts in a Windows Forms Application and have it run in any target machine where that font is not available & doesn't get installed permanently. Please note that I am talking about Windows Client Applications here and not a Web Application where you can use WEFT (Microsoft's IE only option for embedded font) or sIFR (Flash based technique) to embed fonts. 

  • Part 1 - Basics of Font Embedding
  • Part 2 - Getting the Font you're going to embed
  • Part 3 - Loading the Embedded Font
  • Part 4 - Embedded Font Licensing and DPI
  • I found the part of creating a font from a file, loading and using dynamically very interesting. It opens interesting possibilities especially for Indic Language applications.

     
    Wednesday, August 29, 2007

    While development and testing many times we need to change the IP addresses manually to a given IP and then switch back to Dynamic IP (DHCP). Doing it everytime through GUI especially in Vista (finding the Network Option from Start, Right Click, Selecting Network Connections, then Right Click on the Interface, Choose IPV4, ...) is tiresome and waste of time.

    For doing it easily Windows exposes a great command called NETSH. NETSH exposes too many options, the help (/?) and online documentation runs for several pages. Because of this, everytime I tried I was put off. Today I spent last 5 minutes and cracked this. For changing IP address, we need to use the NETSH INTERFACE IP command.

    To display current IP settings (equivalent to your ipconfig command):

    C:\>netsh interface ip show addresses

    Configuration for interface "Local Area Connection"
        DHCP enabled:                       No
        IP Address:                           10.10.99.222
        Subnet Prefix:                       10.10.0.0/16 (mask 255.255.0.0)
        Default Gateway:                   10.10.10.11
        Gateway Metric:                    256
        InterfaceMetric:                     20

    To change your IP Settings to DHCP:

    C:\>netsh interface ip set address name="Local Area Connection" source=dhcp

    To set IP to a manual config (replace with your own values):

    C:\> netsh interface ip set address "Local Area connection" static 10.10.9.22 255.0.0.0 10.10.10.111 1

    Here after static command, the first value is your IP Address, second is NetMask, third is Gateway and fourth is metric.

    Similar to set address command in netsh interface ip there is set DNS command that can set the DNS values as well. If you put the above in a batch (.bat) file then you can just double-click on it everytime you want the IP config to be changed.

     
    Thursday, June 21, 2007

    Many times you have the need to access data (XML) from other sites than the current page, browser security settings prevent it as it could lead to Cross Site Security issues. I came across these two good references on solving this:

    1. Yahoo! Developer Use a Web Proxy for Cross-Domain XMLHttpRequest Calls
    2. Mash-it Up with ASP.NET AJAX: Using a proxy to access remote APIs
     
    Saturday, June 16, 2007

    Most of the time, I get this question - not so much nowadays, but a lot in previous years.

    At Vishwak, we have been using IIS for all our customers for nearly last 10 years and after IIS 5.0 we are very satisfied with it and its scalability. Whenever I get this question I have to keep explaining the differences, pros and cons - but now it is made easy with this excellent comparison written by Microsoft Bill Staples (from Product team of IIS). BillS is very passionate on IIS and I have enjoyed attending his presentations including one in Microsoft Redmond on IIS 7.0.

     
    Monday, June 11, 2007

    The best mantra on security is to reduce the surface area for attacks. This means have minimum number of components or code running at a given point to get the work done, no more and no less (Slogan Courtesy: Oswald Cartoon character Henry Penguin). For example, if you are running a web server for serving static web pages and images, why install and run .NET Framework/JAVA or a Database server or COM+ components. In *nix world this was possible for years but in Windows, though this was possible - it required the average Systems Admin to have extensive knowledge of each and every service running on the machine.

    Now Microsoft has simplified this with the introduction of Windows Server 2008 Core. The Server Core installation of Microsoft Windows Server 2008 provides a minimal environment for running specific server roles that reduces the maintenance and management requirements and the overall attack surface area. To provide this minimal environment, a Server Core installation installs only the subset of the binaries that are required by the supported server roles. For example, the Explorer shell is not installed as part of a Server Core installation. Instead, the default user interface for a Server Core installation is the command prompt. You can manage either locally at the command prompt or remotely by using Remote Desktop. You can also manage the server remotely by using the Microsoft Management Console (MMC) or command-line tools that support remote use.

    In Tech Ed 2007 - Microsoft announced that the Server Core installation option of Microsoft Windows Server 2008 now includes Internet Information Services 7.0 (IIS7). IIS 7.0 introduces much wanted capability such as shared Web server configuration across servers.

    As a side note: I envisioned :-), a similar SKU about 8 years back when I presented this mock presentation on MSDOS.NET for grabbing the audience before my Commerce Server 2000 presentation in Tech Ed 2000.

    References: Server Core: Windows Without Windows

     
    Tuesday, May 15, 2007

    At Vishwak, we have been working on Live.Com gadgets, Vista Gadgets and other mash-up technologies for quite some time. Out of this, I personally feel the Vista gadgets to have the most potential to be useful. Lot of people seem to understand its potential though a bit delayed - including BBC Radio in the Vista gadget that I talked about in my Mix '07 posts.

    When we published to Live Gallery few of our experimental gadgets, we were really surprised by the number of downloads they made. The gadgets we published were Dictionary Gadget, Media Player Gadget, System Notify, CPU Meter, History on Today, Outlook Task and Radio Gadget. Out of this Dictionary and Media player have got over 9000 downloads and growing.

    Vista Gadgets developed by Vishwak Solutions

     
    Friday, April 13, 2007

    If you have been using Vista, Outlook 2007 combination and using POP3 (Non Exchange Server) for downloading emails - you may be experiencing slow email download. This might be due to the auto tuning of TCP/IP in Vista. Here is a Microsoft Support KB that helps to resolve this.

    Update (20 April 2007): Similarly if you feel that search is slow with Outlook 2007 (I liked Lookout, unfortunately it doesn't work with Outlook 2007) then download this fix from Microsoft.

     
    Thursday, January 18, 2007

    One of the questions I frequently get is how to upgrade from VB 6 to VB.NET. Though there are lot of upgrade scenerios explained in detail in MSDN, my favourite has always been step-by-step upgrade. In this approach, you take one of your existing forms, upgrade/re-develop them in VB.NET and have it being called from VB 6.0 applications. Then you move to the next form, by doing this, over a period you can have the entire application moved to VB.NET. The problem in doing this was to have the knowledge on how to turn the VB.NET form into a COM component that can be called from VB 6.0, MS has made this easier now with Interop Forms Toolkit 1.0.

    Having the forms developed in VB.NET brings in lot of capabilities - foremost being the ability to support 100% Unicode, which is very important for Indic Languages like Tamil, Hindi, etc.

    For doing Unicode with VB 6.0:

    Though basic: If Windows XP / 2003 - First ensure you have selected the check box in Control Panel -> Regional and Languages Options -> Languages Tab -> Install Files for Complex Script and Right Languages (or) If Windows 2000 – Ensure you have Indic Support enabled

    VB 6.0 even with MS Forms 2.0 will have some issues with Unicode, especially Indic languages like Tamil. I found it easier and better to do the forms in VB.NET 1.1 and then call the forms from VB 6.0. So the .NET application can be either a standalone EXE (or) called as a ActiveX COM DLL .

    These references might be useful, check them out:

     
    Monday, January 01, 2007

    Wish you all a happy new year 2007.

    Today I received a good new year gift - I was nominated and accepted by Microsoft as one of their MVPs (Microsoft Valuable Professional) - Visual Developer Solutions Architect. I have been a Microsoft Regional Director from 1999 but this is an additional title for me to hold.

    Update 1/Feb/2007: I received my MVP Welcome Kit and the MVP Certificate

    MVP - Microsoft Most Valuable Professional

     
    Saturday, December 16, 2006

    If you are using SQL Server 2005 and not able to connect to it remotely, then check out this useful blog post.

     
    Monday, November 20, 2006

    Read my earlier woes boot (BCD issues) with Vista Beta

    After completing the download of Vista RTM, I got ready to setup my Laptop. Used Acronis Disk Director to create 3 partitions (C:\ Vista, D:\Data, E:\WinXP) and formatted all of them using Acronis. Installed WinXP SP2 in E:\, installed Office 2007, AV and other softwares - got the entire WinXP setup completely.

    Then I started Vista setup in C:\, Setup copied the contents from CD to HDD and machine rebooted. Nothing happened, I got a blinking cursor and that's about it. 

    I guess Vista doesn't like the boot partition to be formatted by any other OS other than itself. So I used Vista Recovery Console

    Now I needed to fix Windows XP to boot. So booted using WinXPSP2 CD and went to XP Recovery console and executed the following:

    • FixMBR.exe (this said there is a non-standard MBR, understandable, as we have Vista MBR now, so skipped it)
    • FixBoot.exe C:\
    • Copied NTLDR and NTDetect.com to C:\ from CD i386 folder
    • BootCFG.exe /Scan
    • BootCFG.exe /Add to add a new boot.ini file and entry

    Rebooted - Windows XP SP2 from E:\ booted and ran perfectly.

    Started Windows Vista Installation again. Since this time the C:\ was partitioned by Vista itself and MBR is Vista MBR things went fine and Vista installed & booted fine. I am able to Multi-boot to previous version of Windows (XP SP2) as well.

    In my HP nx7010 the display (ATI Mobility Radeon 9200) problem continued, I was happy to see a Windows Update coming up with a new driver for it, but that too didn't work. Then I had to do:

    • Boot Vista in safe mode
    • Enable Remote desktop
    • Login again
    • Uninstall the Default Vista Driver for ATI Radeon 9000/9200 (Microsoft), Reboot
    • Install the latest HP (SP30204) WinXP driver through Windows Device manager (Don't install through Driver Setup)
       
     
    Thursday, November 16, 2006

    If you have been playing around with prerelease versions of Office 2007 and then try to install the final RTM build like the way I did today, you will get stuck with a error "Uninstall all preleases versions of Office 2007" and setup halting. Although I uninstall all Office 2007/2003 components I can find, deleted the office folders in Program Files, Registry keys, still the setup refused to run. After some search I found this blog post that writes on the same issue.

    The post pointed me to two useful articles on this from Microsoft: 2007 Microsoft Office System Known Issues/ReadMe & Support Article on setting up Office 2007. After doing all said in the articles, including uninstaling Office 2003 OWC, I couldn't get the setup working.

    Then I went to the last suggestion in the post to use Windows Installer Clean Up utility. I was using Windows Vista RC2 to do the setup - in that whatever reasons the installation of this tool failed with a script error. Then I did the following to get everything working:

    1) Unpacked the package file in which the utility came into a folder. In the extracted folder I noticed another installation file "msicuu.msi" I ran it directly.

    2) In Mid-way the setup came up with a dialog saying it can't find unicode/msizap.exe. In the extracted folder I saw a file called MSIZAPU.EXE, I copied it to a new folder "unicode" and then renamed it as msizap.exe

    3) Pressed retry in the dialog and the Installer Clean Up utility installation went fine.

    4) Ran the clean up utility, which showed couple of Office 2007 components that didn't show up in Uninstall applet of Vista - I removed all of them

    5) Finally I rebooted the machine, ran the Office 2007 RTM setup again - it went thru' without any more glitches.

    Happy working with Office 2007.

     
    Thursday, November 16, 2006

    One of the common problem in deployment of ASP.NET 2.0 applications is permissions. Developers setup IIS to run there application pool with admin priveleges and applications run fine. But when you deploy it in a production environment where the Application Pool runs in a limited permission account like "Network Service" things start to break - especially if the code accesses resources like EventLog. Today I got stuck in one such situation while deploying an application and I came across this good MSDN Article that helped me out.

    A related MSDN Article talks about how to use Medium Trust in ASP.NET 2.0 as a best practise. Recommended read for every ASP.NET developer!

     
    Friday, October 20, 2006

    If you haven't seen Live.com site, go check it out. It is a personalizable start page, you can add any number of available Gadgets - which are tiny AJAX applets that gives you functions like Calculator, News, Currency Converter, Games and more. There is a built RSS feed reading gadget as well that displays the contents of any RSS feeds. At Vishwak, we decided to improve the functionality of this RSS Gadget and we have come up a new RSS Viewer gadget. This gadget accepts any RSS link, displays top 5 stories, expands one abstract at a time in rotation.

    You can add this gadget to your live.com page from: http://www.vishwak.com/gadgets/live.com/vishwakrssrandom.xml. For adding, click on the Add Stuff link above the Pages Tab, then on Advanced options and type the URL of the gadget in the Subscribe textbox and press subscribe. Let me know what you comments .

    If you would like to write Gadgets on your own check out the Live.COM SDK here. There are differences between the Live team approved gadgets that have access to the entire page DOM and JavaScript objects; and your own (not approved) Gadgets which are run on an IFrame, which restricts it from drawing outside the Iframe area. That's why you will notice our gadget having the Edit button not on the same line as in the title display (border) but as a seperate line (Right-aligned).

     
    Saturday, October 07, 2006

     If you have been programming in Windows API/C++/VB 6.0 for long, you will feel the pain of DLL Hell. Dotnet framework solved it, but here is a good song to remember the DLL Hell.

    Link to DLL Hell Song Page

     
    Wednesday, May 31, 2006

    One of the lessons I have learned the hard-way over the years is to "Never rename a machine/server running SQL Server/IIS or any of the server software". If you must rename then think twice, tell for yourself the down-time is going to be nothing less than 2 days and then go about formatting the machine, reinstall OS, give the new name and reinstall everything again. If you are brave, then at least uninstall Server Software like SQL Server, IIS, etc. then rename, reinstall everything back. Doing anything else is risky.

    Anyways, yesterday I was playing around with one of my VPC Images having Windows 2003 Server, SQL Server 2000, SQL Server 2005 & VS 2005. I wanted to install 2007 Office SharePoint Server Beta 2 on this. But I didn't like the existing Machine Name (Host Name), since it was only a VPC I just went ahead and changed the name. After rebooting, tried working with VS 2005, SQL Server 2000, SQL Server 2005 and everything (Surprisingly!) seemed to work fine. With this false sense of confidence, went ahead and did Microsoft Update, that downloaded and ran the install for SQL Server 2005 SP1. Trouble Started. SP1 install refused to recognize my Authentication for SQL Services (How dare can it do this to me:-) ).  After several Internet Searches, I realized I have no other option other than to play dirty.

    <PLEASE DON'T TRY IT AT HOME>
    Went to RegEdit, I found and replaced all instances of OLDHOSTNAME with NEWHOSTNAME. Did the same with all Groupnames found in Computer management for Groups created by SQL Server 2005. Went and reregistered services using the NEWHOSTNAME in the new "Reporting Services Configuration" tool. Restarted SQL Services. SP1 Install was now happy and went ahead smoothly, but very slowly
    </PLEASE DON'T TRY IT AT HOME>

    By this time though the problem seemed to be fixed, I realized this is not the best way to do this. Renaming a machine / host is a common problem for which there should be a  recommended solution in SQL Server. Thanks to my fellow Microsoft Regional Directors: Kimberly L. Tripp & Scott J Golightly, I got the answer to do this correctly. I tried the following solution given by them in both SQL Server 2000 & SQL Server 2005, everything is now working like a charm now. Thanks KT & Scott.


    sp_dropserver oldname
    go

    sp_addserver newname, local
    go

    update msdb.dbo.sysjobs
       set originating_server = newname
       where originating_server = oldname
    go

    RESTART SQL Server

    If you want to check everything is fine and check the machine name registered in SQL Server, use the following code:

    SELECT @@ServerName
    go

    sp_helpserver
    go

    All the above works the same for both SQL Server 2000 and SQL Server 2005. A related problem has a fix at Microsoft KB Article #317241.

     
    Tuesday, March 07, 2006

    If you are trying to get dirty with WinFX ("Avalon", "Indigo" and Workflow), then check out this post by fellow RD Michele Leroux Bustamante. It contains easy steps to get the various pieces of Jan CTP including VS 2005 integration downloaded and installed in the correct order.

    I wrongly assumed Windows SDK (1GB Download) is a superset and will include everything needed to work on WinFX. Had I had this cheat sheet earlier it would have been lot easier!. MS please note this and don't have this so fragmented in future.

    If you are adventurous and want to go bleeding edge, check out WinFX Feb CTP. This blog post has a list of breaking changes in Feb CTP, but remember you are on your own.

     
    Sunday, January 15, 2006

    When you are programming the most frustrating moments are when your IDE crashes and you lose several hours of work. Since I started programming in the DOS days when this was very common, subconsciously I keep pressing Ctrl-S (Save) every few minutes. I carry this habit even when I work in Excel/Word, even to this day. Even while doing this blog entry (I use Web UI to post) I keep copying the contents in to clipboard every few minutes.

    Anyways I noticed a solution for this with Visual Studio 2005 through its AutoRecover option (Tools-Options-Environment-Autorecover). I am just wondering what took IDE vendors so long to do this!

    Visual Studio 2005 Auto Save

     
    Saturday, November 26, 2005
    When you view tamil texts created with dasBlog like my blog indic page, you will see the tamil contents not getting displayed properly in Mozilla or Firefox. It turns out to be a problem in the CSS with the text-align:justify; property. I have described this in my earlier blog post last year.

    After I upgraded to latest dasBlog version (1.8.5223.2) I selected "Project 84" as my theme, this problem resurfaced. All it needed was going to /themes/Project84 and editing the style.css file. In the file,  you need delete the above said property in the #content style.

     
    Tuesday, November 22, 2005

    Due to secure by default design philosophy, IIS in Windows Server 2003 SP1 doesn't allow unrecognized MIME types to be served. Clickonce (that ships with VS 2005) needs few new MIME types to be mapped. If this is not done, after you deploy a ClickOnce application from VS 2005, though it gets deployed successfully the application doesn't run in the clients. To fix this the following MIME types need to added in the deployment IIS server:

    FileExtention : MIME Type

    .application   : application/x-ms-application

    .manifest      : application/x-ms-manifest

    .deploy         : application/octet-stream

    More information is available from these Microsoft websites:
    http://msdn2.microsoft.com/en-us/library/fb94w1t5(en-US,VS.80).aspx
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=10606&SiteID=1

     
    Friday, October 28, 2005

    Charles Petzold is known to many as father of Windows API Programming. His Windows Programming books are Bibles in the subject. But you never knew he is also a profound thinker and orator, until you listened/read his recent speech given to .NET user group. The topic he choose was “Does Visual Studio Rot the Mind?”, if you are using Visual Studio, then this is a must read. Thanks Charles, all these years I was thinking I am mad for being the only person in the planet to complain on these nuisances with VS.

     

     
    Friday, October 07, 2005

    Today I encountered this issue in one of the projects. Simply put, we have an ASPX page like www.venkatarangan.com/file/getit.aspx?id=4040 that is going to read a file say "Office2003.DOC" from filesystem and stream it. The actual file will depend on the ID that is passed. It will come from a folder that is not accessible through IIS or will come from a SQL Server BLOB column. In either case an user will see in IE's dialog box the filename to be get it.aspx?id=4040 and not as "Office2003.DOC".

    We can modify the mimetype of the output of an ASPX page to say image/jpeg or anything by using the Response.ContentType property. It will be easy if we can specify the filename as well, but no property exists to do this in Response object. One way to solve it will be to create a virtual URL like /4040/office2003.doc. This URL doesn't exist, it will be mapped to be handled by a HTTPModule and the HTTPModule does the streaming by parsing the URL and getting the ID number. Since in this case the filepath from IE's perspective is Office2003.doc, IE will no problem in identifying the mimetype and launching MS Word with the file loaded.

    HTTPModule seemed to be a round-about solution. That's when my good friend Deepak Gulati of Microsoft came to rescue with this ASP code snippet (Thanks Deepak, I know I can count on you for these quick solutions. If you get a chance visit his photo blog)
    <%
      'If correct mime type is known use that    
        Response.ContentType = "application/x-unknown" 'Arbitrary
       
        fn = "blog.doc"                                'Actual FileName
        FPath = "c:\temp\" & fn
        Response.AddHeader "Content-Disposition","attachment; filename=" & fn

        Set adoStream = CreateObject("ADODB.Stream")
        adoStream.Open()
        adoStream.Type = 1
        adoStream.LoadFromFile(FPath)
        Response.BinaryWrite adoStream.Read()
        adoStream.Close
        Set adoStream = Nothing
        Response.End
    %>

    The above solution works by adding a "Content-Disposition" header as specified in RFC2183. This RFC seems to provide couple of useful customization possibilities, check it out. The code also shows a simple way to read a file and stream it using ASP/ADO.

    References:
    1) How To Raise a "File Download" Dialog Box for a Known MIME Type - Microsoft Support KB
    2) Explanation of Content-Disposition - MSDN Reference

    While I was searching this, I came across this support article that uses a single API call to "URLDownloadToFile" for downloading and saving a file. The code works in VB6.0 thru' .NET.

     
    Sunday, July 31, 2005

    With IE 7.0 Beta1 release last week, the blogworld is buzzing with posts on what is liked and disliked about the new browser release from MS. One topic that everyone seems to love talking is about IE 7.0 and its Standards Compliance (or lack of, depending on which side you see).  I have given below two posts which I felt were worth linking.

    The first post is from IE Teams' blog where they have talked about what is likely to be supported and what not in the final release of IE 7.0. If you are a serious Web Developer using CSS a lot, it is worth reading. On the same thread is this link posted in the web standards project's website, which talks about how IE 7.0 team in MS is willing to listen and is eager to co-operate with the standards' body.

    Recently I came across this site - sitepoint.com, which contains very good technical articles on CSS, Web Development and more. They also publish a good book on doing web pages with CSS without CSS. Check it out. I have ordered my copy, will tell you my feedback after I get a chance to read it.

     
    Saturday, May 07, 2005

    Setting up Debugging ASP (vanilla Active Server Pages, not ASP.NET) has always been tricky. I remember doing it for the first time as early as 1998 or so. It was during MS Visual Interdev launch in Chennai, which happened to be my first presentation for Microsoft India as well. Those days, it was on Windows NT 4.0 SP4 & IIS 4.0. The whole installation normally would take those days (with those ancient hardware) about half a day.

    Anyways, today we were setting up a web application that was written by us long time back on ASP. We successfully restored the DB, copied the source into a Windows 2003/IIS 6.0 machine and tried to run. We got strange errors and figured out that if we are going to get this working, we need to debug the application line by line. So started the effort of getting a simple ASP page debugged in Windows 2003. After nearly 4 hours strangely I got it working across 3 different OS configurations!

    Before going to the steps, remember that setting up Native Debugging (in fact, any form of Debugging) in a Production Web Server is a big security risk and performance degrade, so please do it only on your Development machines.

    Windows XP (32-bit) SP2, IIS 5.1 & Visual Studio.NET 2003

    1. Ensure the currently logged in user who is running Visual Studio.NET is a member of the "Debugging Users" group in the computer.
    2. Ensure you have IIS 5.1 installed with Frontpage extensions enabled. Try creating a simple Visual Basic.NET ASP.NET Web application and run it. 
    3. Once it runs successfully, add a new file into the project and name it "Check.asp" or any other name, but .asp file extension. Then have a simple <% Response.Write ("Welcome") %>  ASP line, setup the breakpoint on this line.
    4. Run VS.NET 2003 Setup, and ensure you have either Native Remote Debugging or Full Remote Debugging (as shown below) enabled. I think these features are available only VS.NET Enterprise Editions. If not, have it installed. 
      Visual Studio.NET 2003 Remote Debugging
    5. Then right-click on the VS.NET web project properties, in Configuration Properties -> Debugging, select ASP Debugging  (as shown below)
      ASP Debugging in Windows XP (32) with Visual Studio.NET 2003
    6. Open in Notepad URLScan Configuration file (normally found at C:\WINDOWS\system32\inetsrv\urlscan\urlscan.ini). This comes pre-installed with Windows XP SP2. Add a line in the [AllowVerbs] section, DEBUG. This is to add an allowed Verb, in this case DEBUG, HTTP method.
    7. Go to IIS MMC Snap-in. Right Click on Web Sites, go to Home Directory Tab, click on Configuration button. Goto to Mappings tab, select .asp row, click Edit. In that dialog box, select All Verbs (as shown below). Press OK all way down.
      Allow All Verbs in your ASP mapping
    8. Reset IIS, using IISRESET command from Command Prompt or IIS Snap-In.
    9. Go to the VS.NET Web Application, right-click on the ASP file (Check.asp) and Set as Start Page.
    10. Run the VS.NET application in Debug mode by pressing F5, you should hit the break point.  Good Luck.

    The above steps work only if both IIS and VS.NET are on the same machine and you are also administrator to the box. Both these may be rare (and potential security bad-practise) in a real scenerio.  In that case refer to my general items to check at the bottom.

    Windows XP (64-bit) or Windows 2003, IIS 6.0 & Visual Studio.NET 2003

    Windows XP 64 bit, ships with IIS 6.0. So remember to Allow the Active Server Pages, in Web Server Extensions page in IIS snap in. Apart from this you should follow all the steps I have told above for Windows XP 32-bit.

    Some webpages, talk about running IIS 6.0 in IIS 5.1 mode, I don't think so it is necessary. IIS 6.0 perfectly supports debugging of ASP pages with VS.NET 2003.

    Windows 2003/Windows-XP (64 bit), IIS 6.0 & Visual Interdev

    1. Ensure your IIS is up and running.
    2. Then Allow Active Server Pages, in Web Server Extensions page in IIS snap in.
    3. Create a simple ASP page, run it and check that it is working correctly.
    4. Have the second CD of Visual Studio 6.0 handy. Launch the setup and select "Server Components", choose "Backoffice Server components", press Install, in that ensure you have Visual Interdev Server and Remote Debugging components selected. Install them.
    5. Reboot the machine.
    6. Install Visual Studio 6.0 Service Pack 6.0 and Reboot the machine.
    7. Create a simple Web project in Visual Interdev and run it. Most probably your Front Page Server extensions will need tweaking, set it up.
    8. Create a simple ASP page, name it "Check.asp" or any other name. Then have a simple <% Response.Write ("Welcome") %>  ASP line, setup the breakpoint on this line.
    9. Refer and ensure you have all the points mentioned in my section "General Items to check" below, especially #2 & 3.
    10. Run it, it should work. If not doesn't worry, normally it takes more than few hours to get this working especially with IIS 6.0.
    11. Refer to this support page at Microsoft at "INFO: Visual InterDev 6.0 Debugging Resources", which contains a host of links on this issue. Since many of the contents here are dated and for Windows NT 4.0/9x,

    General Items to check

    Even with all the above, you couldn't get it working, check out the following:

    1. Ensure the currently logged in user who is running Visual Studio.NET is a member of the "Debugging Users" group in the computer. You may also want to add "INTERACTIVE, NETWORK SERVICE, IWAM_MACHINENAME" users into the group for testing and once everything works out, keep removing them one by one.
    2. The official pages: Visual Studio Remote Debugging Setup index page and ASP Remote Debugging Setup. The second link talks of adding few registry keys. For convenience, I have saved it as a text file here. Download and save it in your machine with .REG file extension and run it. It will add the necessary registry keys.
    3. Check whether you have enabled ASP Server side script debugging enabled. This can be done in IIS Snap In, Web Sites, Right-Click Properties, Home Directory Tab, Click on the configuration button, go to Debugging Tab (as shown below):
    4. Go to Component Services from Control Panel. Go to Computers->My Computer->DCOM Config, in that select the Catalog Class object. Right Click and go to Security Tab. In that Select Access Permissions area. Select Customize, press Edit and ensure to add all the relevant users (like IWAM_MACHINENAME, NETWORK SERVICE, INTERACTIVE, etc.). NETWORK SERVICE user will exist only on IIS 6.0 (Windows XP 64 bit and on Windows 2003), so if it doesn't exist, it is OK.
    5. In the Catalog Class properties dialog, select Identity tab, ensure "The Launching user" is selected.
     
    Wednesday, April 06, 2005

    I don't believe this - that I am writing a blog entry about working in vanilla "ASP" (Active Server Pages).

    Anyways, last week on an existing website, we had to do a new ASP page that reads an XML from a URL, and display it. While doing it, should cache the XML file, so that for every incoming web request, the page doesn't do an outbound XML file web request. Basic idea was to act as a kind of a reverse proxy (or caching web server) to prevent the full load from reaching the other webserver which had the XML file.

    Doing this in ASP.NET is a simple matter of enabling page caching, but doing it in ASP required pulling off few tricks from my old ASP hat. The code I wrote to do is a generic implementation that used ASP Application Object and VBScript DateDiff time comparison method. You can download the full code from here.

     
    Wednesday, April 06, 2005

    A situation we had in a recent project (Windows Application) was to take some actions based on whether we had an Internet Connection or not. Though it sounds very simple, there is no straight forward way to determine this. This because you can be connected by numerous methods - Internet via LAN/Wireless or Modem/Dialup or thru' IR/Bluetooth, etc.

    Couple of years back, when we were building a Cricket Score Alert Application in VB 6.0, we used to download a very small file via HTTP, and if succeeded we concluded that the Internet Connection was present. This time, I wanted the solution in VB.NET and expected to find a better solution. After several Internet searches, I came across this article (KB Article: 821770), which talks about WinInet DLL. Though this WinInet function gives you good information on the type of Network Connection (LAN or Dialup, etc.), it doesn't still say for sure you have an active Internet connection.

    Instead of calling WinInet through Interop from VB.NET, I would have loved to see a native function in .NET Framework BCL - Framework folks, are you listening?.

    You can download the code snippet here, for using the "InternetGetConnectedState" WinInet Function.

     
    Friday, March 18, 2005
    ASP.NET v2.0 (which is expected this calendar year) brings some exciting technologies including great Web Parts, making reuse lot more powerful and easy than today. Webparts was introduced in Sharepoint and there has been lot of questions on the interoperability between ASP.NET Webparts and Sharepoints Webpart. This blog entry from one of the Microsoft Sharepoint Technical Evangelist throws clarity into it.
     
    The blog also refers to this great tool "SmartPart for SharePoint: Workspace Home" that makes hosting ASP.NET 1.x User Control easily on a Sharepoint Webpart today. Great functionality, check it out. 

    I just now upgraded my blog to the new dasBlog 1.7.x. It is great and much faster than the Predecessor - I simply love it. The upgrade was smooth and so far I noticed no data loss (keeping my fingers crossed!). Also I noticed that the tamil fonts now appear correctly with Mozilla Firefox. Thanks E.Ravi for doing the upgrade on record time.
     
    Monday, March 14, 2005

    Delete '97 and subsequent Delete XP has been one of the popular freebies available for download from our products site: EasyTools.COM.

    Description: Delete XP is for deleting files from Command Prompt in Windows (Windows 9x and Windows NT 4.0/2000/XP). Unlike, the standard "DEL" command which only deletes the file, Delete XP deletes the files and sends them to the recycle bin. In our opinion, this is what DEL command in the command prompt of Windows should have been!.

    Over the years, the usage (familiarity and the need) of command prompt has certainly dimished. The only folks who uses it are the “IT Pros” and Me!. Anyways, even now I get once in a month or so, an email from some user across the world, who has found the tool on the Internet and finds it useful. He/She writes to me with a bug/feature (I leave which is more to your imagination) requests. Today, I have finally made the source code available from here.

    This was one of my favourite Win32 Console applications that I wrote, since I took enough care in handling correctly the various command-line parameters (and their combinations) - which like those of you who have programmed on good ol' C++ know, was by itself a daunting task.

     
    Friday, March 11, 2005

    One of the commonly asked questions on using .NET is the penetration of .NET Framework. This blog list the current statistics on .NET Framework penetration.

    If you are considering using .NET Framework, you can do a sampling by analyzing the log files of your website. Internet Explorer reports the presence of .NET Framework on the client's machine on its User-Agent Property.  In my Windows XP SP2, IE 6.0 with .NET Framework 1.1, this is how this singature looks:  
    Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)

    To successfully have this User-Agent Property recorded in the IIS log files of your website, ensure that W3C Extended Log File Format is selected and in the Extended Properties tab, the User-Agent option is selected.

    Enabling in IIS Log - User Agent

    Added on 13/Mar/2005: This blog entry by Yag from Visual Studio team lists the applications from Microsoft that use .NET Framework. Not a huge list, but certainly proves the bet of MSFT on .NET.

     
    Saturday, February 05, 2005

    Here is a list of few important free resources on ASP.NET:

    1) ASP.NET Resource Kit from Microsoft: These are set of web controls from www.componentone.com, that Microsoft has made available free of cost. It includes Controls for Web Menu, Web Chart, Web Report, Web Data Objects, Web Bars & Paypal ecommerce. Download from here 

    2) ASP to ASP.NET Migration: There are millions of webpages developed on ASP. If you want to convert your ASP Pages to ASP.NET, Microsoft recommends you use their ASP to ASP.NET Migration Assistant. Read more on this at MSDN ASP to ASP.NET Migration Section or at ASP.NET Migration Assistant page.

    3) Internet Explorer WebControls References: These are some cool controls that work with Internet Explorer exploiting IE's enhanced DOM model. It includes Multipage, TabStrip, ToolBar & Treeview ASP.NET Webcontrols. You can read the reference here and download from here.

     
    Tuesday, January 11, 2005

    MS has posted a fix for this at KB 890175
    Also available from Tools->Windows Update, option from IE. 

    I read yesterday about the recently discovered Security Problem (Command Execution Vulnerability) with IE and wanted to do a quick fix to protect my machine. Actually the problem is not with IE, but with an individual ActiveX control (Microsoft Help Control - hhctrl.ocx, found in C:\Windows\System32 folder) which allows any command to be executed.

    So the first step, I did was to login to my PC as Administrator, then Run the command Regsvr32 /u c:\windows\system32\hhctrl.ocx. Though this protected me from the vulnerability, F1 key (help) in all applications in my PC didn't work. So I reverted back by doing Regsvr32 c:\windows\system32\hhctrl.ocx.

    Then I figured a simpler solution, I remembered that Windows XP SP2 (which I was running) has the option “Manage Add-ons” (which I have talked about earlier). I went to Secunia.com Vulnerability test page, did the left click on the link as wanted; the page happily complained that I had the vulnerability. I was expecting this - but what I was after was to get the hhctrl.ocx loaded. Once it was loaded by IE, I went to “Manage Add-ons” dialog in IE and disabled for good the hhctrl.ocx. I went back to the test page, this time it throwed a script error - no more vulnerability!. This setting affects only IE and so F1 is available in other applications as usual. Try this and post your comments below.

    Remember, this is only a QFE and you should use it only till the time MS hasn't released an official patch.

     
    Monday, November 29, 2004

    Though not related, these are some useful URLs I came across recently

    1. Information on when to “Using CLR Integration in SQL Server 2005” by SQL Server team in Microsoft

    2. Roadmap on “Windows Forms and Avalon” by Avalon team in Microsoft

    3. “TechNet Script Center” gives tons of ready to use Scripts that can automate several system administrators tasks in Windows, by Microsoft TechNet Team.

    On Security

    4. “Aaron Margosis' WebLog” that talks about running with least privilege on the desktop, by Aaron who works in Microsoft MCS 
    A great resource to protect your Windows PC against attacks.

    5. “Browsing the Web and Reading E-mail Safely as an Administrator” by Michael Howard from Microsoft Security Engineering

    6. Links on “Microsoft Security Education” by Michael Howard from Microsoft Security Engineering

     

     
    Sunday, September 19, 2004

    You might have already read about the cool things coming in ASP.NET 2.0. The question is there how do I be prepared for it, when I design/development in ASP.NET 1.x. Though still ASP.NET 2.0 is in development, lot of the fundamental blocks are in place.

    Check out this article from MSDN Magazine on migrations tips to move ASP.NET 1.x to 2.0.

     
    Tuesday, September 07, 2004

    In so many of my ASP.NET presentations I get this question. How to do dynamic compliation of a code-behind .vb/.cs file used in a ASPX file?.

    The situation is like this: "We have deployed a project developed with ASP.NET/Visual Studio to the data centre. After going live, we have done a small bug-fix in one of the .vb file, now we don't want to recompile the whole-project in VS.NET to get a new DLL for deployment" or "We have lots of test pages that are half-done in a Web Project. If we compile in VS.NET, all of this code gets into the DLL. How do we avoid it?"

    The answer for this lies in understanding the Attributes available for the @Page tag of ASPX. When you create a .aspx file in Visual Studio, for linking to the appropriate code-behind files, VS.NET uses the tag Codebehind. For example, if you have a ASPX file “Welcome.aspx”, you will have codebehind=”Welcome.aspx.vb”. According to MSDN Documentation for @Page Tag, if you use the codebehind tag, ASP.NET runtime requires the classes in .vb file to be compiled and present in dll in the /bin folder. To avoid this, you can use an alternate tag src, which has very similar syntax src=”welcome.aspx.vb”, except that src will automatically compile the refererred file. The downside to this approach is that, you got to ship or deploy source code of all your code-behind files as well.

    In the same web project, you can mix and match codebehind and src tags in various .aspx files, but in a single .aspx file there can be only one of them.

    When I first did this demo, it failed!. Then I realized I got to change the namespace used in the Inherits tag. If you are using the Codebehind/VS.NET approach, VS.NET automatically uses the project name as the namespace. So Inherits for a web-project named “Venkat” will look like Inherits=“venkat.welcome”. But when you use src, it simply becomes Inherits=“welcome”.

    Download a sample - DynamicCompile.zip (1.1 KB) which demonstrates the use of src tag. Extract the files into a web folder, run it from browser. Change the source in the .vb file and reload from browser to see the changes without manual recompilation.

     
    Thursday, August 26, 2004

    From the time I migrated from FoxPro/Clipper*1 in MS-DOS world to Windows (over a decade back), I have been a strong Visual Basic supporter. From time to time, in between I did some coding in C, C++ and to an extend in JAVA when it first came, but pretty much I have been a VB guy. (Just to prove that I did program in C++ check my Delete ’97 – a console application that sends files deleted from command line to recycle bin). When Web came, I sticked to VB, as most of my web programming was with ASP and VBScript. In fact, I did as little as little possible in JavaScript - which too was mostly limited to client side (browser) scripting.

    In between, whenever I did program in C++, I felt it to be a waste of keystrokes to add semicolon in each line and I didn’t like the look of curly brackets every where. On a more serious note, coming from Basic/dBase world I felt comfortable with Visual Basic especially its support for UI, Database tasks and the availability of more high-level data types like currency, strings and more.

    So when C# came, though I liked its power of expressions, my old dislike for C family of languages continued and kept me away from doing anything serious with it. And VB.NET gave me pretty much of what I wanted and also at the end of the day it was all ending up as MSIL (Intermediate Language) whether you did the initial writing in VB.NET or in C# or in PERL.NET.

    But something happened yesterday that might change this. I listened to Anders Hejlsberg (Microsoft Chief Inventor of C#) talking about new features they are introducing in C# 2.0. The new features include Generics, Anonymous Methods, Nullable types, Partial Types and more. Especially I was very impressed with using Anonymous Methods in place of delegates; this can give great expressiveness with a simple syntax.

    So now, I am left to thinking about switching to C#. Even if I don't move completely, one thing is sure, I am going to give this C# 2.0 a serious try.


    *1 Though C++ was the first Object Oriented Language I learned, the one I used a lot, loved and appreciated was Clipper 5.x. The code-blocks (this is the successor to Macros in dBase) in Clipper gave you great power by allowing you to have code snippets in convenient places (even in a DB) and execute them whenever you wanted it. The support the language gave you to do common DB tasks (more so it was a language integrated with a DB Engine) like Input Masks  ..., I can go on and on about Clipper 5.x, but let me stop my saying I still look forward to some of its power coming to new languages. Language Purists might disagree with me on the above lines, but then it is a free world :-)

     

     
    Saturday, August 14, 2004

    I had written my URLDecode in Visual Studio 2003 (.NET Framework 1.1). Though I didn't use any Framework 1.1 specific feature in my application, it won't run by default in a machine with .NET Framework 1.0. This means I am limiting my target audience.

    .NET supports something called as “Assembly Config” files, which have a file name in the format <ASSEMBLYNAME>.EXE.CONFIG. For example, if you application is named Note.EXE, then you can create an XML Configuration Note.EXE.CONFIG and have it placed in the same folder as your EXE. In a way these are for Windows Application, what is Web.Config is for ASP.NET Applications. The configuration settings specified will affect the execution of your assembly. The settings can include, CLR binding redirections. This means I can write a *.CONFIG file that will redirect references from 1.1 assemblies and CLR to 1.0 versions of same.

    I wanted to create this file manually for URLDecode for sometime now. Recently I found Snippet Compiler download page has a similar config file for their software to do the same. I then customized it a little. You can use this generic configuration file for any .NET 1.1 application and have it execute in .NET 1.0. The caveat ofcourse, is that if the application uses any 1.1 feature, it is going to fail.

    Download the generic config here (0.83 KB)

     
    Sunday, August 01, 2004

    Many times while working in Indic Language web pages, I want to find the true character length of a string. .NET String.length() or its variants from other major programming languages, return character length based on storage space. They don't follow the language rules, so they are incorrect according to language grammar rules.

    For example if the string is Tamil 'வி' or 'கொ', or Hindi 'मा', the returned length is '2'. Obviously this is incorrect, as per grammar it should be counted as '1' character.

    To solve this problem, I have come up with this sample Windows Forms (.NET Framework 1.0) application. It uses .NET Frameworks, System.Char.GetUnicodeCategory() method which identifies every character as Upper Case or Lower Case or Other Letters (which means this is a Non English character) or Control, etc. Check it out.

    Download Application (5.89 KB)

    Download Source (18.44 KB)

    An online version of this (where you can try it without download any bits) can be seen along with my article here at Bhashaindia.com.

    Known bug: Deepak Gulati of Microsoft India found a bug with this solution, for Tamil (Grantha) Character 'ஸ்ரீ', should be counted as 1, but this code counts it as 2. The reason being 'ஸ்ரீ', technically is composed of two unicode seperate characters 'ஸ்' and 'ரி' which are shown as an one glyph by the font used. I am trying to figure to a way to solve. If you can think of one, post it below in the comments.

    My good friend Sri.Muthu Nedumaran has suggested a platform neutral solution that works for Tamil. I am working on that, will post it shortly here.

     
    Sunday, May 09, 2004

    Thanks to a suggestion from Sanjay Vyas, I have fixed the problem of Tamil texts not rendering properly in my blog.

    Analyzing the problem, I found that my Blog Name which is in Tamil and my blog entry text in Tamil were not rendering properly. The encoding is getting set correctly to "UTF-8" in all browsers.

    Currently I am using the DasBlog theme in my blog. If I select Just HTML, as my Theme then the texts gets rendered correctly. So it turns out to be a problem with the main CSS that gets applied for DasBlog them. With this, I narrowed the problem to be with the file at "/themes/dasBlog/dasBlog.css". 

    Since the problem was with Blog Name and Entry text, I searched for their CSS styles. DasBlog uses .siteName & .itemBodyStyle styles for these.

    In the .siteName section, there is a definition letter-spacing: .1em;  I deleted this. Similarly .itemBodyStyle, contained text-align: justify; I deleted this as well. Saved the DasBlog.CSS, refreshed my Mozilla, everything seems to work fine.

    Write a comment if the problem still persists with any other browsers that you are using to read my blog.

     
    Thursday, April 29, 2004

    For long in Windows security experts have been advising all of us to have two different accounts. One with Admin privileges that you use rarely when you need to install something or do some system configuration. The other will be a normal user account with minimum privileges. The second type of account is even more important for a developer. This way the developer doesn't assume admin privilege when he/she codes an application. So applications can run fine with least privileges. This will also prevent all trogans and malicious email attachments to cause chaos having been run as an admin user.

    Personally I feel it will do lot of good for Windows World in general, if all developers in Redmond are denied Admin privilege for their own machines. For developers who really need it like System Drivers team it should be rationed out that too only for a given period. This way they get to feel what is the world without admin privilege, because in real world everyone will be fortunate (or unfortunate, depending your viewpoint) to have admin rights.

    In this context, I got to read this well written article “Security in Longhorn: Focus on Least Privilege” by Keith Brown of DevelopMentor. I was happy to read that Microsoft is finally doing something serious about this in Longhorn. They are making it easier/default for applications to run with least privileges. Read the article for the exciting details. I hope by the time Longhorn ships MS doesn't succumb to compatibility pressures and dilute this heavily.

    What do you think about LUA in Longhorn, share your experiences in the comments section below.

     
    Sunday, January 25, 2004

    I have been always curious on how these IM's work. My favourite IM being MSN Messenger. I was searching for documentation and code-snippets to understand on what goes back and forth over the wire when we use Messenger. I came across the following

    The official documentation from Microsoft for Windows Messenger (the poor cousin of MSN Messenger) is found here. This lists the Messenger Client APIs, the Service APIs and more. Though not updated recently it is the only official source.

    The most active, single source of information about MSN Messenger is the site appropriately called MSNFanatics. The site has discussion forums about the Messenger API, security concerns, add-ons and more. Recently it has a tool called TabMgr that allows you to write your own Tabs in MSN Messenger.

    The website that I found with well written documentation and example sessions for a developer is from Mike Mintz. Check this out at http://www.hypothetic.org/docs/msn/index.php, you will love it.

    If you like Java (I like the coffee) then you can get the JMSN client source from Sourceforge, that shows a working Java client that uses MSN Messenger protocol.

    As usual, this post comes with the disclaimer that I don't support or endorse in any way, any of the above sites and you are on your own; your individual mileages may vary :-) . MSN, MSN Messenger are copyright and/or Trademark of Microsoft Corporation.