Tips / Tricks - Jon Galloway

Tips / Tricks

IE7 Standalone (Updated for IE7 Release)

Update 10/23/06 for the IE7 Release version

Summary

IE6 and IE7 Side By Side I just released a new version of the IE7 Standalone Launcher. Due to changes in this beta release of IE7, a simple batch file alone won't cut it. You can grab a zip package (two batch files, two reg files) on the new tools.veloc-it.com site.

Finally!

Well, it took me long enough. I've been fighting with the IE7 Beta 3 since it was released - FileMon, RegMon, Dependency Walker, and process debugging. This release requires over 1500 interfaces to be added to the registry.

What's New

The previous versions of this standalone launcher were just simple DOS batch scripts that made a couple of registry settings, launched IE7 and waited for it to close, then removed the registry settings. That's no longer practical with the amount of registry entries that are now required, so I've broken it out into a launch script and two reg files.

In the past, setting up a directory to run IE7 required a few too many manual steps. I've simplified that with a setup script (also a batch file) which extracts the IE installation and gets things set up for you. Setting up IE7 standalone is really simple now - download and extract my IE7 Standalone package, download the IE7 installation from Microsoft and copy to the same directory, and run the setup batch file. After that, you can pop up IE7 whenever you want by double clicking the IE7.bat file.

IE7Directory

Another change - this time the launcher just waits 15 seconds and closes itself rather than hanging around until you close IE7. IE only reads the keys on startup, so we can clean them up once it's running.

DOS batch scripts? REG files? Is there a simpler way?

Well, yes. Yousif released an IE7 Beta 3 Standalone Installer (IE7s.exe) that downloads the IE7 installer file, does some magic stuff, and up pops IE7 in standalone mode. I tested it out and it worked well for me. I prefer the batch / reg file approach, though, for several reasons:

  • I'd like to make it as easy as possible for expert users to make recommendations and corrections. For instance, Dr. Thomas Meinike previously made a recommendation to update the IE Version Vector to allow testing of conditional comments (like <!--[if lt IE 7.0]-->). Version 1.4 of this script included his recommendation. I'd love to hear suggestions on how to improve these scripts - leave comments on this post or on the download page.
  • DOS batch files and REG files are easy to customize. They're just text files, so you can edit them in notepad. If 15 seconds is too long or short a wait for you, you can change it. If you want to experiment with other settings to enable enhanced IE7 features like RSS Feed support, have at it (and please let me know so I can update the scripts).
  • I try to avoid programs that make bulk changes to my registry but don't tell me what they're doing. It's like a random stranger offering a pill but refusing to say what it is. Random programs could be malicious (malware, spyware, etc.) or just incorrect (bad installers have caused me more headaches than malware over the past few years). In my testing, IE7s worked great, but I'd prefer to know what's going on with my computer when I can, especially when I'm running IE in an unsupported configuration. The one loophole for this rule is .NET EXE's, since I can open them in Reflector to see what they're doing; IE7s is a native EXE, though. I want to be clear that I'm not implying IE7s is doing anything wrong or sneaky - it seems to be a very clean, well written utility, and it's a lot easier to use than what I'm offering.

The usual disclaimers apply:

[SQL] FTP download and restore an MSSQL database backup

I extended my DOS batch script to restore a SQL 2000 database and grant permission to ASPNET account to pull the database backup from an FTP location.

This has been a big timesaver on a recent DotNetNuke based project. The designer and client are working off a staging server, so I regularly need to refresh my development database to keep in sync. We have a scheduled nightly database backup on our stage server that writes to a location that's accessible via FTP, so I can just run this script and I'm caught up to the most recent backup.

The variables are set at the top of the script. The ones you'll definitely need to change are shown in bold red.

@ECHO OFF

::SET VARIABLES
ECHO Setting Variables
set DBNAME=mydatabase
set DBLOGICALNAME=%DBNAME%
set DBDIRECTORY=C:\Program Files\Microsoft SQL Server\MSSQL\Data
set DBBACKUPFILE=%DBNAME%_backup
set FTPADDRESS=ftp.myserver.com
TITLE 
Restoring %DBNAME% Database from FTP

::Use %COMPUTERNAME%\ASPNET for localhost
::Use DOMAIN\ACCOUNT$ for a domain account
set ASPNETACCOUNT=%COMPUTERNAME%\ASPNET

set /p GETLATEST=Download backup from FTP (Y/n)
IF "%GETLATEST%" == "N" GOTO RESTORE
IF "%GETLATEST%" == "n" GOTO RESTORE

set /p FTPUSERNAME=Enter FTP User Name
set /p FTPPASSWORD=Enter FTP Password
CLS
set 
FTPDIRECTORY=DatabaseBackups

ECHO Downloading backup via FTP
:: Create the temporary script file
script.ftp USER
>>script.ftp ECHO %FTPUSERNAME%
>>script.ftp ECHO %FTPPASSWORD%
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO CD %FTPDIRECTORY%
>>script.ftp ECHO get %DBBACKUPFILE%
>>script.ftp ECHO bye

