Category Archives: Windows

Errors using AttachDBfilename and SQLEXPRESS when migrating dev code to production servers

One of the developers at work had used the Visual Studio web authentication tool thingy, which created an SQL Server Express database which was configured in his web.config to attach the file for use.

When migrating this to a server that has SQL Server (not SQL Server Express) this obviously doesn’t work; you get connection errors.

As this useful post says:

AttachDBFilename is unique to SQL Express, it spins up a user instance of SQL Express attached to a specific DB Filename for single user mode. Database is simply the name of the database to use, it has no additional connotation. For any production server, you would most likely not be using AttachDBFilename. It is strictly useful for development and experimentation in single-user mode.

The answer is to attach the MDF (database file) to SQL Server. You may want to change the database name; it seems to just plonk in the original filename (with path) there, which is pretty unwieldly.

Create an SQL Server login, and a database user (linked to the login) for it (I gave it the dbowner role, though it’s probably possible to restrict it a bit more), and then change the web.config:

  • “data source=.\SQLEXPRESS;” becomes “Server=(local);”
  • “AttachDBFilename=|DataDirectory|\aspnetdb.mdf” becomes “Database=[databasename]; User=[username]; Password=[password]”
  • “User Instance=true” needs to be removed

Cross your fingers and hopefully that’ll work.

Google Desktop discontinued

The Google blog has detailed a number of Google products being discontinued. Most of them I’ve never heard of (Aardvark?) or considered of doubtful use (Google Pack).

But the really disappointing cheap cialis online one for me is the end of Google Desktop.

In the last few years, there’s been a huge shift from local to cloud-based storage and computing, as well as the integration of search and gadget functionality into most modern operating systems. People now have instant access to their data, whether online or offline. As this was the goal of Google Desktop, the product will be discontinued on September 14, including all the associated APIs, services, plugins, gadgets and support.

I really like the way Google Desktop can simultaneously search my local documents, emails in Thunderbird, and in GMail as well. I suppose I’d better learn more about Windows 7 Search — does it even offer the same capabilities?

Google Chrome targeted by Malware

Interesting piece by Ed Bott: Malware authors target Google Chrome (on Windows).

Sounds similar to these kinds of fake Windows anti-virus scans which you see around the place, and try to convince you to click and download an executable which will supposedly clean up your PC:

Fake anti-virus check in Google Chrome

This type of thing reinforces the fact that no browser/platform is safe from malware, and that it’s important not to regularly run your account with Admin privileges on your PC.

Personally I reckon it wouldn’t hurt to have a setting in Windows (and other operating systems) that prevents running executables from any directory where the current (non-Admin user) has write-permissions, eg only letting them run programs that have been installed by an Administrator.

Does any OS offer something like that at the moment?

Importing into SQL Server

Alas SQL Server Management Studio isn’t as friendly as it could be for pasting in data. You’d think Microsoft would have this humming, but when I tried to paste from Excel, it attempted to paste the entire first row from my spreadsheet into the first column (in one row) of the database.

Using MS Access to open up the database probably would have worked, but I didn’t have it on that machine.

Trying to import using the SQL Server Import And Export Data wizard from a CSV text file worked for a small amount of data, but the 80,000 rows I was trying to import from the world ports code list didn’t. Time and time again it would report an error (unspecified) and give me the option of Abort, Retry, Ignore. No matter option I chose, it crashed.

While the 64-bit version of the wizard on my 64-bit Win7 machine didn’t allow you to import from Excel/Access, the 32-bit version did (presumably because MS Office, at least the version I have installed, is 32-bit).

The next problem was that it only supported Excel 2003 format, which can’t handle more than 64K rows. I ended up having to split the data into two and import the two spreadsheets separately. Then it worked.

Shame the wizard is so flaky, and of course it’s a big shame that Management Studio doesn’t do copy/paste like one would expect. (Maybe that too was a 32-bit/64-bit issue.)

Upgrading Windows: 1 to 7

This is utterly awesome. This guy (with a good dose of humour) has started with MS DOS 5, and Windows 1, and followed the upgrade path all the way through to Windows 7.

(Spotted on Twitter, but it’s doing the rounds of Reddit and other places.)

Email startup times

Gmail vs ThunderbirdA quick timing test on my main home workhorse computer, which isn’t the fastest in the world, but isn’t the slowest either. (Windows 7, Athlon 64 X2 dual core 4400+ 2300 Mhz, 3 Gb RAM, on a fast ADSL2+ net connection.)

Having started Windows and logged onto a clean desktop:

  • Start Chrome with GMail set as the home page: 8.5 seconds to ready
  • Start Thunderbird: 11.6 seconds to ready

No wonder people are heading into the cloud.

Subsequent timings (without a reboot, so some things may be cached, eg later in a session when you’ve closed your email and you want to go back in):

  • Chrome with GMail: 3.4 seconds
  • Thunderbird: 3.1 seconds

