CacheViewer add-on for Firefox browser

CacheViewer 0.6

CacheViewer 0.6

CacheViewer 0.6, developed by benki, is a GUI front-end of “about:cache”, an add-on for the Firefox browser.

This plugin allows searching and sorting memory and disk cache files. A very useful tool, I installed it today.

To clear the cache, select Clear Recent History… from the Tools menu in the Firefox browser, select the desired range from the Time range to clear drop-down menu (to clear your entire cache, select Everything), choose what history elements to clear from Details and click clear now.

Gravatar : a Globally Recognized Avatar

last update : 24 August 2010

My Gravatar

My Gravatar

Gravatars are images that follows users from site to site appearing beside their name when they do things like comment or post on a blog. Avatars help identify their posts on blogs and web forums.

I created today my Gravatar using the  picture appearing at the left of this text.

To display the gravatar for Leslie’s Artgallery, the following link can be used:

http://www.gravatar.com/avatar/a679fe148cc868a002e1669b9b788379?s=120

The pixelsize of the displayed square gravatar can is defined by the parameter s.

For SSL connections, the link is the following:

https://secure.gravatar.com/avatar/a679fe148cc868a002e1669b9b788379?s=400

Uploading and hosting public and private videos

last update : october 2010

The following websites allow users to upload and host their videos for public or private views:

  • YouTube (Google) : up to 2 GB in size; up to 15 minutes in length; HD resolution
  • Google video : service has been discontinued
  • Picasa (Google) : up to 1 GB in size; recommended resolution: 640 x 480 pixels; recommended ratio: 4:3; recommended frame rate: 30 frames per second;  videos are converted into a flash format (.FLV) with Standard Quality (320 x 240 pixel) or High Quality (480 x 360 pixels) playback
  • flickr (Yahoo) : up to 150 MB in size; up to 90 seconds in length; HD resolution (720 horizontal lines of resolution in the video); free and pro
  • Vimeo : free and pro ($59.95 a year)
  • LongTail Video (bits on the run) : pro (price calculator)
  • PhotoBucket : up to 500 MB; up to 10 minutes

Reset the auto increment value for a MySQL table

To reset the auto increment value of a MySQL auto incremental primary key to a new value, either higher or lower than what it would otherwise next be, use the following command :

ALTER TABLE mytable AUTO_INCREMENT = xx

Its even more easy to change it in phpMyAdmin. Select mytable, click the “Operations” tab, change the displayed current next auto increment value and then click the “Execute” button.

Tilt-shift Photography : Miniature Fakes

Tilt-Shift miniature faking is a creative technique whereby a photograph of a life-size location or object is manipulated to give an optical illusion of a photograph of a miniature scale model.

Altering the focus of the photography in Photoshop simulates the shallow depth of field normally encountered with macro lenses making the scene seem much smaller than it actually is.

In addition to focus manipulation, the tilt-shift photography effect is improved by increasing color saturation and contrast, to simulate the bright paint often found on scale models.

Most faked tilt-shift photographs are taken from a high angle to further simulate the effect of looking down on a miniature. The technique is particularly effective on buildings, cars, trains and people.

The following websites provide useful informations and tuotials about Tilt-Shift miniature faking :

Some outstanding tilt-shift photos published on flickr under a creative common licence are listed below:

There are currently 142 groups on flickr dealing with tilt-shift. My favorite pools are :

SoundFonts (.sf2)

SoundFont, a registered trademark of E-mu Systems, Inc., is a name that collectively refers to a file format and associated technology to synthesize audio in the context of computer music composition. The exclusive license for re-formatting and managing historical SoundFont content has been acquired by Digital Sound Factory.

A SoundFont file, or SoundFont bank, contains one or more sampled audio waveforms (or samples), which can be re-synthesized at different pitches and dynamic levels. SoundFont banks are related to MIDI devices and can be seamlessly used in place of General MIDI (GM) patches in many computer music sequencers.

