Sunday, November 23, 2008

Safari focus() at beginning of text instead of end of text

Safari browser has a weird textbox.focus() behavior. Instead of putting the cursor after text like the other browsers, it puts the cursor at the beginning of the text. My workaround for this problem to is use focus() then changing the value of the textbox.
element.focus();
element.value += '';

If the textbox needs to be changed anyway, just put the focus() right before changing the value.
element.focus();
element.value = 'some text';

*Using Safari 3.1.2

Tuesday, March 25, 2008

Apache updating wrong log files

When renaming apache log files, restart apache server.

If apache is not restarted, there is a possibility that the old log file even though renamed/moved will still be updated because apache is still accessing its file descriptor.