« May 2006 | Main | July 2006 »

June 26, 2006

WAFL home grounds

Changing demographics and generally lower crowd support have forced West Australian Football League (Aussie Rules) clubs to relocate to remain financially viable. In the last few years various clubs have moved some kilometres from their original bases, but their location-based names have remained.

This has resulted in the current odd situation of East Perth's home ground being in West Perth, and West Perth now playing out of Joondalup, over 20km North of Perth. In addition, home grounds are being renamed after commercial sponsors instead of their locations. To assist confused supporters I have created a WAFL grounds map, showing current and recent WAFL home grounds, the names of stadiums and the clubs that are based there.

Update 1-July-2006: Changed map location.

June 22, 2006

Source of Bush energy policy?

I liked this interesting titbit from the New Statesman's article on the US response to global warming, Can America go green?:

June 21, 2006

Fractal zoom canvas demo

So far my Firefox canvas demos have only used a small subset of the available canvas commands. To learn about some of the other features I have added the zoom capability to my previous fractal offerings.

View the fractal zoom at your leisure.

The zooming was accomplished by displaying sliced images from an offscreen (hidden by CSS) buffer. This is an extension of the concise description from the Mozilla canvas tutorial. I have also tidied up the previous fractal code somewhat, removing hard-coded constants. It still needs a general reorganisation to remove global variables, but that shall wait for another time.

Because Javascript is not the fastest of languages you may see some delay in the drawing of the fractal. After an extended delay Firefox may pop up a message box asking if you wish to continue. If you say 'yes' then the fractal should get drawn eventually. It is this speed issue that has caused me to draw the fractal in lower than maximal resolution. If you want to zoom in to a high-resolution fractal then have a look at a desktop fractal zoomer such as my old Windows software JM's Mandelbrot Explorer.

June 16, 2006

Flame canvas demo

Following on from my successful canvas demos of fractals I thought I'd attempt the old staple of the demo scene, the flame effect.

Luckily it's very common and very simple. There are dozens of examples in Programmers Heaven - Graphics & Sound - Fire & Flame, coded in Java, C, C++, ASM, Pascal and even QBasic. All of those are old hat, as the cool stuff is now being done online, using the canvas tag supported by all modern web browsers. Coding and deployment is much simpler, though the results are usually a tad slower.

That's enough waffling. Here's the fire. Just view the source to see the code.

This time I did the animation using setInterval() rather than setTimeout(), as it's slightly less code. I expected from their definitions that they'd be virtually identical, but setInterval() seemed to run faster but be more CPU intensive, as if the delay value was reduced. As such I increased the delay to compensate.

In addition, I used the canvas scale(x,y) command instead of doing the scaling manually. Again it slightly simplfied the code in this example, but I imagine for more complex programs the benefit would be greater.

June 9, 2006

Let's bookmark bookmarklets

When I click on the URL of an mp3 file in Firefox I want that file to be streamed via Winamp. Instead, Firefox downloads the file in its entirety before passing the file on to Winamp. To get around this I have been copying the URL into the clipboard, opening Winamp, then telling Winamp to play that URL directly. Whilst this works, it is a little inconvenient. A much nicer solution is to use a bookmarklet, such as HubLog's client-side M3U generator. Just bookmark the generator, then when you want to play the mp3s on a webpage just click the bookmark. What magic!

As with all good things on the internet, the code is there for all to see:

javascript:
a=document.getElementsByTagName('a');
s=new Array();
for(i=0;i<a.length;i++){
    if((a[i].href)&&(a[i].href.match(/\.mp3$/))){
        s.push(encodeURIComponent(a[i].href));
    }
}
var newline=encodeURIComponent('\n');
var m3u=s.join(newline);
if(m3u){
    location.href='data:audio/x-mpegurl,'+encodeURIComponent('#EXTM3U\n')+m3u;
} else {
    alert('no links found');}

It works by grabbing all of the links to mp3 files, then uses the lovely (though underused) inline data facility to create an m3u playlist in situ to pass to Winamp. All hail bookmarklets!

June 8, 2006

Smoking whilst hang gliding?

There's something morbidly fascinating about death statistics, especially when they extend into unexpected areas such as computer gaming. Such data is concisely presented in a table at DanceSafe, a site for recreational drug users to gauge the risks of their substances. A more complete explanation of the statistics is at Drugtext. It shows how distinct dangerous events such as parachuting can be compared to potentially hazardous ongoing lifestyle or health issues such as diabetes.

June 4, 2006

Medical connections

While a healthy young person may think that medical science is well on the way to understanding and curing most diseases, the truth is that many common conditions have causes that remain a mystery. Oddly, these conditions may also have benefical treatments that operate in unknown ways. This compounding of unknowns may make it difficult to unravel the truth behind the workings of both disease and medicine.

I recall reading an article about a man who specialised in working in the margins of two or more scientific areas. He would become an expert in various areas, and because of his knowledge in multiple disciplines simultaneously he could make connections that specialists in one area could not. Are there medical researchers doing similar work, becoming experts in multiple disconnected fields, spotting links for the first time?

My interest in the subject was piqued by noticing that many of the recent innovative treatments for the inflammatory bowel disease Crohn's, such as those mentioned in the Crohnology blog, are drugs that have previously been used to treat other conditions.

Most straightforwardly, corticosteroids which reduce inflammation throughout the whole body are used to treat many conditions. For example, whereas Crohn's is inflammation of the intestine, asthma is inflammation of the airways. Both may be treated by corticosteroids such as predisone, though in neither case is this ideal because of its general nature.

Methotrexate, a drug that has been used against cancer since the 1950s has more recently been accepted as a valuable treatment for Crohn's, rheumatoid arthritis, and possibly asthma too.

Naltrexone is widely known as a medicine for reducing dependence on alcohol and opioids. Low dose naltrexone is now thought to be useful for treating Crohn's and multiple sclerosis.

As a final example, recent research has indicated that the famous impotence drug Viagra may also help treat Crohn's.

Initially, I'd love to see a medicinal version of the musicplasma / liveplasma site, incorporating diseases and their treatments, in the hope that innovative new connections would become immediately obvious. The data could initially be automatically parsed from the Wikipedia, and manually appended to as the result of research.