The best PHP framework is…

I’ve never been a fan of fully-fledged (“big“) frameworks like Symfony or CodeIgniter. (There, I said it!) .

I’d rather just start from somewhere comfortable where I know every class that’s in scope and I know nothing is present that I don’t absolutely need.

It seemed silly to me that the simplest web applications can be 80% framework code and 20% application-specific code (even if that’s not at all in terms of code coverage on average, just present code).  Another reason was that I love to learn.  I don’t feel like I’m learning when I’m just learning an API or the contents of some slightly pretentiously presented user manual for a framework.  Writing a framework, however?…

~ My angle ~

Looking at the things my friends use the big frameworks for; I find it strange that most of the use is to do simple things like handling the flow of the application; things we used to do with a few lines like a switch or if…elseif…endif statement.

Two years ago or thereabouts, I noticed that each time I started work on something new in PHP, I’d start by copying a load of stuff over from my last project.  I then noticed that I’d become what I hated, kind of.  Still, more recently, I decided to neaten this collection of classes up, formalise it and write some documentation that is understandable by people other than myself.

My framework, I have named simply Transcend Framework (TF  for short and in the code…) to fit in with the branding of the rest of the stuff I work on.  What does it include?  Not much.  I don’t need much.

  • MVC stuff - Model & Controller abstracts and Views implemented using a fast, simple template engine that is extensible through inheritance.
  • Extends PHP’s autoloading mechanism – just makes everything a little neater and quicker to get started.
  • A configuration & message handling mechanism to ease the debugging and testing of applications in development and the configuration of applications in production.

It’s on GitHub if you want to take a look at it, but I strongly suggest you have a bash at putting something together yourself.  It’s a great learning experience if you are just getting in to PHP.  You can get a handle on organising classes, writing good inline documentation, inheritance, interfaces and lots more.  Frameworks generally push language features to the max; so it’s definitely a good way to polish your knowledge.  Feel free to fork TF and have a play.

~ Cringey summary ~

So, the answer to my slug in the title of this post?  Your own.  I think everybody should have a toolkit of code they use a lot, keep it as a git repo, include it with submodules so it’s easy to roll out updates to all your uses of it.

Cue cringes.

 

I think a touch screen equipped Mac is on the way

In progressive versions of Mac OS X, I think things have become more and more touchy-feely.  By that I mean things are pointing towards the introduction of a touch screen-equipped Apple device, perhaps running OS X and not iOS.

While I have been disappointed by previous dumbing-downs in OS X, this is something I have wanted to see for quite a while; and now I finally think we might see one some time soon.

Recent feature introductions into OS X have all the hallmarks of working well on a touch device; not just of features that have been directly ported across from the hugely successful iPad.  I don’t know if this is just me being a complete dumbass; but I struggled for ages to find a way to dismiss persistent popups without invoking their associated action in the Notification Center, for example the App Store’s “Software Update” popups.  I recently discovered how it’s done – swipe.

This seems a little strange to me given the fact that currently no Apple-built OS X devices ship with touch screen functionality.  The “swipe” is a strange gesture to perform using a mouse – it’s more of a “click and drag” than a swipe anyway.  Granted it’s a little more reasonable on a trackpad (swiping with two fingers dismisses notifications on those); but this feature screams “touch screen” to me.  Some of us are still using a regular mouse you know, Apple?

I know it’s not conclusive, but it certainly indicates that Apple are pushing people away from the mouse and towards other input methods – perhaps even full touch screens a-la-iPad.

We shall see.

A little demo of Aperture Size

This is a short post; just something cool I made while getting to know my new camera and lens.  I thought it makes a great example of the effect of varying aperture size on the photograph.

Probably all too simple for the pros out there, but for us newbies it kinda explains quite well.

Important to note is that the focus point isn’t varied at all here – the focus is manual and is fixed on the front battery (closest to the camera).  The only thing that changes is the f number.

Need for Speed

