Archive for June, 2006

Funny unintended strikethrough in a HTML e-mail

June 18, 2006

I'm subscribed to a newsletter from Realistic Religious Zionism. In the last e-mail I got, there was a strikethrough styling in the middle of the text. At first, I thought it is some kind of a correction, but then I noticed it continued to the end of the e-mail, so I realized this was some sort of a bug.

Out of curiosity, I viewed the HTML mail source, but this was cluttered with many formatted <p>s and <span>s, so I couldn't find anything there. In particular, I didn't find the text "strike" in the text.

I saved it as an HTML file and opened it in Firefox, and the problem still existed, so I tried checking it with Firebug and saw that when the problem started, an <s> element was defined with a pan attribute. I tried to look for an "<s " in the source to find out where it is defined, but couldn't find it either.

So, having no other choice, I looked for the location of the problem in the source. This was a bit problematic since it was a mixture of an English markup and a Hebrew text. When I nailed it down, I realized what the problem is. It appears that the mail text is cut every 1048 characters, and a new line is entered. Normally, this is not a problem, since white-spaces don't count in HTML. But when it occurs in the middle of a <span> tag definition, it renders an <s> tag with a pan attribute. I didn't know that, but <s> HTML tag can be used as the <strike> tag to specify stricken-through text (BTW, both tags are deprecated by the HTML standard and the CSS alternative is encouraged). Since the <span> tag definition was truncated with a new-line after the "<s", it was considered as the definition of an <s> tag, which wasn't really closed, so it lasted till the end of the e-mail.

This problem of cutting HTML in the middle is not mentioned in the list of problems with HTML e-mails. I guess the simplest solution is just to make every HTML markup in a new line. This makes the e-mail a bit longer, but avoids such problems. However, I guess they are using some rich text editor that generates this HTML e-mail, so I don't really know what can be done with that tool.

Advertisements

Problems with defaultValue

June 14, 2006

Today I found a problem in one of our screens (the filter screen) which only occurs on Firefox, but not on IE. After checking it further, I realized that the problem is with the defaultValue attribute of the <input type=text> element.

We use this attribute to store the default value of filter fields, and when the user wants to reset the filter, we set the value to the default value manually, without calling reset(). The default filter value can be set by the server administrator.

It appears that on Firefox, setting the defaultValue attribute causes the control to change its value if the user didn't change it yet. The logic is probably that if the user didn't change it, the control shows the default value, so changing the defaultValue attribute changes what the control displays, and the control's value attribute.

On IE, on the other hand, the MSDN clearly says that "The value of the property can be changed programmatically, but doing so has no effect on the appearance of the object or the submitted value."

I wanted to see what the HTML standard has to say about it, but apparently, the defaultValue attribute is a non-standard extension, supported by both IE and FF.

The solution to our problem is very simple. Use another custom attribute (e.g. defValue) to store the default value. This will have no affect, has the browsers have no special treatment for this custom attribute.

Activity Logger

June 11, 2006

I've pretty much neglected this blog recently. The usual excuse is lack of time, but this time I also have the exotic excuse of a business trip to Stockholm.

I've decided I should really write more here, especially since our company's internal blog, which is based on Roller just got almost unusable when a new version was installed, and I don't know who is directly in charge of it. So I'll blog here about my work revelation, using names initial to avoid unwanted exposure.

So, here goes:

In our work, we are required to report the time we spend working. Usually, when I come with the transportation, this is not a problem, since then I know I worked for 10 hours. However, sometime I work form home, or the transportation leaves early, and I don't always recall how much exactly I worked. I tried to look for tools to log my activity, but failed to find something useful.

I thought of writing a tool to do it, but didn't know how to detect that the screen is turned off, as a sign of me going home (I don't use screensaver), or how to detect idle time in which the computer is not used. Then it suddenly hit me. I can simply record the last mouse position, and constantly check if it has changed. If it has, it's a sign I'm working. If not, well, I probably left m computer, but to be sure, I check that for 5 minutes, to make sure I'm not just staring at some line of code while debugging.

That looks really promising, though I still need to finalize the best and easiest to use format of the output log file.

Note: after looking at that JoS discussion again, I saw that MarkTAW recommended Allnetic Working Time Tracker, which I never really checked, so I'll give it a try as well.

Another note: Once I'll get a laptop to work with, this will be much less of a problem, since the time the laptop is running will usually be the times I'm working. Also, once we move to global salary, it will be less important how much time I exactly work.