Archive

Archive for the ‘Vista’ Category

Vista and Special Folders

December 13, 2007 Comments off

Way back in January I posted about using Windows Special Folders for storing application data. Today, while setting up a new Vista PC for my boss, I came across a great reason why this approach is a good idea.

I was installing one of our applications that stores a serialized file in the special folder LocalApplicationData. My boss has a ton of configuration information in his current install of this application, and I thought it would be a good thing to simply copy his current configuration over to his new machine. Hey, anything that makes his life easier makes my life easier!

So I began by copying his binary file to a network location for later retrieval. I then went to his new Vista PC … and couldn’t find the correct folder path. I looked all through the Vista folder structure, which only served to frustrate me. On XP, the directory path was something like C:\Documents and Settings\%user%\Local Applications\Application Data\. In Vista C:\Documents and Settings\%user%\ has been replaced with simply C:\Users\%user%\.

But I couldn’t find anything there like what I needed, nor anywhere else for that matter, so I wrote a quick little Console application to output the Special Folder path. Sure enough, it turns out to be C:\Users\%user%\AppData\Local. I went back to Windows Explorer and could not see the folder. Of course, that is when I realized that the folder was hidden.

No problem, I thought, I just need to alter the view to show hidden files and folders, something I’ve done a hundred times on Windows machines. So I right-click in the folder, select “Customize This Folder”, and … nothing. No option to show hidden items. Hmmm, they must have moved it. I right-click and try “Properties”. Still no joy.

Finally, in the tool bar, under the “Organize” drop down, I find an option for “Folder and Search Options”. This window has a “View” tab that reveals the old View options I am used to seeing. Finally! I checked the option for “Show hidden files and folders” (and made a couple of other changes while I was in there) and now I can finally find the correct path. I hate relearning old tricks.

So back to the lesson: I found the correct path, which had been created by my application, retrieved the binary file from the Network store, and replaced the new one created by the application install. I open the application and Viola! – all my boss’s configurations are happily restored.

So, take advantage of the Special Folder system. The folder structures between XP and Vista are quite different, but using this approach made reinstalling my old .NET 1.1 application a happy affair.

Categories: Vista

New Vista Machine follow up

December 11, 2007 Comments off

I let VS2008 finish installing last night while I was at home. I got in this morning, and the system had done an automatic update. It loaded a ton of updates from Microsoft, some were Vista specific but most were not. I was able to confirm that VS2008 installed just fine and I have spent the rest of the morning installing other software.

My experience today has been much different than yesterday. Everything seems to be sailing along: I’ve installed a number of applications, configured some network connections, a printer, installed FireFox and extensions, and did some other configuration. All in all I have nothing to complain about: it seems the Windows Update did a lot of good for this machine.

I’ll probably spend the rest of the day setting up some other goodies, and at lunch time I am picking up my new 22″ Widescreen LCD monitor. After that, I have some SPROC development to do. I promise I’ll be getting to LINQ soon.

Categories: Rants and Raves, Vista

New ThinkPad T61 with Vista Business

December 10, 2007 3 comments

My new laptop arrived today. I’ve been playing with it for a few hours now and thought I would share my initial reactions with you.

This is a Core Duo 2.2Ghz processor with 3GB of RAM. It has a 15.4″ widescreen LCD display, which is gorgeous. My favorite feature so far is the integrated fingerprint reader: logging in is super easy and secure. But software installation is shocklingly slow. It only took an hour or so to get the initial Vista install configured, but everything after that has been less than optimum.

I was so excited by my new machine that I went to Staples at lunch time and picked up a new Logitech wireless mouse and keyboard. I bought a docking station with this laptop for the office, one goal of which is to switch back to a regular mouse, keyboard, and monitor. The keyboard part is largely to restore my hands, which hurt quite a bit after working day in and day out on a laptop keyboard. Of course, I know I could have used a regular keyboard with my old laptop, but I found that it pushed the screen to far away. With the new display, that is not an issue. I’m also hoping to use both the built in LCD and an external 22″ widescreen monitor, which should give me loads of space for Visual Studio and related tools. Anyway, I connected my new mouse and keyboard (I haven’t bought the monitor yet) via the USB connector and they worked immediately. I did not even need to push the device “Connect” buttons.

