Code: Custom IIF for VBscript

I add a custom IIF function to every VBscript I make:

' IIF recreated for VBscript
FUNCTION IIF(Expression, Truepart, Falsepart)
	IF Expression THEN 
		IIF = Truepart
	ELSE
		IIF = Falsepart
	END IF
END FUNCTION

'used like so:
strFlavor = IIF(strColor="brown", "chocolate", "not chocolate")

 

Mind you, it evaluates all parameters on the way in, so even though this checks the objTest object when assigning using it, it would still fail (when the objTest object reference is not set):

strFlavor = IIF(IsObject(objTest), objTest.flavor, "vanilla")

 

It’s no ternary operator, but it’s still indispensible for efficient VBScript coding.

Dev tip: CSS-only workaround for IE SELECT Z-index bug

Via Dean Edwards’ Links, meet
HedgerWow’s <SELECT>-Free Layer, a CSS-only workaround for Internet Explorer’s SELECT bug with z-index.

It’s not quite clear from the demo, but I think the magic is an absolutely-positioned + transparent + huge IFRAME inside the layer to show.  C’est trĂ©s hacky, but it still seems better (in a way) than the usual dynamic hide/show javascript approach.

Here’s hoping that Microsoft will quickly windows-update us all with IE7 (which fixes this bug, hoorah), and free us of these sHACKles.

IE6 HTTP Bug with HTTP_Accept request header

Something I bumped into today: The first time Internet Explorer loads a URL, it sends an “HTTP_Accept” request header with the list of MIME types it accepts, like so:
HTTP_ACCEPT = application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*

Any subsequent request of the same URL, though, only sends “*/*”:
HTTP_ACCEPT = */*

Of course I watched this through an ASP page which wrote out Request.ServerVariables("HTTP_Accept").  I wasn’t sure if it was IIS or IE‘s fault tho, so I checked the raw headers with Fiddler, and it’s definitely IE.

What’s especially strange is that I can find little or no mention of the problem. Anyone else heard of (or conquered) this?

It rather messes up a page I’m working on…

UPDATE: See here for a bug and workaround demo article I just put together.

Dev Tip: Rounded Corner Generator

Got a question today from my friend George about the best way to make rounded corners.  I listed some choices, with pros/cons of each:

I ended up recommending static images as the best combination of performance and compatibility, at the expense of developer time.  Then it occurred to me: surely I’m not the only lazy one — someone must’ve already made a web-based wizard to quickly create sets of corner images for download and installation.  Could it be??

Google says Voila!  Jalenack’s Complete Rounded Corners Creator

I say Sweet!  I tell ya, kids these days got it easy!

Discovered: MS-DOS 7.10, hrm?!

Apparently someone ripped out the underlying DOS from Windows 98 and made it work as a standalone OS.  (Unfortunately, the main site is down, but there’s a good info & a download mirror here.)

Why, you ask? So you can keep using old hardware, but with better disk support, FAT32, drivers, etc.

Fun stuff.  I’ve already installed it.  I’m looking forward to silliness like running the Windows 3.1 shell on top of it!

Links:
Main info site (seems to be down): MS-DOS 7.10 Download

Main info site (google cache): MS-DOS 7.10 Download

Download Mirror: PeteWeb.com Forums – Old Operating System Links

2005-10-01 – IPBOOTB errors

Problem:

My SBS 2003 box was getting this error several times a day:
“IPBOOTP was unable to receive an incoming message on the local interface with IP address x.x.x.x . The data is the error code.”

Process:

Most applicable suggestions I found said to either disable the DHCP Relay Agent service, or install a Win2000 hotfix.  No luck for me, though, since the service wasn’t installed, and I’m on SBS 2003.

Solution:

Microsoft.Public Usenet – IPBOOTP ERROR PLEASE HELP.  Hurrah, disabling DHCP Relay on the LAN interface in RRAS manager.

Change Windows XP Home to XP Pro

It requires modifying the installation CD (just two bytes), but for the brave: HOWTO Change Windows XP Home to Windows XP Pro – Gizmodo

Lessee, judging by Microsoft’s Windows XP Comparison Guide, that should get you:

  • System Restore
  • NTBackup
  • Fast User Switching
  • Offline Files
  • Remote Desktop
  • hardware support (Dynamic Disks, Multiple Processors)
  • security (Access Control, EFS)
  • IIS, and
  • domain support (Group Policy, Assigned Software Installation, Roaming Profiles, RIS).

Of these features, everything but IIS and domain support can be useful to many home users.  In particular, there’s no way the first three — System Restore, NTBackup, and Fast User Switching — should have ever been left out of XP Home — ALL users could benefit from them. Whoops, had some bad info before I checked the XP Comparison Guide (and I was caught editing, so I can’t just erase it now!  Good catch Ed!) — It looks like FUS and System Restore are in XP Home. My opinion stands for NTBackup and Remote Desktop, tho.

For those less venturesome (or unwilling to reinstall), it is possible to install NTBackup on XP Home.  See Ed Bott‘s “The amazing hidden backup program“.