Memory leak bug in useless NVIDIA Windows service

Rafael Rivera reports on a severe memory leak in an NVIDIA service that gets installed and auto-runs by default with many GeForce graphics cards. It consumes ever-increasing numbers of handles while running.

The service is the NVIDIA Stereoscopic 3D Driver service – nvSCPAPISvr.exe. I investigated on my system (now Windows 7) and was suffering from the problem. The silly thing is, if I try to explore any of the 3D features (even with the service running) I get a message: Your graphic card does not support 3D Vision.

Well worth disabling the service if you have an affected driver.

This is poor practice from the vendor, and to make matters worse, the driver had apparently passed WHQL verification – a Microsoft certification which is meant to ensure quality. Well, possibly Microsoft only checked the core driver, and not ancillary services like this one, but nevertheless the user has been falsely reassured.

Posted to help spread the word.

Proof of concept: C#-SQLite running in Silverlight

Noah Hart has ported SQLite to C#. I was intrigued to see whether the code could be adapted to run in Silverlight, which has a cut-down .NET Framework and prohibits platform invoke to native code.

I hacked away at his code until it ran in Silverlight:

Note that the sole purpose of the exercise was to see if SQLite could be made to run, not to prepare a port that is production-ready or even code that is fit to check-in. In essence, I defined SQLITE_SILVERLIGHT, removed all the locking, adapted the file I/O to use isolated storage, and generally took as many shortcuts as I could think of to get it to compile and run. Unfortunately transactions do not work, though that can probably be fixed.

As far as I can tell, Silverlight’s Isolated Storage does not support locking at all. If the same application were opened twice, for example in different browsers, that could cause problems, but in normal use it would likely be OK.

One other point of interest: the XAP file in release mode is 257KB.

Update: The sample app is here. The hacked code is here [zip].

In-place upgrade adventures with Windows 7

I have just done Windows 7 RTM in-place upgrades on two systems, one running Vista Ultimate x64, and the other running Vista Business x64. Why do an in-place upgrade? Simply because it is much less time and effort than a clean install. Actually, the “less time” bit needs qualification. The in-place upgrade takes several hours; I left one running overnight. However, most of the time is spent leaving the setup chugging away. It does not take much effort from you.

By contrast, a clean install involves finding all your application setup disks or downloads, serial numbers, and patches, then installing and configuring them. In some cases – Adobe Creative Suite comes to mind – you might need to de-authorize an existing installation first, or be faced with a call to support on reinstallation. Drivers are another issue; you will likely need to visit the vendor web site for your PC and any added devices and download the latest drivers. Overall, not a trivial task.

An in-place upgrade is not optimal. Doing a clean install gives Windows the best chance of running with full performance and stability, without inheriting legacy problems. Still, there is no harm in doing an in-place upgrade now, and a clean install later when you have the time. That way, you get Windows 7 goodness immediately.

Although there has been some fuss about the complexity of Windows 7 upgrades, it is not merited. In a nutshell, you can in-place upgrade from Vista to the equivalent Windows 7 edition or higher. You cannot go backwards, you cannot in-place upgrade XP, and you cannot move between 32-bit and 64-bit editions. Simple.

Here’s how it goes. For an in-place upgrade, you run setup from within the running version of Vista. If you click Check Compatibility Online, you are directed to the beta upgrade advisor. I wouldn’t bother if you’ve got this far; the setup does the same job and does not require a download. So click Install Now.

 

Of course, you’ve backed up stuff that matters to you, and appreciate that there is some small chance that Windows will be broken beyond repair and never boot again.

The first thing setup does is to check compatibility (see!).

 

Then it will inform you of any issues. This is what I got:

 

Apparently Windows 7 does not like Civilization 4, iTunes or Windows Mobile Device Center 6.1. On my x64 box it also objected to SQL Server 2008, Daemon Tools, and an IDE storage controller. You are advised to cancel setup (which you do by closing the window; there is no Cancel button), remove the problem software, and try again.

