Category Archives: Troubleshooting

Viewing CHM files from Network Drives

0
Filed under Hack of the Day, Troubleshooting

Ok. So this is not a particularly new problem. You get an application, which comes with a help file in the CHM (Compressed Hypertext) format. Works great as long as you don’t try and open it from a networked drive. <sigh>

So, what to do?

Well, Microsoft has a pretty complete suggestion here.

But, it’s registry hacks, it’s not pretty, and, it didn’t work for me on a  Win7 system.

The Help and Manual folks put together a pretty interesting alternative here but this is assuming you’ve got a product you’re installing. Not great for a typical user.

A simpler way

After researching this way more than I should have, I ended up with a simple straightforward solution that works reasonably well.

Just zip the CHM file into a zip file in the same location.

Yes that’s it!

image

Notice in the image that I have zipped the 7Zip CHM file into a zip file. I renamed the file as 7-zip.chm.zip, just to remind me that it contains the CHM file.

To read the file, just double click the ZIP file, which, in modern Explorer windows, will open the ZIP directly, then double click the CHM inside the ZIP itself.

When you do that, Explorer will decompress the CHM file to your temp folder and then open THAT file with the CHM viewer. Because that CHM file is located on your local harddrive, the restrictions in place that prevent viewing networked CHM files, won’t take effect and, presto! CHM viewage without any registry hassles.

 

By the way, the 7Zip command line version is an excellent tool (with a great help file<g>) for doing just this sort of thing, if you happen to like command line tools.

Grab it here.

How to Force a Single Instance of FireFox

0
Filed under Firefox, Troubleshooting, Utilities

We have a multiple computer household, but for some reason, my workstation seems to be the one everyone wants to use to check for directions, their email or whatnot. Unfortunately, as I research issues online, I often leave multiple tabs open as quick and dirty bookmarks till I’ve finished whatever work I was doing.

I happen to use the excellent TabMixPlus plugin for Firefox to manage this, and generally, it works great.

But, from time to time, I’ll sit down to continue work, open Firefox and all my tabs will be gone! Even LOCKED tabs! Ugh.

So a few days ago, I decided to try and track down why.

Turns out it’s pretty easy to accidentally do just that.

All it takes is a few simple (and easy to accidentally perform) steps:

  1. Have an instance of Firefox with tab you care about open.
  2. Under Win7, right click on a pinned Firefox icon and select New Firefox Window.
  3. A completely fresh, empty window opens, but the already loaded window is not “in the background”
  4. Click the already loaded window, and close it.
  5. Now, click the newly loaded empty Firefox window and close it.

At this point, if you reload Firefox, all your tabs will be gone!

It turns out that TabMixPlus, as good as it is, doesn’t quite handle this situation properly. If you close the window with all your wanted tabs FIRST, they will be saved properly. But then, when you close the second window with some other (not your) tabs, when that window closes, those tabs will wipe out the previously saved list!

Yikes!

Now, I can’t really call this a bug on Firefox’s or TabMixPlus’s side. It’s a pretty good example of an odd edge case.

Still, that’s not the way I want it to behave.

The Simple Fix

After some digging around, I’d turned up a number of suggestions, including changing the FireFox shortcut link, adding command line options like “about:Blank”, and others.

However, it turns out that the best solution was in TabMixPlus the whole time, just not quite as I would have thought.

On the LINKS tab of the TabMixPlus config options is the “Enable Single Window Mode.”

image

Just make sure that option is CHECKED.

If you do that, anytime a new, EMPTY Firefox window would have opened, instead, a new tab will open in the existing window.

This still means other users could close your tabs, etc, but they’d have to do it intentionally. It can’t happen by accident.

And… all your locked/protected tabs will stay in place, locked and protected. Those would have to intentionally be unlocked/unprotected to be closed out.

So far, I haven’t run into any issues as a result of enabling this mode, but, obviously YMMV.

KeePass and PhraseExpress

2
Filed under Troubleshooting, Utilities

These are two incredibly handy utilities to have around. I’ve used them for years.

KeePass is a task tray utility for keeping track of and auto pasting usernames and passwords into forms. Works with local applications as well as web forms. The password database itself is highly secure.

