Tuesday, 22 June 2010

Autologon

I thought I'd do a quick post singing the praises of another tool from SysInternals called Autologon.

This is a clever little tool where you can feed in your logon name and password, and then when powered on, it automatically provides these and brings you straight to your desktop. Maybe combine that with starting your e-mail client on startup and you can get ready to go just from pressing the power button. Note that the password is encrypted, so you need not fear it's sitting in the clear in the registry.

DISCLAIMER: I am not recommending this be used in any situations. Username and password logons are there for a reason and you should only use the tool if you fully understand the implications involved and do so at your own risk.


That being said the following two cases seem like ones that may be suitable.

  1. You have some sort of full disk encryption in place (i.e. BeCrypt or PGP). You need to supply one set of logon credentials just to get to the OS, so if you're the only one that knows these credentials, the second logon prompt is somewhat redundant
  2. You would rather not have a password prompt on logon, and can guarantee the physical security of the laptop, but can't (or wont) change the machines security settings.

Tuesday, 8 June 2010

Issues with NumericUpDown Databinding

After setting up a form using databinding, I realised that my NumericUpDown controls were not properly updating the underlying object if a value was changed, and the user 'tabbed out', but they would work correctly if the user clicked into and out of the control!

numericUpDown.DataBindings.Add("Value"m_InventoryItems, "UnitCost"TrueDataSourceUpdateMode.OnPropertyChanged)

Thanks to TonyG for sharing the answer.

Friday, 4 June 2010

Programmatically add a Breakpoint with Debugger.Break()

Most of the time when working with visual studio you can debug your applications by simply running your GUI or command-line project in debug mode.

Now sometimes you might be working with projects that are not so easy to debug. For example a windows service, or an installer custom action.

Now one way around this is to create a custom wrapping exe that exercises the same code, but this wont be equivalent to it being run in the field (i.e. from msiexec.exe).

A handy solution to this is to place a call to Debugger.Break() in your code. When this runs windows will ask if you wish to attach a debugger to the running process, which then allows you to debug from this point forward. Great!

Keep in mind you don't want calls to this in your live code! I'd recommend only using it temporarily or ensure it is only included in debug builds by wrapping it in a method attributed with [System.Diagnostics.Conditional("DEBUG")]

Thursday, 3 June 2010

Integrating TortoiseSVN with Bugzilla

My project uses Subversion for version control, and TortoiseSVN as our subversion control client. A very good version control implementation on both fronts.

We also use Bugzilla as our issue tracking tool. The below can also apply to other Issue Trackers, but you will need to do a bit more of the work.

Now I recently found out that you can easily integrate TortoiseSVN with Bugzilla. Linking in this way adds the following benefits:

  • Prompts the user for an Issue reference when committing changes 
  • Records the change against that issue, allowing an indexed search for all changes relating to a given Issue
  • Display the Issue reference in the log message - with a clickable URL directly to that Issue
All of this can be enabled simply by setting the relevant bugtraq SVN properties on the top-level folder. For example I set the properties on the root of my development area, but for a project-wide adoption you can set these properties on trunk.

Here are the bugtraq properties I am currently using:

Simple as that!

Note: We use the term OR (Obersvation Report) in place of Issue in my current project.

Now I can understand those that say this doesn't add a great deal of additional features. Which is true *gasp*. But! It took me 2 minutes to do. For so little effort any benefit is worthwhile, and I definitely think there are benefits.

For more detail on how the available bugtraq properties work, check the official docs. Which are quite clear!

Wednesday, 2 June 2010

Copy and Paste from a MessageBox



Often I find a message box pops up with a message that I want to record, such as an error, and I normally take a screenshot of the active window (Ctrl+Alt+PrntScrn) which is all well and good, and is how I took the above screenshot.

Now I really just want the text and sometimes a picture may not cut the mustard, i.e. entering into an issue trackers 'Description' field, and you don't want to type long messages out by hand.

But I never knew - and I hope I'm not the only one - that if a message box is highlighted, and you use the traditional Ctrl+C keyboard shortcut for copy. It will copy the text to the clipboard. Not just the message, but all text displayed.

For example the above dialog provides the following text extract:

---------------------------
TestTitle
---------------------------
TestMessage
---------------------------
OK  
---------------------------


As you can see you get the Title, the Message (what we want), and the button text. Why it took me this long to find this out I don't know!

Tuesday, 1 June 2010

Remote Desktop Connection - Always use fullscreen

On my OS (XP Professional), the remote desktop client is mstsc.exe, and I always want my remote desktop connections fullscreen. Now it is clever enough to re-use the last session display size, and in most use cases that probably works fine.

My problem is that sometimes I work on my laptop directly, and other times through a docking station. When I switch between them I always find that the remote desktop client has changed the last display size from 'Full screen' to whatever the resolution was in the previous setup - which I have found very annoying!

Today I found my answer. I have the shortcut to this tool in my start menu, and the exe takes a /f switch to indicate fullscreen. So all I needed to do was to change my shortcut to "%SystemRoot%\system32\mstsc.exe /f".

Voila! Whenever I use the shortcut it always defaults to fullscreen! Just the way I like it.