:: Use the temporary script for unattended FTP
FTP --s:script.ftp %FTPADDRESS%
:: Overwrite the temporary file before deleting it
TYPE NUL >script.ftp
DEL script.ftp

:RESTORE
ECHO Restoring database
::PUT DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
osql --d master -"alter database %DBNAME% set single_user with rollback immediate"

::RESTORE DATABASE
osql --d master -"restore database %DBNAME% from disk='%~dp0\%DBBACKUPFILE%' WITH MOVE '%DBLOGICALNAME%_Data' TO '%DBDIRECTORY%\%DBNAME%_Data.MDF', MOVE '%DBLOGICALNAME%_Log' TO '%DBDIRECTORY%\%DBNAME%_Log.LDF'"

::GRANT PERMISSION TO ASPNET USER
osql --%DBNAME% -"sp_grantdbaccess '%ASPNETACCOUNT%'"
osql --%DBNAME% -"sp_addrolemember 'db_owner', '%ASPNETACCOUNT%'"

::RESTORE TO MULTI USER
osql --d master -"alter database %DBNAME% set multi_user"

ECHO Donepress Enter key to close...
PAUSE

 

Posted by Jon Galloway | 1 comment(s)
Filed under: ,

[tip / tools] Pausing music when you get a Skype call

Phil sent me a link to a Motorola / Skype Bluetooth Headset that automatically stops your music when calls come in. We both use Skype a lot - I hardly touch the phone anymore - and it sure sounded convenient to be able to switch from music or podcasts to a phone call, then automatically switch back when the call ended. That got me looking for Skype toys that let you do that with my existing headphones; here's what I turned up.

Phil uses iTunes, so Skypeteer MiTunes is perfect for him. He tested it out and said it works great.

I stick with Windows Media Player1, and the best thing soution for that seems to be MuteForSkype, which also handles WinAmp and Sonique. I worked great out of the box, with two small exceptions:

  1. It stops rather than pauses when you get a call, then starts the track over when the call ends. That's a pain if you're listening to a long mix or podcast. I noticed several comments about that on the website, and it bugged me enough that I disassembled2 the WMP Mute plugin and fixed it. You can download my version of the WMP Mute plugin here. I just changed one character (I changed 0x00004979 to 0x00004978).
  2. The plugin should detect if WMP is playing before it toggles Pause / Play, since it will start WMP playing if it was paused when you received the call. This was an existing problem in the original plugin. I looked into fixing this, but it's not at all simple to find out if WMP is playing. Just about all the WMP API documentation focuses on how to use a WMP control, not how to talk to the existing instance of WMP. Apparently you can the the IWMPRemoteMediaServices interface and remote to WMP. I looked at two remotable WMP wrappers - tried this one first, but prefer this one. This was more work than I was ready to bite off right now - I've got too much work and other unfinished projects. If anyone's got C# code will tell if WMP is playing or paused, let me know.

1I'm not a big fan of iTunes.
2Michal posted the source of the WMP Mute plugin on his blog, so I figured it was okay to update it.

Posted by Jon Galloway | with no comments
Filed under: ,

[tip] Prevent Windows Automatic Updates from rebooting your computer

I recently wrote about how much I dislike the way Windows OneCare requires you to enable Windows Automatic Update to download and install updates automatically, since Automatic Update installations often automatically reboot my computer when complete. Jason Stangroome left a comment informing me that there are registry and group policy settings to prevent automatic reboots. I looked into both approaches (registry and group policy) and decided to go with group policy, since the registry settings require manually killing the Windows Update process .

Here's how to prevent Automatic Update from rebooting your machine:

  1. Start -> Run
  2. Type: gpedit.msc
  3. Expand Local Computer Policy / Computer Configuration / Administrative Templates / Windows Components / Windows Update
  4. Double-click "No auto-restart for scheduled Automatic Updates installations"
  5. Select "Enabled", then OK. Close the Group Policy configuration program.

Fine print: 

  1. You need Administrator priveleges to make this setting.
  2. Some people complained that Windows ignored the "no auto-restart" setting for the WMF patch. Potentially a ID 10T error, though. 

Group Policy settings to disable Automatic Updates from rebooting computer

Posted by Jon Galloway | 7 comment(s)
Filed under:

Runing IE7 Beta 2 Preview next to IE6 (the right way)

UPDATE: See this post for the latest release of IE7 standalone.

 

IE7 Beta 2 Preview - Standalone IE7 Beta 2 Preview is available. Unlike previous releases, this is available to anyone who wants to try it out. Usual Beta Disclaimers apply: It is a Beta product and may cause grevious blah blah blah whatever. On to the fun!

This release does include an uninstall, which should return your machine to the previous working state (presumably IE6). However, you can also run IE7 in standalone mode which allows you to keep IE6 as your primary IE version but keep IE7 handy for testing, as long as you use the IE7 standalone launch script to remove two registry keys after IE7 is shut down.

