Author Archives: admin

Multi-Line String Literals

0
Filed under .NET, VB Feng Shui, XML

VB has long been my favorite development language, but, as is typical, even it can definitely be improved in innumerable ways.

One aspect of VB that has always bothered me is string literals. Since VB treats EOL as significant, you can’t have strings that wrap across multiple lines in the environment. This is especially problematic when you deal with SQL queries, report formatting strings, and the like. For instance, this is generally what you see when you have to deal with long SQL queries in VB code.

Dim q as String = "Select *" & vbcrlf
q &= "From MyTable" & vbcrlf
q &= "Where MyColumn = 1"

Now, you can do a few formatting tricks and clean it up a little, but even then, it’s going to be cumbersome to work with.

One workaround has always been to embed these long, multi-line literals in a Resource file. The VS 2008 IDE even goes so far as to allow you to enter multi-line strings in the resource editor, although you have to use Ctrl-Enter to get a new line:

image

If you look at the RESX file for the above resource, you’ll see something like this:

image

All this is certainly workable, and, in many cases, isolating strings to a resource file (of some sort) can be a really good thing, but in other cases, it’s just a pain.

In VB10, Microsoft is finally doing what VB should have done all those years ago. They’re adding “intelligent line continuation” which is to say, you can continue a line in certain syntactic situations simply by continuing the code on a new line. No need for the line continuation underscore char, etc.  It won’t necessarily work everywhere (esp in places where it the code would end up ambiguous), but hey, that only makes sense.

In the meantime, you can actually have multi-line string literals in VB.Net without too much pain.

The trick is to use XML Literals. Generally, I’m no fan of XML literals. Once they get peppered with variable references, embedded For loops and other code, they become just so much spaghetti code, albeit with a modern twist.

But, they can be handy for multi-line string literals.

Dim q as String = <String>Select *
From MyTable
Where MyColumn = 1
</String>.value

So what’s going on here? First, I dim the result variable Q as a string (technically, this isn’t necessary as VB can infer the type, but you get the picture).

Then, I declare the XML Literal with the <String></String> tags. Everything between those tags (even across lines), gets treated as part of the string, no quotes or line continuation needed.

Finally, since the result of the <String></String> tags is going to be an XElement object, and what I want is a string, I need to invoke the value property of the XElement object to retrieve its string value.

And there you go.

But, as with anything good, there are a few caveats.

  1. line breaks AND whitespace are preserved in the string, which means if you indent those lines, you’ll get space characters where you might not have wanted them.
  2. if you want to include certain characters that are illegal in XML (for instance, the “<” or “>” characters), you’ll need to escape them.

Handling Escape Characters

One option you have for handling escape characters is to use the XML escape sequences, as in:

Dim q as String = <String>Select * as My&gt;Test&lt;var
From MyTable
Where MyColumn = 1
</String>.value

The &gt; and &lt; will be replaced with > and < respectively. You can escape any arbitrary character with &#nnn; where nnn is the ascii code of the character.

But this is code, dammit, not XML, and, at least for me, I’d much rather see normal C-style escape sequences (\r\n anyone <g> ) here than have to muck with XML “&” sequences. If we’re talking about web pages and HTML, that might be a different story, though.

At any rate, you can have your cake and eat it too, as it turns out.

Just feed that string through System.Text.RegularExpressions.Regex.Unescape to convert those sequences, hence:

Dim q as String = System.Text.RegularExpressions.Regex.Unescape(<String>Select * as MyTestvar \r\n
From MyTable
Where MyColumn = 1
</String>.value)

Notice how the XElement.value is simply passed through to the Unescape method to process that \r\n into a normal carriage return/linefeed pair.

Using that, you can now easily embed C-style escaped multi-line strings in your VB code.

But wait, that Unescape call is fairly nasty to look at and use. Wouldn’t it be nice if that was more or less automatic? Well, with a nice Extension Method, it can be.

<System.Runtime.CompilerServices.Extension()> _
Public Function UnEscaped(ByVal v As XElement) As String
    Return System.Text.RegularExpressions.Regex.Unescape(v.Value)
End Function

.....

Dim q as String = <String>Select * as MyTestvar \r\n
From MyTable
Where MyColumn = 1
</String>.Unescaped

