Scott Hanselman tweeted a link to Daniel Cazzulino's blog post about automatically synchronizing the Visual Studio Solution Explorer with the active item open in the editor. It's a great tip, but I personally have never been a fan of the Track Active Item option - I find that it slows down the IDE, causes distracting visuals, and often just isn't the behavior I want. I do, however, often want a way to manually sync up the Solution Explorer with my currently open item.
Fortunately, it's very easy to accomplish this with a very simple macro. The idea is very simple - just turn on the Track Active Item option that Daniel mentions, and turn it off again. It's a two-liner:
Sub SyncSolutionExplorer()
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
End Sub
You can wire up that macro to a toolbar button and/or a keyboard hotkey, and (as ScottHa would say) bam, you're golden.
Sadly, it appears the answer is "yes". Specifically, the debugger has a huge limitation - one that's been there since Visual Studio 2005 (maybe even 2003). You can't set a breakpoint on the first line of an anonymous function. Consider, for example, the following:
1: <script type="text/javascript">
2: function aFunc()
3: { 4: alert("hi"); 5: }
6:
7: var aFunc2 = function()
8: { 9: alert("hi, yourself"); 10: alert("what's your problem?"); 11: }
12:
13: aFunc();
14: aFunc2();
15: </script>
Here aFunc is a named function, and aFunc2 is a variable that points to an anonymous function. With the Visual Studio debugger, you can set a breakpoint on line 4, and line 10, but not line 9.
Why is this such a problem? Because most all the major Javascript libraries (at least Prototype, YUI, JQuery, and even, to a lesser extent, Microsoft's own ASP.NET AJAX) use anonymous functions up the ying yang - mostly for object methods. In other words, you can't set a breakpoint on the first line of most functions in most AJAX libraries. And if the function has only one line, yeah, you're screwed - no break-ey break-ey for you.
When I learned that this bug wasn't fixed in Visual Studio 2008 I was, in a word, dumbfounded. Isn't improved Javascript development one of the primary new features of VS2008?
Now, when I characterized the problem as being related to anonymous functions, that isn't quite right. In the above code, even if you give the aFunc2 function a name - "var aFunct2 = function theFunc()..."- the problem remains. There's a brief discussion of this issue on the ASP.NET forums here (note the date - March 2007), but the explanation rather nebulous. Whatever the root cause, it's a horrible limitation that I'm stunned wasn't addressed for RTM.
Guess it's back to Firebug for me. Or maybe it's time for another look at Aptana.
I finally got around to installing the latest beta of Windows Live Writer, my favorite blogging tool. As part of the install, it displays the following dialog:
I can't believe that in this day and age, applications still want to change my home page. The checkbox was checked by default, by the way - I unchecked it before I took the screenshot.
A while back I blogged about a problem I had installing Visual Studio 2005 on a fresh Vista install - it complained about requiring Windows XP SP2. I never found a satisfactory explanation, but copying the DVD contents to the hard drive worked around the problem. The stock suggestion was to check the Compatibility settings on the property page for setup.exe - but in my case no compatibility mode was set. Or was it?
Recently I tried installing Visual Studio 2008, and got the same error. Following a suggestion from the MSDN forums, I checked the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers. Lo and behold, it contained an entry for %tempdir%\setup.exe. But I'm not running setup.exe from the temp dir, I'm running it from the DVD, so that entry shouldn't affect anything, right? Wrong. When you run the installer from the DVD, it appears to copy itself to the the temp dir and run itself from there. At that point, the compatibility flag is in effect.
Where did the registry setting come from in the first place? I have no idea. But removing it allows the Visual Studio install to proceed.
Maybe this is common knowledge, but my co-worker and I spent some time chasing this down today, so I figured I'd post it in the hope that it will save other people some time.
Normally, a empty, unstyled DIV reserves no space in an HTML document. However, it seems that under Internet Explorer (we were testing under IE7), if you set the innerHTML property of such a div to an empty string, suddenly the DIV starts taking up space. In other words, if you have this:
some text
<div id = "theDiv"></div>
some more text
and execute a line of script that does this:
document.getElementById("theDiv").innerHTML = "";
then suddenly a blank line will start appearing in between "some text" and "some more text" - the DIV now occupies space in the flow. This doesn't happen in Firefox, and I believe it's a bug in IE.
We were seeing this using ASP.NET AJAX. We have multiple UpdatePanels on a page, and one of them was rendering empty content. After an async postback, a blank line started appearing where the empty UpdatePanel was. The UpdatePanel script code sets the innerHTML property to the result of the async-postback (blank in this case), and suddenly the UpdatePanel DIV was taking up space where it hadn't before.
The fix in our case was easy - set the RenderMode property of the UpdatePanel to "Inline".
I recently blogged about the NoSquint Firefox extension, for remembering per-site text zoom levels. I also recently blogged about the Keyconfig extension, which allows you to change hotkey bindings. I guess you could say that this post is the bastard child of those two posts.
The one feature I've been wanting from NoSquint is a keyboard hotkey that jumps the zoom level straight to 100%. I keep my default zoom level at 160%, but many sites just don't render well at that level. A few are downright unusable. I can hit Ctrl-dash a few times to dial down the zoom on those sites, but I really wanted a way to easily jump right to 100% (the standard Ctrl-0 Firefox hotkey jumps to the default zoom, not to 100%, when running NoSquint). I submitted an enhancement request to the extensions author, but this morning I realized that I could probably just add the hotkey myself. I was browsing the NoSquint source when I struck on the idea to use Keyconfig to create the binding, rather than mess around with unpacking, changing, and repackaging the source JAR file.
Here's how you do it. Bring up the Keyconfig configuration UI (Tools/KeyConfig). Click the "Add a new key" button. Give the hotkey a name (I used "Zoom to 100%"), and in the big textbox enter:
NoSquint.zoom(gBrowser.selectedBrowser, 100);
NoSquint.saveCurrentZoom();
NoSquint.updateStatus();
Save the hotkey definition, and bind it to the hotkey of your choice (I used Ctrl-Alt-0).
That's it. Now when I hit Ctrl-Alt-0, my zoom level jumps right to 100%. Perfecto.
UPDATE - the original version of the hotkey code didn't remember the 100% setting. I've updated it so it does.
It's been a good week for new (to me) Firefox extensions.
Any serious Firefox user will tell you that it's all about the extensions. Unfortunately, if you install enough extensions, you'll eventually encounter a conflict between the hotkeys registered by different extensions. A few extensions are nice enough to allow you to redefine the hotkeys. Most do not. I've been struggling with this lately - the Focus Last Selected Tab and Image Zoom extensions register conflicting hotkeys - I've been wanting to use the FLST version, but Image Zoom was taking priority.
I just ran across the keyconfig extension, which solved my problem handily. It allowed me to suppress the Image Zoom hotkey (it can also reassign operations to a different hotkey). Problem solved.
Recommended.
Generally, I find that the font sizes used on many, if not most, web sites, are too damn small - especially on a 15" UXGA laptop screen. To avoid having to hit Ctrl-+ (text zoom) on every page I visited, I've been increasing the the minimum font size in the Firefox Options dialog. But this isn't an ideal solution - it screws up the layout of a lot of web sites. And minimum means minimum - you can't use Ctrl- - to zoom out and shrink the text size.
This week I ran across the NoSquint Firefox extension, which offers a much better solution. It allows you to specify a default zoom level used when pages load. Moreover, it can remember zoom levels per-site, so that sites with particularly sadistic designers can be set to zoom in more by default. It ROCKS!
I've got a brand-spanking new, clean install of Vista on my laptop, and I'm trying to install Visual Studio 2005 on it. Unfortunately, I'm not getting very far. The installer always displays the following dialog, complaining that I don't have XP SP 2 installed:

The only related info I've found from Microsoft is on the VS2005 on Vista issue list, which states that "Visual Studio products fail to install in XP compatibility mode". However, I'm not selecting any compatibility mode when running the install. I've run the install as administrator, but no difference. I've tried disabling UAC, but no difference. Does anyone know how to get around this problem?
UPDATE - Although Scott Guthrie and crew graciously offered to help track down the problem, I haven't heard back from them after our initial exchange. However, based on other recommendations that I found online, I copied the DVD contents to my hard drive and successfully ran the install from there. My guess is that when the installer is run from the DVD it ends up running in XP compatibility mode - but I have no idea why.
I've been meaning to rename this blog for ages. The whole PuppiesAndIceCream thing was originally just a dumb joke from when I renamed the blog the first time, and I never meant for it to stick. But being the unimaginative person that I am, I never came up with another name, and so it has stayed.
Then I today I read Clemens post about Blogger Types, and his description of "The Blip In The Noise" so precisely matched this blog that I simply had to steal adopt it. Hope you don't mind, Clemens - let me know if you do.
So, the puppies are gone and the ice cream is all eaten. We now return you to your regularly scheduled program.
More Posts
Next page »