The original SoundFont file format was developed in the early 1990s by E-mu Systems and Creative Labs (used in Sound Blaster AWE32). Files in this format conventionally have the file extension of sbk. The SoundFont 2.0 version was released in 1996 and was fully disclosed as a public specification to make it an industry standard. New versions up to 2.4 have been relased in the past years and the new SoundFont files conventionally have the file extension sf2.

There are other sound formats available, e.g. The DownLoadable Sounds (DLS) standardized by the MIDI Manufacturers Association (MMA),  the DLS-Level 2 and the Structured Audio Sample Bank Format (SASBF )standardized by he MPEG standards body in collaboration with MMA and MIT and  proprietary formats developed by Yamaha and other music companies. Nevertheless the sf2-soundfonts became a de-facto standard and are widely used today.

There are a lot of websites available that offer free and commercial sf2 soundfonts :

The following tools are best suited to use SoundFonts :

  • SynthFont : a free midi file player using SoundFonts
  • Viena : a free SoundFont editor
  • FluidSynth : an open source real-time software synthesizer used in several music applications
  • Gervill : a software sound synthesizer for use with the Java Sound API
  • SFPack and SFArk : archivers for SoundFont banks which use different compression techniques

Inline (binary) images, data:URIs and canvas tags

In a typical webpage, images are not embedded in the HTML code, but stored as separate files on the server and requested by individual HTTP GET commands. For different reasons it would be useful to include images in the main web document :

  • to speed up the rendering of the webpage in the browser : 80% of the end-user response time is spent on the front-end by downloading all the components in the page: images, stylesheets, scripts, Flash, etc
  • to minimize HTTP requests and to reduce trafic costs (e.g. when using an Amazon webservices pricing model)
  • to display images created by code (e.g. sparklines)
  • to display images retrieved from a database or from a REST service

In august 1998, L. Masinter from Xerox Corporation published a Request for Comment (RFC 2397) for a Uniform Resource Locator (data:URI) scheme that provides a way to include data in line in web pages as if they were external resources. Although the IETF never formally adopted it as a standard, the HTML 4.01 specification refers to the data URI scheme and data URIs have been implemented in most browsers, but not in Internet Explorer before version 8, which is the major problem of this solution.

An example of a red dot picture embedded in HTML is given hereafter :

<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0 vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Red dot" /> 

Data URIs may contain whitespace for readability.

Another way to embed images in HTML code is the new element <canvas> which is  part of HTML5 and allows for dynamic scriptable rendering of bitmap images. A tutorial about the canvas tag is available at the Mozilla developer center. As for the data:uri, the canvas tag is not supported by Internet Explorer. ExplorerCanvas developed by Erik Arvidsson brings the same functionality to Internet Explorer. To use this solution, web developers only need to include a single script tag in their existing web pages.

<head><!--[if IE]><script src="excanvas.js"></script><![endif]--></head> 

To get the code working, the following additional javascript is needed :

var el = document.createElement('canvas'); G_vmlCanvasManager.initElement(el);var ctx = el.getContext('2d');

The classic solution to display binary images embedded in HTML code is the following :

<html>
<body>
<img src="myimage.php">
</body>
</html>

The corresponding code for myimage.php is :

<?php
header('Content-type: image/jpeg');
// Create image
$image = imagecreatetruecolor($width,$height);
// pick color for the background
$bgcolor = imagecolorallocate($image, 100, 100, 100);
// fill in the background with the background color
imagefilledrectangle($image, 0, 0, $width, $height, $bgcolor);
// output image to the browser
imagejpeg($image);
// delete the image resource
imagedestroy($image);

Be sure that there is no leading whitespace or blank line before the <?php tag, otherwise the displayed result will be of the form

Garbage

One of the first cross-browser methods for incorporating images into self-contained HTML documents was published by Benn P. Herrera in march 2005.  Two years  ago there was not yet a better method avilable. Today the <canvas> tag and the ExploreCanvas JavaScript seems to be the most promising solution to embed binary images in HTML code.

TrueType, OpenType, EOT, WOFF and SVG Fonts

Last update : February 20, 2001
TrueType is an outline font standard originally developed by Apple Computer in the late 1980s as a competitor to Adobe’s Type 1 fonts used in PostScript. TrueType offers font developers a high degree of control over precisely how their fonts are displayed, right down to particular pixels, at various font heights.