First, define an Extension Method that would apply to the XElement object. This is a very simple method that just takes the associated XElement object, retrieves it’s value, and runs that string through the Regex Unescape method.

Since the extension method extends the XElement itself, you can now simply call the Unescaped method directly on the long string definition (the very last line in the code above).

You can’t get much cleaner than that. Or can you? Let me know!

When Videos Only Play Audio

0
Filed under Arcade, Media, Troubleshooting

image I recently was doing some work with some videos. Things were working just fine at one point, but then I installed the latest version of JRiver Media Center (version 13).

Whammo. My videos wouldn’t play anymore. Well, actually, they’d play audio, but the video was just black.

I thought it was the particular app I was using, so I tried Media Center, and Microsoft’s Media Player. Same result.

From past experiences, I figured something had hosed a codec (codecs are utility libraries installed on your machine that code and decode video and audio files, each format has it’s own codec).

But, where to start looking?

So, I did some googling and found a great page that lists all the various FOURCC codes for codecs:

http://www.fourcc.org/fcccodec.htm

From that, I found a little app you run against a specific AVI to determine what codec it uses, called GSPOT:

http://www.headbands.com/gspot/v26x/index.htm

Running that against the AVI in question yielded the XVID codec.

Alternatively, just view the AVI in a hex editor and look at the header in the file:

image

You should be able to pick out the four character CC code fairly readily.

Then, from the table at FOURCC, I went to the xvid codec page:
http://www.xvidmovies.com/codec/
Downloaded and installed. Presto! Videos with audio and video again!

It’s just that simple 🙂

Duke Lives

0
Filed under Games

image Sad news from several days ago. Apparently, 3D-Realms, the team behind the original Duke Nukem 3D, has called it quits.

I’d known the follow-up to the original was long overdue, but I guess there were more problems than just getting the code done.

At any rate, in reading about this story, I discovered something very cool. A complete port of the original Duke Nukem 3D, targeted for Windows, called EDuke32, using all modern support code, including updated audio drivers, and support for OpenGL rendering engines.

Not only that, but there’s a whole fan base that have re-rendered all the level textures in full hi res! The difference is absolutely astonishing and really breaths new life into a wonderful old game. I actually found a deathmatch level I’d designed back in the day (sept 22, 1996 to be precise, the file still had the last modified date on it), loaded it up with EDuke32 and, with the textures from the hi-res pack, it looked spectacular. Far better than it ever did originally.

If you were a fan of Duke back in the day, it’s definitely worth the download.

Cisco VPN Headaches, The (new and improved) Solution

4
Filed under Cisco, Troubleshooting, Vista

image I wrote about my headaches with the Cisco VPN client some time ago.

I thought I’d resolved those problems, but as is the case with most things computer, I had not.

At least part of the problem, as I discovered some time ago, is that the 5.0.0 version of the Cisco VPN client didn’t properly deal with network interfaces coming and going, so in cases where that happened, the client would often end up trying to connect to the VPN host via the wrong network adapter.

How would network adapters come and go, you might ask? After all, they’re physical cards in the machine.

But not so! If you run VMWare or Microsoft’s Virtual PC, those apps create “virtualized” network adapters that come online as you start the program (and in some cases when you start each individual virtual machine) and can go offline just as frequently.

The solution (or so I thought) was to do a hard reset of Cisco’s VPN service. That worked, mostly. But it still wasn’t 100% complete. I still sometimes had trouble connecting that would, in the end, require a reboot.

Fast-forward to yesterday, when I couldn’t get connected even after several  reboots, and I decided enough was enough.

Sure enough, some Google searches revealed that there is NOW a new version of the Cisco Client, the latest I was able to find is 5.0.4.0300.

One point to note is that this is all under Vista 32. From what I understand, XP has none of these issues.

Anyway, after a lengthy and pretty painful install, this new version appears to completely fix the problem. No Service resets required at all.

The Install

The biggest problem is the actual installation of the new version.

First make sure you write down all the connection details from your existing VPN connections. Once you’ve got the new version installed, you’ll have to reset all those details back to what they were. This includes the host name (or ip address), passwords, username, etc).

Uninstall the old Cisco VPN client. For me, this took several reboots as the uninstall appeared to hang several times. Eventually, it did uninstall itself, though.

