Archive for the ‘Micro$oft’ Category.

Dell factory restore when F8 does not work

UPDATE: after all this work, I started up the laptop only to find that the restore had somehow retained data from the previous install. Need more investigation to figure this one out…

Performing a factory reset on a Dell Inspiron 15R N5110 wound being a ridiculously complex task. I found many people online having problems with the factory restore function; fortunately I was able to put together a recipe for success after reading through a mountain of blogs and forums.

Some people recommended ditching the factory restore and installing from scratch. This was not an option for me because 1) Dell did not include the installation media with my purchase, and 2) even if they did I would need to apply the drivers myself; that gets awkward if I’m trying to sell this laptop as a blank slate.

F8 actually does work

Dell’s official instructions are a bit unclear about the timing of the F8 key taps:

Turn on the computer, after the Dell logo press F8 key repeatedly until the Advanced Boot Options menu (Advanced Startup Options).

You need to press F8 after the Dell logo disappears from the screen but before the Windows logo appears. If I hit F8 any time while the Dell logo was up, I would not get the Advanced Startup Options. [Source]

Wherefore art thou, Dell DataSafe Restore?

Continuing to follow Dell’s instructions, you are eventually supposed to select a Dell DataSafe Restore and Emergency Backup option. This option was missing for me.

The major things I had done to this computer were to upgrade to Windows 7 Ultimate and to enable Bitlocker. The Dell recovery disk partition was still present and untouched, but maybe one of those things caused the option to disappear. So I was then left to discover how to apply the recovery partition data myself.

If you want a job done right…

The steps to successfully apply the recovery yourself are mostly described here: Inside the Dell PC Restore Partition. Here is my own recipe:

  1. Install the Windows Automated Installation Kit (AIK). This will give you the imagex.exe utility you’ll need to apply the factory image.
  2. Use F8 to boot into Repair Your Computer mode and open a Command Prompt
  3. I found myself in an X: ramdisk. For convenience, I copied imagex.exe into this ramdisk. Needed help from the internet to realize that I should use the amd64 version despite running an Intel processor and not an AMD. Command: copy "d:\Program Files\Windows AIK\Tools\amd64\imagex.exe" . (dot at the end is intentional)
  4. More help from the internet to aggregate Dell’s factory images into one as part of the restore. Command: imagex.exe /ref c:\dell\image\factory*.wim /apply c:\dell\image\factory.wim 1 d:\
  5. The restore takes about 15 minutes, after you which you can reboot into the factory fresh install.

In the end, this is a nice reminder of why I have ditched Windows PCs. Very rare that I have to burn a Sunday evening mucking around with some obscure software issue on my MBP. Apple certainly has its problems, but only Windows vendors can set the frustration bar this high.

D&D Character Builder crashes under Parallels

I had the D&D Character Builder running fine under a Parallels 5 Windows XP Pro virtual machine. But then a few weeks ago I ran a bunch of updates – both Windows and Parallels updates. Following the updates, the Character Builder would crash after trying to perform an update or launching the program. All of the following failed to fix the problem:

I didn’t have any useful snapshots of the virtual machine, so going back in time was not an option. At last I got fed up and installed a completely new Windows XP virtual machine, ran all the Windows updates, installed the Parallels Tools, then installed the Character Builder. SUCCESS!

When the Character Builder installs, it first automatically downloads and installs the .NET Framework. My guess is that the updates I ran somehow introduced an incompatibility between the .NET Framework and Parallels or the Character Builder. If I had it to do over again I would have tried this:

  1. uninstall Character Builder
  2. uninstall .NET Framework
  3. install Character Builder, allowing it to install .NET Framework itself

I’ll bet that would have worked, but I’ve already spent way too much time on this and don’t feel like testing my theory. Hopefully this blog post will help out anyone who finds themselves faced with this same irritating problem.

Norton Nightmares: Windows cannot connect to the Internet using HTTP, HTTPS, or FTP

The Problem: following a Norton Internet Security uninstall, I could ping IP addresses and hostnames, but not browse to either. Running XP’s Network Diagnostic gave me something like: “Windows cannot connect to the Internet using HTTP, HTTPS, or FTP”. The problem went away when running in Safe Mode.

I tried everything, including:

The Solution: run the Norton Removal Tool.

