September 2001

09/24/2001 Monday

As you may know, trying to get the same font size in all browsers in all platforms (I'm using the word 'all' very loosely, here) with CSS is a pain in the ass. You just can't get a single font size style to apply consistently on everything. I used to have different external style sheets and use a browser detect to dynamically write the correct <link> tag into the document. The font sizes for the NS4 Windows style sheet would be 1-2 pixels bigger than the non-NS4 Windows style sheet. There is, however, an odd bug with this approach - when you first load a page like this in NS4, there is the possibility that the browser will introduce a line break in the source code. If this line break occurs in the middle of a tag name or attribute name or value, it can destroy the page appearance (and that's worse than tiny type). It looks like the position of this line break may be predictable because it always occurs in the same spot on any given page so you could juggle whitespace to get the line break to occur in where no damage will be done. But that's a huge hassle. The technique I am using now is to use a single style sheet with non-NS4 Windows font sizes and use Javascript Style Sheets (JSSS) to modify the font size in NS4.x Windows. Here's an example of the script needed for a simple page with styles applied to just a single tag selector (body), a class (bob), and an id (ed):

if (navigator.appName == "Netscape" && 
   parseInt(navigator.appVersion) == 4 &&
   navigator.platform == "Win32") {
   document.tags.body.fontSize = '11px';
   document.classes.bob.all.fontSize = '11px';
   document.ids.ed.all.fontSize = '11px';

There's a small caveat with this approach - you can't use hyphens in your class or id identifiers. This is because the hyphen looks like a minus sign when used in Javascript. The traditional way around this is to use array notation instead of object notation. You ought to be able to write document.classes['bob'].all.fontSize. But you can't. For some reason, Netscape doesn't recognize the class (or id) names when written like this and your style changes won't be applied. You may be tempted to use underscores to improve readability in your identifiers, then, but that can cause NS4.x to lose your styles. You are stuck with big, long, unreadable identifiers if you want to use JSSS to modify their styles. 17:25 permalink

Ok. That NS6 offset weirdness is worse than I thought. On my WinNT4, the offset properties work as I explained. On Sang's Win2000, they have the same behavior as in IE and Mozilla. While non-standard behavior is bad, inconsistent behaviour is worse.
16:50 permalink

09/19/2001 Wednesday

In IE and in the more recent Mozilla builds, the offset properties of elements are measured in a similar way to the top and left style properties - a relative or absolutely positioned element determines the zero point for any contained elements. So if you wish to find the displacement from the document origin of an element which is embedded inside an absolutely positioned element, you need to add the top property of the containing element to the offsetTop property of the element of interest. Netscape 6.0, 6.01, and 6.1, however, measure all offset properties from the document origin no matter what. So any given offset property in NS6.1 is different from the same property in Mozilla 0.9.4. Expect future NS6.x releases to adher to the wider standard. Write your code accordingly.
23:50 permalink

09/18/2001 Tuesday

Hints that David Flanagan has been working on a fourth edition of Javascript: The Definitive Guide (scroll to the August 30th entry). Also, O'Reilly appears to have recently released a new edition of Web Design in a Nutshell which is, I think, the best general scope web book available.
08:40 permalink

Somewhere, in the maze of government regulations that stipulate how IT employees may be employeed (or mis-employeed), there must be one that reads as follows:

Upon the completion of any IT project of a duration of not less than 2 weeks but not more than 2 months during which 70% of the employees resourced at a level of 80% or more recorded 100 or more overtime hours, each employee resourced to the project is eligible to receive:

  • 1 (one) helium-filled balloon, any color, on a string.
  • 1 (one) "gourmet"-style chocolate in a small, cardboard gift box.

08:35 permalink

09/12/2001 Wednesday

Started reading some websites again but stopped. It's still too soon. I know what I will find and I don't want to be reminded.
23:05 permalink

09/09/2001 Sunday

Started receiving interestingly-named Sircam-infected documents. What am I bid for a July payroll? Seriously, someone ought to set up an auction site for these documents. I'm sure the demand is there.
15:35 permalink

You know you are working from dodgy documentation when you encounter the word "somehow".
15:30 permalink

Heard an interesting piece on CBC this morning supposedly about workaholism but was more about corporate expectations regarding employee work hours (interesting because I am working both days this weekend). Firstly, the two interviewees where architypical examples of their respective nationalities - one was American and one was Canadian. The American was constantly interrupting the Canadian and the Canadian was suffering the interruptions patiently and without comment. More subtly, the Canadian spoke about large scale manifestations and results of longer work hours - morning rush hours start earlier, reports of work-related illness are up, productivity is down - while the American singled out specific examples putting emphasis on the individual - the woman who worked until 5am the night before her wedding, the single dad who takes his kids to work on weekends. The content of their conversation was also interesting: both agreed things have been getting worse. They pointed to the falicy of the now-famous late-70's belief that technology was going to decrease the amount of work everyone would have to do and greatly increase leisure time (I even had a class called Leisure Studies in grade school to prepare us for all the free time we would have). They implied that, for most people, workaholism isn't a personal trait but is a result of outside pressure from today's corporate culture. In order to keep up with their work (nevermind getting ahead), most people need to work longer than 9-to-5. However, they believed that things would get better. Even after stating that international companies have ignored the productivity increases of the enforced 35-hour work week in France and haven't applied the lessons learned to North American operations. They talked about companies who now encourage managers to minimize their employees extra time on the job. But the reality is that, from the company's point of view, if the work has to be done, it's going to be done no matter how much ext ra time is required. And companies like to see employees working long hours - to them it indicates loyalty. And loyalty begets promotions which feeds the workaholism. Self-policing doesn't work. The only real way you will get people to work less is enforce limited work weeks through legislation. Which is never going to happen on this side of the Atlantic. One interviewee brought up a study done by Price Waterhouse Coopers Etc that seemed to indicate that the next generation of workers won't put up with the current working conditions. Students were asked what they would value in a job and they said that they wanted a challenge and opportunity for advancement but not at too high a cost with regards to working hours. Well, what they want and what they will settle for are two different things. If you interview those already working, you would find the same desire but there is no great workers movement towards better working conditions. The survey indicated that the next generation's desires will have more leverage because of the labour shortage caused by retiring baby-boomers which, I believe, is another myth. You'll probably see an increased number of retirement community developments and RV sales due to baby-boomers retiring but there will be no labour shortage. If anything, working conditions will get worse - longer hours, increased expectations, less opportunity. Show me someone who thinks otherwise and I'll show you someone who thought that Leisure Studies classes would be a good thing.
13:50 permalink

09/06/2001 Thursday

Whenever I am in a social situation and someone turns to me and asks: "So, what do you do?", I have two possible answers. If they seem like someone who might be interesting to talk to, I say that I am in web design. People like that. If I don't want to talk to them, I tell them that I am a programmer. For some reason, that dries up the conversation real fast. Try it sometime.
15:55 permalink

When I was young, I was pretty naive. I thought most people would go to university and get jobs as doctors and lawyers and stuff. And there would be problems filling joe jobs (I really did think this way). Little did I realize that those positions are filled by people who call themselves artists and actors and that I had nothing to worry about. Thank you, artists and actors. Thank you for thinking that you have talent and that soon, very soon, you will be discovered.
15:50 permalink

There's been a rash of marriages at work recently and it's made me think a bit about the ceremony and related activities. My concusions:

  • The marriage ceremony is for the parents of the couple. They say who and how many get invited. They will invite their friends so that their friends can see that they managed to raise you into respectable adult and that they are rich enough to afford the lavish ceremony. The couple may invite some of their friends if there is any room left. And why shouldn't the ceremony be for the parents - they are paying for the damn thing.
  • Gift registries are the most obscene instances of consumeristic greed. It's the 21st century! More than likely, you've moved out of your parent's place so you have all the stuff that used to be given as gifts. If you don't live together yet (pretty rare now), you have two of everything - you are in less need of gifts. And do you really need a crystalware bowl, silver serving tongs, and an expresso maker?
  • If you are getting married soon, please don't invite me. The last thing I want to do is spend $100 on a rental, $200 on a gift and waste one of my precious vacation days in exchange for $15 of mediocre food. The only positive aspects of weddings is that you get to watch people get embarassingly drunk. But even that isn't all that satisfying because you don't know them and won't be able to bring up the subject of their behaviour with them later.

09:55 permalink

Interesting (read: "How annoying"). In NS4.x, you can't do a document.write() from within a function defined in an external .js file. If the document.write() is in a .js file but outside of any functions, fine. If the document.write() is in a function within the .html file, fine. In a function in a .js file, not fine. If (like me) you want to isolate your UI functions in an external library, you need to move the document.write() to the calling .html file and rewrite the functions to return the HTML to write out. This seems to only affect writing to the main document at load time - writing out the contents of position elements is unaffected (but remember not to write to a layer at load time in IE4.x and NS4.x).
09:05 permalink

From the Quicktime mailing list, comes some guidelines on how to use the <object> tag for QT embedding. The reworded and condensed rules are:

  • The only attributes the <object> tag should contain are height, width, classid, and codebase.
  • All other parameters should be passed using <param> tags nested in the <object> tag structure.
  • You don't need to specify pluginspage or type as <param>s.
  • If you are using src and qtsrc, just specify the qtsrc value but define it in a src <param> tag: <param name="src" value="the_qtsrc" />.
  • Include a standard QT <embeb> tag nested in the <object> tag structure.

Apparently, these rules are needed because the specification is very ambiguous and open to different interpretations (which, of course, means the browser differences are as vast as possible). This is a follow-up to the new <object> tag for embedding QT in recent IE releases thing. (Thanks to Eric Bin for forwarding Steven Gulie's message)
08:45 permalink

09/05/2001 Wednesday

Usually, sets of radio buttons are accessible through an array. If your radio buttons all have name="radioButtonName" and are in a form named formName, then the array reference is document.formName.radioButtonName and each entry in the array is a reference to a radio button. If, however, there is only a single radio button, then javascript doesn't define an array with a single element as would be consistent. Instead, document.formName.radioButtonName is a direct reference to the single radio button and contains the standard radio button properties such as value and checked. Usually you wouldn't use a single radio button - it's more logical to use a checkbox. But in cases where your form is dynamically created, you may end up with a single radio button in some circumstances. In this case, you'll have to check for the length property to determine if there is an array or not:

if (document.formName.radioButtonName.length) {
   // multiple radio buttons
   // radioButtonName is an array of radio buttons
else {
   // single radio button
   // radioButtonName is a reference to single radio button

(gleaned from a recent mailing list question)
08:45 permalink

09/04/2001 Tuesday

So, if you use one form of <!DOCTYPE> tag, you get "standards" layout, if you use a different <!DOCTYPE> tag, you activate "quirks" mode (more details on what <!DOCTYPE> tags are quirks mode or standards mode). But what, exactly, are the differences between standards and quirks modes? Very roughly, quirks mode is what earlier browsers implemented and standards follows W3C rules. But I haven't found a good summary of the differences beyond a rough and incomplete outline. Update: John sent a link from the MS site that details some differences from an IE6 perspective.
10:50 permalink

Note to restaurants everywhere: if I haven't heard of your "world famous" burger / buffalo wings / nachos / french fries / whatever, then they probably aren't world famous.
10:15 permalink