PhraseExpress is an “autotype” tool that works across multiple applications, and can even do limited automatic correction of misspelling in any program.

However, when I updated to KeePass 2.18 recently, password pasting into WebForms (Specifically FireFox in my case) stopped working.

Well, sort of.

The username would typically paste in, followed immediately by the password. Even though KeePass was configured to send a TAB key between them and ENTER after the password, those keys weren’t getting sent, so the password paste didn’t work right.

 

Long story short, something changed in Keepass that suddenly makes the “Route Enter and Tab Key Through PhraseExpress” option of PhraseExpress very important.

image

I originally had this setting CHECKED, but that now appears to conflict with Keepass.

Unchecking the setting seems to correct the issue and Keepass works fine now.

I’m not sure what, if any, negative effect there is from unchecking this option though, when using PhraseExpress normally.

Can’t see a Windows XP machine from a Windows 7 Machine

0
Filed under Networking, Troubleshooting

I ran into a strange problem today. I had brought up a new Windows XP machine, wirelessly connected to my network. It has SP3 installed, could see the internet, and could see other machines (including Windows 7 machines) on my network.

But, my Windows 7 workstation could not see the XP machine.

By “see”, I mean:

  • it didn’t show up in explorer
  • I couldn’t ping the machine by name
  • I couldn’t browse to the machine by using a unc (like \\majestic\Drivec)

However, I had another XP machine that my Win7 workstation could see!

After a few google searches, I came across a post that mentioned changing a few Win7 networking settings.

In particular:

Open up Advanced Sharing Settings

image

And alter a few settings:

image

Notice that

  1. I’ve set File Sharing Connections to the 40-56 bit encryption option
  2. I’ve set Password protected sharing to OFF
  3. I’ve set HomeGroup connections to “Use user accounts”

I then logged out and logged back in (no need to turn off).

Presto! I can see both of my XP machines!

Ok, so which settings actually did the trick?

Long story short, I ended up setting ALL these settings back to their original values, rebooting between each, and even using IPCONFIG /flushdns, but I can still see my XP machines just fine.

Ugh.

In the end, I’m guessing switching those settings allowed “something” about the XP machine to register itself on my Win7 machine, after which, I could switch the settings back, but everything will still be OK.

But that’s just a guess at this point.

Windows Can’t Acquire IP Address Via DHCP

0
Filed under Troubleshooting

I’ve run into a situation a few times where, for some unknown reason, a Windows machine will be unable to obtain an IP address via DHCP.

Then that happens, the machine is likely to get an APIPA address, such as 169.254.xxx.xxx. This is known as the DHCP failover situation, and generally, it’ll mean that while you might be able to see sites out on the internet, most likely, you won’t be able to see any computers connected to your internal network (often computers on your internal network will be associated with IP addresses of 192.168.xxx.xxx).

In my case, I could set static addresses for those affected computers and they’d work fine, but reset them back to using DHCP and they’d be unable to obtain an IP address.

Googling turned up a variety of possible solutions (unplug your router, reset the IP stack by deleting registry entries, plug your computer into a different power outlet <huh?>, running IPCONFIG /RELEASE….IPCONFIG /RENEW, etc), but nothing was working for me.

On a lark, I browsed over to my router (in this case a Verizon Fios router) to check it’s configuration.

I have several routers, but the Verizon router is the only one set up to be a DHCP server (there should only be one machine, router, or actual server, on your internal network set up as a DHCP server), and it all looked good, but then I noticed something.

I had a LOT of devices showing up in the connected devices list. Many were offline, but they were still there.

This means that the router was still holding leases for them and tying up those IP addresses. Hmmmm.

I counted. 21 of them.

So I navigated to the DHCP configuration screen of the router and lo and behold, I had it set to lease addresses from 192.168.100.100 to 192.168.100.120. Exactly 21 addresses!

Ugh.

Why?

Way back when I set up this router, my thinking was “I’ll never have more than 20 devices connecting, so why should I accommodate any more than that?” so I’d limited to the available IP address range that the router would pick from.

In retrospect, I suppose that was being a little to prematurely security-conscience.

It was that limit, along with a router than apparently does not like to recycle IP leases readily, that caused me to simply run out of DHCP addresses, and thus the failure of Windows to acquire an IP address.

