Posts|Comments
Dec 04 2008

Remote Debugging with VS2008

This is a very common thing many of you might be knowing this thing already. However, I am just putting this information as it might help someone. In a distributed development scenario it becomes imminent to have remote debugging possible lest you have your development environment both on your regular development system and the remote server where the webapp is deployed. However, this problem could be resolved if we try to use remote debugging. It is easy to do with Visual Studio.NET. I am using VS2008 but the same should apply to 2005 as well with minor changes.

All you need to do is to copy C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\ folder from your local development system having VS2008 to the remote system which you want to debug. On remote system you can launch msvsmon.exe and also you can create a desktop shortcut for the same to make it easy to launch everytime. The user launching this app must be an admin to provide full previledges else you should use run as to launch this application with administrator rights.

Remote Debugging Monitor

More information could be found from
http://www.wictorwilen.se/Post/How-to-get-Remote-Debugging-work-properly.aspx

Dec 03 2008

Delete .svn folders recursively

Very often scenarios crop up when we want to clean our mammoth source code repository without having to export it elsewhere. I was looking for an elegant way to delete hidden .svn folders which are created by tortoise svn to keep track of the repository state on the client. I found this site which provided an elegant way which precisely meets my requirement.

I modified a minor glitch in the command to enable directory deletion from the folders which contain a space in name.

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"

Link: http://blog.snakehit.be/2007/08/29/svn-recursively-delete-svn-folders

Sep 08 2008

MSDN code examples could be incorrect as well

It was really odd for me to find an error in MSDN code example which took almost a couple of hours to figure out what is wrong. I am working in VSTO (Visual Studio Tool for Office). I am developing a plugin which is suppose to override some of the specific Office 2007 functionalities and implement some custom actions. My quest for knowledge took me here. I found this page very interesting and I found the explanation for exactly what was required. I took the C# code example as it is and tried to play around in my own sample. Sadly, the example which is given on the page in C# has a flaw.

public void mySave(IRibbonControl control, bool cancelDefault)
{
    If (repurposing)
    {
        MessageBox.Show(“The Save button has been temporarily repurposed.”);
        cancelDefault = False;
    }
    else
    {
        cancelDefault = False;
    }
}

In this code example, the second parameter should be a reference type. Visual basic example in the same MSDN page shows it correctly but the C# example as given above is incorrect. I respect MSDN so much that I didn’t care to see if anything is wrong in the code I lifted. After fiddeling around with a number of things and learning a whole lot than intended, I found the problem.
Lesson learnt! I will be more careful from next time :)

Aug 31 2008

Microsoft .NET Framework 3.5 SP1 Source Code Released

I would have never known that this takes up these many calls to perform a simple Console.WriteLine operation unless Microsoft had released the source code of the .net framework. I am delighted that the source code for 3.5 sp1 is out. It is time to dive deep in the framework itself.

Find the link below:

http://blogs.msdn.com/rscc/archive/2008/08/28/net-framework-3-5-sp1-sources-are-available.aspx

Aug 21 2008

Run Commands for Windows XP

I found this incredible link to start most of the XP system apps from Run box.

