Update: 4.2 was released today and I am very happy to have played a (small) part in it!
Photos or it didn’t happen!
I have just released a new plugin called Debug Bar Tracer. It is meant to work with the Debug Bar plugin that should be a staple of any WordPress developer’s toolkit. The idea behind it is quite simple – I am always printing data out to the browser when developing and it always breaks the page and looks horrible. This plugin just adds a new panel that will show you the location of the call ( complete with file name and line number ) as well as the data you are sending out.
Please take a look and let me know what you think!
So I’ve decided to retire the Action Script section of my website. I don’t really work with Flash all that much anymore and to be honest, I’m getting quite rusty at it. The posts will still be available but I won’t be adding anymore moving forward.
I recently developed a Dreamweaver command to automate a process I hate to do manually – turn French characters into their HTML entities. It’s pretty straight forward, highlight the copy you want to scan, select French Characters under the Commands menu and follow the prompts.
To install, unzip the files and drop them into your Commands folder.
I wrote it for CS5 but have since tested it in CS6 and it works.
So, I was one of the many who jumped on the bandwagon and bought a Playbook when they were offering them at a ridiculously reduced price over Christmas. I was never really that interested in getting one but they were cheap and I wanted an e-reader (Playbook comes pre-installed with a Kobo app) so I convinced myself that it was worth it. Continue reading “Blackberry Playbook OS 2.0”
I just heard that my former employer Les Stroud is going to be doing more episodes of Survivorman – but this time for 10 days instead of 7.
If you’re not familiar with Survivorman you should be. It basically invented the Survival TV genre – and no not the reality TV, I can win a car crap – the real stuff where people are actually required to know how to do it.
I loved the show and am definitely looking forward to the new episode(s) both as a fan and a friend of Les’ and I wish him and the Les Stroud Productions team the best.
I was writing a post about Events in AS3 and while explaining why in my opinion one approach to passing data is preferable to another I stumbled across the phrase “Set it and forget it” when it comes to programming. I think that this is a great way of describing how I like to write code and is a pretty good way of determining when a certain functionality should be abstracted into it’s own class or sub class.
The basic concept is that as a programmer I shouldn’t need to remember anything special about the class I have just written.
Obviously I’m not referring to things like a particular method or getters/setters but rather little gotchas that you won’t remember 6 months after writing the class.
For example, I was writing an ImageLoader utility class and added some functionality to create a thumbnail dynamically using the BitmapData class. I was pretty happy with the class and it worked very easily, once the data was available an Event was fired and a Getter method was called to return the bitmap. The only issue was that I was returning a Bitmap and MouseEvents are not triggered by Bitmaps so I was having to wrap the Bitmap in a Sprite and then assign listeners. As you can see, the extra step I have to remember is tedious and so I re-approached the class and wrapped the Bitmap in a Sprite before returning it. No fuss, no muss. Now I can just use the class without having to remember anything. I can “Set it and Forget it”
Garbage collection can be a big deal when writing complex programs in Actionscript. Not removing EventListeners is probably one of the biggest sources of AS holding onto memory it doesn’t need.
There is a very easy way to allow GC to handle your event listener clean-up for you when creating a new event listener – the useWeakReference argument.
Here is some standard code we’ve all done million times when creating a button:
var button:MovieClip = new MovieClip();
The two arguments are pretty straight forward the first is the event we’re listing for and the second is the function that is called once the event is fired, but there are actually 5 arguments that can be passed to addEventListener() here is the method definition:
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
the 5th argument (useWeakReference) is false by default but by setting to true, this eventListener will be automatically removed and freed for Garbage Collection when required.
Here is the new eventListener code updated to make use of useWeakReference.
I have been developing an AS3 library for the video publishing company Castfire on my own for the past little while and recently got in touch with them about continuing the endeavor. I thought it was a shot in the dark but they were more than willing to help out and so here is the first of, I hope, many articles on the Castfire API and the class library I am working with them to create for it.
The point of this library is to allow Flash devs like myself to easily access the Castfire API when creating custom video players.
I have been working on an update to my Easy Analytics plugin for WordPress and it’s almost ready. It’s a very big change in that I have added the ability to pull page stats and store them in a custom table in the WordPress database.
I have attempted to use the Google Analytics API before with limited success but this time around I used a very good PHP library called GAPI (Google Analytics PHP Interface). It is free to use and made the whole process of getting the data from GA very simple and is allowing me to focus on the plugin interface and programming options.
The catalyst for this addition to EA came from one of my clients. The project required a WordPress theme that pulled the most popular posts into a page. That in and of itself is not a big deal as there are plenty of plugins that will pull the most commented posts from the database but she wanted to use her Google Analytics stats as the basis.
I took a look around WordPress.org to see what options there were for plugins and I found that while many would connect to GA and pull the data in for use, the formatting options were limited to a sidebar widget or they would only output a list of links. I wanted more control over what each post looked like.
Currently I have the data being pulled in and displayed, There is a noticeable load time for the page so I am working on a way to cache the data in the database so the pull only happens once a day – which will reduce load times and since GA updates on a 24 hour delay anyway it’s extremely redundant to query the server every time a visitor hits the page.
I want to make the system as automated as possible so probably the first time someone hits either the Admin section or the page itself the pull will happen and the database will be updated. That way there is no need to manually hit a button to update the stats.
I will keep you posted on my progress!