Some caveats apply:

  • The standalone mode is unsupported and didn't play well with the IE6 Cumulative Security Update (December 05). The point is that you can't count on Microsoft to test against IE7 in standalone mode. However, I am running this on my system and it is working for me without problems.

  • Not all features work correctly in standalone mode. In my tests the search, feeds, and other non-browsing features didn't work. However, you can use it to browse and test websites.
  • IE7 writes a registry key that conflicts with IE6, so you need to launch it from a batch file that deletes the registry key when you shut down IE7. Fortunately, such a script is available here. Running IE7 in standalone mode without the launch script, as Scott Hanselman and others have tried, can cause problems.
  • IE7 Beta 2 Preview is only available for XP at this point.

It's a good idea to take a look at how your sites render in IE7 now, especially if you've been using IE specific hacks. The IE team has fixed a lot of the quirks in their CSS standards support, so things like the Star-HTML hack no longer work (read more on the IE Blog). The CSS Zen Garden design page in the screenshot above works in IE6 but has overflow problems in IE7. Looks like the MSN page needs some work, too. Notice the toolbar area, the positioning of the ad, and the way content from the middle column runs past the right border, for starters.

The IE7 Developer Checklist has some good things to look at, including pointers to some common CSS problems.

Update - if setting up the launch script is more work than you'd like, and you don't mind downloading from a non-Microsoft source, you can easily find zipped IE7 redistributions with the launch script already set up.

MSN Homepage in IE7

[tip] Test command line settings with EchoArgs 9.78 PRO

Occasionally, applications will allow you to call external helper programs via command line. That can get tricky when you're supplying a command line template and the application does some token replacement before running the commandline. For example, when I hooked up SourceGear Vault to WinMerge, the trick was in figuring out which tokens it was replacing and how those mapped to WinMerge's commandline arguments. So if my commandline setting is /dl "%WORKING_LABEL%" /dr "%OTHER_LABEL%" "%WORKING_PATH%" "%OTHER_PATH%" "%DEST_PATH%", what exactly is being passed for "WORKING_LABEL" and "OTHER_LABEL"?

Thus, I proudly release EchoArgs 9.78 PRO, the following (ahem) DOS Batch File:

TITLE EchoArgs 9.78 PRO
@echo off
echo Command Line: %*
echo Path :        %~dp0
echo .
echo Arguments 
echo 0: %0
echo 1: %1
echo 2: %2 
echo 3: %3
echo 4: %4
echo 5: %5
echo 6: %6
echo 7: %7
echo 8: %8
echo 9: %9
pause

Here's what it does:

C:\>echoargs test "inscrutable monkey" 5 geronimo

C
:\>TITLE EchoArgs 9.78 PRO
Command Line
: test "inscrutable monkey" 5 geronimo
Path 
:        C:\
.
Arguments
0: echoargs
1
: test
2
: "inscrutable monkey"
3
: 5
4
: geronimo
5
:
6
:
7
:
8
:
9
:
Press any key to continue 
. . .

 

Of course, that doesn't tell us anything we didn't already know. The point is that you'd use it to test the commandline settings by temporarily setting echoargs.bat as my external diff / merge tool (in this example) and seeing what's actually going to be passed to the real application when I've got my arguments straight.

 

Posted by Jon Galloway | with no comments
Filed under: ,

[tip] Use WinMerge for compare / merge in SourceGear Vault

I previously blogged about how to use WinMerge as the diff tool in StarTeam. Diff / Merge against source control is something I do very frequently, so I think it's worth the few minutes to use the best possible tool. I've been a fan of WinMerge for a while, so when I started using SourceGear Vault this post was pretty much inevitable.

So, here's how you set this up:

  1. Download WinMerge. I know it sounds kind of crazy to use experimental builds of a diff / merge tool, but these guys have been putting out very high quality releases for years and their betas are better than most finished products, so if you're feeling lucky go with the latest experimental build.
  2. In Vault: Tools > Options > Diff/Merge tab.
  3. Diff Program and Merge Program fields: Path to your WinMerge.exe (or WinMergeU.exe if you need Unicode support). Default is C:\Program Files\WinMerge\WinMerge.exe\
  4. Diff Arguments: /dl "%LEFT_LABEL%" /dr "%RIGHT_LABEL%"  "%LEFT_PATH%" "%RIGHT_PATH%"
  5. Merge Arguments: /dl "%WORKING_LABEL%" /dr "%OTHER_LABEL%" "%WORKING_PATH%" "%OTHER_PATH%" "%DEST_PATH%"

More info on the WinMerge commandline args here.
More info on the Vault Diff/Merge Options here.

Oh, and one other Vault tip - use CRC's to determine changed files when working in CVS mode. Otherwise I end up with tons of files that say they're changed, but aren't. You can set that via Tools > Options > Local Files > Check "Detect Modified Files using CRCs instead of modification times"

Posted by Jon Galloway | 2 comment(s)
Filed under:

Using Markup Based Javascript Effect Libraries to make dynamic sites in standards compliant HMTL