At this point you can try to install the new version, but I received a message that the “Deterministic Network Enhancer” wouldn’t install properly.

I had to manually uninstall the “Deterministic Network Enhancer” from my network connection properties dialog before Cisco would complete a successful install.

To do that, click on the Windows button (the old “Start” button), select Control Panel, and Network and Sharing Center”.

Find you network adapter listed and click View Status.

image

On the resulting screen, click Properties

image

and on the next screen, click the Deterministic Network Enhancer and uninstall it.

image

Then, you should be able to install the latest Cisco VPN Client and not have any more connection problems.

Google to find the latest version.

First Flash Coding

0
Filed under Uncategorized

image I had the opportunity to take on a Flash project recently. Never touched Flash before but I’d had it ever since I picked up a copy of Dreamweaver MX (the 2004 version, version 6, I still use FireWorks regularly).

From what I can tell, there’s been lots of improvements to Flash and ActionScript, but mostly in the areas of video and multimedia, which, for this, I didn’t need.

The idea is to create a preview of a text message, with font selection, sizing, coloring, etc. Initially, maybe only a half-dozen options, but eventually, incorporating a plethora of options (wavy text, anyone?).

It took a good deal of web queries and tinkering to get past the initial Flash hurdles (like how the heck to you actually place a movieclip onto the stage, much less create a new movieclip!). Is it just me, or is making the user “create a new symbol”, a completely non-intuitive way of creating a new movie clip? Maybe it’s just the old version. But I’m not sure I want to pay big $$$ to find out if any of that non-sense ever got straightened out.

Initially, I’d placed a chunk of code in the action area for the main frame, (there’s only one frame in this “movie”), but when I ran it, I happened to notice that it was being run over and over again. I’m guessing that’s because Flash, is, at it’s heart, an animation/movie creator, so that made a certain amount of sense.

I also found through combing the help file, that what I probably needed was the OnClipEvent On Load event. But that was only available on an actual movie clip object, and I couldn’t seem to create one of those.

Long story short, I’ve gotten something working in relatively short order, it was less painful than I expected, and in the process, I’ve gained a whole new level of appreciation for those guys out there cranking out Flash games.

Using TLBIMP.exe to create Strong Named Interop Assemblies

2
Filed under .NET, Utilities

Working on a VSTO 8 Word addin recently, I discovered to in order to deploy it, you must “strong name” the assembly.

I’d already obtained a Verisign certificate for digital code signing, and had a password protected PFX file containing both my public and private keys, so I figured I had what I needed.

So, I loaded the project, set the signing options to use my PFX file and compiled.

Full stop.

“Interop.Word.dll” is not strong named

Doh.

A little research later and it turns out that if you strong name one assembly, every single assembly that it references must also be strong named!

Yikes. In my case, I have almost a dozen, plus piles of interop assemblies for accessing legacy COM libraries.

First, the .NET assemblies. Setting them to be strong named using the same PFX file is easy, just use VS, under the project properties.

image

But, if your .net code refers to any COM components, it’s very likely you also have references to “interop” assemblies. These are DLLs that VS creates for you “behind the scenes” to act as convenient .net wrappers around the COM library objects.

The problem is that VS won’t automatically strong name those interop assemblies, and if you strong name your .net assembly, those interop assemblies also must be strong named.

First, I tried just creating an interop assembly.

I chose the Word 2000 object library to initially play with, but just about any COM dll or TLB or OLB file will do.

tlbimp "{path}\msword9.olb" /verbose /out:Interop.Word2000.dll /sysarray

(note, {path} is the path to your copy of this file, and the /sysarray option appears to be required if your working with just about any COM based interface). Worked like a champ.

So, I add in the keyfilename argument:

tlbimp "{path}\msword9.olb" /verbose /keyfilename:mycert.pfx /out:Interop.Word2000.dll /sysarray

and TLBIMP responds with an “Incorrect strong name arguments specified” error.

I then tried the PUBLICKEY option, like so:

tlbimp "{path}\msword9.olb" /verbose /keyfilename:mycert.pfx /out:Interop.Word2000.dll /sysarray

This appeared to work, until I actually tried to run my application. It failed, indicating that the “Strong Named Assembly was corrupt or was not signed with a private key”. Apparently, PUBLICKEY means just that, that the public key is used for one part of the signing process, and that you have to use a private key for the other.