OpenType is a format for scalable computer fonts which is built on TrueType, retaining TrueType’s basic structure and adding many intricate data structures for prescribing typographic behavior.

Other font types are :

  • Embedded OpenType (EOT) fonts are a compact form of OpenType fonts designed by Microsoft for use as embedded fonts on web pages. These files usually use the extension “.eot”.
  • Web Open Font Format (WOFF) is a font format, based on the sfnt file structure (used in TrueType and OpenType fonts) and specifically designed for web use with the @font-face declaration. It was developed by Jonathan Kew (Mozilla Corporation), Tal Leming (Type Supply) Erik van Blokland (LettError).
  • SVG Fonts are supported in the W3C spec (http://www.w3.org/TR/SVG11/fonts.html).

The following links give access to Font libraries :

A @fontface generator is available at the Font Squirrel website. A very useful guide about font embedding has been published by Joshua Johnson on the Six Revisions website. A guide about the Google Font API has been published by Divyang Patel on the same website. How to achieve cross-browser @font-face support is the title of a tutorial published on the website lost in the woods.

Sparklines and SpriteMe

The term Sparkline was proposed by Edward Tufte for small, high resolution graphics embedded in a context of words, numbers, images. Tufte describes sparklines as data-intense, design-simple, word-sized graphics. Sparklines present trends and variations associated with some measurement, such as average temperature or stock market activity, in a simple and condensed way.

A Sparkline PHP Graphing Library has been developed by James Byers who edits alos a wiki about this topic.

jQuery plugin developed by Gareth Watts generates sparklines directly in the browser using data supplied either inline in the HTML, or via javascript.

Joe Gregorio created a sparkline generator. You can start right away by dynamically creating a sparkline using the Sparkline Generator Web Application or you can download the spark.cgi code written in python and running the sparkline service on your own server. Joe Gregorio published a contribution about sparklines (A Bright, Shiny Service: Sparklines) in june 2005. Another sparkline builder has been developed by Mark Pursey. Will Larson created a a simple javascript utility for building sparklines.

Most sparklines are embedded in webpages with data:URIs (RFC 2397) which are not implemented in Internet Explorer lower than version 8. The sparklines are not displayed with those browsers.

Sparklines are also part of the Google Visualization API which works also with Internet Explorer.

Other useful links about sparklines are :

Another technique to reduces the number of downloads in a webpage are sprites. A sprite combines multiple background images into a single image. Steve Souders developed a bookmarklet (javascript file) called SpriteMe to add this functionality to webpages.

Amazon S3 php source code

The basic php file provided by Amazon AWS in 2006 and updated in 2007 to manage S3 accounts requires the PEAR modules Crypt_HMAC and HTTP_Request.

Today there are several php open source toolkits available which are well documented, easy to set up and offering extended features :

  • undesigned S3 php class :  a standalone Amazon S3 REST implementation for PHP 5.2.x (using CURL), that supports large file uploads and doesn’t require PEAR. The latest version is 0.4.0 published on july 20, 2009. The developer is Donovan Schonknecht, a web/mobile application developer based in Cape Town, South Africa. The sourcecode is available at the Google Code website.
  • Tarzan : a fast, powerful PHP toolkit for building web applications with Amazon Web Services. The latest version is 2.0.5 released on august 14, 2009. The developer is Ryan Parman. The sourcecode is available at the Google Code website. User Metadata is managed if the HTTP header has the prefix x-amz-meta- (example: header : x-amz-meta-city value: Luxembourg).
  • CloudFusion : a rebranded version of Tarzan to better reflect the beyond-Amazon evolution of the product. Tarzan 2.5 will be CloudFusion 2.5 and will come with a refreshed website, documentation, examples, and other goodies. The sourcecode is available at the Google Code website.
  • Amazon GS3 : a stream wrapper to get and send files to Amazon S3, developed by Cesar D. Rodas from Paraguay.

A list of some Amazon S3 php code examples is shown hereafter :