Sunday, January 22, 2006

Moving to

After being annoyed by the Blogger interface, I'm moving to my new blog at

I hope one day they will support importing Blogger blogs again, so I could import this blog to there.

Tuesday, November 01, 2005

Blogger's spell checker doesn't know the word "blog"

That's weird. When I used Blogger's spell checker to check for spelling, it didn't recognized the word "blog". Go figureā€¦

Note that Joel said that Google spell checking is "not based on dictionaries; it's based on word usage statistics of the entire Internet", but I guess he only meant the search engine spell check, not the blog service.

User script to make Joel on Software blog posts print better

Joel on Software blog sometimes links to Joel articles and the articles have a "Printer Friendly Version" link below the subtitle. But the posts themselves, which are sometimes quite long, don't have a "printer friendly version". At least I didn't find one.
So I created a Greasemonkey user script to hide all the irrelevant stuff and leave only the post itself, so it takes less paper and ink to print.

This is of course only for personal use, as I remove the copyright string.
This is subject to change as Joel is currently redesigning his site.

Monday, October 31, 2005

ISAPI extension doesn't write to log in IIS 5 when status code is wrong

For a long time, we've experienced a problem in which we saw that no request to our ISAPI extension was written to the IIS log. This only happened in IIS 5 and not in IIS 6, so we thought this is an IIS 5 problem.
However, it always felt strange to me, since this is very strange bug, and I didn't see any reference to it on the web.
I tried tweaking our HttpExtensionProc function, but couldn't not find what the problem is, until yesterday, I tried calling the base class (CHttpServer) implementation, and there, I saw that the dwHttpStatusCode member of the EXTENSION_CONTROL_BLOCK structure is set to an error value, and this caused the request to our ISAPI extension to be written to the log.

A quick search showed me that in the beginning of our HttpExtensionProc function, we set the dwHttpStatusCode member to 0, and then, we never change it. This cause the request to work well, but IIS 5 doesn't write the request to the log. IIS 6 changed this behavior, and does write the request to the log.

I guess the problem started because someone copied a sample code from somewhere, and that code initialized the member t the function start, and set it properly at the end, but our coder only took the first part, and forgot to set it in the end, and since it worked, no one really noticed.
Only later, we saw that log is not written, but we couldn't find the reason.

Well, now we've finally found it.

Wednesday, September 07, 2005

Paul Graham for Print user script

I finally set down to write the Paul Graham for Print user script.
I was always annoyed by the formatting of his articles, which might make it easier to read on screen, but take a lot of space when printed.
This script hides the unrelated links and trailing empty lines from the article, and makes the text occupy 100% of the page width.


Tuesday, September 06, 2005

IE bug with a label related to select

Here is a nice IE bug I just found.
When a <label> is attached to a <select> element, and the user clicks the label, the <select> is selected (which is nice), but its selectedIndex becomes 0 (that's not so nice).

Here is an example page.

Update: I found out that this is an MSDN report bug. See;en-us;314279&Product=iep. They also suggest a workaround - use the onfocusin event to store the current selection before the focus is actually moved to the list, and reset it later. However, they say "you can only work around this problem in Internet Explorer 6" - I'm not sure why, as the onfocusin event is said to be supported on Internet Explorer 5.5 and later.

However, I would suggest a much simpler solution - simply handling the label event ourselves, without IE to interrupt and destroy. In their sample, I would use:
<LABEL for="test" onclick="document.getElementById(this.htmlFor).focus(); return false;">Citizenship Status:</LABEL>

In my tests, it does the job perfectly well.

Saturday, January 22, 2005

Open This URL

I finally sat down to find a solution to a problem that been bothering me for a while now. Sometimes I see a URL in a web site (this mostly happens in forums or blogs), which is not a link, so if you want to see it, you must copy and paste it.

Avant Browser version 10 came with a little toolbar that sometimes show near your selection, but this toolbar is not predictable - I couldn't figure out when exactly Avant decides to show it, and it only has a Search button. Normally, when Google is searched for a URL, this URL is opened, but I don't want to count on this.

So, what I did is creating a file in d:\winnt\web named OpenThisURL.html, with the following content:

And I also added a new registry key to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt named "Open This &URL" with default value set to d:\WINNT\Web\OpenThisURL.html. I also added a binary value named Contexts, with its value set to "10 00 00". Now, after restarting the browser, selecting the URL text, and right-clicking adds an "Open This URL" menu item, which opens it in another window.

This even works well in Avant Browser.

Thursday, January 20, 2005

Formatting code

I really need to understand how to format properly in the blog. The blogger editor kind of drivinig me nuts.

First Post - Firefox fights

I really don't know what to write on my first post, but Joel says I should write one (great article, by the way. As usual. I should really get to read the JoS book sometime), so I guess I should just start.

Today I stayed late since I go to the Achla meeting, and Sefi was kind enought to pick me.

Anyway, I just had a big fight with Firefox today. First of all, it insists on blocking my popups, no matter what I tell him. I wonder if this is because I have TBE installed. I guess I need to reinstall a clean Firefox so I can blame all the weird behaviors I found on it. I don't use it as my day-to-day browser anyhow. (I really love Avant Browser. I do hope that the little features I still miss will be entered soon.) I also tried to install a different theme, but failed. At first the themes page didn't loaded, and then it claimed the jar file is corrupted. I really don't know how all of the geeks keep up with this crap. It is event worse than MS problems.

The real problem was getting the update via XMLHttpRequest to work.

Our code looks like this:

function getXMLHTTP()
return new ActiveXObject("Msxml2.XMLHTTP")
return new ActiveXObject("Microsoft.XMLHTTP")

return (typeof XMLHttpRequest == "undefined") ? null : new XMLHttpRequest();

function updateEventList(szJSUpdateCode)
if(gXMLHTTP.readyState == 4)
if(gXMLHTTP.responseText && gXMLHTTP.responseText.charAt(0) != "<")
eval(gXMLHTTP.responseText); // call retrieved JS code to get events
} else {
alert("Failed to download '" + gszURL + "'");
gszURL = null;

var gXMLHTTP = null;
var gszURL = null;
function sendRequest(szURL)
if(gXMLHTTP == null)

if(gXMLHTTP == null)
return false;

if(gXMLHTTP.readyState != 0)

gXMLHTTP.onreadystatechange = updateEventList;
gszURL = szURL;"GET", szURL, true); // true means work asynchronically
It is called from the main page to update the list, but when an event is being updated in popup, the popup called opener.sendRequest() with the updated URL, to update the list, and then window.close(). This works well in IE, but for some reason, Firefox decided to stop the download and set the readyState to true without any data in the time that popup closed itself. I don't know exactly why it is, but the solution was to write:
function delayedRequest(szURL)
setTimeout("sendRequest('" + szURL.replace(/\'/g, "\\\'") + "');", 1);

And make the popup call delayedRequest.