After 10+ hours of debugging, the problem was that my initial uninstall of Norton Internet Security had left severed limbs of that wretched beast still clawing at the vital organs of the WinXP laptop. I could hardly believe it. I did find Symantec remnants scattered around the system during my trials, but I dutifully removed them all. Yet somewhere, somehow, Norton was still doing what it does best: grinding computers to a halt. Reminds me of a Haiku that a wise man once wrote

TortoiseSVN “connection closed unexpectedly”

This burned several hours of my time so I thought I’d add this post to the others that I found on the Intertron.

I had debugged every possible angle when trying to get a Vista machine to checkout a repo from an svn+ssh server. At last I figured it had to be a subversion client-server version problem, rather than an issue with the SSH keys, and so it was.

For reference, I’m using TortoiseSVN 1.5.5 and the server is running openSUSE 11.0’s subversion-1.5.0-96.1 package.

The solution, as many have stated, is to downgrade to TortoiseSVN 1.4.8.

FOSS in the workplace: FAIL x 3

While I run Linux on the servers and IT workstations, I’m always looking for opportunities to deploy the OS and FOSS in general in a “user” context. I’ve made three attempts that all failed:

  1. The Web Browser: after an employee got some annoying Windows virus, and I was unable to reinstall due to some licensing problem, I finally stopped running in place and installed Ubuntu. This was the perfect opportunity as this employee primarily works through a web browser (Firefox, no less!). Turns out that the website that works with Firefox on Windows doesn’t work on Linux – not with Firefox… or Opera… or any other browser I tried. Yeah, the problem is probably due to some stupid crap that the website is doing, but this was one case where I was sure that Linux would work out. He still uses the machine from time to time, but it’s supplemented with his Windows laptop.
  2. The Scanner: an older scanner/copier/printer needed a computer attached to it. Perfect for Linux!, I thought, until I discovered that SANE couldn’t deal with it. No problem, I had a newer color scanner that should do the job… SANE didn’t support that either. And so off went Ubunutu and on went WinXP.
  3. The Office Suite: did a WinXP install for someone, knowing that they’d probably need some Windows-only apps. Having had some success showing OpenOffice.org to my girlfriend, I figured I’d install that instead of MS Office. After explaining to him that OOO is compatible with MS Office, the guy gave it a try. A week or so later, he said he was just more comfortable with MS Office and wanted to ditch OpenOffice.

It’s all pretty discouraging. In situations that seem ideal for Linux, in the end I’m forced to use Windows. Though to end on a positive note, I will say that I’ve had nearly global success employing Firefox and Thunderbird.

Downloading files over SSL with IE7

Problem

I have a script, call it download.php, that pulls files from a database and serves them up to the user. For example, download.php?fileId=69 might return some headers and data that cause the user’s browser to download a PDF and prompt the user if they want to open it in Acrobat or something.

This works fine in Opera and Firefox, but when dealing with IE7 over SSL, the browser throws an error message saying that it can’t download the file download.php. I tried playing with various header() calls, but eventually wound up with a solution that is “good enough”.

Solution

In IE7, do the following:

  1. Go to Tools -> Internet Options
  2. Click the Advanced tab
  3. Under the Security section, check Do not save encrypted pages to disk
  4. Click the Apply button

And there you go. For me this is fine because I’ve convinced most of my users to use Firefox. If you have a large userbase that is still using IE, then telling each one to muck around in their browser settings might not be the cleanest solution.

Using the QuickBooks SDK via JACOB Java-COM Bridge

So you want to be a hero?

You had better be prepared for a little heroics if you want to use the QuickBooks SDK with Java because it isn’t exactly straightforward. I saw a few mentions of people having done this, but certainly didn’t find any tutorials. Maybe I will be the first person on the planet to write this up. BOW TO YOUR NEW GOD!

Anyway, the problem is that the QBSDK is done with Microsoft’s COM and Java has no built-in COM support. I should mention that you can use Java with the Online Edition or apparently by setting up a Tomcat server and sending qbXML through a SOAP-to-COM pipe or something like that. In my case, I had a bunch of existing Java code that I wanted to connect as directly as possible to QuickBooks – preferably using QBFC.

If you don’t know what I’m talking about with QBSDK, qbXML, and QBFC then you should read this informative tutorial.