Moral of the Story

At the end of the day, I probably shouldn’t have limited the router to 21 addresses. It seemed like a reasonable number, but these days, with several computers in each house, plus smart phones, TIVOs, internet-connected TVs, IPADs, laptops, game systems, etc, it’s completely conceivable to have far more than 20 devices or so vying for IP addresses through DHCP.

When I exhaust the range from 192.168.100.100 to 192.168.100.200, then I’ll know I have too much tech <g>!

Direct integration of ILMerge with VB.net Projects

0
Filed under .NET, Error Handling, MSBuild, Troubleshooting

I’ve been working on a few utility type applications lately (more on them later, once they’re firmed up), but one thing I’ve found incredibly useful for certain projects is ILMerge.

If you’re not familiar with it, ILMerge is a utility that essentially can combine two or more .net assemblies into a single assembly, and reducing an application’s footprint is something I’m particularly passionate about!

In the past, I’ve always created postbuild steps that included executing ILMerge as just a command line post build process, but doing it this way has always been problematic. To start, debugging in the IDE tends to be compromised at best, and not possible at worst. Plus it just never felt clean.

In researching the problem, I ran across three blog posts that have provided more than enough info to get me past the Post Build process and actually integrate ILMerge directly into the build process itself, and one very intriguing alternative.

First, Scott Hanselman wrote about his experiences using ILMerge to merge a VB.net assembly into an otherwise C# project back in 2007. A great article and a fantastic first step.

Then, I came across Daniel Fortunov’s  article about integrating ILMerge into the VS build process. His example is also very good and a little cleaner, I’d say than Scott’s approach, but both articles are definitely worth checking out if you find yourself needing this kind of thing.

Lastly, Jeffrey Richter wrote a terrifically short but incredibly eye-popping article about a technique to load .net assemblies dynamically from binary resources baked into a single assembly at compile time. Very simple and clean. A great technique to have in your toolbox if the need ever arises.

