Monthly ArchiveMarch 2005
Geek 31 Mar 2005 04:24 pm
Make
I’ve finally managed to get my hands on the new O’Reilly magazine, Make. Yes, one of the disadvantages of being on the other side of the world (with respect to the USA) is that things take a little longer to get here…
As I was browsing it last week while “Better Homes and Gardens” was on TV, I couldn’t help but noticing that there are similarities between the magazine and that show… sort of a “Better Hacks and Gadgets”, so to speak. It’s a book-lenght (and format) magazine, filled with projects to be made at home; lots of geek appeal, as only O’Reilly could do. Project include building a $14 steady-cam, using a kite to do aerial photography (with a silly-putty timer) and others. Plus, lots of geeky-content, “life hacks” and cool stuff in general.
It’s a quarterly magazine, and the next edition will come out in May (which means it will probably get here in mid to late June). There are lots of web content as well: besides their website, they have a blog, a photo pool on Flickr, a del.icio.us link stream, and a huge fan base. Definitely recommended.
Footy 29 Mar 2005 11:28 am
Footy tipping - round 1
It’s a Melbourne thing; if you live somewhere else, you’re not really supposed to understand this. But, when March arrives, together with the new football season, comes the new football tipping season.
Everyone seems to hold tipping competitions: TV stations, phone companies, groups of friends and co-workers… everyone tries to be a football expert and to predict the results better than everyone else.
Well, I don’t really now much about Australian Rules Football, having been introduced to the game less than a year ago (and despite having read parts of “Aussie Rules for Dummies” - yes, there is such a book, and I admit to reading some sections). So, I decided to approach this tipping thing as a numeric exercise; a “technical” approach, if you will, with no more regard to the teams than what can be glanced from a few external information sources (to take the investment metaphor a little further, I am disregarding the “fundamentals” of the teams).
I devised three simple strategies; they are a starting point and can be improved for next year, if necessary. I’ll use them and follow the results during this whole year, to find out how they fare against the real “experts” out there. They are:
- the ladder: in each game, the team that is higher on the ladder (that is, has more victories and/or a better goal average) is expected to win; for the first round, the final ladder of the previous year is used; this can be rephrased as “using past results to predict future performance” (don’t try this with your investments)
- the money: as in, following it; for each game, the team most people are betting on (and, as a consequence, the one paying less to winners) is expected to win; this way, I try to use the wisdom of the masses to predict the results
- home: the simplest of all, it considers that the home team will always win; it takes home-turf advantage as the only deciding factor
In each case, I’m ignoring completely the possibility of a tie; some tipping competitions don’t even let you bet on a tie. I’m recording the results as the number of correct guesses but, also, as the amount of money I would have made if I had bet on my tips, at 5 dollars per game. I’m not actually betting, so these results are all hypothetical; maybe next year, depending on how these strategies fare this year…
After the first round, all strategies fared better than I expected; all of them did better than chance (50%) and all of them did better than the average tipper (55%, according to Channel Ten). These are the results (out of eight games):
| Round 1 | Ladder | Money | Home |
|---|---|---|---|
| Correct tips | 6 | 5 | 5 |
| Accuracy | 75% | 62.5% | 62.5% |
| $ result | $9.05 | $-2.20 | $3.30 |
The dollar result is the net result, subtracting the supposed expenditure ($40) from the winnings. The “money” strategy didn’t do too well, despite a reasonable number of correct tips; I believe this is a side-effect of the strategy, as it tends to bet on teams that will not pay well; as such, it needs a higher number of correct guesses to actually yield a positive net result.
I’ll post the next update in a week, after round 2.
Links:
Tech 24 Mar 2005 05:05 pm
Playing with Ajax
Ajax is the fashionable expression of the month, it seems. It stands for “Asynchronous JavaScript + XML”, and it’s actually a mix of several well-known technologies that people have been using for a while: XHTML/CSS, DOM, XML/XSLT, Javascript and the XMLHttpRequest object.
So, it’s nothing new, but, thanks mostly to Google (and web applications such as Gmail, Google Suggest and Google Maps) it is now in fashion. Also, it has been only recently that browsers became standard-compliant enough that these technologies can be used with relatively consistent and reliable results across the most used versions: IE 6.0 and Firefox 1.0.x.
And I’ve decided to play with it for a while, mostly to get a feel of how it works and what can be done with it (and how easily). The first step, of course, was to find something I needed done that could benefit from Ajax. The one thing I came up with was a page I have where a small part of the content is generated by a CGI script: it shows the current time and temperature in a group of cities around the world, and the temperature data can take a while to be retrieved and displayed. The effect would be that the page would partially load, stop for several seconds while the data was retrieved from the CGI, and then finish loading.
The temperature info is not the most important info in the page, and it’s ok if it’s not displayed at all; but it’s nice to have. The original code looked like this:
getweather.pl returns the city full name and the temperature as a document.write Javascript command (the “js” parameter requests a Javascript output). I replaced this with a placeholder to be filled later:
This was done for each of the cities listed on the page, of course (with a different id for each; the id will be used to reference each entry later on and insert the temperature data). Then I modified the CGI script so that it became capable of returning data in a new format, XML. The return format looks like this:
<title>temperature</title>
<query>temperature</query>
<mel>Melbourne: 17.8°C<br/></mel>
<syd>Sydney: 20.0°C<br/></syd>
</response>
Note that it contains data for more than one city. With the data in this format, I can use Javascript methods to retrieve all the information I expect from the XML document and insert it in the right place in the HTML file being displayed.
Finally, I added to the end of the page the Javascript code that retrieves the data from the server and sprinkles it over the page that was already displayed to the user:
var req, city;
var myurl = “http://www.netwhatever.com/cgi-bin/getweather.pl?long&xml&mel&syd”;
function doRequest(url)
{
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = finishRequest;
req.open(”GET”, url, true);
req.send(null);
} else if (window.ActiveXObject) {
req = new ActiveXObject(”Microsoft.XMLHTTP”);
if (req) {
req.onreadystatechange = finishRequest;
req.open(”GET”, url, true);
req.send();
}
}
}
function finishRequest()
{
if (req.readyState == 4) {
if (req.status == 200) {
response = req.responseXML.documentElement;
syd = response.getElementsByTagName(’syd’)[0].firstChild.data;
mel = response.getElementsByTagName(’mel’)[0].firstChild.data;
document.getElementById(”syd”).innerHTML = syd;
document.getElementById(”mel”).innerHTML = mel;
}
}
}
doRequest(myurl);
doRequest is the function that starts the asynchronous request (note that it needs to deal with differences between Firefox and IE). When the request finishes, finishRequest is called and, if everything went ok (return code 200), it parses the XML data and populates the DIVs created earlier on with the right data (it rewrites the innerHTML attribute of the DIVs). (technically, finishRequest is called for every change of the state in the request: state 4 means the request is finished; we ignore the other states and act only when it finishes)
So, not that complicated, and very powerful. This is a simple example that retrieves always the same information with no user interaction, but it can be easily extended to do much more interesting things (as Google has demonstrated). It “pushes the envelope” of what users may expect from online apps, really.
Random 21 Mar 2005 01:16 pm
Ghost Rider in Melbourne
Yes, I’m a little late. One week ago yesterday, they apparently finished the filming of the “Ghost Rider” movie in the Melbourne CBD. As far as I know, filming continues in other parts of Victoria and New South Wales, as well as in other parts of Melbourne.
For the last day of shooting, Little Lonsdale Street was closed for almost 48 hours (Saturday and Sunday) and transformed into a war zone: overturned cars, burned buildings, smoke, melted asphalt… the works. This seems to be the sequence from the scene filmed a few days earlier (Wed. night), which had a motorbike going down the street, followed by all the parked cars and store fronts exploding one after the other. Yes, they did the explosions right there; very cool, for lack of a better word.
The scenes filmed on Sunday, then, showed what the street looked like after the rider went by; a “morning after” scene. There were Texas police cars and bikes all around, as well as firetrucks (from Melbourne, with Texas signs pasted over the original lettering), news vans and CSI cars. An assortment of cops and fire fighters were at hand and busily “studying” the damage.
A few pictures of the action follow; they were taken from our 6th floor window, as we couldn’t really get any closer to the set. We got to see Nicolas Cage walking up the street (and then riding down the street) in front of our building when we went downstairs to try to see things from a different angle; the production crew didn’t let us take pictures from there, though.
In my other blog (in Portuguese), you can also see pictures of the set while still under construction, and some images of the night scenes filmed earlier in the month.
Random 10 Mar 2005 03:32 pm
Melbourne, Texas
Yesterday, when I left for work, all the cars parked in our block of the street had Texas license plates. Which, considering that we are half a world away from Texas, is a little peculiar. The reason for this is the filming of the Ghost Rider movie, currently happening here in Melbourne. When I got back home in the afternoon, our street was a piece of Texas: all commercial buildings had new signs in front, most of them in Spanish, and there were even newspaper boxes selling the Houston Chronicle (dated Feb. 5th).
At night, the actual filming was interesting and spectacular. The scene they did has a character riding a motorbike (presumably the Ghost Rider) down the street, and all parked cars blowing up as he passes by them, as if he were creating a sonic boom. The rider was filmed separately from the explosions; he went down the street four or five times (plus rehearsals), but the cars exploded only once, for obvious reasons. And we watched it all from our apartment; it’s not every day that you have cars exploding and stores going up in flames right under your window.
The bad part was that it took them most of the night to clean the street up, which made it a little hard to sleep. And they’re coming back: there’s more filming next Sunday, and the street is going to be closed from noon on Saturday until 7am on Monday. I’ll let you know if they blow up anything interesting.
Random 07 Mar 2005 09:57 am
Saturday in Melbourne

After a gray and rainy Saturday, the afternoon ended with a nice display over the CBD…