Program Run Command
Accessibility Controls access.cpl
Accessibility Wizard accwiz
Add Hardware Wizard hdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Tools control admintools
Adobe Acrobat ( if installed ) acrobat
Adobe Distiller ( if installed ) acrodist
Adobe ImageReady ( if installed ) imageready
Adobe Photoshop ( if installed ) photoshop
Automatic Updates wuaucpl.cpl
Basic Media Player mplay32
Bluetooth Transfer Wizard fsquirt
Calculator calc
Ccleaner ( if installed ) ccleaner
C: Drive c:
Certificate Manager cdrtmgr.msc
Character Map charmap
Check Disk Utility chkdsk
Clipboard Viewer clipbrd
Command Prompt cmd
Command Prompt command
Component Services dcomcnfg
Computer Management compmgmt.msc
Compare Files comp
Control Panel control
Create a shared folder Wizard shrpubw
Date and Time Properties timedate.cpl
DDE Shares ddeshare
Device Manager devmgmt.msc
Direct X Control Panel ( if installed ) directx.cpl
Direct X Troubleshooter dxdiag
Disk Cleanup Utility cleanmgr
Disk Defragment dfrg.msc
Disk Partition Manager diskmgmt.msc
Display Properties control desktop
Display Properties desk.cpl
Display Properties (w/Appearance Tab Preselected ) control color
Dr. Watson System Troubleshooting Utility drwtsn32
Driver Verifier Utility verifier
Ethereal ( if installed ) ethereal
Event Viewer eventvwr.msc
Files and Settings Transfer Tool migwiz
File Signature Verification Tool sigverif
Findfast findfast.cpl
Firefox firefox
Folders Properties control folders
Fonts fonts
Fonts Folder fonts
Free Cell Card Game freecell
Game Controllers joy.cpl
Group Policy Editor ( xp pro ) gpedit.msc
Hearts Card Game mshearts
Help and Support helpctr
Hyperterminal hypertrm
Hotline Client hotlineclient
Iexpress Wizard iexpress
Indexing Service ciadv.msc
Internet Connection Wizard icwonn1
Internet Properties inetcpl.cpl
Internet Setup Wizard inetwiz
IP Configuration (Display Connection Configuration) ipconfig /all
IP Configuration (Display DNS Cache Contents) ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) ipconfig /flushdns
IP Configuration (Release All Connections) ipconfig /release
IP Configuration (Renew All Connections) ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) ipconfig /registerdns
IP Configuration (Display DHCP Class ID) ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) ipconfig /setclassid
Java Control Panel ( if installed ) jpicpl32.cpl
Java Control Panel ( if installed ) javaws
Keyboard Properties control keyboard
Local Security Settings secpol.msc
Local Users and Groups lusrmgr.msc
Logs You Out of Windows logoff
Malicious Software Removal Tool mrt
Microsoft Access ( if installed ) access.cpl
Microsoft Chat winchat
Microsoft Excel ( if installed ) excel
Microsoft Diskpart diskpart
Microsoft Frontpage ( if installed ) frontpg
Microsoft Movie Maker moviemk
Microsoft Management Console mmc
Microsoft Narrator narrator
Microsoft Paint mspaint
Microsoft Powerpoint powerpnt
Microsoft Word ( if installed ) winword
Microsoft Syncronization Tool mobsync
Minesweeper Game winmine
Mouse Properties control mouse
Mouse Properties main.cpl
MS-Dos Editor edit
MS-Dos FTP ftp
Nero ( if installed ) nero
Netmeeting conf
Network Connections control netconnections
Network Connections ncpa.cpl
Network Setup Wizard netsetup.cpl
Notepad notepad
Nview Desktop Manager ( if installed ) nvtuicpl.cpl
Object Packager packager
ODBC Data Source Administrator odbccp32
ODBC Data Source Administrator odbccp32.cpl
On Screen Keyboard osk
Opens AC3 Filter ( if installed ) ac3filter.cpl
Outlook Express msimn
Paint pbrush
Password Properties password.cpl
Performance Monitor perfmon.msc
Performance Monitor perfmon
Phone and Modem Options telephon.cpl
Phone Dialer dialer
Pinball Game pinball
Power Configuration powercfg.cpl
Printers and Faxes control printers
Printers Folder printers
Private Characters Editor eudcedit
Quicktime ( if installed ) quicktime.cpl
Quicktime Player ( if installed ) quicktimeplayer
Real Player ( if installed ) realplay
Regional Settings intl.cpl
Registry Editor regedit
Registry Editor regedit32
Remote Access Phonebook rasphone
Remote Desktop mstsc
Removable Storage ntmsmgr.msc
Removable Storage Operator Requests ntmsoprq.msc
Resultant Set of Policy ( xp pro ) rsop.msc
Scanners and Cameras sticpl.cpl
Scheduled Tasks control schedtasks
Security Center wscui.cpl
Services services.msc
Shared Folders fsmgmt.msc
Sharing Session rtcshare
Shuts Down Windows shutdown
Sounds Recorder sndrec32
Sounds and Audio mmsys.cpl
Spider Solitare Card Game spider
SQL Client Configuration clicongf
System Configuration Editor sysedit
System Configuration Utility msconfig
System File Checker Utility ( Scan Immediately ) sfc /scannow
System File Checker Utility ( Scan Once At Next Boot ) sfc /scanonce
System File Checker Utility ( Scan On Every Boot ) sfc /scanboot
System File Checker Utility ( Return to Default Settings) sfc /revert
System File Checker Utility ( Purge File Cache ) sfc /purgecache
System File Checker Utility ( Set Cache Size to Size x ) sfc /cachesize=x
System Information msinfo32
System Properties sysdm.cpl
Task Manager taskmgr
TCP Tester tcptest
Telnet Client telnet
Tweak UI ( if installed ) tweakui
User Account Management nusrmgr.cpl
Utility Manager utilman
Volume Serial Number for C: label
Volume Control sndvol32
Windows Address Book wab
Windows Address Book Import Utility wabmig
Windows Backup Utility ( if installed ) ntbackup
Windows Explorer explorer
Windows Firewall firewall.cpl
Windows Installer Details msiexec
Windows Magnifier magnify
Windows Management Infrastructure wmimgmt.msc
Windows Media Player wmplayer
Windows Messenger msnsgs
Windows Picture Import Wizard (Need camera connected) wiaacmgr
Windows System Security Tool syskey
Windows Script host settings wscript
Widnows Update Launches wupdmgr
Windows Version ( shows your windows version ) winver
Windows XP Tour Wizard tourstart
Wordpad write
Zoom Utility igfxzoom