After hunting around the web, I found a free library called JACOB: Java-COM Bridge. The theory is that I could go from Java -> JACOB -> QBFC -> QuickBooks. I managed to create a proof of concept for this theory that I will begin sharing with you now.

SETUP

  1. Obviously, install QuickBooks, run its updates, and create a test company file (I’m using QuickBooks Premier Nonprofit Edition 2007)
  2. Sign up with the Intuit Developer Network and then download/install the SDK. Note that you must say “yes” to installing the .NET stuff or the install will fail. (I’m using QBSDK 7.0)
  3. Download and extract JACOB (I’m using version 1.14)
  4. Being on a 32-bit OS, I copied the x86 JACOB DLL (jacob-1.14-x86.dll) into C:\WINDOWS\system32
  5. For Eclipse users, go to the Java Build Path property, click the Add External JARs button, and add jacob.jar to your project. For non-Eclipse users, make sure that the JAR is in your CLASSPATH.

NOTES ABOUT JACOB

Obviously everything you do with the QBSDK must be enveloped by JACOB API calls. The main beasts in JACOB seem to be Dispatch and Variant. Basically, you’ll use Dispatch to call functions on COM objects, and Variant to serve as parameters and outputs to those functions.

While JACOB seems to work well for me so far, the project lacks documentation of the HOWTO/tutorial variety. By cruising the web for examples and looking over the API, you can sort of figure out how things work. As I was wrestling with it, I stumbled across a QBFC wrapper for Ruby. Looking at the project’s source code helped me figure out a couple of things in the JACOB-QBFC connection.

One thing that JACOB lacks is the ability to lookup COM constants. Some of the QBFC functions require you to pass in one of their constants – hard to do when you can’t access them. The workaround for this is in the How can I get the value of constants? question in the JACOB FAQ. In short, you are supposed to use the Visual Basic editor in Excel to open the “object browser”, search for the constant, read its value, then code it into your program. Not exactly an elegant solution, but oh well. Note that when you’re in the object browser, you’ll need to go to Tools -> References and add the QBFC7Lib.

THE FIRST TIME HURTS

The first time you connect to QuickBooks through your application, you need to have QuickBooks already running. If you do not, then you’ll get an error message like:

This application is not allowed to log into this QuickBooks company data file automatically. The QuickBooks administrator can grant permission for an automatic login through the Integrated Application preferences.

The reason is that QuickBooks needs to pop open a dialog box and ask you if the application is really allowed to connect. After you’ve registered your application with QuickBooks, you’ll be able to access the data without the need to open it first.

SHOW ME THE CODE!

This code assumes that you have some vendors defined. If all goes according to plan, then it should print out all your defined vendors. Note that I am not doing all the various error, status, and type checking that the documentation mentions.

import com.jacob.com.*;

public class Foo {
  public static void main(String[] args) {
    System.out.println("Hello world!");
    // QBFC constants looked up using the object browser
    Variant ctLocalQDB = new Variant(1);
    Variant omDontCare = new Variant(2);
    // major and minor version of qbXML used to talk to QuickBooks
    Variant qbXMLMajor = new Variant(6);
    Variant qbXMLMinor = new Variant(0);
    // location of the company file to access
    String qbFile = "C:\\Documents and Settings\\rdavis\\Desktop\\FfAMETest.QBW";
    // connect to QuickBooks
    Dispatch qbsm = new Dispatch("QBFC7.QBSessionManager");
    Dispatch.call(qbsm, "OpenConnection2", "", "My Sample App", ctLocalQDB);
    Dispatch.call(qbsm, "BeginSession", qbFile, omDontCare);
    // build and execute a request to obtain all vendors
    Dispatch msgSet = Dispatch.call(qbsm, "CreateMsgSetRequest", "US", qbXMLMajor, qbXMLMinor).toDispatch();
    Dispatch.call(msgSet, "AppendVendorQueryRq");
    Dispatch resSet = Dispatch.call(qbsm, "DoRequests", msgSet).toDispatch();
    Dispatch resList = Dispatch.get(resSet, "ResponseList").toDispatch();
    int count = Dispatch.get(resList, "Count").getInt();
    for (int i = 0; i < count; i++) {
      Dispatch res = Dispatch.call(resList, "GetAt", new Variant(i)).toDispatch();
      // blindly assume that we have a vendor response
      Dispatch vendList = Dispatch.get(res, "Detail").toDispatch();
      int vcount = Dispatch.get(vendList, "Count").getInt();
      for (int j = 0; j < vcount; j++) {
        Dispatch vend = Dispatch.call(vendList, "GetAt", new Variant(j)).toDispatch();
        Dispatch dname = Dispatch.get(vend, "Name").toDispatch();
        String name = Dispatch.call(dname, "GetValue").getString();
        System.out.println("Vendor: " + name);
      }
    }
    // close the QuickBooks connection
    Dispatch.call(qbsm, "EndSession");
    Dispatch.call(qbsm, "CloseConnection");
    System.out.println("Goodbye world!");
  }
}

