↓ Archives ↓

Making your web service embeddable

Introduction

One thing that keeps filling me with awe every time I reflect upon it, is how the world wide web has evolved over the past decade – and still keeps evolving. In March 2000, I was twelve: I didn’t have my own computer and the only computer I had access to was on dial-up. I believe we had a 28.8k modem, and that just about allowed me to load altavista in search of cheatcodes for Sim City 2000 or C&C 1.

I type this as I sit behind my custom-built PC, 23″ widescreen monitor (while wishing I had a second one), with an iPhone in my pocket that alerts me of facebook notifications faster than the browser I also have facebook opened in. The editor I use is powered by javascript and automatically saves what I write as I write it. In the meantime I am listening to music from a youtube video that was embedded on a different website while also browsing two other websites on which I’m logged in with my facebook and twitter accounts respectively. Admittedly, this is a bit of a cheap write-up and certainly not the first one at that, but the underlying thought here is that many of the above web services are no longer confined to their own domain and have become more and more interconnected.

For this post, I’m going to look only at what I’d dub the most basic form of embedding: the ‘coppy-and-paste-this-html-into-your-website’ method, or so to speak. The sample project to which I will refer throughout this post is the Digillusions website on which I included the ability for users to embed polls into their own websites. For good measure, I’ve included a poll below to prove that what I’m talking about actually works. If an image is worth a thousand words, a live sample must surely be worth a hundred times that.

Continue reading →

KhanAcademy, a peek at the future?

Today I was introduced to a concept I’m now wildly enthusiastic about. KhanAcademy is the brainchild of Salman Khan and allows you to watch and practice everything from basic addition to college-grade trigonometry. Practice exercises seem to focus mostly on maths but I have no doubt that will be expanded upon soon.

So, great, another e-learning site! What’s new? Well quite a lot actually: for one, all the content on Khan Academy is completely free of charge. We’ve already seen MIT pushing boundaries in free education with its OpenCourseware program, but that’s just raw material. Certainly not to be frowned upon, but it’s not quite the same as a patient tutor teaching you things. And that’s exactly what Salman Khan does for you.

At the time of writing this, the site features over 2400 videos on topics ranging from algebra to finance to history. Having checked out several videos myself, I find myself immensely impressed with the educational value. Khan has a pleasant voice and really touches upon the foundations of the concepts he tries to teach you. There is no “just memorize this formula and you’ll be fine”. The aim is to really make you understand what you’re doing by guiding you through Khan’s thought process as well as exploring other ways of going about things. Continue reading →

A useful PHP database wrapper class

UPDATE; Download the files here: PHP Database Wrapper Class

I don’t think there’s any PHP developer out there that at one point hasn’t been frustrated in their dealings with databases. Do you use the mysql_ extension? It certainly is more simple to use than the mysqli extension, but then, mysqli is supposed to be faster as well as more secure. And what about hosting? Wouldn’t it be a pain if your project worked like a charm on your development machine and then your shared hosting provider didn’t provide the mysqli extension?

Of course you could go with a PHP framework like CodeIgniter or CakePHP, but unless you’re working on a big project, you might find that overkill and more of a hassle than just writing your own code from scratch.

Having faced these exact dilemmas on many past projects as well, I’ve long ago written a database wrapper class which takes all the annoying intricacies out of my hands and provides me with a simple and clear interface to MySQL databases. Continue reading →