Summary

You can make websites effects with plenty of glitter using simple, standards compliant HTML through the use Javascript effect libraries which operate on CSS classes. I'll talk about why I think it's important, and if you stick with me, I'll point you to some of my favorite lightweight Javascript effect libraries.

The Conflict

Websites need eye-candy. Everyone loves rounded corners, fancy menus, animation, fades, effects... The problem is that the sparkly stuff often leads to unmaintainable code which is inaccessible and doesn't degrade gracefully. The usual solutions are all bad:

  1. Flash
    Hard to maintain, requires proprietary software, doesn't degrade at all, not very accessible[1]. I'm not a big fan of Flash for most websites. I'm happy to see Flash use moving to complex client side web applications, which is about the only place it's justified (maybe, and hopefully not for much longer).
  2. Javascript
    This gets ugly fast. Even if you put your Javascript code in well structured JS files, you usually end up with a lot of javascript event code in HTML attributes. This completely fights the declarative nature of HTML, and leads to really ugly code. Javacript's a pain in the neck to debug, and ugly Javascript is just about impossible to debug. As I've said before, I'm concerned about the messy Javascript code that's being churned out because everybody loves AJAX but IE's Javascript isn't really ready for it.
  3. Try to get out of it
    That's not good either. Customers and end users have grown to expect a certain level of flashyness. Even if you succeed, they're not going to be happy about it.

Let's take a step back. Why do we need to write this Javascript? In many cases, we're adding behaviors and effects that browsers don't support (yet ). If they did support them, though, we'd invoke them declaratively in CSS, just as we do for all the behaviors and effects that CSS currently does support. Instead of directly manipulating the DOM in our HTML, we'd like to be defining content in our HTML and use CSS classes to map behaviors to the content.

Spoiler

We can do this today by writing Javascript effect libraries which operate on HTML elements with CSS specific classes.

The Gutless Disclaimer

I'm primarily talking about the mouseover / hover / onload stuff that makes the page move and shimmer, not AJAX code which calls back to the server. I think this approach could work pretty well for AJAX, but I'm focusing mostly on the simple sparkle stuff here.

But why, and why now?

This isn't a completely new idea. Peter-Paul Koch and Simon Willison were talking about this 2004 (PPK's writeup explains the philosophy behind this pretty well). This is important to consider now, though, as the AJAX movement is causing Javascript use to skyrocket. It's important that we get our Javascript approach right now more than ever. To quote Ben Nolan, author of the Behavior JS library:

It's great to see public uptake of these technologies - but it worries me to see the influx of <SCRIPT> tags and onclick attributes into webpages. For example, check out these html snippets from two well-known AJAX-enabled sites.
Backpack
< span onmouseover ="notesBlock.hoverBegin(128699)"  onmouseout ="notesBlock.hoverEnd(128699, true)">
<
class ="trashcan"  href ="#"  onclick ="if (confirm('Are you sure?')) { new Ajax.Updater('notes', '/page/2326/notes/destroy/128699', { ... 
Flickr
<div id="image_16209134_normal">
<
script language="Javascript">
photo_hash['16209134'] = new Object();
photo_hash['16209134'].title = '2am on Saturday';
</script>
<
h4 id="title_div16209134" style="margin-bottom: 0px; margin-top: 0px;">2am on Saturday</h4>
<
script type="text/javascript">initPhotosUserPageTitle_div('16209134');</script>

The Payoff - Markup Based Effects

Note: Please click the links in this section! I'm including demos here since the pages have great demos. Check them out!

Lightbox JS

Lightbox JS

Lightbox JS is a great example of what I'm talking about. Reference a JS file, then add rel="lightbox" to any image tags on your page and they get a cool popup effect. If the image tag has a title, it's used in the display. If the browser doesn't support it or the page is being rendered in another format (screenreader, print, etc.), it's a standard image tag so it degrades gracefully.

Perfect.

FACE

FACE