We recently invested in broadband from Virgin Media.   Previously, we were stuck with BT and their ADSL, which, out in the sticks, tends to be quite poor.  The speeds we used to expect, or rather endure, were around 4Mbps down & 400Kbps up at their very best.  This was with all the improvements we could possibly muster – expensive shielded cabling, expensive ADSL modem/routers, no telephone extensions, short runs of cable… the works.

So we decided to opt for Virgin.  They had been spamming us for some time with offers of ridiculous speeds for prices not too much higher than we were paying BT for their “offering”.  Their installation was a little rocky – they sent the wrong kind of “team” out to start with because they thought we already had a “drop” (A coaxial cable that runs from the tap point in a cabinet a little walk down the street to a box on the front of your house).  Two weeks later they sent some guys to dig up the lawn and install the drop cable, then a week after that the original team came back to do the modem and local wiring installation.  We have had a stable, 100Mbps/10Mbps connection since.  Couldn’t be happier with that.

Speedtest

Looking at technicalities, the connection is based on DOCSIS, or more accurately, EuroDOCSIS 3.0 - The European flavour of the Data-Over-Cable Service Interface Specification.  It’s a standard that describes high speed data transmission over a regular Cable TV (CATV) HFC (Hybrid Fibre-Coaxial) infrastructure.

The router Virgin supply – the Super Hub – is effectively a rebranded Netgear specced with a EuroDOCSIS modem instead of an ADSL one.  It’s… alright… certainly not as Super as the name implies.  There are a number of bugs and it is quite restrictive in what you can do with it.  The best move by far is to place it in “Modem” mode and connect it to another more functional router.

One serious missing piece of functionality is the ability to set the DNS servers used by the router to resolve domain names.  This makes it impossible to easily deploy OpenDNS or Google DNS without use of the aforementioned Modem Mode functionality.

Bugs I have encountered include the crazy data counter that increases by about 4GB a minute under certain conditions:

This is apparently a known issue, however.

I also discovered a number of lesser Cross-Site Request Forgery vulnerabilities affecting the Super Hub Web GUI; perhaps the most serious of which pertains to sites being able to enable remote access to the router and then of course record the IP address of the visitor.  I have documented this in a video here.

These issues aside, however, Virgin have, as the annoying PlusNet man says, done us proud.  We have had practically no downtime on their end and they are offering to upgrade us to 120Mbps/12Mbps in the near future for free too.

Can’t say fairer than that.

Digging into DVRs

During the summer holidays, my friend and I installed a CCTV system at my home just to improve the general security.  I had to take a dive into the world of DVRs (Digital Video Recorders).  I found that, like most product genres, there is a distinct line between quality, branded products and budget unbranded or vaguely-branded products.  I didn’t fancy spending upwards of £300 on a DVR, so I went for a reasonably mid-quality model recommended to me by my friend.

The DVR I went with is a generic, reseller-branded model sold by Aban - a Manchester-based CCTV firm:

The designation is VU-431 - but this seems to have been assigned by Aban themselves.  Inside, it’s fairly straightforward – SATA hard drive, connected to a board with a cheap SATA controller and HiSilicon Technologies CPU.  A small amount of flash memory containing the Linux (Busybox) OS and the actual Application that drives the DVR is mounted as the root and the peripherals (IR receiver for the remote and the actual video encoder chip) are available as devnodes in /dev/.  It provides an shell interface (ash) over Telnet with a root password that is immutable by the end user using the normal DVR software or client.

It works fairly well – in that it records things that happen outside my house.  That is, however, unfortunately the limit of the things it does well.

The web interface is presented as an ActiveX control; an antiquated framework by Microsoft for, among other things, presenting interactive applications to the user in the browser.  Why they couldn’t have just used Flash or something, I don’t know.  In any case, I’m a geek, as you probably know, so I couldn’t just sit back and be happy with the ActiveX rubbish.  I did some digging

Continue reading