Blog RSS Feed Subscribe

Jordi Boggiano

Jordi Boggiano Passionate web developer, specialized in web performance and php. Partner at Nelmio, information junkie and speaker.


PHP RSS Generator

As part of my work on my CMS (and website as this site is running on it), I decided to code a RSS feed builder. This could easily be made as a standalone class so I thought I would share it.

The package is made of two files, one being the feed and the other one representing an item (i.e. an article). It works nicely as you can see from all the feeds I set up in here, and it supports the RSS2.0 standard entirely.

December 18, 2007 // News, PHP // Post a comment

Heat maps drawing in Flash

Someone was looking for help to draw Heat Maps in Flash this afternoon on #flash and as I found the matter interesting I gave it a shot.

I managed to do it by drawing grey circles with 1-5% opacity to a BitmapData object, which works a lot faster than working with Arrays to sum up all the values. 

After that first pass the class scans the whole BitmapData to find the peak value and then uses that peak to scale all values and enhance the contrast of the image. At the same time, the pixels are colored depending on their value, which creates the "heat" look.

However, with a high resolution and thousands of heat spots, the process is taking a while to complete so I thought I would use this occasion to try and implement a render loop that computes chunks of data on every frame instead of running all at once and freezing the player. And here is the result, although the heat map doesn't match the underlying map.

Continue reading...

December 16, 2007 // ActionScript // Post a comment

ActionScript 3 Language file for GeSHi

As I wanted to post AS3 code with syntax coloring, I researched it a bit and found GeSHi, a PHP syntax highlighter, for which you can create language files quite easily. There is currently no AS3 file available in GeSHi though, so I decided to build one.

For now it's available here, but I hope it will make it into GeSHi's next releases. It's following the FlexBuilder2 colors for the default style, but it is stylable with CSS.

Should you see any missing keyword or anything, please contact me so I can update it.

Edit : I updated this file to v1.0.1, I was so focused on scraping data that I forgot the "this" keyword in the process, that's now fixed.

Download : AS3 Language file

November 30, 2007 // ActionScript, PHP // Post a comment

Throwing errors before a super() statement

Lately I was building a class which takes XML as it's configuration, reads part of it and then calls super() with some parameters.

However I wanted to throw an error if the XML did not contain valid settings, and Flex doesn't let you do that. Upon compilation it returns an error saying 1201: A super statement cannot occur after a this, super, return, or throw statement.

Fortunately, it's possible to overcome this by creating a helper function or class that will throw the error for you, so that's what I did with my ErrorThrower class. It is as simple as it can get, and it fools the compiler alright.

package com.seld.errors 
     public class ErrorThrower 
         public function ErrorThrower(msg:String, id:int = 0):void 
             throw new Error(msg, id); 

Then with that class, instead of doing throw new Exception('foo'); you just do new ErrorThrower(msg); and it will be compiled, error free.

November 27, 2007 // ActionScript // Post a comment

The Renewal

After some months of heavy procrastination, I finally took the time to put my new website online, so here it is, although it's still quite empty as of today.

Hopefully I will have time to complete what needs to be done soon.

November 09, 2007 // News // Post a comment

First page< Newer entries 1 2 3 4 5 [6]