Link: http://www.adamsdvds.co.uk/run%20commands.php/

Aug 20 2008

Excellent Programming Quotations

While looking for an appropriate signature quote I stumbled across this website. I really liked a few of the quotes.

  • And the users exclaimed with a laugh and a taunt: “It’s just what we asked
    for but not what we want.”
  • If the lessons of history teach us anything it is that nobody learns the lessons that history teaches us.
  • The Six Phases of a Project:
    * Enthusiasm
    * Disillusionment
    * Panic
    * Search for the Guilty
    * Punishment of the Innocent
    * Praise for non-participants
  • Theory is when you know something, but it doesn’t work.
    Practice is when something works, but you don’t know why.
    Programmers combine theory and practice:
    Nothing works and they don’t know why.
  • Learning is not compulsory. Neither is survival.
  • Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else
  • Two things are infinite: the universe and human stupidity; and I’m not sure about the universe
  • Good programmers use their brains, but good guidelines save us having to
    think out every case.

This is just a few of those which I liked from the entire list. Find time to visit the website and enjoy the quotes or to use them in your own email signatures.

Link: http://www.eskimo.com/~hottub/software/programming_quotes.html
Aug 13 2008

Generate Random GUID by script

I had a task in hand to read and update a few registry settings. Since the registry keys might change in future and some more changes might be required on the fly, I decided to go with script instead of a config driven executable. Also, one compelling reason was that it has been some time since I did some good amount of scripting so I wanted to brush my scripting skills again.

Initially I wanted to use Windows Powershell but I couldn’t proceed far with it as the scripts require special privilege and security certificates to run. I don’t want to trouble my client with these hassles and ask him to install PowerShell. I am still exploring easy ways to allow a PS script to run without previliges and certificate/signing frustrations. Finally I settled with JScript which I have used extensively for my own purpose.

