Hey, Scripting Guy!

I’ve bugged the Microsoft Scripting Guys to make a feed for their great daily Q&A.  “Coming soon” was the most I ever heard (and over a year ago)…

I don’t know what the holdup is, but it doesn’t matter to me now.  Thanks to etc., I just found Yoktu.com Feedmaker.  A moment later, I had the feed I want.  Sweet!

One note: Feedmaker has a Word Filter option.  Unfortunately it doesn’t do positive filters, so “?” hides all the links I want, instead of the generic ones I don’t.  No big deal (I’ll choke doen the extras), but hey Yoktu, how about a googlish syntax like “+?” for specifying what to include?

Got a new feed reader

A comment I just posted at http://datamining.typepad.com/data_mining/attensa/ :

I’ve been using intraVnews for several years, liking Outlook’s sorting power to manage info, but I’m not at one machine long enough lately to keep current. So I went shopping for an online reader, and found your post and the RSS Reader Survey.

Based on those, I tried (or at least looked at) Bloglines, Rojo, NetNewsWire and Great News. I mostly didn’t like the UIs (too weak or clunky compared to Outlook), and most just didn’t work on my Windows Mobile phone’ Pocket IE.

I ended up using Google Reader instead — sure it’s not as powerful as intraVnews/Outlook (no search folders, no deactivating feeds), but I don’t think I need that power since the “reading flow” is so smooth (aka “UX”, or User Experience in Microsoft’s new lingo). I don’t Need to filter out the “junk” since it’s easy to just ignore it.

Granted, it’s only been 2 weeks, but I’ve been successfully keeping up on 296 feeds pretty easily.

I should mention I was actually looking for an Outlook/online combo.  Apparently Newsgator and Attensa both do this, but Newsgator ain’t free (and I’m a tightwad), and I couldn’t find Attensa’s supposed free service…  I’ve tried the Outlook addins for both in the past, tho, and they’re fine (since it’s Outlook).

Hm, should I post my 296 feed OPML?  ..or I guess Google Reader has a sharing feature — maybe that’s something to try out.

Links for 2007-01-04

Busy?  Oh yeah.

IE7 and minWidth


IE7 was supposed to have supported min-width in CSS.  It doesn’t work right


Their spec says it applies to “floating block-level elements”, but they don’t mention that it also requires an explicit width — “auto” won’t work.  While that’s fine for “stretchy” layouts, it’s useless for what I want: a flexible, tableless form layout (with elements which can expand to their contents’ sizes).


In fact, my previous IE6 hacks to force it with CSS expressions now don’t work, because while the min-width attribute is valid in IE7, the feature is not actually implemented.  SO, while I previously could pick it up in IE6 with something like this:
SELECT {
min-width:11em;
_width:expression(this.currentStyle.getAttribute(‘min-width’));
}


IE7 now requires the same trick to be like so:
SELECT {
min-width:11em;
_width:expression(this.currentStyle.getAttribute(‘minWidth’));
}


Unfortunately, forking logic inside CSS expressions is a bit of a pain.  That, combined with the limitations of this technique (IE6 treats width as min-width only when the contained elements can’t be wrapped), prompted me to write a solution script.  Here it is:


/*
author: Rob Eberhardt
desc: fix MinWidth for IE6 & IE7
params: none
returns: nothing
notes: cannot yet fix childless elements like INPUT or SELECT
history:
   2006-11-20 revised for standards-mode compatibility
   2006-11-17 first version
*/
function fixMinWidthForIE(){
   try{
      
if(!document.body.currentStyle){return} //IE only
   }catch(e){return}
   
var elems=document.getElementsByTagName(“*”);
   
for(e=0; e<elems.length; e++){
      var eCurStyle = elems[e].currentStyle;
      var
l_minWidth = (eCurStyle.minWidth) ? eCurStyle.minWidth : eCurStyle.getAttribute(“min-width”); //IE7 : IE6
      if(l_minWidth && l_minWidth != ‘auto’){
         var shim = document.createElement(“DIV”);
         shim.style.cssText = ‘margin:0 !important; padding:0 !important; border:0 !important; line-height:0 !important; height:0 !important; BACKGROUND:RED;’;
         shim.style.width = l_minWidth;
         shim.appendChild(document.createElement(“&nbsp;”));
         if(elems[e].canHaveChildren){
            elems[e].appendChild(shim);
         }
else{
            //??
         }
      }
   }
}


It uses a shim technique to fix it only for IE (other browsers don’t support currentStyle).  The remaining limitation here is that it only works on elements which canHaveChildren, so it does not work on childless elements, like form INPUTs or SELECTs.  Any suggestions for this case are welcome!


To use it, just call fixMinWidthForIE() in the window.onload, or better yet when the DOM has loaded, and you’re set.


2006-11-20: I updated the script for better standards-mode compatibility (it was causing extra blank lines).  I had missed the doctype switch in my current project.  The good news is that IE7 in standards mode does do min-width.  (I wish I’d noticed that sooner!)  However, I still have a lot of IE6 miles to go before I can put it to sleep…


 

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.

…And finally someone else noticed.

Guess I’m not the only one who was baffled by the new W3C XMLHTTPRequest spec credits.

From Dare Obasanjo:

Interesting. A W3C specification that documents a proprietary Microsoft API which not only does not include a Microsoft employee as a spec author but doesn’t even reference any of the IXMLHttpRequest documentation on MSDN.
I’m sure there’s a lesson in there somewhere. 😉

And then finally from Anne van Kesteren (one of the spec’s authors):

Hereby my apologies to everyone who had to waste his time by writing a rant… The current draft reads: “Special thanks also to the Microsoft employees who first implemented the XMLHttpRequest interface, which was first widely deployed by the Windows Internet Explorer browser.”

XMLHttpRequest finally becoming standard

It’s great that XMLHttpRequest is finally becoming an official standard.  It’s better though, that the “other” browsers didn’t wait for this before implementing it.  Real progress has happened as a result, in particular the recent popularity (& naming) of the AJAX technique, and the somewhat-related “Web 2.0” phenomenon.

The news also makes me smile at the anti-Microsoft folks who have thrown stones at Internet Explorer’s standards support — once again the IE team innovated (*overused word through gritted teeth*) a proprietary extension, and it was such a good thing that the competition swiped the idea, thus making it a de-facto standard.

I’d rather have a good de-facto standard now, than an official one too-late. End result: Developers and Users win (and they already are winning).

Footnote: Anyone else think it’s strange that the standard’s authors list seems to represent every browser except for XMLHttpRequest’s inventor?

What happened to the design?

Thanks to Clagnut, I’m observing CSS Naked Day on April 5th.

To know more about why styles are disabled on this website visit the
Annual CSS Naked Day website for more information.

For the remaining dotText-ers out there who want this to automatically kick-in every April 5th, I just added this condition to DTP.aspx:

<%
// suspend styles on April 5 to observe CSS Naked Day - http://naked.dustindiaz.com/
DateTime dtNaked = DateTime.Today; 
if(!(dtNaked.Month==4 && dtNaked.Day==5)){
%>
		<link rel="stylesheet" type="text/css" href="/mystyles.css" />
<%
}
%>

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.