FACE (Faruk's Animated CSS Enhancements) is a great example of how to do this right. You include a JS file, then define our behaviors by the CSS class as the library defines (see right). The CSS class syntax may look a little ugly, but if you think about this as virtual classes that define a particular behavior, it makes some sense. To use this, your CSS would include multiple classes that start with myclass - myclass1, myclass2, etc. FACE will automatically step through the classes using the parameters defined in the element's class, as on the right, so to have a div fade in on page load I'd simply define fader1 to have the div invisible and fader2 fully displayed, then set the div's class to S:fader:2:L:20.

See the site for some simple examples. This library really showcases the concept of markup driven behavior well.

S5 Slideshow

Slideshows

There are a few slideshow systems that use this approach. Eric Meyer's S5 Simple Standards-Based Slide Show System (demo ) is my favorite, which uses CSS and Javascript for PowerPoint like slide shows that gracefully degrade since they're built with standards based HTML. View source on the demo - there's a single reference to a JS file, and the rest is clean, HTML.

The Couloir.org slideshow is nice for photo slideshows. It's really slick -there's even sound effects for mouseovers and image changes. Most people would assume it's Flash. There's a slight tradeoff in symantic purity and maintainability - the image references aren't in the HTML, so they aren't visible if you don't have Javascript enabled and maintainence is a little more complex - but the Javascript is all controlled by HTML element ID's, so the Javascript is simple.

Rounded Corners

Rounded Corners

There are a few systems which will round corners for you. Rounding corners looks cool, but it's a pain in the neck. Using fixed size background images isn't at all web friendly and doesn't work when the area needs to expand - more text or browser text size, for instance. You can make expanding boxes with rounded corners built from chopped up images , but that takes 8 or 9 images and 9 div's for each box, which is a lot of complication for a simple design feature. Doing this on the client side in Javascript can barely perceptible square moment as the page loads, but I think the simplicity is often worth the tradeoff. Nifty Corners (demo) is pretty cool and has a ton of options, but isn't completely pure from the CSS driven effects point of view. It operates on CSS ID's, but to invoke it you need to make an Javascript onload call:
Rounded("div#nifty","all","#FFF","#D4DDFF","smooth");

The Rounded() function accepts five parameters:

  1. A CSS selector that indicates on wich elements apply the function
  2. A string that indicates wich corners to round
  3. Outer color of the rounded corners
  4. Inner color of the rounded corners
  5. An optional fifth parameter, that will contain the options for Nifty Corners
I've used Nifty Corners on two sites, and the bang to buck ratio is very high.

Ilkka's Rounded Corners trades functionality for some simplicity and anti-aliasing, but still requires an onload function call. I'm still looking for a Rounded Corner implementation that's invoked via CSS, but I mention these solutions here because they do fulfil the general purpose of enhancing the user experience through the use of Javascript in a clean, unobtrusive manner that works with CSS rather than directly against the DOM.

Are there any Javascript libraries that make this kind of development easier?

Yes, I'm glad you asked!

Ben Nolan's Behavior library does exactly that. It really works, too - remember that amazing slideshow at Couloir.org? Built with Behavior. So is Foopad.com, a free hosted wiki service. Check out some simple Behavior demos here.

Of course, you can use any of the above libraries without writing any Javascript. That's the point. Behavior is for creating new affects like those I mentioned above.

Aren't you going to talk about dropdowns?

S5 Slideshow Dropdowns shouldn't really need Javascript at all. Son of Suckerfish is CSS based, and only used Javascript to work around IE bugs. Don't use mouseover Javascript code when CSS will do.

But what about AJAX?

The careful reader will note that I have avoided this issue through the the use of a Gutless Disclaimer, to which I now refer you.

If this careful reader happens to be familiar with Microsoft's Atlas project, though, the will note that this is the general direction that the Atlas team taken on the generated client side HTML. That "generated" is important - If you browse Live.com and view source, you won't see a scrap of semantic markup. Nothing but includes and javascript. Take a look at the generated source (Firefox WebDeveloper toolbar > View Source > View Generated Source; for IE use either FullSouce or a generated source viewer bookmarklet from here or here). The JS cruft is still there, but the actual HTML part of the page doesn't have a single javascript call despite a high amount of interactivity. That's because the CSS classes are defining the behaviors, and the javascript is acting on the behaviors. I think the feasibility of CSS driven AJAX is a separate discussion, but this shows it is at least a possibility.

Atlas is interesting in that it's Markup Based both in the original source code (on the server) and in the generated HTML on the browser. I'm not sure what this buys when the HTML is generated by a backend framework, but it's interesting.

I'm energized by this discussion and would like to read further. What to do?

Check out this huge CSS tools list. Read PPK's article. Take a look at the Behavior introduction page, which explains the reason the library was created in the first place.

Fin.

[1] Flash can be made accessible, but it's rarely done.

DOS format file (XSHD) for SharpDevelop, IMHO Instant Blogger, etc.

I use IMHO Instant Blogger to edit and post blog articles. One of my favorite features is the code snippet editor. It's built on the SharpDevelop text editor, which has support for language syntaxes which are defined in xml syntax highlight definitions (XSHD's). It's a nice way to show color coded source code on a web page.1

I post enough DOS scripts that I finally wrote a syntax file for the DOS Batch grammar. It's probably not 100% complete, but I grabbed the cammand from the DOS help command, some standard EXE's from c:\windows\system\, etc. It's easy to install for IMHO:

1. Save this text as C:\Program Files\Elite Agency\Imho Instant Blogger\formatters\CodeSnippet\styles\DOS-mode.xshd:

<?xml version="1.0"?>
<!-- 
syntaxdefinition for DOS Batch by Jon Galloway -->

<
SyntaxDefinition name "DOS" extensions ".cmd;.bat">
    
    <
Properties>
        <
Property name="LineComment" value="::"/>
    </
Properties>
    
    <
Digits name "Digits" bold "false" italic "false" color "DarkBlue"/>
    
    <
RuleSets>
        <
RuleSet ignorecase "true">
        
            <
