PS3 Disc Error

Well, I booted up my PS3 today to give my brand new copy of Prologue a go. I inserted the disc into the Playstation, but it never appeared in the crossbar. All I can see is the little loading icon in the top right. I have tried a few different games; ones which I know work, but no luck. It seems my ps3′s laser has burnt out or something. Nevertheless, I have an extended warrenty on it, so no big drama other than the massive inconvenience it is causing. :(

I was initially suspect about it last night when I tried to resume playing Burnout Paradise, but wasn’t able to due to an error message on screen saying “Disc Read Error”. I just turned the PS3 off and went to bed, but waking up this morning I see that its a larger problem than first anticipated.

It seems like it is a fairly common problem with the PS. Anyone else had this problem with their PS3?

EDIT:  I called Sony to ask what to do. Basically they said to send it to them (they pay the shipping), and then they send me one back. Great customer support! It’s nice dealing with companies like this.  My PS3 is out of warranty too!

Gold Coast Twitter Underground Brigade (GCTUB) 1!

There are a lot of twitter meet ups around the world these days, but unfortunately there isn’t one on the Gold Coast (Australia); so Kahunagirl and I decided to organize the first Gold Coast Twitter Underground Brigade (GCTUB) for our lovely city. We will be having the first meet up at an awesome new put in Varsity Lakes called Hotel CBD. The details are as follows:

Location: Hotel CBD, in the lounge bar area (next to the bistro).
Address: Cnr Lake Street and Varsity Parade, Varsity Lakes, QLD, 4227
Date: Wednesday, April 2, 2008
Time: 7:30pm to around 8:30pm
Dress Code: No singlets/thongs/shorts (not my decision, the pub has a dress code)
Age: 18+ (the next one will be more underage friendly)
Everyone is welcome to attend, if you wish to get more up to date updates, follow either myself or kahunagirl on twitter. If you don’t use twitter, then you can join the facebook event. I will upload photos after the event to my flickr page and this blog post.

Don’t be shy, it is a great opportunity to network with like minded individuals. Hope to see you there!

Melbourne Formula 1 Grand Prix

Last week my father and I went to the first round of the  2008 Formula 1 Grand Prix season in Melbourne.  I had a fantastic time watching the race and checking out all the off track activities. There was historic and modern car exhibitions  in the middle paddock which had cars such as the Bugatti Veyron, old Brabbham cars and a lot of others.

As they are planning to move the Formula 1 from Melbourne to another location, it was a great experience to see it live. I think the last race at Melbourne will be in 2010, and I’d definitely recommend it to anyone who follows F1, but hasn’t been to a race

I have posted my pictures to flickr, but you can also check some of the images out below.

jQuery fadeIn/fadeOut IE cleartype glitch

While using the jQuery  javascript library today at work, I noticed a glitch under IE7. When fading a html node with the .fadeIn() and .fadeOut() functions in jQuery, IE drops the windows Cleartype rendering; which results in very ugly text. This problem appears to be very common, but no one has a nice solution for the problem.

The most common way to solve this problem is by removing the filter CSS attribute. In normal javascript, it would look like this:

document.getElementById('node').style.removeAttribute('filter');

and in jQuery, it would look like this:

$('#node').fadeOut('slow', function() {
   this.style.removeAttribute('filter');
});

This means that every single time we want to fade an element, we need to remove the filter attribute, which makes our code look messy.

A simple, more elegant solution would be to wrap the .fadeIn() and .fadeOut() functions with a custom function via the plugin interface of jQuery. The code would be exactly the same, but instead of directly calling the fade functions, we call the wrapper. Like so:

$('#node').customFadeOut('slow', function() {
   //no more fiddling with attributes here
});

So, how do you get this working? Just include the following code after you include the jQuery library for the added functionality.

(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);

I have been informed by Steve Reynolds that the US Whitehouse Website is using some of the JS documented on this blog post. I would just like to say thanks to everyone who contributed in the comments. :)

Issues with mysql 2.7 gem

I’ve been trying to get a rails development setup running on my Leopard install. After managing to get the mysql gem installed without errors, I can’t use the gem in any projects.

When I run rake db:migrate, I get the following error:

G5:ag $ rake db:migrate(in /Users/xxx/Projects/ag)
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookupdyld: Symbol not found: _mysql_init
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Expected in: dynamic lookup
Trace/BPT trap

If anyone knows what the problem is, and has a solution, please let me know by leaving a comment!

EDIT:Thanks to Chris for doing the hard and blogging about it on this blog post  which appears to solve this problem. I’ll post here again once I have tried this solution.

Rails gem install mysql throws error: *** extconf.rb failed ***

Whilst reading guides on how to setup a rails dev server under OS X (both Tiger and Leopard), I kept running into issues installing the mysql gem. The guides would instruct you to install the mysql client libraries from the mysql website, which is fine. But to get improved performance under rails, you must install the mysql gem, but in doing so, I would constantly run into issues getting the gem to install correctly. The issues normally arises after running the following command:

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

And the resulting error is:

checking for mysql_query() in -lmysqlclient... no

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of

necessary libraries and/or headers.  Check the mkmf.log file for more

details.  You may need configuration options.

Basically, the gem compile fails as a result of not knowing where the correct mysql files are, despite the fact that the command line switch points to the mysql folder.

To fix this problem, use a line like the following:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Note that instead of pointing at the mysql folder, we are pointing at a mysql config which is bundled with the mysql client install files.

Google Adsense Partner Meeting

Google AdsenseAs an employee of a high profile site, I was invited by my boss to attend the Google Adsense Partner Meeting at the Googleplex in Sydney. Unfortunately I can’t really talk about much that was talked about as we were all required to sign NDAs on arrival.

Overall, the day was a huge success. Very interesting developments within the world of Google that we can all look forward to (You didn’t need to go to know that already!). The networking was fantastic as there were a lot of other high profile sites invited too, such as drugs.com, ski.com.au, hotel.com.au just to name a few.

Continue reading

natsort() pain in PHP

While writing some software for work which works out distances between geographic locations, I discovered some nastiness with the natsort() function in php.

This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a “natural ordering”.

So, given this definition of natsort, I’ll now outline a working example and then an example of the problem I encountered.
Lets say we have a list of values in an array that need to be sorted descending whilst maintaining key/value pairs. E.g:

$a = array(4 => 9.1, 3 => 4.2, 10 => 4.5);
natsort($a);

As you would expect, the resulting array looks a little something like this.

print_r($a);
Array
(
[3] => 4.2
[10] => 4.5
[4] => 9.1
)

But what happens when the values in the array we are trying to sort are a little more complex:

$a = array(4 => 9.11705244995,3 => 4.23956628237,10 => 4.5361796771);
natsort($a);

The resulting array isn’t what we expect though.

print_r($a);
Array
(
[10] => 4.5361796771
[3] => 4.23956628237
[4] => 9.11705244995
)

As you can see, the sort order is incorrect. As you have probably picked up, the 4.5xxx number’s decimal places are 1 less than the other two numbers. As soon as you change 4.5361796771 to 4.53617967711 and run natsort() over it, it returns the correct order.

Conclusion: Don’t use natsort() when sorting floats of different precision as it will return incorrect values! Use something like asort() if you want to maintain key/value pairs, or sort() if you don’t care about the key ordering.