Made Media Ltd. 105 Carver Street, Birmingham B1 3AP

mail@mademedia.co.uk +44 (0)121 200 2627

Made Media Ltd

Posted in culture, life, technology by Jake on October 27th, 2006

Big in Poland

A small spike in Polish traffic to our blog, lead me to this article, discussing my MyActiveRecord MySQL/Object Mapping class.

Jana, who is after all a Slav, had a go at translating. She assures me that the post signs off:

This is one of the best PHP Classes I've ever seen. It just works!

I guess that's better than:

This is one of the worst PHP Classes I've ever seen. It doesn't work!

But perhaps the wife is just trying to bolster my ego...

2 Comments

Posted in culture, design, life, local, news by Tim on October 23rd, 2006

Made Plus+

made collage

We've spent a busy week flaunting our wares at Plus+ 'an international design expo presenting pioneering work by Birmingham’s leading graphic designers through a five day showcase in the heart of the city.'

Made have been involved with the event for some months now, being one of four agencies to head up the events steering committee. So it was a great relief to see our efforts come to fruition for the launch party on Saturday.

Amongst the highlights was an informal talk by the design legend Peter Saville. After proving his rock star credentials by appearing an hour and a half late, he gave a charismatic potted biog and some interesting perspectives on city branding (birmingham take note).

The expo was also a nice opportunity to hook up with other Birmingham design based contemporaries, some old friends, some new acquaintences. We've now got some slick wall panels to adorne our office space and finally had an excuse to buy a red leather sofa to compliment the made interior.

The show's now over but shall be returning next year, bigger and bolder so hope to see you all there. In the meantime, more pics from the event here.

0 Comments

Posted in news, projects, technology by Josh on October 19th, 2006

Introducing Jobs Board Digest

jobs_board_digest.jpg

We’re delighted to announce the launch of Jobs Board Digest. The Jobs Board Digest is a small side project that we think some people may find useful.It provides aggregated listings from three of the best new jobs boards that have recently been springing up.

Specifically, we are combining the latest advertised jobs from 37 Signals, Joel on Software and Vitamin. You can view the latest job postings online or via a combined RSS feed.

This is a completely free service and we’re not aiming to profit from this at all. The advertisers pay the board owners directly, we’re just helping distribute the information. Let us know what you think.

0 Comments

Posted in apple, life by Josh on October 12th, 2006

Nike+iPod - Run for a cause

Nike+iPod

I bought a Nike+iPod kit a few weeks ago, motivated partly by Cabel Sasser's inspiring post about the subject and turning a workout into a challenge, computer game style. Works for me.

And now Nike has introduced 'Run for a cause' which is a great additional motivation.

I’m walking (not running - bad back, long story) about three miles a day now. If I can do that every day for the next three weeks (the length of the current promotion) then Nike will apparently donate $63 to charity ($1 per mile x 3 miles x 21 days). That’s more than I paid for the kit. I predict that this is going to raise enough money to force Nike to lower the price per mile. Even if they do, what a great incentive for layabouts like me, what great PR for Nike, what a great boost in income for the charities concerned. Hard to see a loser here and I like that. Ars Technica has a good write up.

1 Comment

Posted in apple, culture by Josh on October 10th, 2006

Review - iWoz: Computer Geek to Cult Icon

iWoz: Computer Geek to Cult Icon

For Apple fans this is probably the book they’ve been waiting for. iWoz is the autobiography of key founding member of Apple, Steve Wozniak. My copy duly arrived from Amazon and I devoured it within a couple of days.

Firstly I should point out that I loved it. Cheers Woz, I really appreciate hearing your story first hand. Having said that, I’m not sure I really learned anything new that really interested me. Woz seems to go out of his way to correct a series of fallacies that have built up over the years, he shows a real keenness to get the truth out there. The thing is though, while certain information does clarify matters I still feel exactly the same way about Woz as I did last week.

He’s a fascinating, lovable, cuddly prankster with only the best of intentions. My kind of guy but the new and clarified information in this book hasn’t changed that, or even enhanced it particularly.

This is not a heavyweight read. It reads much like the process that produced it – a conversation with Woz. It’s simple, straightforward and not in any way salacious or sensational. I can imagine some people being disappointed. It’s not packed with new revelations, it’s just a diary of events – this happened then that happened – not much more. Those events take us from early childhood almost to the present day in a linear fashion.