After that, it was time to start installing software. First, I tried to install IBM’s iSeries Access for Windows, V5R4. This was the first task for the CD drive, and it sounded like a rocket ship taking off. It got about half way through the install, whirring, buzzing, and scraping all the while, and then it just quit. I tried to bring up Task Maanger, but it would not show itself. Finally, I popped the disc out and reset it. I don’t think I had it seated all the way although it seemed fine. I resumed the setup and the noises were gone. At the end of setup, I received a “Updating software, please wait” message that never went away. Eventually, I succeeded in bringing up the Task Manager and the process showed running but 0% CPU. I ended it, thinking the install failed, but it appears to have worked.

I closed Task Manager, but in my shortcut tray there were now 2 task manager icons that would not go away, and clicking on either did not reactivate the Task Manager. Sigh. I decided a reboot was in order.

Except the machine would not reboot. I tried restart, log off, and shut down. I tried them from the Start menu and from Task Manager. Each responded to the mouse click yet accomplished nothing. Finally, I did the old push and hold the power button technique to get the machine to shut off. When I brought it back up, I received no errors or warnings about a previous incorrect shutdown.

While it was coming back up, I hit the Google Highway and found that this is a fairly typical problem: the USB devices connected to the machine were preventing it from shutting down. Now, the only two devices connected are my printer and the Mouse and Keyboard connector mentioned above. According to the complaints I found on the web, the Mouse was most likely the culprit and the solution was to update the drivers. Now, I’ve used Logitech accessories for about 7 years, and I’ve never been a fan of their software. I just want a stinking mouse and keyboard that work, I don’t need to use them to program my dishwasher. The last few times I’ve installed their products I have been able to forego installing their software, but this time I figured I’d better do it if I want to be able to shut down my machine, so I did.

The good news is that installing “Logitech SetPoint 3.3a” seems to have solved the problem. After the install I was able to restart from the Start menu just fine. The bad news was that it took almost 15 minutes to install.

I have a stack of other software to install, including of course our erstwhile Visual Studio 2008 and Expression Blend Preview 2. I’ll let you know how these go as well.

Update:

Xara Xtreme, an awesome (and inexpensive) vector based graphics tool installed no problem and took less than 5 minutes.

New problem: I can’t get to the Network. It appears that Norton Internet Security, which came preloaded and is active on this machine, is preventing me from seeing my network. I’m investigating this problem now, but I can’t get on with the installs until I can get to the network path where they are stored.

Update 2:

OK, annoying, but I basically had to disable the Norton Personal Firewall, at which point the network location I was seeking became visible. I established a connection and the system offered to remember the password, which I said yes to. Then, the Fingerprint reader asked me to verify who I was with a swipe of a digit. Way cool! Anyway, it’s off to VS2008 next.

Update 3:

New problem: I am using Microsoft’s Virtual CDRom Control Panel to mount the VS2008 ISO files to a local drive. When I execute the program, it denies access to the needed files. I found in Vista you can right-click and Run the application as Administrator, which worked. I was able to install the driver and mount the file to a local drive letter. The problem now is that the Computer window will not show or find the mounted drive letter. I guess I’ll either need a different emulator or to try and find a Vista update for Virtual CDRom.

Update 4:

OK, I found a freeware utility called Virtual CloneDrive that appears to work on Vista.? I was able to install it and mount the ISO file to a drive.? Immediately, the Autorun.exe started (which never worked on Virtual CDRom XP for me) and I began installing VS2008.? It is 3.5 GB (after I removed C++ and Crystal Reports), so it might be a while.? I’m going to let it run and head home.? I’ll check in tomorrow.

Categories: Rants and Raves, Vista

Windows Special Folders

