1 | 2

1 - 5   [7]

Firefox…Firebird…Pheonix

Relates to Open Source and Firefox and Co

Yes, the Royal Oak is out, and the One Tree Hill has arrived! Everyone has been talking about it. The truth is out…

…as a matter of fact, as Firefox gears up for landmark version 1.0, I fear we will see miracles before us in the form of an Internet browser. Firefox is that good. It really is. Look out Internet Explorer… your days have been numbered for some time now, but Firefox 1.0 will surely leave you shaking on your already shaky foundations and standing in a small warm puddle. First Look at Mozilla Firefox 0.9 by Adam Doxtater

What is so significant about the version 9 release of Firefox (code named One Tree Hill) is that this is the final technological preview before the browser is released into the wild. Bar bug fixing this is very much how Firefox will appear.

The one feature that was lacking has finally arrived in this release - the extension/theme manager. While I was quite happy playing with my chrome, this improvement should finally make the home user market sit up and notice there is a life beyond the exploder. The online extensions repository has also been updated and is far more usable with the clever addition of RSS syndicated feeds of the latest and most popular extensions. This is the way to get Firefox noticed - get syndicated content distributed around the web. I will certainly be syndicating the latest extensions, since I am still waiting for the update of several essential extensions, including Link Tool Bar, HTTP Headers, Tabbrowser Extensions and the Advanced Search Side Bar. The good news is that due to the re-location of the user profile directory, Firefox 0.8 can remain installed for the time being without any conflicts arising (of course can only run one or the other version at a time). Also, with the added benefit of a usable extension manager, I decided to dip my toes into a few other extensions, and Radial Context has become an immediate must have. I have been bred on mouse gestures ever since I first booted up Opera 6, so continue to use these while assigning radial context to the middle button for added pleasure.

Everything about the browser is smoother and more efficient on my grinding old Windows 98 PC and this has been further backed up by the release of Thunderbird 0.7. This email and news reader client seems to be catching up very quickly - I hadn't event got round to installing the previous version yet! This has already become my principle email client, in part due to the regular instability and crashing of MS Outlook (blame it on the OS and not the vendor no doubt!!) Plus a much smoother interface for archiving and retrieving the multitude of material that finds its way into my Inbox.

The last word must return to Firefox and where it all began. Have you noticed what that codename is for the version 1 milestone?

Pheonix
1. Mythological Bird. In ancient mythology, a bird resembling an eagle that lived for 500 years and then burned itself to death on a pyre from whose ashes another pheonix arose. It commonly appears in literature as a symbol of death and resurrection.
2. SB Or STH Beautiful Or Unique. A supremely beautiful, rare, or unique person or thing.

The Encarta Dictionary

The personification of a web browser!? I can handle that - after all I talk to my Firefox daily and praise her on her efforts!

Posted on Jun 20, 2004 at 04:41:33. [Comments for Firefox…Firebird…Pheonix- 0]

Viva PEAR::Cache_Lite

Relates to PHP and PEAR

With the latest release of the PEAR::Cache the Cache_DB extension has been removed. I first came across Cache_DB in the PHP Cookbook last year and ran several tests to integrate it as a principle caching mechanism in the Content Management System. However, the class offered no noticeable benefit in performance, and when several database calls were being executed for a single page, it did not make sense to use a cache per query. So as an alternative I decided to test drive the PEAR::Cache_Lite package instead. As its nomenclature suggests, this is an excellent lightweight package and offers the perfect solution for filling the caching void in content retrieval. One of the package extensions is <a href="http://pear.php.net/manual/en/package.default.cache-lite.cache-lite-function.cache-lite-function.php" title="Current End User Documentation on Cache_Lite_Function">Cache_Lite_Function</a>, a caching class for functions. This allows for several database calls and the template system to be wrapped in a single method for caching:


class SS_Content {

  // [..snip..]
  
  function fetch($action, $caching = NULL)
  {
    $this->action = $action;
    
    if ($caching === NULL) {
      if (isset($this->_caching)) {
        $caching = $this->_caching;  
      }
    }
    
    if ($caching === SS_CACHING_ON) {
      return $this->retrieveCache();
    }
    else {
      return $this->retrieve();  
    }   
  }
  
  function retrieveCache() {    
    require_once "Cache/Lite/Function.php";

    $options = array(
      'cacheDir'     => CACHE_DIR,
      'lifeTime'     => CACHE_EXP
    );
    $objCache = new Cache_Lite_Function($options);
    return $objCache->call(
      $GLOBALS['_SS_Content_Obj'] . '->retrieve');           
  }
  
  function retrieve()  { 
  
    // this is where the content is built
    // eg database retrieval and content 
    // creation with a template system
  
  }
  
  // [..snip..]
}

This is only a raw example, since within its actual context, SS_Content is actually an abstract class serving specific modular extensions. But it shows how simple Cache_Lite is to use - create the object and invocate the <a href="http://pear.php.net/manual/en/package.default.cache-lite.cache-lite-function.call.php" title="End user documentation on the call method of Cache_Lite_Function">Cache_Lite_Function::call()</a> method. There is one area of caution when using Cache_Lite in an OOP environment like this. The method will look for an object in the global name space equating to the name preceding the accessor operator in the parameter string of the method. How this is achieved is dependant on the application and naming conventions. One solution is to register the variable name of the object in a global variable during instantiation of the class (as demonstrated above).

Melon Fire provides a terse but detailed introduction to Cache_Lite, Cache_Lite_Function and its counterpart Cache_Lite_Output.

