Tuesday, March 14, 2006

Command-line shortcuts to start/stop/reset the IIS service

The application that I develop at work runs in a client/server environment where the server is a Windows machine running IIS. I tend to reset the IIS service on the development server reasonably frequently, as it's a quick and easy way to clear any data that has been cached in memory on the server.

I used to start and stop the IIS service when necessary by going through Start | Control Panel | Administrative Tools | Services, selecting the IIS Admin service, and clicking the "start", "stop", or "restart" button on the toolbar as necessary. Eventually I decided that going through this multi-step procedure every time was too slow, and went looking for some ways to accomplish the same tasks from the command line. The shortcuts below work with IIS 5, and I believe they also work with IIS 6.


This resets the IIS Admin service, including the World Wide Web Publishing service.

iisreset /timeout:0

This resets the IIS Admin service faster. According to the help information (iisreset /?), iisreset normally might wait up to 20 seconds to wait for a successful stop of internet services before the restart is performed. The timeout:0 parameter causes the reset to be performed immediately.

net stop iisadmin /y

This stops the IIS Admin service and dependent services (including the WWW service) without restarting them. The /y parameter skips the confirmation prompt that would otherwise be displayed.

net start w3svc

This starts the WWW and IIS Admin services after they were previously stopped.

Monday, March 06, 2006

Cancelling Block Recognizer (Pocket PC) shift punctuation mode

On my Pocket PC, my text entry method of choice is the Block Recognizer -- a clone of the Grafitti text input method from Palm PDA devices. My first PDA was a Palm Pilot (the Pocket PC being my 2nd and current PDA), so I'm on familiar ground entering text with Block Recognizer.

One gripe I've had for a while is that I didn't know of an quick way to cancel the punctuation "shift" state if I put Block Recognizer into that state by accident. Block Recognizer has a input combination method of entering punctuation characters where you tap the text entry area once with the stylus, then do a pen stroke and the app will interpret the stroke as a punctuation character instead of a letter or number. (For example, a tap followed by a vertical top-to-bottom stroke is interpreted as a singlequote instead of the letter "i".) Grafitti allows you to cancel the "shift" state with a "backspace" pen stroke, but unfortunately, Block Recognizer interprets the "backspace" as a "-" character when in shift mode instead of cancelling the shift mode. (Tapping the screen once more doesn't work to cancel shift, either -- that's a "." character.)

I accidentally happened around a workaround for this earlier tonight. I noticed that when in shift mode, the dot that indicates shift mode is active appeares in only the "letters" or "numbers" portion of the input area, but not both. I found that if I want to cancel shift mode in the letters portion of the input area, I can tap in the numbers section -- this moves the "shift" dot from the letters aera to the numbers area -- and then proceed to write normally again in the letters area.

This will hopefully work out to be a better solution than my old method of cancelling shift than my old method of writing any stroke, backspacing it, and then continuing, which I found to be really disruptive to my flow of writing when in the middle of a sentence and trying to write quickly (such as when taking notes during a presentation or lecture).

Now I just need to figure out my other main problem with Block Recognizer -- my low accuracy rate, particularly when it comes to the software misinterpreting my entry of a standard a-z letter character as an "international" character. The "œ" ("oe") character is one that comes up particularly often. I wish there were a way to disable recognition of all characters except the standard a-z and 0-9 when not in one of the shift modes.

Fix: Can't hit Visual Studio breakpoints when debugging Windows Forms app in browser

In the past, I've run into a problem where when trying to debug a .Net Windows Forms application running embedded in an Internet Explorer window in Visual Studio, breakpoints will not be hit in the debugger. I've seen this issue myself in Visual Studio 2002 and 2003; a colleague just told me that the issue is apparently present in VS 2005 as well.

The solution is in the Project Properties dialog/pane, on the Debug tab, instead of checking the "Start browser with URL" radio button, the "Start external program" radio button needs to be checked instead. In the text field for "Start external program", enter c:\program files\internet Explorer\iexplore.exe (or wherever your local copy of iexplore.exe is located).

Optionally, you can enter the URL of the web page that you want to be initially loaded in the browser in the "Command line arguments" field.

Another thing to verify is that the <object> tab in your web page is pointing to the current debug version of your application's .dll file.

Once that is done, you should be able to successfully hit breakpoints when debugging the application running in the browser.

Friday, March 03, 2006

Notepad.exe gone haywire?

A few times in the past, I've encountered a situation where I'll be in the middle of working when Notepad suddenly seems to go haywire. The text becomes right-aligned, some glitches come up in the text, the vertical scrollbar moves to the left side of the window, and the functionality of some keys such as the right and left arrow keys is changed or reversed:

I recently figured out what was going on. Apparently, there is a Windows shortcut key combination, Ctrl + Right Shift, that activates "Right to left reading order". (This apparently only works if the "Install files for complex script and right-to-left languages (including Thai)" checkbox is checked on the Languages tab in the Regional and Language Options dialog from the Control panel.) The Ctrl + Left Shift shortcut key combination restores the normal left-to-right reading order.

The "Right to left reading order" option is also available from the right-click menu of the Notepad window's text area when the checkbox is checked:

These shortcut keys are also effective in some other places in Windows, such as the Start | Run dialog.

I presume these features are in place to support right-to-left languages such as Hebrew and Arabic. However, what's up with the unusual Ctrl+Shift shortcut key combination? Most shortcut keys are don't involve *only* the Ctrl/Shift/Alt/Win keys, but involve one or more of those keys in combination with another keyboard key. (The times that I stumbled across the Ctrl+Shift keyboard shortcut in the past, I was probably doing something like Ctrl+Shift+RightArrow to add words of text to the current selection.)

It would be nice if the shortcut keys for this feature were assigned to something less easy for users to stumble across and activate by mistake, to avoid confusing users who do activate the feature by accident with the apparently "buggy" behavior when working in a non-right-to-left language.