January 23, 2007 1 comment

We were watching a Microsoft Web Seminar yesterday on Windows Vista User Account Controls, and one of the code samples referenced the users LocalApp directory. This led to a discussion of where to store things like binary files, config files, and .ini files. In the past, you may have stored this in the Program Files directory. This is not a good practice, because there is no guarantee that this is where the user installed the software. Fortunately, in .NET, you can get the installed directory from an Assembly object, but this is still not a good practice
because if the software is uninstalled and reinstalled, you could lose those files, frustrating your users.

To compound this problem, in Vista the Program Files directory requires Administrator priveleges. The whole point of UAC, of course, is to limit potentially dangerous code from executing and to allow users to truly operate in a “Standard User” account environment. Even a user with Administrator priveleges executes programs with Standard User access [NOTE: this behaviour can be overridden by manually assigning a manifest to the assembly instructing it to run as Administrator]. This means that in order to access a config or binary file stored in Program Files requires the user to bump up their security by responding to a Dialog Box. One of the Vista goals that Microsoft has set forth for ISVs is that our software should run as Standard User. That and the user being constantly prompted to upgrade their security level are reasons enough not to rely on Program Files for storage in Vista.

Another typical solution is to simply create your own directory structure in C:\, but I find that unrealiable as well. Some users like to “clean up” their C:\ drive on occassion, and your application may all of a sudden not work anymore. Plus, it makes curious users into dangerous users if they can directly access config files or who knows what: I meant, these are users we’re talking about, and you just never know what they might do.

So the question becomes “Is there a safe, reliable directory we can use to store and retrieve such files from?” The answer is yes! .NET provides access to a series of special folders, enumerated in Environment.SpecialFolder. (The Environment namespace is part of System, so does not need to be referenced, it is always just accessible) Following the link will show you the list of Special Folders, most of which are pretty straight forward, like My Computer, My Documents, etc. There is one in particular, though, that is not so straight forward, but is exactly what we need: LocalApplicationData. This is a directory buried within the User structure. On my XP box, the path looks like this: C:\Documents and Settings\Joel\Local Settings\Application Data. Underneath this directory are a listing of other directories, usually company names (Microsoft has one, as does Google), and inside those directories are directories for specific Applications.

This is where we want to store our persistant data. It is safe from being overwritten, does not require Administrator priveleges, and most curious users aren’t going to go tampering with it. Another good thing about this approach is that we are going to use a system name to get the path: we are not going to hard code this path structure! I don’t have a Vista machine yet, but there is no guarantee that Microsoft kept the same structure. What they will keep, however, is .NET’s ability to find the path of this folder on any given system.

To get the path, you need to pass the SpecialFolder enumeration value you want to the Environment.GetFolderPath method:

// Get Special Folder path
string myLocalAppPath = Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData );

Your application directory will not be automatically created beneath this path. You will need to check for the existence of it and create it if necessary. This would be an ideal task for a Custom Action in the Installer.

This should provide the ideal location for your application settings and persistent configuration files.

Categories: .NET, Vista

Windows Vista IS the Killer Feature

January 16, 2007 1 comment

SearchWinIT.com has an article outlining the new must-have features for Windows Vista. The author, Bernie Klinder, notes that there isn’t a single killer feature, but rather Vista is ful of smaller features that overall add up to the “must-have” aspect of Vista. He says once you’ve used Vista, it is almost painful to go back to XP. Here is his list of items:

  • Integrated Search
  • Power Management
  • Network Management
  • Ad Hoc Wireless
  • Presentation Mode (AWESOME)
  • Previous Versions
  • Mobility Center
  • Document Previews
  • Guided Help and Automated Diagnostics
  • Aero

Not all of these features will appeal to everyone, but overall Vista looks very promising. I plan on getting a new laptop once the OEM version comes out… I’ll be sure to review it in detail then. In the meantime, read the rest of Kindler’s article for more details.

Categories: Vista
Follow

Get every new post delivered to your Inbox.