You can fix the SQL Server 2008 issue by installing SP1. Daemon Tools is a low-level utility and could easily trip-up a Windows upgrade, and has only recently come out in a Windows 7 compatible version, so I removed it. iTunes was not being used so I removed that too. I also uninstalled Windows Mobile Device Center.

How about the storage controller on the x64 box? This one made me nervous, since if Windows cannot find a compatible storage controller, nothing will work. However, I knew that the storage controller which matters was the one for Intel Sata RAID, not IDE, so I ignored it.

Once I had tidied up the system, I re-ran setup. This time, I hit Next. I got the Big Decision dialog box:

 

I wanted an in-place upgrade, so I chose Upgrade.

The next task is to wait a long time. Go and do something else. While it would be nice if this part went more quickly, it does not bother me that it takes hours; it is a one-off task. In my case, setup transferred nearly 600,000 “files, settings and programs”.

The aftermath

All going well (and it did) the next action is to hit Ctrl-Alt-Del (strange how that ugliness survives the years) and log onto your shiny new Windows 7 OS. There were just a few issues to resolve.

First, the upgrade tinkers with the Start menu, and one of the oddities is that Microsoft Office (version 2007 is installed) in effect disappears from view:

 

I am not saying it is hard to find. Desktop shortcuts remain, if you have them, and you can always type a search or burrow down into All Programs. Still, this could be jarring for some users. Among my first tasks with Windows 7 is to find the applications I use frequently and pin them to the taskbar (right-click, pin to taskbar).

Second, Internet Explorer 8 opened for the first time with odd dimensions. Easily fixed, though it is annoying that you have to go through Welcome to IE8 wizards that you have seen many times before.

 

Third, Lego Digital Designer (don’t ask) failed to run. Apparently the upgrade messed up OpenGL, even though setup correctly detected my NVIDIA graphics card. I downloaded the latest from NVIDIA, bumping up the version from 8.15.11.8593 to 8.15.11.9038. This fixed it. I suspect it was not the driver version as such, more that the NVIDIA install added additional components including OpenGL support.

Fourth, the Movie Maker problem. Your old Movie Maker 6 is removed, and if you try to run Movie Maker, you are invited to download Windows Live Essentials from the Web. The new Live Movie Maker is in beta, and after installation you get a message saying it has expired and offering an update (I imagine this will be fixed by the time of full rollout in October). Eventually it runs, but it is not as good as the old one. Solution: install the Vista one.

Fifth, the upgrade reduces your UAC protection level without asking. My first move is to put it back to the highest level, for reasons explained here.

Sixth, Windows Live Writer is slightly broken under Windows 7. When inserting a picture, the “From Web” option no longer appears; and even if you type in an URL in the file dialog (which used to work), it still tries to upload it. Some incompatibility in the common dialog API, or risky assumptions made by the Live Writer developers?

Overall, these are minor issues – so far, so good. Even Visual Studio 2008 appears to have survived the upgrade.

I need to run Windows 7 for review; but I’d recommend it anyway. It is an excellent upgrade from Vista, even more so from XP.

Running Vista Movie Maker in Windows 7

As time allows, I’m upgrading various machines to Windows 7 using the RTM bits and will be blogging points of interest.

