Jun 29 2007

Transformers

Tag: LifeAlex @ 12:03 am

Movie PosterIf you are a mid-eighties child and haven’t already got your tickets to the Transformers Movie, do it now. I went and watched it tonight at the new Chartwell theatre. It is incredible, made it so much cooler remembering everything from the cartoon in my childhood.

Also, amazingly we managed to get it 5 days before USA, awesome.


Feb 08 2007

Thoughts On Music

Tag: Apple, Computers, Gadgets and MusicAlex @ 7:37 am

Steve Jobs has issued a Hot News article detailing Apple’s stance on DRM and it’s future. I’m going to go so far as to say he has laid down a challenge in full public view to the big 4 Music Distribution Companies. However I can see that his account serves only to appease the public’s wrath due to Apple not licensing it’s FairPlay DRM technology to other companies, I can’t see the big wigs in the music world even reading the article, let alone uttering more than a chuckle.

http://www.apple.com/hotnews/thoughtsonmusic/


Feb 04 2007

Hmm. Upgrades

Tag: LifeAlex @ 11:49 am

This is the obligatory blog entry warning that I have upgraded to Wordpress 2.1 and to ask anyone who finds something that used to be working, now broken, to comment here.

I might make an AJaX Askimet spam counter plugin (if I can’t find one already done) for my sidebar. It’s amazing how much spam attempts to hit my blog. Is there a conspiracy going on. Does askimet make up spam to make it look like it’s stopping a lot more spam than is actually getting submitted?

Statistics time:

  • I installed Askimet on October 11, 2006.
  • Since then it has stopped 7,884 spam comments.
  • That averages to 68 spam comments a day.
  • 925 of those were in the last 15 days.
  • The average over the last 15 days is then 62 spam a day.
  • It is currently letting through less than 1% of that into my moderation queue.
  • Because of my moderation settings, a total of 0 have made it to my blog.

I should really just turn on compulsory registration or try referer checking as well as Askimet but this is fun so I’ll leave like this for a while longer.

EDIT: After watching the access logs (using tail -f access_log | grep wp-comments-post.php) I have found a couple of interesting things. The first is that all the spam that is trying to hit my blog does in fact have a valid referer and a valid User-Agent. The referer is that of various posts in my blog and the User-Agent happens to all be "Opera/9.0 (Windows NT 5.1; U; en)". These requests are either spoofed IP packets or are from a bot-net as the IPs are all over the show.

Just for fun, I’ve done a little .htaccess file hacking which now “403 Access Denied”’s them based on various information I’ve discovered from the access_log, I just want to see if I can stop the spam even getting to Askimet.


Feb 02 2007

Syntax Highlighting

Tag: LifeAlex @ 9:11 am

I just installed a syntax highlighting plugin “igSyntaxHilite” but man it has some things I don’t like. Hard-coded CSS instead of using classes and an external stylesheet, hard-coded Courier New font. Anyway, I’ll be looking around for another syntax highlighter or hacking this one up a lot (must check the license to be honest).


Feb 01 2007

Internet Explorer 6 Performance

Tag: Computers and Web DesignAlex @ 5:18 pm

I spent a huge part of today trying to determine the cause of a major Internet Explorer performance and rendering regression in a Web Application I'm developing. The reason it was such a bitch to find was because so much code had changed since the last time I had done a proper test in IE6. This was in code which I didn't expect to cause rendering issues, performance issues maybe, but those could have been dealt with.

So, I went through carefully ripping apart the project, disabling stylesheets, removing images, removing individual styles to figure out what was going on. About a hour later I hadn't got very far. I had determined that every1 browser was fine except IE6.

In frustration, I turned to Google. Trying to find pages describing huge black areas rendering over the page while using Scriptaculous Sortables got my nowhere so I tried searching for causes of huge black rendering artefacts in IE in general... nothing.

I turn back to trying to make a minimal test case. I ended up removing an image that was inside each Sortable item and suddenly the rendering problem went away and the performance jumped up significantly. Anyway, some dilly-dallying around and it turns out it was the javascript I'd written causing problems at all. It was the IE6 CSS Alpha PNG hack which was causing all the problems (which was working fine without performance issues the last time I tested this site in IE6).

It is indeed common knowledge among web developers that IE6 does not support transparency on 24-bit+Alpha PNG images. The alpha channel is rendered [usually] in a baby blue colour instead of being see-through.

To remedy this I was using the fastest hack around the issue that I have found and it involves pasting 5 lines in the CSS file for a site and bingo. I didn't make this hack but here's how it works. It uses the proprietary filter CSS attribute combined with the DirectX ActiveX control to draw the PNG, to target only PNGs and the also proprietary CSS extension 'expression' which uses JScript to compute values. I haven't had a problem with this hack yet, it doesn't handle CSS background images but I haven't needed it to yet.