Posted on Jun 20, 2004 at 04:40:35. [Comments for Viva PEAR::Cache_Lite- 0]

Accessible Javascript Event Handling

Relates to Accessibility and DOM Scripting

Thanks to Simon Willison's interesting post on closures in Javascript I recently rediscovered W3Future's article on applying closures to event handling methods. This article provides a very illuminating resolution to the common problem in separating the behaviour of a web page from the structure - the method assigned as the event handler to an object does not contain a reference to the object itself (at least not in IE). Traditionally this could be solved with a cross browser concoction of event.target, window.event.srcElement and bubble management.

The closure paradigm is a very adaptable and dynamic solution, that not only allows clean cross browser access to the source element, but is readily extensible in an object oriented environment:


function EventHandler(elem) {  
  this.elem  = elem;
  this.evt   = "";
  
  this.register = function(handler, fn) {
    addEvent(this.elem, handler, fn);  
  } 
  
  this.invoke = function(evt) {}
  
  this.cancel = function() {}
  
}

function FieldHandler(elem) {
  var me = this;
  this.base = EventHandler;
  this.base(elem);
  
  this.mouseon = function(evt) {
    me.invoke(evt);
  }
  this.mouseoff = function(evt) {
    me.invoke(evt);
  } 
}
FieldHandler.prototype = new EventHandler;      

handle = new FieldHandler(DOMElement);
handle.register('mouseover', handle.mouseon);
handle.register('mouseout', handle.mouseoff);

The me variable provides access each instance of the FieldHandler object, which would otherwise be unavailable. (Note EventHandler::register it uses Scott Andrew's Cross Browser Event Handling routine to assign the event listeners.) Another use might be to assign the callback function for the event at runtime based on the event type:


function EventHandler(elem, me) {  
  
  var me = this || null;
  
  // …
  
  this.invoke = function(evt) {
    me.evt = (evt) ? evt :
      ((window.event) ? window.event : null);
    me.assign();
  }
  
  this.assign() = function() {}
  
  // …  
}

function FieldHandler(elem) {
  
  this.base(elem, me);

  // …
  
  this.assign() = function() {
    switch(this.evt.type) {
      case 'mouseover':
        this.mouseon();
        break;
      case 'mouseout':
        this.mouseout();
        break;
    }
  }
  
  // …

}

// …   

handle.register('mouseover', handle.invoke);
handle.register('mouseout', handle.invoke);

The one stumbling block I fell over briefly was the cancelling of an event. A typical example being a stylesheet switcher where a link is supplied to switch the CSS on the server where Javascript is not available. In a Javascript environment the HTTP request should be cancelled. Sadly, using event attachment to assign handlers, return false will not cancel the operation. Information on this hurdle appears to be lacking on the web, but fortunately the solution was nestled in the DOM2 Events Specification:


this.cancel = function() {
  if (this.evt) {
    if (this.evt.preventDefault) {
      this.evt.preventDefault();
    }
    this.evt.returnValue = false;        
  }
}

In the W3C event model preventDefault called anywhere within an event processing tree will cancel the default event. For the Exploders falsify the returnValue property for the event.

These are very basic examples, but just in an afternoon I discovered immense power in this method without the need to hack cross browser scripts (I have tested the method successfully across all the major PC browsers - IE5.x, IE6, Moz, Opera). I have started work on integrating the EventHandler class into my form validation scripts and will hopefully present this as a more detailed and explanatory article when I find more time. The biggest benefit of the method is it allows for the behavioural scripts to be totally detached from the mark-up for a web document, thus only serving javascript content where it can be handled while achieving a more lightweight document.

Posted on Jun 20, 2004 at 04:39:51. [Comments for Accessible Javascript Event Handling- 6]

Renewal Dates In OO Calc

Relates to Open Source and The Office

One of my many goals the past few weeks has been improving the automation of my office environment. A little example is the management of renewal dates and years of service for database records. There are enough features in Open Office to just enter the registration date for a new record and leave the rest to the system. The solutions I came up with are:


cell_service_yrs  = CEILING(YEARFRAC(cell_register_date;TODAY());1)
cell_renewal_date = DATE(YEAR(cell_register_date)+cell_service_yrs;MONTH(cell_register_date);DAY(cell_register_date))

Perhaps this is the same set of date functions available in Excel? I never really got to play with them before migrating to Open Office.

Ideally I would like to create a set of UDFs as an add-in module for the global library using Basic that could be plugged into this and other spreadsheets. Unfortunately there has not been the time to explore Open Office Basic yet! Here are some links if you are venturing down that path (and for my own future reference).

Posted on Jun 20, 2004 at 04:37:22. [Comments for Renewal Dates In OO Calc- 0]

A Vision Of The Future

Relates to Peregrinations

Do you realise that every day something like five hundred hours of radio and TV pour out over the various channels? If you went without sleep and did nothing else, you could follow less than a twentieth of the entertainment that's available at the turn of a switch! No wonder that people are becoming passive sponges - absorbing but never creating. Did you know that the average viewing time per person is now three hours a day? Soon people won't be living their own lives any more. It will be a full-time job keeping up with the various family serials on TV!

Colonist of New Athens, circa 2050.
From Childhoods End, Arthur C. Clarke, 1954

Posted on Jun 20, 2004 at 04:35:21. [Comments for A Vision Of The Future- 0]

Breadcrumbs Trail

[ Home ] -> TW Blog -> Archives for June 2004
Site Map

The Severn Solutions website achieves the following standards:

[ XHTML 1.0 ] [ CSS 2 ] [ WAI AA ] [ Bobby AA ]

Page compiled in 0.007 seconds