CONCLUSION

Using QBFC is already a somewhat verbose process and running it through JACOB certainly doesn't make the code more terse. Hopefully I'll be able to create my own little API to shield most of my code from needing to mess with all these Dispatches. My needs might be simple enough that I can wrap all the ugly stuff in a few function calls. After I get really down and dirty with QBFC I may write another post detailing my exploits.

A Norton Anti-Virus Haiku

Norton AV App
Crashes, hangs, burns resources
Worse than a virus

Tip #2: Beware the “Norton Anti-Virus” virus

While the Windows operating system may have been host to a minor worm or virus here and there, nothing major has come along until today. A serious Windows virus is making the rounds; security experts have dubbed this one: Norton Anti-Virus.

This virus is very confusing to the lay-user because it pretends to be a software application that protects against viruses. Unfortunately, Norton Anti-Virus does little of the sort.

The goal of this little beastie is apparently to launch a denial of service (DOS) attack against the host machine. The Norton Anti-Virus virus accomplishes this very effectively by doing the following:

  • monopolizing the CPU
  • sequestering large chunks of memory
  • saturating the I/O bus with continuous disk access
  • spamming the user with popups regarding various “alerts”, “warnings”, “notifications”
  • consuming network bandwidth by downloading an endless series of “updates”

Using these techniques, the Norton Anti-Virus virus can grind a host system to a halt. The impact on user productivity can only be estimated, but some analysts are predicting that this could be as bad as the Windows 95 virus.

How to convert Micosoft Outlook .msg files

The hatred that I have toward Microsoft is a screaming inferno that wells from the core of my body and projects outward through the cosmos. The heat of this burning anger is not decreased when I am faced with a proprietary Microsoft format that uses the company’s illegal software monopoly to lock out all competition. In this case, I found myself in a position where I had to convert Outlook’s .msg files into something that the rest of the world can read.

After a little googling, I found that if one had the emails in Outlook on a Windows machine, then Thunderbird could import them directly. So I figured all I had to do was load the .msg files into Outlook, use Thunderbird to import them, then get them into mbox format. Using Outlook Express 6, there seemed to be no way to load them into Microsoft’s little virus vector. Double-clicking one of the .msg files would open it for viewing, and it appeared that one could subsequently save the message to an Outlook folder, but I could not find a way to do it en masse. I also had a password-protected .pst file, but I managed to get nowhere with that.

At this point I was fuming. I thought Microsoft’s products were supposed to all work wonderfully with each other. Did I need to pay $500 dollars or whatever for a non-“Express” version of Outlook which contained the needed funtionality? The intuitively obvious File -> Import did not allow one to select files… did I miss some option hidden away in Microsoft’s idiot-proof, user-friendly software?

I asked a friend for help. Claiming that his “google-fu” was superior to my own, he quickly proved the point by finding a perl program called msgconvert.pl written by Matijs van Zuijlen. Once I installed the program’s dependent modules, I was converting .msg files left and right. Running the conversion, I got lots of warning messages like:

  • This MSG file contains Unicode fields. This is currently unsupported.
  • Unknown property 10F3
  • foo_email.msg must be an OLE file at ../msgconvert.pl line 732.

Despite these messages, I was able to create an mbox file that appeared to be valid. I managed to load the file into Thunderbird using the technique described here. Basically, Thunderbird does not explicitly have a way to import mbox files, but simply closing Thunderbird, dropping an mbox file into your “Local Folders” folder, and starting Thunderbird will give you what you want. Viewing the emails, I found they looked pretty good – formatting was a bit weird in places, but everything else seemed fine, including attachments.

So in the end, Microsoft can take all their .msg files, crush them up into a nice big wad, and cram it.