CSS:
  1. img {
  2.     height:expression((this.complete&&(String(this.src).substr(String(this.src).length-4,4)==".png"))?"1px":"");
  3.     width:expression((this.complete&&(String(this.src).substr(String(this.src).length-4,4)==".png"))?"1px":"");
  4.     filter:expression((this.complete&&(String(this.src).substr(String(this.src).length-4,4)==".png"))?("progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.src+")"):"")
  5. }

This combined with the addition of a PNG on each individual Sortable Item caused the poor DirectX Transform to basically crap itself and render parts of the window black. Very black.

Blah.

What a waste of many hours of my day.

Honestly though, this rendering bug caused a few 'wow' moments from people in my office when they saw what IE was displaying on the screen and how it took roughly 20 seconds and 100% CPU to drag one single item between two lists. I'll have a screen-shot of this up in the next few days.


#1 every means "Safari, Firefox 1.5, Firefox 2.0, IE7, WebKit nightlies and Opera 9"


Jan 30 2007

Windows Vista

Tag: LifeAlex @ 12:09 am

It makes me ROFL.

EOT


Jan 26 2007

External Storage

Tag: LifeAlex @ 5:18 pm

Pleiages Taurus Dual-Bay EnclosureSunday night I bit the bullet and bought a new hard-drive enclosure online. The enclosure I got is a Pleiages Taurus 3.5" Dual-Bay Enclosure with built-in RAID0 (Stripe and Span) support. It hold 2 x SATA II hard-drives which I purchased from Tom, both 320GB Seagate drives and now I have a 600GB Firewire 800/400/USB2 external hard-drive for my storage pleasure.

It looks awesome, like a Mac Pro front, has the same power button as my laptop and looks damn hot sitting next to it. I'm transferring all my data from my 120GB External which I'm selling to Aimee. For some reason though the transfer is going unbearably slow. I have about 90GB to transfer, one HDD in the USB2 port, the double enclosure, Striped RAID in a Firewire800 port and it is transferring at only 8MB/sec which is pitiful.

Ah well, I guess I can live with it, only a few hours left now anyway.

EDIT It turns out the older hard-drive was only giving the data out at 8MB/sec which is annoying.


Jan 26 2007

Fall Out Boy Concert

Tag: Life and MusicAlex @ 8:25 am

Looks as if the tickets for the Fall Out Boy Concert at the start of March are going to become hard to get soon.

Fall Out Boy - Sold out ticketsThe mezzanine floor where Aimee and I usually grab tickets sold out during the presale period and now the stalls at the back of the bottom floor have standing room only. I managed to get Grand Circle tickets (at the top) yesterday from the site using the presale password but I can't imagine those tickets lasting very long as public sales started this morning at 9am.


Jan 25 2007

Productivity++

Tag: Apple and Web DesignAlex @ 9:22 pm

This afternoon, Tom got me to check out a SIMBL plug-in named megazoomer. After upgrading my version of SIMBL and dropping the megazoomer bundle into its place in my Library folder, each Cocoa program I started from then on had fullscreen capability.

With the default key combination that seems borrowed from Windows ( + - similar to Alt + Enter which is full-screen/window mode toggle for apps on Windows) it sends the Application full screen.

The big deal for me was that it worked multi-monitor flawlessly even allowing 2 windows to be full screen on different monitors creating an uninterrupted workflow between the two. Now I can set up a text editor on one screen and Safari on the other at work and not have any distractions.


Jan 15 2007

PHP4, Constructors, $this and Output Buffering

Tag: Web DesignAlex @ 1:56 pm

Just spent half an hour trying to figure out a very random bug in a PHP4 application I'm developing at the moment. I'm using an MVC design pattern and in the constructor for the View object I wanted the class to set itself up to capture all output using output buffering. I've used this style in a couple of sites now and once it was all figured out, it worked fine but this time I was doing one subtle thing differently.

This time around I was using the following code:

PHP:
  1. class viewXHTML
  2. {
  3.         function viewXHTML($model)
  4.         {
  5.             if ($model === null)
  6.                 return;
  7.  
  8.             $this->model = $model;
  9.  
  10.             ob_start(array(&$this, 'output'));
  11.         }
  12.  
  13.         function output($text)
  14.         {
  15.             []
  16.         }
  17. []

Which sets the model to an instance variable and provides the output buffering function a callback to the output function of this object. This works fine and dandy, when the page is done, the output function gets called with the parameter being all output that was sent using echo and print statements. The problem is only visible when you want to access instance variables of your object within that function.

Theory One:

The output function was being called on a copy of the original object. Problem was that some of the instance variables were set but the ones set after the constructor weren't. Turns out that the $this variable you get given in the constructor is a special object which you can't pass by reference, only by value.

This was all fixed by calling a bind method after the constructor returned so the code is now similar to:

PHP:
  1. class viewXHTML
  2. {
  3.         function viewXHTML($model)
  4.         {
  5.             if ($model === null)
  6.                 return;
  7.  
  8.             $this->model = $model;
  9.         }
  10.  
  11.         function bindOutput()
  12.         {
  13.             ob_start(array(&$this, 'output'));
  14.         }
  15.  
  16.         function output($text)
  17.         {
  18.             []
  19.         }
  20. []

The bindOutput function is now called straight after the constructor in my bootstrap code.

Anyway, this mildly reiterates to me that I really shouldn't be pushing PHP4 to do things that I should be using Ruby, maybe Python or at very least PHP5 to do.

This was in PHP v4.4.1.

edit: typos for the win
edit2: added syntax highlight plugin


« Previous PageNext Page »