I really didn’t want this to be a two step process so I kept looking.

Eventually, I discovered that signing an assembly is a completely separate process from “Strong Naming” an assembly.

Strong Naming an assembly doesn’t guarantee that you wrote it, but it does provide a way for one assembly to guarantee that it is loading the exact same assembly that it was compiled to work with, a subtle but significant difference.

Signing an assembly, on the other hand, requires a certificate from a signing authority, like Verisign. Signing does guarantee that an assembly was written by who the certificate says it was written by.

From what I can tell with VS2008, signing an assembly automatically strong names it, but the reverse is not true.

And certain assemblies need to be signed, (such as the primary assembly for an Office Addin), but others don’t.

And still others need to be strong named, but don’t necessarily need to be signed (such as any assembly or interop assembly referenced by an Office Addin.

But when you do this, you might notice that you end up with another unexplained dll in your output folder, called Office.dll.

After some digging, it turns out that TLBIMP will also create interop files for those COM libraries referenced by the COM library that you’re creating an interop file from. And you’ll need to include those additional interop files with your app for everything to load properly.

This is where the /reference option comes in. First, generate a strong named interop file for the referenced COM library, and then for the COM library you actually care about, like so:

tlbimp "{path}mso9.dll" /out:Interop.Office2000.dll /sysarray /verbose /keyfilename:mycert.snk 
tlbimp "{path}msword9.olb" /out:Interop.Word2000.dll /sysarray /verbose /keyfilename:mycert.snk /reference:Interop.Office2000.dll

The first line will create the Interop file for the Office.dll, which is referenced by Word.

The second line will create the interop file for Word itself, but note that it uses the /reference option to indicate that this interop file should reference the just created interop file for the Office library.

Finally, a note about namespaces. You’ll notice that I specified an OUT filename of Interop.Word2000.dll.

TLBIMP appears to automatically assume that when you do that, you want the classes defined within that interop file to exist within the “Interop.Word2000” namespace (ie the file name minus the “.dll”).

image

This may be appropriate, but it may not be, depending on your needs. Why might you want to change it? The only reason I can think of offhand is that you are referencing multiple versions of a single COM interface. A common example would be the need to reference both the Office 2007 Primary Interop files (available directly from Microsoft), and the Office 2000 interop files you created yourself (because MS doesn’t provide them).

It is possible that the two Interop files would have the same namespace and would collide.

Changing the namespace of one of them will allow your assembly to reference both interop files with no collisions. This is one element of .net that is, at the same time, unfortunately complicated, but incredibly useful.

Cisco VPN Client and Vista 32

0
Filed under Troubleshooting

image I’ve been running the Cisco VPN Client (version 5.0.0.360) for quite some time now and have consistently had another one of those “annoying but not enough to bother doing something about it” issues the entire time.

Basically, it can often be difficult to establish a connection. Once a connection is made, it stays up quite nicely (as long as there’s a little bit of activity over it). But establishing the connection in the first place can really be an exercise in patience sometimes, often taking 10 minutes or more of repeated connection attempts before succeeding. It seemed to me to have something to do with a timeout, but I had no idea what to tune or even where to look.

I finally decided to go poking around for a possible solution this morning.

First stop was Google, looking to see if there was a new version out. There is, but only with relatively minor changes, it would appear.

But the “changes and release notes” page did have some possibly pertinent material on it.

In particular, this caught my eye:

Vista Window Auto-Tuning Feature Might Cause Network Timeout Problems

Vista introduces a new feature called “Receive Window Auto-Tuning” that continually adjusts the receive windows size, based upon the changing network conditions.

Some people reported that auto-tuning causes network timeout problems with some applications and routers.

To turn off this Auto-Tuning, just open an administrative access command prompt and enter:

netsh interface tcp set global autotuninglevel=disabled

Try it out. If it doesn’t help, you can turn auto-tuning back on by entering enabled in the above command.

At least so far for me, with it off, I’ve been able to connect immediately, every time now. A far cry from before.

*UPDATE*

There’s a little more to it than just the autotuning level, it turns out. Apparently, VMWare’s networking support can really mess with the Cisco VPN service. From what I can gather so far, Cisco’s service does not like network interfaces disappearing and reappearing. It doesn’t track them internally properly. So, even if you exit VMWare to start your Cisco VPN session, the Cisco service might still be confused.

The easiest solution is to simply restart the Cisco VPN Service (called CVPND). You can do it manually through the Services control panel, or use a batch file to restart it even more easily (check here for a nice clean little batch file that handles all the nuances of restarting a service).

Finally, it’s not just VMWare that can mess with the Cisco VPN service. Apparently, ANY application which causes network interfaces to be created or removed could cause similar problems.

Fixing Fonts that Won’t Install

0
Filed under Fonts, Utilities

image Previously, I wrote a bit about fonts that won’t install under Vista (and possibly Windows XP SP2, but I haven’t tested that).

Apparently, Vista expects certain fields within the TTF file to be filled, whereas older versions of Windows don’t. The result is that while you might have been able to install a particular TTF file perfectly fine under an older version of Windows, the same font won’t install under Vista, with Vista claiming the font is corrupted.

Enter Font Creator Pro 5.6, a utility to actually allow you to edit fonts. One of its ancillary features, however, is the ability to correct this problem in TTF files quite easily.

Unfortunately, it’s a very manual process, requiring a lot of mousing or keyboarding.

Until now!

I cobbled up a short little VBScript that will accept either dragging and dropping onto it, either:

  • a single TTF file
  • Several TTF files
  • or a single folder containing a bunch of TTF files

The script essentially automates the process of loading the font into Font Creator, applying the rename fix and saving the font out.

Note that it saves the font in place (for simplicity’s sake more than anything else), which means that you should make a backup of any font you process with this.

'FONT FIX SCRIPT
'Darin Higgins May 2009
'---------------------------------------------
'Requirements
'------------
'Eval or licensed copy of Font Creator 5.6
'
'Purpose
'-------
'Many Fonts will not install properly under Windows XP SP2 or Vista, because they are 
'missing a few values for several internal fields.
'While the field values themselves are immaterial, Windows will consider the font "corrupt"
'
'What this script does
'------------
'You can drag either a single TTF font file or a folder that contains a number of TTF files
'onto this script.
'The script will run and will use Font Creator to
'1) Open the font
'2) Perform a Font Creator "AutoName" on the font
'3) Close and save the font, overwriting the original file.
'
'I've never had problems but if you are concerned, be sure to make a backup copy of
'all your font files first.
'
'Usage
'-----
'1) Make sure that you've opened Font Creator, clicked past the eval screen
'   and have an empty window open before running this script
'2) Drag iether a single TTF file or a folder containing TTF files onto this script
'3) The script should run, with lots of window flashing.
'4) Don't touch anything, even if you hear beeps.
'5) Eventually the script will finish. It is possible that some files didn't get saved properly
'   so check each file with a good font viewer app.
'
'--------------------------------------------------

dim Name
Dim fso, fldr, s, file
dim shell
Dim Count, x
dim excel

Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
set Excel = nothing

for x = 0 to wscript.arguments.count-1
    Name = wscript.arguments(x)
    on error resume next
    '---- first, try to retrieve argument as a file
    if fso.FileExists(name) then
        '---- it worked, convert the single file
        Count = Count + 1
        CheckForQuit
        FixTheFont name
        CheckForQuit

    elseif fso.FolderExists(name) then
        '---- try to get a folder
        on error resume next
        Set fldr = fso.GetFolder(Name)    
        For each file in fldr.files
            if instr(1,ucase(File.Name),".TTF") <> 0 then
                Count = Count + 1
                CheckForQuit
                FixTheFont File.Path
                CheckForQuit
            end if
        next
    end if
next

'---- don't show a message if Only one file was processed
if Count > 1 then Msgbox "All Done"

'---- Alert if nothing was processed
if Count = 0 then Msgbox "No fonts were processed"

CleanUp

'====================================================
'End of main script
'====================================================

Sub CleanUp()
    if not Excel is nothing then excel.quit
    wscript.quit(1)
End Sub



'---- this subroutine uses sendkeys to 
'1) load the font in FontCreator 
'2) tell FC to perform the AUTONAME function on the loaded font
'3) close and save the font
Sub FixTheFont(File)
    shell.appactivate "FontCreator 5.6 (UNREGISTERED)"

    wscript.sleep 1000
    shell.sendkeys "%F{DOWN}{RIGHT}{DOWN}{ENTER}" 
    wscript.sleep 500

    '---- fix up possible bad elements in the Filename (could conflict with SendKeys)
    File = Replace(File, "{", chr(1) & "1")
    File = Replace(File, "}", chr(1) & "2")
    File = Replace(File, "(", chr(1) & "3")
    File = Replace(File, ")", chr(1) & "4")
    File = Replace(File, "[", chr(1) & "5")
    File = Replace(File, "]", chr(1) & "6")
    File = Replace(File, "+", chr(1) & "7")
    File = Replace(File, "~", chr(1) & "8")
    File = Replace(File, "%", chr(1) & "9")
    File = Replace(File, "^", chr(1) & "A")

    File = Replace(File, chr(1) & "1", "{{}")
    File = Replace(File, chr(1) & "2", "{}}")
    File = Replace(File, chr(1) & "3", "{(}")
    File = Replace(File, chr(1) & "4", "{)}")
    File = Replace(File, chr(1) & "5", "{[}")
    File = Replace(File, chr(1) & "6", "{]}")
    File = Replace(File, chr(1) & "7", "{+}")
    File = Replace(File, chr(1) & "8", "{~}")
    File = Replace(File, chr(1) & "9", "{%}")
    File = Replace(File, chr(1) & "A", "{^}")

    shell.sendkeys file & "{ENTER}"
    wscript.sleep 500

    Shell.SendKeys "%LN"
    wscript.sleep 500
    shell.sendkeys "{ENTER}{ENTER}"
    wscript.sleep 500
    shell.sendkeys "%FC{ENTER}"
    wscript.sleep 1500
end sub


'------------------------------------
'Check to see if user pressed esc
'Do this using a hadny little hack through excel
'There's likely better ways, but this works
'------------------------------------
dim Skip
Sub CheckForQuit
    if Skip = true then exit sub

    On Error Resume Next
    '---- make sure Excel exists and we can create an object
        '     if not, no big deal, just skip all this code
    if excel is nothing then
         set excel = CreateObject("Excel.Application")
                if err then Skip = true
        end if

    if Skip = true then exit sub

    dim keys(0)
    'ESCAPE
    keys(0) = 27

    dim Passed
    Passed = 1
    For i = 0 To UBound(keys)
        keystate = excel.ExecuteExcel4Macro("CALL(""user32"",""GetAsyncKeyState"",""JJ""," & keys(i) & ")")
        If (keystate and 1) = 0 Then
            Passed = 0
        End If
    Next

    If Passed = 1 Then
        CleanUp
    End If
End Sub

To use it, just copy the text above and save it to a FixFont.VBS file on your desktop.

Then, back up a font TTF file you want to process, and simply drag it from Explorer onto the VBS script.

Then sit back and let it drive for a few seconds.

Each font takes about 2-3 second to fix.

It doesn’t work 100% (sometimes the SENDKEYS just don’t get synchronized properly), but I didn’t have any problems as a result, and I processed some 10,000 fonts through it. It just took several passes (and a few days<g>)

One final note. I used a trick from Excel to check if the ESCAPE key has been pressed and terminate the script. If you have Excel, that should work fine. If not, it should just skip all that, but that means you won’t be able to stop the script should you need to. To be safe, just do a few fonts at a time.

And as with everything else here, IWOMM (It Works On My Machine) but your mileage may vary.

System process in Vista running at 100%

0
Filed under Uncategorized

I’ve had a very strange problem for months now that was intermittent enough to not be overly concerned about, but happening enough to be bothersome.

Basically, every other time I rebooted my system, the “System” process (as listed in TaskMan) would get pegged at max utilization (in my case, on a dual core system, it would hover around 45-50%, but on a single core system, it’d run at near 100%).

This would drag things to almost a standstill. The cursor would move haltingly, apps would take forever to load, and shutting down was interminable.

It happened again this morning, so when I got some time, I started researching it.

Turns out the solution is relatively straightforward, at least in my case.

Vista has a feature called Offline Files. It allows files stored on network drives to be automatically synchronized down to your local system, for access when you are, yes, offline.

However, this feature appears to have some really nasty timeout handling issues, so when network devices actually are offline, it can end up bringing your entire system to it’s knees.

For virtually everyone out there, I’m guessing this feature isn’t actually something you even care about. I certainly don’t. And fortunately, turning it off is easy.

Open the Control Panel, and click Offline Files.

image

Then, if the first button listed says “Disable Offline Files”, click it. That will disable the offline files features, and, at least so far, through several reboots, has resulted in my system not getting dragged down in the slightest.

And just when I was starting to like Vista<g>

New Debugging Option For InstallShield 2009

2
Filed under Installations, Troubleshooting

The new InstallShield supports a very handy command line argument for debugging the handling of prerequisites.

Often times, you’ll have a prerequisite for your install that, for whatever reason, fails to run. When that happens, if you’ve properly set the launch conditions for your install to detect the installation of your prerequisites, your install will fail based on that launch condition.

This is a good thing, but it still begs the question; why did my prerequisite fail to install?

In my case, I had a preq for the .NET Framework 3.5. But my installation failed to run the prerequisite, so it failed at the launch condition because the 3.5 framework was not on the machine.

However, I had no idea why it didn’t run the .NET installer.

Even turning on Verbose MSI Logging, didn’t help, because IS runs prerequisites BEFORE the Windows Installer kicks in, so the verbose log won’t include anything about what happens when the preqs are run.

With the new InstallShield 2009, though, your SETUP.EXE supports a new switch, /DEBUGLOG.

Use it like this:

MySetup.exe /DEBUGLOG”Path and file to debuglog”

note there’s NO SPACE between DEBUGLOG and the “.

so you might use:

MySetup.exe /DEBUGLOG”c:\debug.log”

Doing so revealed that the bootstrapper was, indeed, attempting to run the .NET Framework installer, but that it was failing. Unfortunately, It did not indicate the reason for the failure. Here’s the pertinent snippet from the log:

1-23-2009[01:10:15 PM]: Extracting ‘Microsoft .NET Framework 3.5 SP1.prq’ to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\{D4907620-651C-4FA9-9B3F-FCE2FCADB41A}\Microsoft .NET Framework 3.5 SP1.prq
1-23-2009[01:10:15 PM]: PrereqEngine: condition,2,2,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5,SP,,1 — Successful
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,5,1,2, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,5,2, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,5,2, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,6, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,6, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: operatingsystemcondition,6, — Failed!,
1-23-2009[01:10:15 PM]: PrereqEngine: file,AD29C3DEC8FB0CFDAFE8548371B0EE6D,<ISProductFolder>\SetupPrerequisites\Microsoft .net\3.5 SP1\Full\Helper.exe,http://saturn.installshield.com/devstudio/setuprequirements/Microsoft .net/3.5/Helper.exe,,, — Successful,
1-23-2009[01:10:15 PM]: PrereqEngine: file,,<ISProductFolder>\SetupPrerequisites\Microsoft .net\3.5 SP1\Full\dotnetfx35.exe,http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe,,, — Successful,
1-23-2009[01:10:15 PM]: PrereqEngine: execute,Helper.exe,/p dotnetfx35.exe /l 1033 /v “/q /norestart”,/p dotnetfx35.exe /l 1033 /v “/q /norestart”,1641,3010,, — Successful
1-23-2009[01:10:15 PM]: PrereqEngine: Id,{074EE22F-2485-4FED-83D1-AAC36C3D9ED0},http://saturn.installshield.com/is/prerequisites/microsoft .net framework 3.5 sp1.prq, — Successful
1-23-2009[01:10:15 PM]: PrereqEngine: behavior,Optional,,Reboot,2,Failure,
1-23-2009[01:10:15 PM]: PrereqEngine: Lua,
1-23-2009[01:10:15 PM]: PrereqEngine: Hidden,1
1-23-2009[01:10:15 PM]: PrereqEngine: MsiProgress,
1-23-2009[01:10:15 PM]: Skipping prerequisite ‘Microsoft .NET Framework 3.5 SP1.prq’ because it was installed before the reboot

Since things seemed to point to the .NET Installer, I ran it manually. Lo and behold, it failed because I didn’t have SP2 installed on this virtual machine.

Duh!

But that DEBUGLOG switch definitely helped point the way.