Unknown Domain

Scaling HTML elements proportionally (the easy way)

Want to make your WordPress Custom Post Type appear in the main blog stream?

Probably not, but this code allows you to do it, and save you doing all the hard work I had to do, in order to get this to work...

I’ve just released my 5th WordPress plugin!

I did blog about my first WordPress plugin (Broadcast MU) quite some time ago, however I quietly canned it when some other people came along with theirs. Since I have released several other small plugins, and now I am re-releasing Broadcast MU 2.0 and a new plugin, links below:

I also have written other plugins for GDNM.org, they just aren't suitable for release, they include:

  • Workshops
    Allows staff to post a custom post type which works just like a normal post but has additional fields for staff name, location, start and end of workshop, number of places, and a custom taxonomy for which course the workshop is open to. The plugin then allows logged in users to signup up to the place limit, it also allows students to cancel up until the cutoff time to prevent last minute cancellations and emails students a confirmation message. Staff can print out a list of all the students, or compose an email to them all with one click
  • Tutorials
    Tutorials takes the Workshops plugin a stage further allowing staff to enter time ranges and tutorial lengths and have the plugin calculate timings for every workshop time inbetween, for example giving a working day of 10:30-12:00,12:00-16:30 and tutorials of 15 minutes it would offer slots at 10:30,10:45,11:00... and it allows for multiple students per slot for group tutorials.
  • Profile Fields
    Profile Fields adds additional fields during signup to require a full name, year and group to be completed which greatly improves the Workshops and Tutorials plugins which display the full name, rather than the username of their internet handle. Also by capturing a course and group (year) we can produce a directory of students.
  • Signup Code
    This plugin also adds additional an additional field in the signup screen which acts like an invite code allowing us to avoid spam while also allowing any email address to work, we keep the site spam free by only providing the invite code to students face to face.

I also have an idea for a rework on someone else's plugin however due to the legacy of old code in the WordPress Dashboard code it isn't currently possible:

Signup Manager (name tbc)
This plugin builds on the ideas of WPMU New Blog Defaults which allows use to set the default parameters of new blogs registered on a multisite installation. The plugin implements this feature in a more modern way and additionally allows the network administrator disable this plugin from further changes, or disable it and hide it entirely. This is useful as there are many options in Dashboard under the Settings menu like Timezone, and permalinks that you don't want the blogger changing.

Learning Objective-C

The first programming language I ever learn't to write, was ASP (not ASP.net) I had learnt a bit about HTML and was confused by CSS and JavaScript, but I wanted to experiment with including headers and footers, and with the idea of a user login system. I am quite sure the first try was diabolical, it I didn't learn about password hashing until I learn't PHP so there is no way that the passwords were hashed and I am not sure that I even used a database.

My days of IIS and ASP are long gone, I never use a PC these days and I don't remember anything about ASP other than <% document.write("Hello, World!"); %> (I think?). At some point I switched to PHP and like most new PHP programmers started writing and rewriting a CMS. Time passed, and my knowlege has improved, I now know bits and pieces of: PHP, C, JavaScript, and Java.

I bought my first Mac over the phone with my dad when I was at college in about 2004. It was a 14" iBook with a Mighty Mouse, AppleCare Protection Plan and a AirPort Express base station. I don't remember when I first got interested in learning to program the Mac but it wasn't long after. I bought a copy of Aaron Hillegass's infamously brilliant "Cocoa Programming for Mac OS X" (2nd Edition) book and got started. I didn't know C then and hadn't really understood Object Oriented programming either. The book was an extremely hard learning curve and even with my dad's help I didn't make it through.

Time passed and I tried again but got stuck again and failed, time passed and I bought the latest edition (3) of Aaron's book and tried again, got further and understood more but still got stuck. A lot of time passed and I had been tinkering with little experiment projects all along, but it wasn't until this summer that I knew I would have time. I bought a bunch of books in preparation for the summer:

That's a lot of book, probably about 2,000 pages of book, but I am really commited this time, I have already completed the first book (Objective-C Programming) and really feel a lot more confident having learn't it. I also think that the time coupled with previous attempts and reading other things has helped me to whizz through that book in about 24 hours worth of reading.

I am now on chapter 5 of the next book (Cocoa Programming for Mac OS X) and things are making more sense than I remember previous attempts did. I am hopeful that I can complete this book in the next week and a half to two weeks max and start playing about with some of the APIs, sadly the More Cocoa Programming for Mac OS X book isn't out yet so my Amazon order is still pending, according to Safari Books it isn't going to be published until October, so that is rather unfortunate. Aaron, fancy sending me a preview?

Either way I think I will hold off the Advanced book as it goes into networking and tasking which I think might be pushing it, and besides there's tons of WWDC videos from Apple's Developer channel to watch and I want to spend time on my Split-flap project, and a friend has come up with an idea for using flip-dots to make a QR code clock so we are going to try to make a flip dot, and we've ordered some samples from a polish company called Alfa Zeta.

My first WordPress plugin!

So I released my first WordPress plugin recently called 'Broadcast MU' - Thanks Luke!

Its actually for WordPress MU (Multi-user) and it allows you to post the same post to multiple blogs, you can read up more on it here.

I hope people find it useful and it is a great opportunity for me to learn more about PHP and WordPress MU, it was developed because there was no similar plugin available for WPMU and we needed it for GDNM.org a site I have been managing for UCA Epsom's Graphic Design: New Media and Graphic Design courses/departments.

HOW TO: Detect operating system in Flash

Using the following if statement you can test which operating system your currently within, great for my current project where the USB memory stick my projector will be running from needs to have 2 partitions and I want to be able to access the assets from the Windows FAT32 partition from Mac OS X's HFS partition.

if (System.capabilities.os.substr(0, 3) == "Win") {

// Windows code

} else if (System.capabilities.os.substr(0, 3) == "Mac") {

// Mac code


This code combined with my previous post's code allows me to calculate the current path to my resources folder for Windows and if on Mac to simply use a hard coded path as Mac does not have random drive names, it uses the standard of /Volumes/disk name.

HOW TO: Find the path to the location of Flash projector (Win + Mac)

This snippet of code can be put in the main flash projector so that any loaded swf files can find their way home....

var path = "";
var currentPath = _root._url.split("/");

for (i = 0; i < currentPath.length; i++)
	if (i != (currentPath.length - 1)) path = path + currentPath[i] + "/";

The code simply gets the _root._url and splits it everywhere it finds a forward slash and puts it all back together again skipping the last part of the url (the filename) its a simple bit of code, could be better written by searching for /*.* using a search pattern but it works and it only has to run once if you run it in an if statement....

if (_root.path == "") {

I am using this code for a project where we need to have a USB flash drive with two partitions, one for Mac, and one for PC, the PC one will have all the assets (SWF files) and the Mac one will just have a flash projector which points to "files:///Volumes/Memory stick name". The windows partition will need to have the above code so it knows where to look for its files as Windows assigns a random drive letter where as the Mac uses the "/Volumes/Memory stick name" which unless renamed should remain the same.

The need for two partitions came as for Windows we will have an autorun.cfg file to launch the projector but on Mac this is not possible so the user will open the Finder window and because that partition of the drive is formatted for Mac it will remember the layout allowing us to setup a custom logo, and layout which will be more user friendly than a list of files.