JavaScript 101 – Private Variables

Funny things happen in the course of piecing together solutions in this field. Programmers have a tendency to throw their hands up in the air when they get to the end of a week and they can’t quite figure out a concept, and the problem is compounded when looking at programmers who don’t take the time to actually learn the new idioms of a language before getting into the position of writing production code.

JavaScript lends itself to this type of behavior. It has Java in it’s name, and it looks a lot like C or Java syntax, so it attracts a lot of OO type behavior. Little do these people know the language should be written more like lisp and less like Java. Continue reading “JavaScript 101 – Private Variables”

canPlayType is nearly useless

Go ahead, look at the documentation for this function. For those of you who don’t like to follow links, you would be looking at the documentation for a function attached to any html5 video element. It accepts a mimeType, a set of codecs and well… here is the the rub. What would you expect it to return?

I expected a boolean. The guy who worked on this problem before me tested it as though it were a boolean…

if (video.canPlayType(mime + ";codecs='" + codec + "'"))

In fact, after polling the friends around me, every single one of the 15 people I have asked expected the same. In reality it returns either “probably”, “maybe” or “”. This is probably the most non-committal function in the history of time.

Further, imagine my surprise when I opened Safari up, yes I’m on a mac, and passed it 20 different combinations of videos and codecs, all of them return something odd – “maybe”. Not only did this happen for mpeg, which is absolutely supported, but it also returned maybe for wmv and avi files, which were absolutely not supported. I can only hope that this function works better on the iPad/iPhone and Android devices.

Until then, I’m going to be using something else.

Intro to the WordPress Settings API

API Documentation is always going to be a hell that I do my best to avoid. I learned early on when working with SourceSDK that documentation for much of anything worth a damn would be hard to find and the new WordPress Settings API (SAPI) is in the same ballpark. This was actually added to the 2.7 release of the trusty blogging / CMS software, but it was (was? is!) not well documented and has some really dope capabilities and features that you should all take advantage of.

So what are you waiting for? Time to rewrite a plug-in and learn the new API!

Continue reading “Intro to the WordPress Settings API”

My Forums

I absolutely hate advertisement bots, and i wish that their inventors would be blessed with a flesh eating virus. I have been fighting a losing battle over the last two years to regain control over my forums, claiming it back from the shitty bots, and i think i have finally figured things out.

Below is the beginnings of a script that you can run on a semi regular basis and keep your PHPBB3 Databases cleaned of ridiculous bullshit landing on your forum. Just remember to log in from time to time to resynchronize your statistics.

Continue reading “My Forums”