One of the requirement was to generate unique GUIDs. I looked around for generating unique GUID values using JScript or VBScript but couldn’t find something useful. I am not looking for re-writing a logic to generate a GUID with a specified pattern with all the scemantics. I just want a simple object which exposes the functionality to generate a new unique GUID and the object must be natively supported so that my client won’t require to install something additionally.

As usual after exploring all the way I stumbled across Microsoft Scripting Guy and the solution was a piece of cake ! Following is the answer

var typeLib = new ActiveXObject(”Scriptlet.TypeLib”);
var newGuid = typeLib.Guid;

Isn’t it easy ?

Aug 08 2008

SharpZipLib Decompression

Very often I require to perform (de)compression of archives programmatically. I use SharpZipLib for this purpose. After fiddling with several algorithms I found this simple piece of code that performs an elegant task of quick decompression of a zip archive.

internal void Decompress(string fileName,string extractPath)
{
FastZip fZip = new FastZip();
fZip.ExtractZip(fileName, extractPath, “”);
}

Link: http://dotnet.org.za/thea/archive/2006/01/17/Unzip-files-programmatically-in-C_2300_-_2D00_-_2300_ZipLib.aspx
Aug 04 2008

Huge list of productivity tools and utilities

While exploring for CodeRush guides I stumbled across this website. The author has compiled a very good link to various tools and utilities which someone can use to boost his productivity a great deal. The reason I bookmarked this website and I am providing the link here is that it contains almost all the productivity tools which I rely on heavily.

Some of the favorites which I can’t live without are -

  • slickrun - awesome tool for keyboard geeks like myself ;)
  • coderush - great boost to productivity in VisualStudio.NET
  • TestDriven.NET - unit test integration with visual studio. Exttremely good.
  • SysInternals - An array of productivity tools. Very handy in variety of scenarios.
  • WinMerge - A super elegant comparison/merge utility. Integrates seamlessly with SVN. A must have tool.
  • HightLight for Windows - nice utility to export code files to html with predefined css templates.
  • XMLSpy - Ultimate software for XML documents.

There are many more which has taken my attention. I will be using them in future and if I feel strong enough then I will post my reviews over it.

Link: http://www.hanselman.com/blog/ScottHanselmans2005UltimateDeveloperAndPowerUsersToolList.aspx

If you use something that does not constitute the list of utilities as provided in the above link then do comment with the appropriate link to the utility and tell more about it. It might be helpful to me and fellow readers.

Jul 22 2008

Power of Unix on Windows

I am an ardent admirer of console commands. For a very fast execution of the most simple tasks, I rely on cmd. About an year back I saw my tech architect using Grep on windows. Until then I didn’t know how effective it could be on Windows platform. At that very moment I downloaded unix-utilities for windows. I have realized its power many times in my profession. Very often it is required to find a few pieces of information from a pile of XML logs occupying around 20 Megs on my system. I wonder if I could have done it if I were not having the power of unix on windows. A variety of utilities are available for most of the tasks. Undoubtedly, my favourite is grep because of its splendid blend of simplicity and power.

I like powershell too, but for simple tasks it seems like an overkill. I am not an expert of powershell but for simple task of finding some information recursively, I think grep is great. The command is simple and execution is very fast.

With the evolution of powershell, it seems micrososft is empowering users with powerful console commands. WMI is good but still it was not a general purpose scripting platform. Powershell leverages both its potential for managing windows and perform quick one line commands. I like a few of the commandlets available in powershell like “ps” is a quick way to dump all the available processes with relevant information. Powershell becomes really fun when one has the PowerShellPlus which is an interactive scripting environment for powershell which also has intellisense support.

If you do not like default appearance and behaviour of Command prompt, which has not changed much since the DOS era, then go for Console. It is an excellent piece of open source creativity which gives better control on command prompt as Linux users have always enjoyed. It allows multiple tabbed console prompts, coloured background with custom picture and true alpha blending.

Please share your experiences and suggestions.