For my part, I’ve used the ILMerge technique to merge Mono.Cecil.dll (a C# library from the mono project for directly altering .net assemblies) into a VB.net utility that can repackage portions of an assembly’s PDB file directly into the assembly’s EXE or DLL file, to supply line numbers during the rendering of an exception’s stack trace without actually have to provide a PDB (and all the additional metadata about your assembly) to your client. A fantastic debugging technique and one that I’ve been working with (off and on) for several years now. I’ll write about it in more detail later.

VB6 Menus Disabled

0
Filed under Troubleshooting, VB6

In my current job, I have to do some maintenance on some legacy VB6 code. Yeah, its archaic by .net standards, but there’s something….comforting I guess…. about VB6. I spent almost 10 years with that language, so at this point, I know it just about as good as anyone, save maybe Bruce Kenney or Matthew Curland.

At any rate, I’ve been working with it over the last few weeks and happened today to notice that the Bookmarks menu items were all disabled, even when the cursor was located somewhere where I should be able to set a bookmark. You can see the menu items in the screenshots below. Note that in these shots, then menu items are enabled properly. I didn’t think to grab clips before trying to resolve this.

image    image

At first, I thought the problem was with one of the Addins I’d been playing with (CodeSmart, MZTools, etc).

But disabling them didn’t make a difference. Of course, it’s completely possible that an addin did the damage and VB just never “fixed itself” but I have no way of knowing.

The Fix

After playing with several possibilities and even scanning through the registry, I ended up with this simple fix.

Right Click on the menu bar, select Customize, you’ll get this window.

image

For each of the items highlighted above (and the others if you suspect problems there too), click the item and click the RESET button.

That’s it!

Simple. No reboots required. You don’t even have to restart VB.

More Fun with Generic XAML Errors

0
Filed under Troubleshooting, Windows Phone 7

Here’s another obscure XAML error I hope no one else stumbles onto.

I have several VisualStates defined for a particular UserControl. One example is:

<VisualState x:Name="Waiting">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="pnlBeforeWakeup">
            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="0" />
        </ObjectAnimationUsingKeyFrames>

Now, I’d entered that state by hand and it worked just fine in Visual Studio, compiles and runs (at least, on the phone emulator).

But, when I tried to fire up Expression Blend, the control would load initially, but when I tried to view the States tab, crash!

After a few false starts, I just removed all my VisualStates manually and recreated one via Expression Blend.

Presto! Anyone care to guess the “fault”?

<queue Jeopardy theme>

Ok, here’s the version that works fine in both VS and Blend.

<VisualState x:Name="Waiting">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="pnlBeforeWakeup">
            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                <DiscreteObjectKeyFrame.Value>
                    <Visibility>Visible</Visibility>
                </DiscreteObjectKeyFrame.Value>
            </DiscreteObjectKeyFrame>
        </ObjectAnimationUsingKeyFrames>

Notice that instead of Value=”0”, Blend seems to want a specific Value element, with a Visibility sub-element.

And finally, here’s the Expression error that results from using the Value attribute as I did originally.

image

The only clues that helped were the fact that it only happened when I tried clicking on a particular State that made use of the Value=”0” for Visibility, and the mention of “StoryBoard” in the StackTrace above.

“Unspecified Error” in XAML under WP7

1
Filed under Troubleshooting, Windows Phone 7

Ran into a very strange error today that took me a bit to figure out.

Essentially, I was templating a standard ol’ Silverlight Button (I wanted it to have a bit of a gradient and a nice rounded border in this instance).

I was mainly messing around with things, so I was defining the control template inside the button control itself, instead of the more general purpose way of defining a Style.

<Button Name="btnTest" Content="Caption" Click="btnTest_Click" HorizontalAlignment="Stretch" >
    <Button.Template>
        <ControlTemplate>
                <Border BorderBrush="White" BorderThickness="3" CornerRadius="10" Margin="{StaticResource PhoneMargin}" >
                    <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFCDCDE5" Offset="0" />
                        <GradientStop Color="#FF389940" Offset="0.25" />
                        <GradientStop Color="#FF008d00" Offset="0.314" />
                        <GradientStop Color="#FF002200" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Stretch" TextAlignment="Center" FontFamily="Segoe WP" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Margin="0,6,0,18"/>
            </Border>
        </ControlTemplate>
    </Button.Template>
</Button>

Nothing special, but when I ran the program and navigated onto the page containing this button….

image

Ugh, Just about the most general error message possible.

Fortunately, I’d checked things in just a little earlier so I had a record of what had changed, the main thing being that I’d added the use of the TemplateBinding Content feature.

The idea there is to be able to customize exactly what UI element is used to display the “Content” property of the Button control itself. As you can see, I set the button’s Content to “Caption” and then bind to that in a TextBlock.

Simple stuff.

But it crashed.

If I took out the TemplateBinding reference, everything worked just fine.

After a lot of headscratching, I eventually realized that in this case, I did NOT provide a TargetType argument to ControlTemplate. I guess I was thinking that sense the ControlTemplate was being defined within an actual control instance, it wasn’t necessary. Lo, I was but mistaken!

Once I’d specified the TargetType for the ControlTemplate element, everything was back on track.

<Button.Template>
    <ControlTemplate TargetType="Button">

It truly is the tiny things in XAML that’ll get you!

Mysterious NET USE Drive Mapping Problem

0
Filed under Troubleshooting, Windows 7

At some point recently, my workstation became unable to map drive M: to a particular server share.

If I tried “net use m: \\server\share”, I’d end up with an error stating that “That device name is already in use” or better “System Error 85 has occurred”.

But, if I then did a “net use” to list the active mappings, drive M didn’t show up in the list.

I tried rebooting, both client and server, as well as a few minor registry tweaks (under the advice from one site that mentioned Windows will cache drive mappings in some cases), but nothing worked.

Finally, I just happened to open up the Disk Management screen from “Computer Management” (Right click on “Computer” and select “Manage”).

image

Notice the Drive M line and the “Removable” disk type. Ugh.

At some point, I must have inserted a new USB thumbdrive when I didn’t happen to have a connection (and hence a mapped M drive) to my server, and Windows just decided to map the thumbdrive to the empty M: slot.

But, when I got my server back up, even though the thumbdrive was long gone, that mapping was persisted and thus the slot was taken.

To fix it, I just right clicked on the highlighted line above, and selected “Change Drive Letter”. Remove the old M: mapping, and add a new W: mapping.

image

and the problem is solved.