One of them is Movie Maker. As I previously noted, the Windows 7 Movie Maker (which is a separate download as part of the “Live Essentials”, and currently in beta, is a disappointment compared to the version in Vista.

Following a tip here, I tried copying the Movie Maker folder from Vista to Windows 7. To my surprise, it seems to work fine (though I have not tested all the features). The screenshot shows the Windows Vista version in front, and the cut-down Windows 7 version behind; you can run them side by side.

The reason for my surprise is that many applications require registration of COM components or other setup magic before they will run (though see update below).

If in fact the Vista version works, what are the implications? Has Microsoft actually tweaked Windows 7 so that Vista Movie Maker will run? If so, that’s odd since the in-place upgrade actually removes it. And why is Microsoft making us install a beta as part of Live Experience, if the old one works OK and would at least tide us over?

Those who do not want to risk the Vista version can download a proper installer for Movie Maker 2.6 here.

Update: according to this post you do also have to register some DLLs to get full functionality – a batch file is provided.

Technorati Tags: ,,

The scandal of PC repair shops

This month’s PC Pro, quaintly dated “October”, has an excellent, shocking article, researched in association with Sky News, in which a faulty laptop was taken to a number of computer repair shops around London. You can also read the article online. The laptop was not really faulty, but had a deliberately loosened memory module that needed to be pressed home. In addition, the researchers installed spy software hooked to the laptop’s webcam (I find it hard to believe that the engineers did not notice this).

The results are truly depressing. Only one of six shops behaved with full professionalism, fixing the fault without charge. Another fixed the fault but could not resist flicking through the customer’s holiday snaps. Three of the six insisted a new motherboard was required and quoted or charged accordingly; one actually charged for this but returned the machine with the old (and good) motherboard still in place. The sixth shop fixed the fault but then quoted £145 for a full fault-finding examination.

One of these six shops went the totally evil route, not only quoting for an unneeded part, but also searching the laptop for logon credentials and attempting to break into the customer’s bank account.

I would find all this implausible except that something similar happened to a friend of mine. They had a Dell machine that shut itself down spontaneously from time to time. They took it to a PC repair shop locally, several times (because the fault was never fixed). First, a new power supply was fitted. Machine was returned as working, but still had the fault. Next, the shop reinstalled Windows, even though the fault bore all the symptoms of a hardware issue. Machine returned as working, but still had the fault. On the third visit, the customer was told that they must have downloaded a virus which was preventing the machine from working. They were sold an anti-virus security suite and made to sign a statement that the PC was now fully working, though it still was not reliable.

I took a look at the machine and discovered that it was a known issue with this particular Dell model, caused by a fault on the motherboard. I didn’t discover the exact fault, since the remedy was to exchange the board with Dell. Nothing to do with the power supply. Nothing to do with Windows. Nothing to do with malware.

Looking at the research, along with my friend’s experience, is enough to convince me that this sort of thing is very common.

I doubt there will ever be a complete solution to the problem. It is like the motor trade. On the one hand you have users who know little of the technology but can only describe their experience: works, does not work, makes a strange hum, etc. On the other hand you have service engineers of variable expertise who can easily exploit their customers’ lack of knowledge, though the better ones will at least deliver a working system at the end of it.

Technorati Tags: ,,

C#-SQLite now published

Noah Hart has published his port of SQLite to C#. The project is called C#-SQLite. The main SQLite author, D Richard Hipp, originally said that the project should not include SQLite anywhere in its name, but has now relented:

I think I would be comfortable with a name like C#-SQLite. The prefix makes it clear that it is a reimplementation, not the original. People notice prefixes much more readily than suffixes. There is also precedent for changing a prefix for a reimplementation. Lucene, for example, was ported to C-Lucene. I’m sure there are others.

The whole point of this exercise it to avoid confusing people. Folks who use C#-SQLite need to be fully aware that what they are using is distinct and separate from the original SQLite. As long as that one condition is met, I am happy.

I downloaded the code, compiled in Visual Studio 2008 (requires project conversion), ran the shell and tried a couple of commands. It works!

Of course there are already a million ways to use SQLite from .NET, but they all require platform invoke to native code, which is not allowed in some scenarios for security and/or cross platform reasons – Silverlight being a prime example.

Next question: how hard will it be to get this working in a Silverlight project?

See also SQLite C# port raises hopes for a Silverlight local database manager which has some early performance results.

Technorati Tags: ,,

Google buys On2, plans to integrate video into web platform

Google is buying On2 Technologies, a video technology company. Although On2 is not a household name, it is well-known to Adobe Flash developers since its codec is used in Flash Player 8; it is also in JavaFX. Flash has since moved to H.264 for high definition though the older codec is still supported.

Why does Google want a video compression company? This is from the press release:

Today video is an essential part of the web experience, and we believe high-quality video compression technology should be a part of the web platform," said Sundar Pichai, Vice President, Product Management, Google.

That could mean any number of things; but it does imply that Google does not intend to rely on Flash for its video content. The acquisition will re-open the debate about the video element in HTML 5, which has been left without a codec because of lack of consensus about what might be suitable and affordable. See Ian Hickson’s post from June 2009:

After an inordinate amount of discussions, both in public and privately, on the situation regarding codecs for <video> and <audio> in HTML5, I have reluctantly come to the conclusion that there is no suitable codec that all vendors are willing to implement and ship.

Could Google now establish its own codec as the standard in HTML 5?

I’m guessing Google is also keen to integrate On2 technology with its communication products.

Technorati Tags: ,,,,

Apple is like Microsoft

That was my first thought after seeing the news that Google CEO Dr Eric Schmidt is leaving the Apple board. Steve Jobs:

Unfortunately, as Google enters more of Apple’s core businesses, with Android and now Chrome OS, Eric’s effectiveness as an Apple Board member will be significantly diminished, since he will have to recuse himself from even larger portions of our meetings due to potential conflicts of interest. Therefore, we have mutually decided that now is the right time for Eric to resign his position on Apple’s Board.

I realise that we are more used to the idea that Apple is Microsoft’s polar opposite. Apple has design and beautiful hardware, Microsoft has OEM’s with their model-a-minute systems that are never quite right. Apple has iPhone which everyone wants, Microsoft has Windows Mobile which everyone puts up with (if they don’t have an iPhone). Apple has iPod which everyone uses, Microsoft has Zune which nobody uses. And so on.

Nevertheless, Apple and Microsoft are companies from the same era, and they both make most of their money by constantly upgrading the client and persuading us to buy into the latest version. Although Apple has some investment in the cloud, with Mobile Me and more importantly the App Store, these exist primarily to support its client devices.

Google on the other hand is invested in the cloud. Projects like Android and Chrome OS may run on the client, but they are not profit centres in themselves – they exist to promote Google’s web-based services (see Google Chrome OS – the Web’s the thing). It is important for Google to make these investments, as without them the client-centric giants (Apple and Microsoft) have too much power to impair web-based computing in favour of the old model.

Recently Apple has been been making life miserable for App Store developers by denying applications that compete with built-in iPhone features – most visibly in the case of Google Voice. Unfortunately by protecting the iPhone in this way Apple is diminishing its usefulness in the cloud era.

Apple is not quite like Microsoft. Apple can grow by taking market share from Microsoft, whereas it is harder for Microsoft to do the reverse (though Windows 7 is a good attempt). Apple can make more inroads into business computing. It can broaden the market for the iPhone by making a wider range of device and lowering the price of entry, as it did with the iPod. The digital home is another promising market.

On the other hand, Microsoft has more of a cloud platform than Apple. Microsoft has Bing-Yahoo search, Hotmail and Messenger, Windows Azure and Silverlight. It has failed so far, but in theory it could build this into a viable alternative to Google.

Still, now that Apple and Google have started to break their alliance and openly compete, it’s clear that Apple and Microsoft are on the same side of a great divide, with Google on the other.

Technorati Tags: ,,

SQLite C# port raises hopes for a Silverlight local database manager

Yesterday programmer Noah Hart announced a port of SQLite to C#:

I am pleased to announce that the C# port is done to the point where others can look at it.

Unfortunately the code was taken offline almost immediately afterwards, thanks to the intervention of the author of SQLite, D Richard Hipp:

Noah, you are welcomed, even encouraged, to take the source code to SQLite and translate it in any way you want and do whatever you want with it. But you need to make it abundantly clear to everyone on your site and in the comments of your source code that your code is not the original SQLite … SQLite is a registered trade mark. If I don’t defend the trademark, then I could lose it. So, I really do need to insist that you not use the name "SQLite" for your product.

The reason given is that Dr Hipp does not want to receive support requests for the port, though the intervention is a little surprising since there are other 3rd party adaptions out there that do use the SQLite name, though these generally modify or wrap the original code rather than porting it completely.

Still, Hart has taken it in his stride and it looks as if the code may be back soon under the name sqlsharp – a Google code project with that name has been created. I hope this is the name since I suggested it, though it is rather an obvious one and I might not have been the first.

Why the interest? First, it’s always interesting to compare languages. Currently, Hart says his executable compiles to 528kb vs 506kb for the native version, and performs 3-5 times more slowly (results in rows per second):

Test SQLite3 C# SQLite3
Inserts 300K 1300K
Selects 1500K 8450K
Updates 60K 300K
Deletes 250K 700K

Although that may seem disappointing, SQLite is remarkably fast so even 5 times slower is still acceptable in many contexts; and there are no doubt many possibilities for optimisation.

What’s the point? Hart says it was a C# learning exercise, which is fair enough. Others are hopeful for a local database manager for Microsoft Silverlight, writing to isolated storage. Competitor Adobe AIR includes SQLite in the runtime, as does Google Gears.

Silverlight may a stretch for Hart’s port. Silverlight does not allow platform invoke or code marked as unsafe; and while there are apparently only a few p/invoke calls I’m guessing there may be many unsafe sections since the original SQLite makes heavy use of pointers.*

Although Silverlight is an implementation of the .NET Framework, it does not include the System.Data namespace. It does include System.Linq.

There are a few other efforts at creating a local database manager for Silverlight, including McObject’s Perst, db4o (work in progress), and Silverlight Database which works by persisting XML.

*Update: the project has now been published as csharp-sqlite, which is an excellent name; it looks as if Hipp relented to some extent. Now that I’ve seen the code I find I’m wrong about unsafe sections. In fact, I added C#-Sqlite to a Silverlight project and it failed to compile with a mere 53 errors, many of them related to file locking – possibly less necessary in isolated storage? A Silverlight port looks feasible.

No more Windows E – Europe will get full Windows 7 plus upgrade editions

Microsoft’s Dave Heiner has announced that plans for a separate Europe-only release of Windows 7, without Internet Explorer, have been abandoned at the last minute. This follows a new proposal to include a menu of browser choices instead:

In the wake of last week’s developments, as well as continuing feedback on Windows 7 E that we have received from computer manufacturers and other business partners, I’m pleased to report that we will ship the same version of Windows 7 in Europe in October that we will ship in the rest of the world.

Did Microsoft ever intend to ship Windows E, or was the whole thing some sort of bargaining proposition? Heiner even threatens to re-introduce it:

… if the ballot screen proposal is not accepted for some reason, then we will have to consider alternative paths, including the reintroduction of a Windows 7 E version in Europe.

Although Microsoft is making a significant concession by promoting other browsers, its proposal does mean that some users will still get IE by default. These are the users who either install Windows 7 themselves by purchasing Microsoft’s standalone package, or who receive a PC from an OEM that has chosen to leave IE as the default. In this case, here’s what happens:

Shortly after new Windows PCs are set up by the user, Microsoft will update them over the Internet with a consumer ballot software program. If IE is the default browser, the user will be presented with a list of other leading browsers and invited to select one or more for installation. Technically, this consumer ballot screen will be presented as a Web page that can be updated over time as new browsers become available.

There will be a proportion of users who have a “don’t bug me with this” reaction and just close the screen, in which case they will keep IE.

However, if the OEM supplies a PC with a browser other than IE as the default, the ballot screen will not appear, so Microsoft is at a disadvantage in that respect.

I am not sure how this will be handled in corporate environments. IE is arguably more attractive in a Microsoft-centric business environment, because it integrates with network management tools and should work properly with other Microsoft products such as SharePoint or Outlook Web Access. If IE is the corporate standard, I doubt admins will want users to see a ballot screen offering other browsers, and I imagine there will be some way of blocking it.

One final observation. Personally I have never felt locked into using IE or had any problem making choices between different browsers, email clients or other applications on Windows. That’s not the point of course; owning the defaults gives a vendor a substantial advantage because of inertia or lack of technical confidence among a certain proportion of users. It is still worth noting that users have always been able to install alternative browsers, and that the adoption achieved by Firefox, Opera, Google Chrome and others would not have been possible if Windows were truly a closed platform.