I do now know a little more about Woz’s personal life but he doesn’t talk extensively about his wives and kids. I enjoyed hearing about his relationship with his dad and about his early pranks. Woz and Gina (his co-writer) do a great job showing how events unfolded, how Woz’s understanding developed and how this led to the creation of his seminal work, the Apple II.

He’s been incredibly open in some ways and yet seems to reveal little. Gina Smith has done a professional job, seemingly faithfully reporting Woz in a style that really feels like the man himself. The only trouble with this is that Woz likes to keep things simple so the book is kept simple. It’s a little disconcerting having Woz explain how he basically invented the personal computer in such a matter of fact way. Maybe that’s part of the charm but I was hoping for a little complexity I think!

All in all, recommended for Apple nerds everywhere and for anyone who fancies a quick, lightweight read about a genuinely decent bloke. If you’re looking for a colourful, rich history of Apple then look elsewhere.

ps. My personal favourite book on Apple history is Revolution in the Valley by Andy Hertzfeld which I particularly recommend. You can read most of it online at http://folklore.org

3 Comments

Posted in life by Josh on October 10th, 2006

Blazing Broadband

Since moving house a couple of weeks ago I’ve had no internet connection at home. Not so much as a phone line to help me out. It’s been a weird and not-at-all pleasant experience that has left me feeling somewhat disorientated.

I’m so used to being permanently connected to the internet – email is my main communications tool these days – that it’s been hard to go without.

Imagine my joy then when I tell you that I’m typing this on a newly installed Telewest broadband connection. I really pushed the boat out and went for their Elite up to 10Mb service. And look!

1 megabyte a second

I’m currently getting a megabyte per second! That’s a theoretical 60Mb a minute and 3.6Gb an hour, more than enough to keep me amused.

I think I’m getting old but I remember my excitement at getting my first 56k modem, thrilled at the speed improvement over my old 28.8k brick. Less than a decade later and I’m now getting 200 times that original 5k per second dial up speed.

Oh how times change.

1 Comment

Posted in linux, technology by Jake on October 9th, 2006

MyActiveRecord - New Release

I've finally got it together to release an update to the MyActiveRecord class.

There's nothing like open-sourcing some code to teach you a few lessons:

  1. Not everyone is using the same version of PHP, MySQL or OS as you
  2. Not everyone is using English as their first language
  3. Whilst you might not be dealing with the kind of databases that trigger out-of-memory errors in your script, some of your users most definitely are...

So after releasing MyActiveRecord via phpclasses last March, I was overwhelmed with the response in both good and bad ways. Almost everyone who wrote said that the class had really helped them speed up a major project they were working on (good!). Also most people really got my motivations for developing the class; Many were quite familiar with Ruby on Rails but for whatever reason were sticking with PHP. Most were after a class they could use to cut down on basic SQL hoop-jumping, but they didn't want to learn an entire framework, and they wanted the flexibility to do things their own way. Many were developing in a PHP4 environment and deploying on PHP5 or vice-versa.

In my update I tried to incorporate bug-fixes, some of the nicer ideas, and stuff that I'd implemented half-heartedly and wanted to do properly. The major new features are:

  1. SQL Logging (handy for debugging)
  2. Query Caching (improves performance)
  3. Single Table Inheritance (allowing you to store a class hierarchy in a single table)

There are also some new, useful methods:

The Prepare() Method allows you to escape SQL parameters in a hassle-free way, using sprintf syntax. Eg:


$condition = MyActiveRecord::Prepare("first_name LIKE '%s' AND age > '%d'", $_GET['first_name'], $_GET['age']); 
$people = MyActiveRecord::FindAll('Person', $condition); 

The FreqDist() Method will provide you with an array containing the distribution of unique values for a given table/field. Eg:


foreach( MyActiveRecord::FreqDist('Person', 'name') as $name=>$total ) { 	print "There are $total people with the name $name"; 
} 

The TableExists() is a utility method to tell you if a table exists in the database or not

 if(MyActiveRecord::TableExists('person')) print '`person` table exists!'; 

The add_child() method provides a convenient way of creating new child objects:

 $comment = $post->add_child('Comment', $_POST); $comment->save(); 

