Wednesday, August 22, 2007

Ever wished you could select a vertical column of code?

Stumbled across this cool shortcut in the VS editor:

Hold down the right CTRL+ALT key and then drag the mouse to select a rectangular column of text....

How to find the system directory (and other environement variables)

Was looking through the msdn Forums recently and someone was asking how to get the system path to save some files... and I though hmm this sounds like a job for the my namespace.... Alas I was wrong, could not help me but then it struck me... The system.enviroment class could help. Here are some of the goodies in this class:

Returns and sets the fully qualified path of the current directory; that is, the directory from which this process starts.

Returns the NetBIOS name of this local computer.

Returns an OperatingSystem object that contains the current platform identifier and version number.

Returns the fully qualified path of the system directory.

Returns the network domain name associated with the current user.

Returns the user name of the person who started the current thread.

Returns a Version object that describes the major, minor, build, and revision numbers of the common language runtime.

Returns the amount of physical memory mapped to the process context.

me.text = System.environment.systemdirectory

Monday, August 20, 2007

Where is SmartNavigation in ASP.NET 2.0 (VS2005)

Had a quick question taday that comes up often so I decided it's time to blog it!! In vs2003 there was this feature that would hold the page position after a postback so that it was redisplayed, updated at the postion where the page was scrolled to during the postback. It's a page level property that is not visible anymore in the Properties Window. however drop into a code window and it there, under a different name:

Page.MaintainScrollPositionOnPostBack = True

For more info please follow this link:
How to implement the smart navigation features in ASP.NET 2.0

Saturday, August 11, 2007

Remove Remote Desktop IP Entries on Public Computer

I was teaching a class y'day when I saw trainee was search desparately to remove the remote desktop entry on his PC after he had successfully connected to his home PC. He was obviously worried that some other user may find the entry and start trying to establish a connection to his home PC. The moral of the story so far... don't use remote desktop from a public PC!!

Anyway the MSDN site proved as valuable as ever turning up this:
How to Remove Entries from the Remote Desktop Connection Computer Box

To remove entries from the Remote Desktop Connection Computer box in the Windows Remote Desktop Connection client, start Registry Editor, and then click the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default
Entries appear as MRUnumber, and are visible in the right pane. To delete an entry, right-click it, and then click Delete.

All have now vanished ... except for ONE; the default that you find as soon as you open Remote Desktop. After numerous reboots, logging off and on... the answer was easy... Go to my documents and remove the Default.rdp file. It's a hidden file so you won't see it unless you go to Tools->Folder Options-> View -> Show Hidden files and folders :)

Wednesday, August 1, 2007

AJAX Error: Error: Sys is undefined

AJAX Enabling an Existing ASP.NET Website!!

A common mistake new AJAX developers make is to just start adding AJAX controls to their existing ASP.NET 2.0 web project. However after adding say the time it will let you know that you need a scriptmanager control. That's easy, drag-drop , press F5 or right click, view in browser. Waaaahhh no AJAX, just a Javascript error in the bottom right of IE7, which when expanded states:
AJAX Error: Error: Sys is undefined
Well if we had started out with an AJAX-enabled Website and looked closely at the Web.config we would have noted one very important difference between the two:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

For more info:
How Do I: Add ASP.NET AJAX Features to an Existing Web Application?

Visual Studio 2008 Beta 2 - Part 1

Well it's starting to get exciting now that MS have dropped the 'Orcas' Code name and gone Beta 2 wit VS2008. Naturally I was on the download straight away, and just so as to save time I down loaded the Team Suite Virtual Hard disk. I loaded it up in Virtual Server 2005 R2 on my HP nc8430 Laptop with 2GB Ram and gave the VM 1GB. After linking the downloaded vhd to my base01.vhd I got the VM up and now it's time to play and see what's new.

Expect part 2 shortly :)