Forcing FAVICON.ICO to appear on the browser address bar
23rd June 2007Here's a piece of code that should really be unnecessary when you put the favico.ico into the root of your website directory:
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
The favico.ico should automatically appear there and in your browser bookmarks (favourites in IE) but there are occasions when the above has to sit in the header section of your web pages. I know because I am doing it for this blog.
IE6 and JavaScript performance
22nd June 2007Having been exposed to an application at work that uses a lot of JavaScript, I fully appreciate what some mean when they discuss IE6's inefficient handling of JavaScript. After seeing a web page taking an age to reload and your CPU taking a hammering because of JavaScript processing, the penny does tend to drop...
Needless to say, this very much impacts the world of AJAX-driven web applications with their heavy dependence on client-side JavaScript. While IE7 does come to the rescue, there remain plenty of IE6 users still out there, and this is reflected in website statistics. This demonstrates a certain level of inertia in the browser market that not only afflicts the uptake of IE7 but also the likes of Mozilla, Opera and Safari. It also means that anyone developing AJAX applications very much needs to continue testing in IE6, especially if the product of their labours is for wider public use.
An example of such an application is Zimbra, an open-source web application for messaging and collaboration, and the people behind it have generously shared the results of their browser performance benchmarking. They did comparisons of IE6 vs. IE7 and Firefox 2 vs. IE7. IE6 easily came out as the worst of these, while Firefox 2 was the best.
The next question to be asked could centre around the type of code that is processed inefficiently by IE6. While I wouldn't be at all surprised if a list emerged, here's one: using Microsoft's proprietary innerHTML object to update the DOM for a web page format. Having a quick trawl on Google, this came up for mention as a cause of memory leaks. It is also a Microsoft innovation that never got taken up by those overseeing web standards, hardly a surprise since a spot of DOM scripting achieves the same end. It may be faster to code than any alternatives, and it does have some support from other browsers, but it does seem to have got a bad name, so it should be avoided if possible. That said, it would be interesting to see a performance comparison between innerHTML and DOM methods in IE6.
Two reviews of the Olympus E-410 tell very different stories
21st June 2007
Recently, I encountered two very different reviews of the newly launched Olympus E-410 DSLR, in Which Digital Camera and Practical Photography, respectively. The review in the former was a positive affair, though it was a first look at the camera, but the impression formed by the latter reviewer was lukewarm in nature.
The camera features a live electronic viewer on its back, a carry-over from digital compacts and a feature that I may never use. While that might be the unique selling point for the camera, good image quality and the fact that it possesses a cleaning mechanism for its sensor are of much more interest to me.
Ironically, the Practical Photography review spent most of its time talking about the very feature of the camera that interests me the least, with only a scant mention of quality; to be frank, I didn't find it a very useful appraisal even if the electronic viewfinder may not be all that it's cracked up to be, and it's picture quality and camera handling that ultimately matter to the photography enthusiast.
In contrast, Which Digital Camera seemed to give a more rounded view and proved to be of more interest, and I'd be interested to see what the likes of Photography Monthly and Amateur Photographer might have to say. Incidentally, I also shall be awaiting the Which Digital Camera appraisal of Ricoh's Caplio GX100 in their next issue.
WARNING: The quoted string currently being processed has become more than 262 characters long…
20th June 2007This is a SAS error that can be seen from time to time:
WARNING: The quoted string currently being processed has become more than 262 characters long. You may have unbalanced quotation marks.
In the days before SAS version 8, this was something that needed to be immediately corrected. In these days of SAS character variables extending beyond 200 characters in length, it becomes a potential millstone around a SAS programmer's neck. If you run a piece of code like this:
data _null_;
x="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
run;
What you get back is the warning message at the heart of the matter. While the code is legitimate and works fine, the spurious error is returned because SAS hasn't found a closing quote by the required position and the 262-character limit is a hard constraint that cannot be extended. There is another way, though: the new QUOTELENMAX option in SAS9. Setting it as follows removes the messages in most situations (yes, I did find one where it didn't play ball):
options noquotelenmax;
This does, however, beg the question as to how you check for unbalanced quotes in SAS logs these days; clearly, looking for a closing quote is an outmoded approach. Thanks to code highlighting, it is far easier to pick them out before the code gets submitted. The other question that arises is why you would cause this to happen anyway, but there are occasions where you assign the value of a macro variable to a data set one and the string is longer than the limit set by SAS. Here's some example code:
data _null_;
length y $400;
y=repeat("f",400);
call symput("y",y)
run;
data _null_;
x="&y";
run;
My own weakness is where I use PROC SQL to combine strings into a macro variable, a lazy man's method of combining all distinct values for a variable into a delimited list like this:
proc sql noprint;
select distinct compress(string_var) into :vals separated by " " from dataset;
quit;
Of course, creating a long delimited string using the CATX (new to SAS9) function avoids the whole situation and there are other means, but there may be occasions, like the use of system macro variables, where it is unavoidable and NOQUOTELENMAX makes a much better impression when these arise.
Now, I know why my site layout changed on WordPress.com…
19th June 2007One of the caveats of using themes authored by others is that you don't quite know how things are set up. The reason that this has come home to roost for me is that I was trying to change the title of a widget last night and was wondering why it wasn't filtering through to the blog pages. When I went for a spot of googling, as you do, it dawned on me what might be going on. The plug-ins used by the Andreas09 theme are defined in its functions.php file, and I was being scuppered by a naughty piece of hard-coding in there. If it was using the standard widget from widgets.php in the wp-includes directory, then everything would have worked as expected. A quick spot of code porting resolved the issue and all was well again.
What this has to do with WordPress.com is that they seem to have encountered the same problem and fixed it using what could be viewed as a more ham-fisted approach: deleting the widget functions from functions.php for Andreas09. This would have meant that the default widgets shone through, thus explaining the changes that I had seen and why my nice categories listing now grabbed less attention. I reckon that my more surgical approach is the better one: at least, I still have my categories looking how I want them...
Tidying dynamic URL’s
15th June 2007A few years back, I came across a very nice article discussing how you would make a dynamic URL more palatable to a search engine, and I made good use of its content for my online photo gallery. The premise was that URL's that look like that below are no help to search engines indexing a website. Though this is received wisdom in some quarters, it doesn't seem to have done much to stall the rise of WordPress as a blogging platform.
http://www.mywebsite.com/serversidescript.php?id=394
That said, WordPress does offer a friendlier URL display option too, which you can see in use on this blog; they look a little like the example URL that you see below, and the approach is equally valid for both Perl and PHP. Since I have been using the same approach for the Perl scripts powering my online phone gallery, now want to apply the same thinking to a gallery written in PHP:
http://www.mywebsite.com/serversidescript.pl/id/394
The way that both expressions work is that a web server will chop pieces from a URL until it reaches a physical file. For a query URL, the extra information after the question mark is retained in its QUERY_STRING variable, while extraneous directory path information is passed in the variable PATH_INFO. For both Perl and PHP, these are extracted from the entries in an array; for Perl, this array is called is $ENV and $_SERVER is the PHP equivalent. Thus, $ENV{QUERY_STRING} and $_SERVER{'QUERY_STRING'} traps what comes after the ? while $ENV{PATH_INFO} and $_SERVER{'PATH_INFO'} picks up the extra information following the file name (/id/394/ in the example). From there on, the usual rules apply regarding cleaning of any input but changing from one to another should be too arduous.
Does Automattic have a penchant for strange decisions?
14th June 2007WordPress.com has retired its Feed Stats feature. While there might have been problems with it for some, I do find it a strange decision not to spend some time on it. After all, given the existence of Google Reader and its kind, I wouldn't be surprised to learn that more people read blogs with RSS readers than by going to the sites themselves. In fact, I peruse blogs more often with Google Reader than by visiting the websites themselves. It's enough to make me wonder if I could use Feedburner with this blog.
To follow on from this, I am beginning to wonder if that Automattic, the people behind WordPress.com, seems to be a quirky company that makes decisions that are questioned by its customers. After all, they did remove the post preview functionality from blog post editing screens, and that has generated numerous comments. On self-hosted WordPress, you can add a plug-in to correct this, but that option is not open to WordPress.com users. The answer that I got to a theme change request earlier this year adds to the impression, as does seeing a company having staff apparently work from home all over the world.
Automattic seems an unconventional beast alright; could that lead to their undoing? Though it is king of the hill with blogging world for now, there is nothing to say that will last forever.
Could the Ricoh Caplio GX100 be my backup digital camera?
14th June 2007
Because my digital SLR has needed to be sent away for cleaning for a while now (meanwhile, I have got handy at using Photoshop Elements to clean up pictures...), I have been on the lookout for a backup camera so that I can add photos to any trip reports on my hillwalking blog without having to wait for film to be processed.
Previously, my eye was on Ricoh's GR Digital, but the same manufacturer has now introduced the award-winning Caplio GX100. The zoom range is a very useful 24-72 mm in 35 mm film terms, and that removable electronic viewfinder looks very neat. Having a 10 megapixel sensor adds to the appeal and advanced exposure modes like manual and aperture priority.
The feature list has almost ensured its ousting of the GR Digital from any wish list that I might have; the only thing outstanding is seeing how it performs in a photography magazine's full test review. A thumbs up from there might even get me onto the acquisition trail...
The return of the Navigator
13th June 2007
With the launch of the ill-fated Communicator, Netscape dispensed with the Navigator brand that had served it so well up to that point. And it continued the practice when it turned to re-branding the output from the Mozilla project. The new Navigator is, in essence, a tweaked variant of Firefox's latest incarnation and has the spelling checking capability that I have been missing when giving Safari a spin. You have to ask why, and I am not certain that I have the answer. That said, it does feel slick and works well, a definite change from some of it predecessors then.
Safari on Windows?
12th June 2007
Steve Jobs recently surprised an audience at Apple's Worldwide Developer's Conference with the announcement that the Safari web browser is being made available for Windows. While everyone else is awaiting Apple's forthcoming iPhone, the Safari announcement is a more important one to me; not being big on phones, I will let the iPhone excitement pass me by. Without either buying a Mac or running OS X in a virtual machine, there was no other way for me to test my web pages in Safari bar looking for a rendering site on the web. Now, that has all changed, and I have downloaded the beta to have a look; it should iron out any rough edges that Mac users have been seeing.
Update: Safari seems to have got a mixed reaction from Windows users; some have tried it with Vista and cited issues. Another gripe has been its memory footprint, but I have seen Firefox take up 100 MB.