The validadate_uniqueness_of() method allows you to check whether a field value is unique before attempting to save it in the database:

 $person->validate_uniqueness_of('username', 'username is already in use'); 

Most of the changes are under the hood. One you do need to know about is the way MyActiveRecord maps classes to tables. Originally classes were supposed to be named identically to the table in your database. So a Person class would map to a Person table. Unfortunately a bug in PHP4's get_class method meant that this could not be sustained. The get_class function always returns a lowercase string in PHP4. The only reason this didn't cause problems for most users is that most combinations of OS & MySQL effectively give you case-insensitive table-names. However this wasn't true for everyone. The only way to get 100% compatibility for all cases is to mandate that table-names are specified in lowercase. So a Person class will map to a person database table. It's one of those classic PHP frustrations, and it annoyed me no end, but you could say that this whole project was born out of a desire to circumvent PHP's foibles

What didn't make it.

A lot of people asked for stuff that seems perfectly reasonable, but that I decided to leave out anyway. Here's what got left out:

  1. Changes to mappingPeople wanted to be able to append stuff to the front of their table names i.e. myapp_person mapping to Person. People wanted to be able to change the name of the field that acted as primary key etc. I've resisted this because whilst on the surface these things seem simple enough to implement, in practice they add complexity and ambiguities at every level of the class. MyActiveRecord wasn't my first attempt at a mapping class, and defining a few simple, solid rules about naming and IDs was what freed me up to finally build a class that I felt had some elegance and integrity. It also allowed me to document and explain the class without constant caveats and exceptions. So I'm not bending on this yet. (Actually, working around the get_class() bug required me to add a Class2Table method, so in theory, adding a prefix to your table names would be easy enough and I might consider it.)
  2. View logic in the mapper classA few people supplied me with some helpful methods for getting HTML out of the class. Pre-formed error lists and the like. Obviously this is evil, I even feel a bit icky about the h() method, but it's just so damn handy and I stole the idea from Ning. Actually, I do have a class that takes a MyActiveRecord object and then uses methods to spit out helpful HTML fragments, but it's not quite ready for production yet...
  3. Event hook methodsSome people supplied rails-esque event-hook methods like before_save(); before_destroy() etc.. After some deliberation I decided not to add these. Why? Because I think you can achieve exactly the same thing by extending the class. That is one of the key advantages of OO after all! For example:
     Class Person extends MyActiveRecord { 	function save() 	{ 		return $this->some_cleanup_or_test_method() ? parent::save() : false; 	} } 
    If someone can make a good argument as to the advantage of putting blank event hook methods into the class I'll look into it again, but for now I'd rather prevent the base class from getting any broader!

  4. Shorter NameSo some people are developing RSI typing the same 14 characters over and over. I admit, the name is ugly and too long, but it has several marketing advantages with regards to describing what the class does, picking up search engines and so on. This one is easily solved anyway:
     Class AR extends MyActiveRecord{} Class Person extends AR{} $people = AR::FindAll('Person'); 
    Actually I really recommend this approach whenever you build a serious application, as this gives you an opportunity to extend all sorts of basic functionality like saving etc.. at your application level. For example, you might decide to extend the save method so that it stores a serialised copy of every object that's ever updated, giving you a complete transactional history of every object in your application. It's easy to do. Plus when you develop some great ideas in your extended classes you can send them to me and I'll have nice cleanly separated code to incorporate into the next version of the base class.

What's next?

Apart from the fact that I'm extremely busy anyway I don't really intend to develop this class a whole lot further. It does a pretty nice job, and it's already a lot bigger than I would really like. There will be bugs in this release, and I will fix any that are reported. Other than that, I intend to improve the general integrity of the class and add some magic field names (datetimes called modified_on and created_on will get time-stamped automatically, stuff like that). I want to deal with the caching and encapsulation of related objects so that - for example - saving a post object will automatically save changes to any child comment objects.

Once those basic features and bug fixes are implemented I'll declare the class at version 1(beta) and after a reasonable time to fix any bugs I'll declare it 1.0.

I'd like to thank Walter Lee Davis, Mark Kaye, Mike Stupak and Mihael Konjevic in particular for their help and feedback to date.

0 Comments

links

categories


archives