Technology Tales

Adventures & experiences in contemporary technology

FCKEditor for WordPress

26th July 2007

The standard WordPress post editor got broken on this blog so my mind turned to replacing and I spied plugins for adding FCKEditor to the thing. Dean Lee’s is the one that I am using and it seems to work well so far too. As this is FCKEditor, there are more editing options than those offered by the WordPress standard and that’s even with the advanced options made visible with the Alt+V/Alt+Shift+V keyboard shortcuts; the former is for IE and the latter for Firefox. We’ll see how it goes from here…

SAS9 SQL Constraints

23rd July 2007

With SAS 9, SAS Institute have introduced the sort sort of integrity constraints that have been bread and butter for relational database SQL programs but some SAS programmers may find them more restrictive than they might like. The main one that comes to my mind is the following:

proc sql noprint;
create table a as select a.*,b.var from a left join b on a.index=b.index;
quit;

Before SAS 9, that worked merrily with nary a comment but you now will see a warning like this:

WARNING: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem.

In data step, the following still runs without a complaint:

data a;
merge a b(keep=index var);
by index;
run;

On the surface of it this does look inconsistent. From a database programmer’s point of view having to use different source and target datasets is no hardship but seems a little surplus to requirements for a SAS programmer trained to keep down the number of temporary datasets in an effort to reduce I/O and keep things tidy, an academic concept perhaps in these days of high processing power and large disks. Adding UNDO_POLICY=NONE to the PROC SQL line does make everything consistent again but I see this as being anathema to a database programming type. I do admit to indulging in the override for personal quick and dirty purposes but abiding by the constraint is how I do things for formal purposes like inclusion in an application.

An unexpected side effect

29th June 2007

I recently posted about using mod_rewrite to block access to your images from all but the websites to which you want access to be available. Following so doing, I discovered that my FAVICON had disappeared from Firefox’s address. As it turned out, it was easy to fix and that is covered in another recent post.

More useful WordPress plug-ins

22nd June 2007

Apart from a widget that puts a login form onto a blog sidebar, I am not really on the lookout for WordPress plug-ins but here are two that came to my attention recently. I have found them to be useful; maybe you will too.

The first is WordPress Admin Themer. This allows you to store wp-admin.css in your blog’s theme folder, out of harm’s way from future upgrade cycles. A neater way of otherwise storing your customisations of admin pages -- I keep changing the logout destination to the front page of my blogs -- would be a bonus but the style plug-in is a good step forward.

One use to which I was going to put WordPress Admin Themer was to hide some elements of the WordPress dashboard page but I happened accross another plug-in that does just this kind of thing: Dashboard Editor. Activating this gets you an extra admin page where you can select the components that you want to see using the tick (check) boxes. You can even take things further by having your very own dashboard instead of what WordPress offers or by activating widgets for using with your dashboard. It’s all good stuff and I have got rid of extraneous pieces such as Planet News and the getting started section (I have using WordPress long enough that I should know my way around by now…).

IE6 and JavaScript performance

22nd June 2007

Having been exposed to an application at work that uses a lot of JavaScript, I fully appreciate what some mean when they talk about 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 of client-side JavaScript. While IE7 does come to the rescue, there remain plenty of IE6 users still out there and this is reflect in website statistics. This reflects 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 share 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 in these while Firefox 2 was the best. I suppose that the next question to be asked centres around the type of code that is processed inefficiently by IE6. I wouldn’t be at all surprised if a list emerged but 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 and so should be avoided if possible. That said, it would be interesting to see a performance comparsion between innerHTML and DOM methods in IE6.

WARNING: The quoted string currently being processed has become more than 262 characters long…

20th June 2007

This 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 prior to 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="[string with more than 262 characters (putting in an actual string wrecks the appearance of the website)]";
run;

What you get back is the warning message at the heart of the matter. The code is legitimate and works fine but 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.

Vi Reference Card

20th June 2007

This is a useful PDF that I found somewhere: Vi Reference Card. Being a Vi newbie, I find that things like this do help me to find my way about.

Now, I know why my site layout changed on WordPress.com…

19th June 2007

One 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. I went for a spot of googling as you do and 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 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…

Internet Explorer Developer Toolbar

13th June 2007

Here’s something that I found while looking into something else: Internet Explorer Developer Toolbar. My first impression is that it looks like IE’s answer to Firefox’s Web Developer add-on and they do share a lot of functionality. While I am going to stay with Firefox as my main browser, IE’s Developer Toolbar will prove invaluable for those occasions where web page rendering is not the same for both Firefox and IE.

The return of the Navigator

13th June 2007

Netscape Navigator

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.

  • All the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. As regards editorial policy, whatever appears here is entirely of my own choice and not that of any other person or organisation.

  • Please note that everything you find here is copyrighted material. The content may be available to read without charge and without advertising but it is not to be reproduced without attribution. As it happens, a number of the images are sourced from stock libraries like iStockPhoto so they certainly are not for abstraction.

  • With regards to any comments left on the site, I expect them to be civil in tone of voice and reserve the right to reject any that are either inappropriate or irrelevant. Comment review is subject to automated processing as well as manual inspection but whatever is said is the sole responsibility of the individual contributor.