Delimiters>~!%^*()-+=|\#/{}[]:;"'&lt;&gt; , .?</Delimiters>
        
            
<Span name "LineComment" bold "false" italic "false" color "Teal" stopateol "true">
                <
Begin>::</Begin>
            
</Span>
            
            <
Span name "LineComment" bold "false" italic "false" color "Teal" stopateol "true">
                <
Begin>rem</Begin>
            
</Span>
            
            <
Span name "Label" bold "true" italic "true" color "DarkBlue" stopateol "true">
                <
Begin>:</Begin>
            
</Span>
            
            <
Span name "String" bold "false" italic "false" color "Magenta" stopateol "true">
                <
Begin>"</Begin>
                
<End>"</End>
            
</Span>
            
            <
Span name "Char" bold "false" italic "false" color "Magenta" stopateol "true">
                <
Begin>&apos;</Begin>
                <
End>&apos;</End>
            </
Span>
            
            <
Span name "EnvironmentVariable" bold "true" italic "false" color "Blue" stopateol "true">
                <
Begin>%</Begin>
                
<End>%</End>
            
</Span>
            
            <
MarkPrevious bold "true" italic "false" color "MidnightBlue">(</MarkPrevious>
            
            <
KeyWords name "Punctuation" bold "true" italic "false" color "Black">
                <
Key word "?" />
                <
Key word "," />
                <
Key word "." />
                <
Key word ";" />
                <
Key word "(" />
                <
Key word ")" />
                <
Key word "[" />
                <
Key word "]" />
                <
Key word "{" />
                <
Key word "}" />
                <
Key word "+" />
                <
Key word "-" />
                <
Key word "/" />
                <
Key word "*" />
                <
Key word "&lt;" />
                <
Key word "&gt;" />
                <
Key word "^" />
                <
Key word "=" />
                <
Key word "~" />
                <
Key word "!" />
                <
Key word "|" />
                <
Key word "&amp;" />
            </
KeyWords>
            
            <
KeyWords name "Literals" bold="false" italic="false" color="Black">
                <
Key word "false" />
                <
Key word "true" />
            </
KeyWords>
            
            <
KeyWords name "IterationStatements" bold="false" italic="false" color="Navy">
                <
Key word "do" />
                <
Key word "for" />
                <
Key word "while" />
            </
KeyWords>
            
            <
KeyWords name "ManagedIterationStatements" bold="false" italic="false" color="Navy">
                <
Key word "foreach" />
                <
Key word "in" />
            </
KeyWords>
            
            <
KeyWords name "JumpStatements" bold="false" italic="false" color="Navy">
                <
Key word "break" />
                <
Key word "continue" />
                <
Key word "goto" />
                <
Key word "return" />
                <
Key word "call" />
            </
KeyWords>
            
            <
KeyWords name "SelectionStatements" bold="false" italic="false" color="Navy">
                <
Key word "if" />
                <
Key word "else" />
                <
Key word "case" />
                <
Key word "choice" />
            </
KeyWords>
            
            <
KeyWords name "Environment" bold="false" italic="false" color="Navy">
                <
Key word "@" />
            </
KeyWords>

            <
KeyWords name "CommonPrograms" bold="true" italic="false" color="Black">
                <
Key word ".exe" />
                <
Key word "devnev" />
                <
Key word "msbuild" />
                <
Key word "append" />
                <
Key word "at" />
                <
Key word "calc" />
                <
Key word "chkdsk" />
                <
Key word "defrag" />
                <
Key word "cscript" />
                <
Key word "defrag" />
                <
Key word "doskey" />
                <
Key word "ftp" />
                <
Key word "iisreset" />
                <
Key word "ipconfig" />
                <
Key word "makecab" />
                <
Key word "netsh" />
                <
Key word "netstat" />
                <
Key word "notepad" />
                <
Key word "ntbackup" />
                <
Key word "print" />
                <
Key word "ping" />
                <
Key word "regedit" />
                <
Key word "regedt32" />
                <
Key word "regedit" />
                <
Key word "soon" />
                <
Key word "sort" />
                <
Key word "shutdown" />
                <
Key word "rundll32" />
                <
Key word "regsvr32" />
                <
Key word "subst" />
                <
Key word "runonce" />
                <
Key word "telnet" />
                <
Key word "write" />
                <
Key word "xcopy" />
                <
Key word "wscript" />
            </
KeyWords>
            
            <
KeyWords name "BatchCommands" bold="false" italic="false" color="DarkBlue">
                <
Key word "assoc" />
                <
Key word "at" />
                <
Key word "attrib" />
                <
Key word "break" />
                <
Key word "cacls" />
                <
Key word "call" />
                <
Key word "cd" />
                <
Key word "chcp" />
                <
Key word "chdir" />
                <
Key word "chkdsk" />
                <
Key word "chkntfs" />
                <
Key word "cls" />
                <
Key word "cmd" />
                <
Key word "color" />
                <
Key word "comp" />
                <
Key word "compact" />
                <
Key word "convert" />
                <
Key word "copy" />
                <
Key word "date" />
                <
Key word "del" />
                <
Key word "dir" />
                <
Key word "diskcomp" />
                <
Key word "diskcopy" />
                <
Key word "dosKey" />
                <
Key word "echo" />
                <
Key word "endlocal" />
                <
Key word "erase" />
                <
Key word "exit" />
                <
Key word "fc" />
                <
Key word "find" />
                <
Key word "findstr" />
                <
Key word "for" />
                <
Key word "format" />
                <
Key word "ftype" />
                <
Key word "goto" />
                <
Key word "graftabl" />
                <
Key word "help" />
                <
Key word "if" />
                <
Key word "label" />
                <
Key word "md" />
                <
Key word "mkdir" />
                <
Key word "mode" />
                <
Key word "more" />
                <
Key word "move" />
                <
Key word "path" />
                <
Key word "pause" />
                <
Key word "popd" />
                <
Key word "print" />
                <
Key word "prompt" />
                <
Key word "pushd" />
                <
Key word "rd" />
                <
Key word "recover" />
                <
Key word "rem" />
                <
Key word "ren" />
                <
Key word "rename" />
                <
Key word "replace" />
                <
Key word "rmdir" />
                <
Key word "set" />
                <
Key word "setlocal" />
                <
Key word "shift" />
                <
Key word "sort" />
                <
Key word "start" />
                <
Key word "subst" />
                <
Key word "time" />
                <
Key word "title" />
                <
Key word "tree" />
                <
Key word "type" />
                <
Key word "ver" />
                <
Key word "verify" />
                <
Key word "vol" />
                <
Key word "xcopy" />
            </
KeyWords>

        </
RuleSet>
    </
RuleSets>
</
SyntaxDefinition>

2. Add add a reference to it in C:\Program Files\Elite Agency\Imho Instant Blogger\formatters\CodeSnippet\styles\SyntaxModes.xml by adding this line:

<Mode file = "DOS-Mode.xshd" name = "DOS Batch (by Jon Galloway)" extensions = ".bat;.cmd;"/>

I also wrote up a simple Quote XSHD with no keywords in case I want an easy way to drop a quote in a scrollable frame (installation is the left as an exercise for the reader):

<?xml version="1.0"?>
<SyntaxDefinition 
name = "Quote" extensions = ".txt">
    <Digits 
name = "Digits" bold = "false" italic = "false" color = "Black"/>
    <RuleSets>
        <RuleSet>
        <
/RuleSet>
    <
/RuleSets>
<
/SyntaxDefinition>

1 I know there are some nice solutions for doing this in Visual Studio (Jeff Atwood's VS addin, Copy Source as HTML), but I like having this built into the blog editor; plus this formatter does some cool stuff like copy the code into a scrolling frame.  

Posted by Jon Galloway | with no comments
Filed under:

IE7 Standalone Launch Script

As of IE7 Beta 3, this launch script no longer works. I've released a new version which works with newer IE7 versions (including RC1). Read about it here, then download it here


UPDATES
8/31/2006 - Version 1.6 works with IE7 RC1. Grab it here.
7/26/2006 - Version 1.5 works with IE7 Beta 3, but requires a few more files so I've bundled it into a zip file for distribution. Grab it here.
6/29/2006 - This isn't working with IE7 Beta 3 yet. I'll have to test it out more and probably release a new version.
2/8/2006 - Version 1.4 temporarily updates the IE version to work with conditional statements (<!--[if lt IE 7.0]>) based on a recommendation by Thomas Meinike. 3/21/2006 - This build has been tested with the IE7 B2 Preview released on 3/20/2006. It works, in that it allowed me to browse sites in IE7 without messing up IE6 or my default browser association. However, I noticed high CPU usage while browsing and had to close IE7 using the task manager when I was through - it didn't respond to that little red X thing. I believe these are minor inconveniences compared to running a separate virtual machine just to check how a site looks. Obviously, this build of IE7 just came out yesterday so I haven't put this through rigorous testing.
2/2/2006 - Version 1.3 works with IE7 Beta 2 Preview.

The IE6 Cumulative Security Update (Dec 13) broke the IE Standalone Mode that's been around since IE3 and is a big help in designing for forward compatibility. The IE team's response is that the standalone mode is not supported, so do a full install of the IE7 beta if you want to use it. After a short bit of grumbling, I'll tell you how you can still run IE7 in standalone mode despite the security update.

I hope the "by design" solution is a temporary workaround that will be fixed soon, for a lot of reasons:

  • It's going to be really annoying for web developers to have to test on IE6 and IE7 if they can't both run on the same machine
  • It's not the developers' fault
  • Other browsers allow running multiple versions on the same machine
  • IE is making a lot of breaking changes between versions 6 and 7
  • IE's "standard defiance" virtually required (or highly encouraged) non-standard HTML / CSS / Javascript
  • The standalone mode, unsupported or not, has worked for like 10 years now

The symptoms of this recent problem are interesting - in my case, every time I clicked a link in IE it would open in Firefox (my default browser). There are lots of other strange effects other people are seeing, such as blank windows, hanging, and a ringing in the ears. The problem is that IE7 writes a registry key that causes IE6 to shift to an also undocumented "evil" mode, and it's necessary to delete this registry key after running IE7 and before running IE6 with the December 05 cumulative security update.

Okay, on to the solutions...

If you just want to delete the registry key and follow the rules (don't use IE7 at all, take the plunge and use IE7, or use a virtual machine with VirtualPC or VMWare), then you can just copy the following text into notepad, save it as ie7fix.reg, and double-click it. Note: this is not the launch script, it's just a cleanup in case you've used the launch script before and it's causing problems.

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\CLSID\{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}]

But if you'd like to keep running IE7 in standalone mode, you can use the following DOS batch script. You'll use the batch file to launch IE7, and it will stay active as long as IE7 is running. As soon as you shut IE7 down (that red X button or File / Exit), the batch file will clean up after IE7 so your other browsers will continue to work.

How to use the IE7 Launch Script:

  1. If you already have IE7 set up for standalone mode, skip to step 4.
  2. Download the IE7 Beta Install from MSDN. I know there are versions of this floating around the intarwebs, which may or may not carry the ebola virus.
  3. Open the install file with a decompression program like WinRAR (yep, it's an EXE, but it's a self extracting EXE) and extract them to a folder. Alternatively, you can just run the EXE, make a copy of the files which are extracted in the first step, and cancel the install. I was too chicken to do this on my work computer. There were some other steps to the setup which I've included in the batch file below - if you want to know what they are, read the original info here.
  4. Copy the text below to notepad and save it as IE7.bat in the same folder you're setting up the standalone IE7 copy.
  5. When you want to run IE7, double click IE7.bat - it pops up a DOS window that will hang around as long as IE7 is running so it can clean up after it (by deleting that pesky registry key) when you close IE7. Don't close the DOS window down or your pancreas will implode.
  6. When you're done with IE7, just shut it down. The DOS window will clean up that pesky registry key and delete the standalone files, then disappear. If you shut IE7 down and the DOS window hangs around, just close it and run it again.
Update - If setting up the launch script is more work than you'd like, and you don't mind downloading from a non-Microsoft source, you can easily find zipped IE7 redistributions with the launch script already set up.

@ECHO OFF
TITLE IE7 Launcher 1.4

ECHO 
IE7 STANDALONE LAUNCHER 1.4
ECHO 
Updated for IE7 Beta Preview
ECHO.
ECHO Do not close this window or it will not clean up after itself properly.
ECHO You can pass a URL into this batch filelike this:
ECHO ie7.bat www.microsoft.com
ECHO.
ECHO More info here: http://weblogs.asp.net/jgalloway/archive/2005/12/28/434132.aspx
ECHO.
ECHO When you close IE7this will remove the registry key and shut itself down.
ECHO.
ECHO Setting up IE7 for standalone mode...
PUSHD %~dp0

ECHO Removing IE7 registry key and set the version vector to "7.0000".
%TEMP%.\IE7Fix.reg ECHO REGEDIT4
>>%TEMP%.\IE7Fix.reg ECHO.
>>
%TEMP%.\IE7Fix.reg ECHO [-HKEY_CLASSES_ROOT\CLSID\{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}]
>>
%TEMP%.\IE7Fix.reg ECHO [-HKEY_CLASSES_ROOT\Interface\{000214E5-0000-0000-C000-000000000046}]
>>
%TEMP%.\IE7Fix.reg ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector]
>>
%TEMP%.\IE7Fix.reg ECHO "IE"="7.0000"
>>%TEMP%.\IE7Fix.reg ECHO.
:: Merge the REG file to delete the IE7 standalone entry
REGEDIT /%TEMP%.\IE7Fix.reg

REN SHLWAPI.DLL SHLWAPI.DLL.BAK
TYPE NUL IEXPLORE.exe.local
ECHO Running IE7...
iexplore.exe "%1"

:: Merge the REG file to delete the IE7 standalone entry
REGEDIT /%TEMP%.\IE7Fix.reg
:: Delete the temporary REG file
DEL %TEMP%.\IE7Fix.reg

ECHO Removing IE7 standalone files...
REN SHLWAPI.DLL.BAK SHLWAPI.DLL
DEL IEXPLORE.exe.local

:: Set the old version vector "6.0000".
%TEMP%.\IE7Fix.reg ECHO REGEDIT4
>>%TEMP%.\IE7Fix.reg ECHO.
>>
%TEMP%.\IE7Fix.reg ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector]
>>
%TEMP%.\IE7Fix.reg ECHO "IE"="6.0000"
>>%TEMP%.\IE7Fix.reg ECHO.
REGEDIT /
%TEMP%.\IE7Fix.reg
DEL %TEMP%.\IE7Fix.reg

POPD
ECHO 
Completeclosing...

Please leave any comments here.

More Posts « Previous page - Next page »