Interesting.

Connecting to a Windows shared drive: Domain user works, local user fails

(Apologies for the long title. I’m hoping Google indexes this well so some poor sod who gets this problem will easily find it the solution.)

Many problems the other day trying to connect a shared drive on a server (Windows 2008) on a domain, but with a local user.

It would work from some hosts, but not others — returning enigmatic errors hinting that the username/password combo was wrong.

C:\>net use z: \\servername\testdir /user:servername\test Password!
System error 1326 has occurred.

Logon failure: unknown user name or bad password.

The weird thing was, using a domain logon would work every time.

We thought it might be dependant on whether the hosts were in the same domain, but it looks like it’s related to the version of Windows being used… with later versions able to connect okay.

I did wonder at the time if it might be due to a weird security policy setting, and that turned out to be right. It seems later versions of Windows Server have stricter security settings.

After much wailing and gnashing of teeth, then some Googling, I eventually found the solution here:

  • On the server, go to Control Panel, Administrative Tools, Local Security Policy
  • Local policies / Security options
  • Check out the Network Security LAN Manager Authentication Level option
  • If it’s set to “NTLMv2 response only” or similar, then change it to “Send LM & NTLM – use NTLMv2 session security if negotiated”

Voila.

This MSKB article has some material on it: Q823659 — it’s helpfully buried with lots of other security policy settings. Look about two-thirds of the way down for “Network security: Lan Manager authentication level”.

If the policy is set to (5) Send NTLMv2 response only\refuse LM & NTLM on the target computer that you want to connect to, you must either lower the setting on that computer or set the security to the same setting that is on the source computer that you are connecting from.

Yes, I suppose I could work out how to change the client host to use NTLM V2. But I really don’t want to break anything else.

Oh, and the KB article almost gleefully notes something we saw when wrestling with this:

One effect of incompatible settings is that if the server requires NTLMv2 (value 5), but the client is configured to use LM and NTLMv1 only (value 0), the user who tries authentication experiences a logon failure that has a bad password and that increments the bad password count. If account lock-out is configured, the user may eventually be locked out.

Beautiful.

Microsoft’s open-source CMS

Interesting — Microsoft has launched its WebMatrix open-source web development bundle, as well as the first version of its open-source “Orchard” content management system.

Wonder if these means MS has WordPress, Joomla and Drupal as its targets? Perhaps it’s realised that having some kind of open-source CMS is vital to winning the hearts and minds of web programmers, and weaning them off PHP and MySQL back to ASP.Net and SQL Server.

(via Mary-Jo Foley)

Thanks a lot, Apple

I was using a USB drive to move copy files from a Windows box onto a Mac.

Easy enough; plug it in, copy the files over.

Then I plugged the drive back into a Windows computer. What do I see? Oh, delightful, MacOS added some hidden directories for Trash and Spotlight.

Apple Spotlight directories

Harumph. Annoying, but no biggy I guess.

Wait a sec, what’s inside those directories? A bunch of stuff, it turns out:

How about: .Spotlight-V100 \ Store-V1 \ Stores \ [long hex string] … and inside there, about 2Mb of junk.

Apple Spotlight crap on my USB drive

Now, I could understand that if I’d copied anything from the Mac back onto the USB drive, thus it might have needed all that stuff to do the wonderful Spotlighty things in the future.

But just copying stuff off it? Why make that assumption and dump all this crap on it? Particularly hidden, so many people wouldn’t even spot it.

Oh well, it’s in keeping with the iTunes bloatware philosophy of dumping heaps of software onto your PC that most people don’t need. Ed Bott’s updated his guide to avoiding that with iTunes 10:

Apple still gives its customers a monolithic iTunes setup program with absolutely no options to pick and choose based on your specific needs.

Why is that important? When you run the iTunes setup program, it unpacks six Windows Installer packages and a master setup program, which then installs nearly 300MB of program and support files, a kernel-mode CD/DVD-burning driver, multiple system services, and a bunch of browser plugins. It configures two “helper” programs to start automatically every time you start your PC, giving you no easy way to disable them. It installs a network service that many iTunes users don’t need and that has been associated with security and reliability issues.

And you wonder why I dislike iTunes with a passion that burns like the fire of a thousand suns?

It’s a must-read if you’re installing iTunes on Windows.

iTunes not up to date

Downloaded the latest iTunes 9.2.1.

Installed using the less-bloat method (for people like me who just want to use it to manage an iPod):

Extract the components from the iTunes setup EXE…

AppleApplicationSupport.msi /passive
Quicktime.msi /passive
iTunes.msi /passive

All good! All up to date!

I decided to fire up Quicktime and make sure none of its stupid tray icons were configured to run all the time, wasting my memory and CPU. What do I find?

Quicktime out of date

Quicktime is out of date — it tells me. It’s only 7.6.6, and you should be running 7.6.7.

Oh, bravo Apple — can’t even keep their own software up to date.