Roscommon. After driving for an hour we stopped at a garage to ask directions, and I noticed this. It dates from 1937. Chassis and V8 engine by Ford. Coachwork by… a blind guy with a headache, apparently. It’s long retired of course, but the garage owner said they still take it out for runs occasionally. Only short ones though, as it does about four miles to the gallon. The thing must’ve had to carry more petrol than water. Which is sub-optimal.
I’ve been talking about PHP a lot recently, but so far I’ve said little about what it is and how it works.
So, What is PHP?
PHP files are a lot like HTML web pages, but also contain these PHP instructions or ‘scripts’. In normal Web browsing, the user requests a file by clicking on a link to it. If this is HTML it is sent directly to them, to be rendered on the screen as text and images by their browser. If it’s a PHP file however it is sent first to the PHP interpreter on the server. Here the scripts it contains are executed and the results – which are always HTML – inserted into the document where the script used to be. Now entirely HTML, it is sent to the user’s browser to be rendered in the usual manner.
So What Can They Do There, These Scripts?
In this way PHP can take requests from a website user, turn them into SQL or some other database query language, and format the results of the query as HTML to send back to the user’s browser where they can be displayed. As I mentioned in the previous post (and the one before that), this is a hugely powerful and flexible technique that can be used for untold purposes. While pages of search results would seem an obvious example, that’s just the nursery slopes. Systems as complex as Facebook are built in PHP. And systems that are good too.
¹Don’t worry if you don’t, there is much you can do with PHP without knowing any programming at all. Thanks to the likes of WordPress, Drupal, Joomla and many more, you can install and run a PHP-based site without speaking a word of the language.
When considering what Content Management System to deploy today, one question needs to be answered first.
Why not just use WordPress?
WordPress was created to be the software behind the popular blogging service¹, and only a few years ago would have been dismissed as little more than that. It was never conceived as a general-purpose content management system, but designed with the singular goal of getting a person’s words and pictures onto the Internet simply and quickly. The thing is though, that is the core functionality of content management. Do it particularly well, and you’re onto something.
Combine that solid core with the ability to add functionality and you’re really onto something. Though invented for blogging, conversion into a different sort of content management system – say a gallery, a forum, or an e-commerce store – is available through third-party plugins. There is a staggering ecosystem of (the last I checked) nearly 29,000 of these. Consequently WordPress has become the most popular CMS in the world. And not by a margin – almost by an order of magnitude. Sixty percent of all content-managed sites use WordPress, one in five out of the ten million most popular sites on the Web. I’ll give that a second to sink in.
But by the same token, using something so well-accepted feels almost like copping out. We’re students of this technology, we’re assumed to be on the cutting edge. What’s the point in being just part of the crowd? There are innumerable content management systems out there. Many use the same attractive PHP + MySQL open source formula. Others again are based on ASP, Java, Perl. Some are even designed specifically to create online galleries, which is certainly closer to what our client needs than a blog is. But while these are worth looking into, the requirements go well beyond just the presentation of images. There is a great deal of text that needs to be easily and well presented, and a dedicated gallery system might not envisage that. The client also needs to manage membership, promote upcoming events, and automatically archive past ones. We will need something extremely flexible, and WordPress scores highly there.
But it’s not alone. Joomla¹ is also designed to be extended – it seems particularly rich in image galleries – and unlike WordPress it was a general-purpose CMS right from the start. It will have to be on our shortlist, especially as the team has had some experience with it in the past. Perhaps the biggest mark against it is that, with only around 6,000 available extensions – about a fifth of what WordPress offers – it just seems less likely that the functionality to meet our client’s needs will be readily available.
Initially, my instinct was to use Drupal. Also designed from the start to be a universal content management system, this one has put even more emphasis on flexibility. So while with WordPress you can have a usable blog virtually the moment it’s installed, Drupal is at first confusing – all you have is a framework, with few features except basic database and user management. Useful functionality is added by downloading and installing “modules”, over 25,000 of which have been contributed by the community, very comparable to WordPress’s 29,000 plugins.
But while plugins and modules might sound like two ways of describing the same thing, there is an important conceptual difference. WordPress extensions are very much goal-orientated. If you wish for example to add gallery functionality to your site, you compare the galleries available and plug in the one that best suits your needs. Drupal modules are function-oriented. To add a gallery, you consider what additional functions it would actually require – image management, display, cataloguing and captioning for example, possibly also resizing and retouching – and add modules for those functions. You’ve got a huge smorgasbord of features to avail of, what you mix is up to you. Such a level of flexibility is both challenging and exciting. A much more precisely customised result should be possible with Drupal, and this is why it is considered by some to be the best CMS of all. But the learning curve is also infamously steep (see illustration). I have to admit that this is part of the attraction. I’ve built several sites based on WordPress and it presented little challenge; the Drupal one I started over two years ago is still far from finished. It definitely represents the greater learning exercise. But that is not the objective today. Even if the team could become sufficiently skilled with Drupal within the timescale, it seems likely that that time could be better spent.
Plus, with Drupal skills being relatively hard to come by, future site maintenance would inevitably be more difficult. Perhaps a clinching argument in favour of WordPress is that, as by far the most popular CMS in use today, future maintenance and improvement should not be a problem. Indeed as an open source tool with both a strong community and the backing of a commercial interest, WordPress would seem to combine the best of both worlds in terms of support.
I wish we could use all three just to see which came out best, but the postgrad workload is too heavy for that. We should be making our decision shortly. For now though, my money’s on WordPress as the one most likely to deliver the client’s requirements without excessive drama.
¹WordPress the open source blogging software, sometimes also referred to as WordPress.org, should not be confused with WordPress.com, whose business model is the hosting of WordPress-driven websites. Both the software and the hosting service are managed by the Automattic company. An aside: Though basic WordPress.com blogging is free – this site uses it – the feature set would be too limited for our client.
²Actually they style themselves “Joomla!”, but I have a strict policy on companies that expect you to shout their names. This policy being: Shush.
For our next project, we don’t just make a website. We make a way to make a website. Ya may have noticed the Web has transformed drastically in the last few years. Well OK maybe you haven’t noticed. Transformation is pretty much the norm for the Web. But in a short time there has been a sea-change behind the scenes. Or a scene change beneath the sea. One of those. To be clear, this ain’t your parents’ Web.
Twenty years ago when HTML was new-born, most pages were just text with a few code words (called “tags”) laced through. You could type a page into a computer by hand, upload it to another computer called the web server, and voilà, you had a website. Or more precisely, you had a document sitting on a server. Someone typed the address of your page into their browser, the software on the server sent them a copy of what you uploaded. Done. Things were simpler then.
You can still do this indeed. It’s easier than you will be imagining to create a basic website. What’s considerably harder is making a page someone will actually look at. Constantly-changing, information-rich things like Google search results or Facebook timelines or eBay auctions clearly aren’t waiting around as static documents on a server somewhere. Nor are they being typed up on demand by millions of underpaid interns – though that is an entertaining thought. All such modern sites have one thing in common: a database.
This really means no more than putting your information into tables so it’s logically organised and accessible, but the difference that makes is enormous. Say you’re looking for a particular car, a blue Golf around ten years old, for less than about 2,000 eurodollarpounds. Imagine having to read through the details of hundreds and hundreds of used cars arranged in no particular order. You’d settle for the first one you found. Hell after an hour you’d settle for a burnt orange Daihatsu three-wheeler. But if the info is in a database the computer can do the tedious work for you, instantly winnowing that huge list down to the few that meet your criteria. Most excellent; this sort of thing is why we keep those darn machines around.
And a huge proportion of modern websites also work this way. Instead of sending out static documents on request, new software on the web server takes the visitor’s input, queries the database for relevant information – which could include images and other media as well as text – and pours the results into a template to create a custom page. And that is what it sends back to the visitor – a document that didn’t even exist before they asked for it.
This ‘new software’ on the web server is called a Content Management System, or CMS. You create the templates that dictate how your pages will look, you put the information into the database, but the CMS mixes them together and serves them to your website visitors. Modern ones even give you tools to create those templates and an interface with which to enter your information. A good one is as easy to use as a word processor – like the one I’m writing on here.
A content management system is what we need for the ‘team thesis’ I spoke of. We could make our own one using PHP, a popular language for writing code that runs on web servers, but the objective is not to show off our coding skills. The objective is to deliver a real working solution to a real working client. If we were consultants here, we’d recommend they use an existing CMS, customised for their needs. So that’s exactly what we’ll do for them – choose the best for their needs, and customise it to suit them even better. There is a huge range of great ones available.
The question we face now is, which?
Especially if your science is physics. Obviously something to do with magnetic… [Waves hands around] domains. Yeah, definitely those domains probably.
The tweezers here have two small disc magnets attached. When the arms are squeezed together, one magnet flips up to contact the other arm. When they’re squeezed again, it flips back – and so on. The freaky aspect is that it happens so consistently. Same input but opposite outcome, every other time.
It seems like there’s some sort of “magnetic equilibrium” that neither position can quite satisfy. Whichever one it’s in, the system takes any opportunity to get out again. It’s also very dependent on how the magnets are positioned. I got them this way quite by chance, and I haven’t (yet) been able to reproduce the arrangement. One other clue: Their poles are aligned in the same direction.
Answers on a postcard. Or in the comments, which I suppose are a form of post-post postcard.
Sorry. First day back in college. I have a bit of delirious.
- Magnetic Field Experiments (invent.answers.com)
- Magnetic Charge Crystallization Directly Visualized in Artificial Spin Ice Material (azonano.com)
- Magnet therapy claims not supported by science (beaconnews.ca)
Only, not quite. This time I’ve eschewed not just Vodafone’s particular mix of Android, but Samsung’s too. Up until now I’ve stayed with the stock firmware so that I would be reviewing the standard user experience. This time I decided to go the whole hog and “root” the phone – which basically means giving myself administrator privileges so that I can change whatever I like. Obviously that involves some risk, but it makes your device a lot more interesting. Particularly it means you no longer have to stick to official builds, but can try out customised versions of Android.
A word of warning first though. Certain models of the Note, and several other Samsung Galaxy phones, are vulnerable to a problem known as “BrickBug”. Due to a design fault, if the memory chip it contains is erased in the wrong way it can never be written to again. Thus the device is rendered absolutely unusable and – short of an expensive mainboard replacement – irreparable. Which is depressing. So proceed with caution!
It can be worked around safely, but I won’t attempt to give comprehensive instructions here. Go straight to the horse’s mouth – the invaluable XDA-Developers forum. Actually it’s well worth looking around there before you do anything with an Android phone.
Indeed it was here that I came across the version of Android I chose to use: Sweet ROM. This is one guy’s personal mix that he released to the public, but I think he got the balance pretty right. And unlike many custom versions of Android it’s designed specifically for the Note and so retains all its pen abilities. Here’s the (almost) complete feature list provided by the author – which you can skip if you hate jargon:
- LT9 Firmware
- Kernel Philz XXLT9 v5.08.5 (thanks Phil3759)
- Modem LT3
- Deodexed & Zipaligned
- Full Root
- SuperSU (thanks Chainfire) & busybox
- 24 Toggles including working 2G/3G toggle controlled in Settings (Silver 3D theme thanks Dr.Ketan)
- Full Airview in Gallery, Video, Lockscreen Notifications, Email & Message. Partial in Snote & Splanner
- Multi Window Add All Apps S4 white theme
- SG4 Weather Widget
- Samsung Camera Shutter Sound on off hack
- MMS Hack – No SMS in call Log, 200 recipients & No SMS to MMS Auto Convert
- TW Launcher rotate 270 degrees
- Call record and no ascending ringtone & 2G/3G hack
- Ink Effect Added to Settings/Lockscreen
- Smart Rotation & Smart Stay
- LockScreen Shortcuts, News Ticker & Weather all working
- 4 Way Power Menu
- Enabled extra widgets Negative Colors etc
- Added Nova Launcher
- added Flash Player
- S4 Wallpapers (modded SecWallpaperChooser.apk)
- Resized Popup Browser with call up app (thanks vijai2011 & kam333)
- Transparent Status Bar with White S4 style icons & circle percentage battery
- Added Internet Speed Meter Lite
- Sub Symbols in stock keyboard
- Build prop tweaks for battery & performance
- All Mods & Hacks done myself (unless mentioned) using LT9 firmware
- and more I can’t remember
To translate: it’s a lot of thoughtful tweaks done by an experienced user. And lovably, it cuts out most of the pre-installed (and irremovable) apps that phones come burdened with. Only real essentials are there; the rest you can choose whether to install.
It’s a great mix and I’m enjoying using it – it’s like my phone came back from a holiday to the feature. Now I have root though it’s almost trivial to switch to other customised versions, and I’ve no doubt I’ll be trying some more.
- Sweet ROM video demo (youtube.com)
- Tweak now available that lets you run TouchWiz and stock Android on one Galaxy S4 (news.yahoo.com)
- [Report] Samsung Galaxy Gear to come in Five Different Colors (goandroid.co.in)
Yeah, well. When you find yourself wedged head down in a narrow, cobweb-filled space between ceiling and roof tiles, you do tend to take stock of your life.
I was laying a cable to the satellite dish; a second one, so that we could record one channel while viewing another. But the original run had been put in when the house was far from finished. All is buried now behind stud partitions and under layers of insulation. My only choice was to to squeeze into the little triangular storage space at the side of the attic room, crawl along its length until I reach a gap that slopes down to the eaves, through that to where the slates meet the top of the stone wall…
Except the sloping part is way too tight. I probably could worm my way down it, but worming back up in reverse might be a different story altogether. One with the headline “Skeleton Discovered”.
Luckily though, I see a literal way out. Light shines dimly in through a knothole in the fascia board. Thanks to a slight stiffness in the cable, from where I’m lodged I can maybe feed it through – and from there run it along the front of the house, hidden by the gutter. It’s a matter of a few feet, but in the claustrophobic location it feels as tricky as in-flight refuelling.
Why all this death-defying effort? It’s not like there’s so much good on television you need two channels of it at once. Ludicrously perhaps, it’s mostly because I came across a decent satellite card that was almost too cheap not to buy, about a quarter the price of my original one. Admittedly, that was a much nicer job. It can pick up Saorview, and comes with a fully-featured Windows remote control. The remote (and software) with the cheap card are more novel than useful, but that didn’t matter. It picks up satellite channels – even HD ones – perfectly well, and can be controlled seamlessly by Windows Media Center. (Or MythTV if you like.) The result is just an easy-to-use entertainment system, one that doesn’t intimidate parents or children. All the cleverness happens behind a pretty blue interface that anyone can use to surf, record, and pause TV.
I hope Microsoft aren’t in the process of quietly dropping Media Center. In Windows 8 it’s an extra you have to buy, and even then you can’t boot directly into its television-friendly interface but still have to go via the screen of tiles. Yes, when Microsoft has an idea nothing gets in the way. Your phone, your tablet, your desktop PC has to have a touch interface. Even your television on the other fucking side of the room has to have a touch interface. That’s vision taken to the point of obsession. But it would be a terrible shame if they gave up on Windows Media Center just because its face no longer fits. In its quiet way it’s one of the best things they’ve done, with possibly the nicest EPG of any satellite/cable/PVR device. It takes a bit of trouble and/or experience to set it up just right, but you can get all the channels you actually want into one manageable menu, and banish all the porn and religion to the outer darkness.
Perhaps the worst-designed part is arranging the order of your channels, which has to be done painstakingly with the arrow keys of the remote. Here is where a touch interface – or just drag and drop – would be a good idea. But no, this is a home entertainment or “10-foot” interface, so everything has to be done via the remote.
I think we’re zoning in on the problem here, aren’t we? It’s not bad interface design per se. Microsoft make some great interfaces, and probably research human-machine interaction more than anyone else in the world. It’s when a design orthodoxy takes over. This one is for remote controls. This one is about touch and touch only. As if letting us plug in a mouse or boot straight to the desktop would mean abject failure. It must be PURE. And so we actual users have to find ways to get around all the convenience they invented for their ideal users.
Why not have devices designed to be used from whatever distance, by whatever means, that we want to use them?
- There’s Yer Feckin’ Start Button (i.doubt.it)
Tricky Curves – 4X Magnification
Obsessive attention to detail – that’s the thing that makes me not too bad at design. Also, the thing that makes design… maybe not so good for me. Several kinds of work will keep me up late into the night. But there are few that I will return to the moment I wake, brimming with new things to try. Web design, particularly in the final stages, is a constant stream of interesting problems.
CSS (Cascading Style Sheets), the design language of the modern Web, is a simple yet powerful tool. A style sheet is just a list of instructions about how things should look, really more like description than programming. I’d encourage anyone to try it out, no matter how non-technical you consider yourself. Sadly though, even today there are discrepancies in the way different Web browsers interpret these instructions. It’s not as bad as it was; there was a time they weren’t even trying. Microsoft’s Internet Explorer and Netscape’s Navigator (ancestor of Firefox) both had features actually designed not to work in the other. Today they at least seem to be aiming at the ambitious standards set out for HTML5 and CSS3. Browsers once competed with each other, now they compete with apps – nothing like a mutual threat to enhance cooperation.
Minor as they are, these discrepancies can still make the design that works beautifully on one platform look like something flung from a catapult on another. There really is no alternative except to test and test and re-test – on Windows, Mac OS, iOS, Android, Linux and so on, in all their different browser versions, at screen sizes from HD to phone. The permutations are slightly mind-blowing.
You find a bug, you think up or look up or remember a solution, you see if it works. If it works in Firefox on a PC you see if it still works in Chrome on a tablet, so on and so forth. When you’re sure you’ve solved that, you immediately go looking for another problem. For the best part of last week I did little but eat, sleep, and hunt bugs. And I was cutting corners on the sleep.
Don’t mention corners… See the one in the picture? Most of a day, that cost me. A lot more is going on than meets the eye. For a start, round corners can be a challenge. They look good, and they’re a part of the CSS3 standard, but people using Internet Explorer 8 and (God forbid) lower don’t see them. Well, you face a choice there: recreate the effect using images of round corners, or let the design gracefully fail in IE8. And really the latter is the sensible approach these days. Which is a little rough on users of XP – still my own favourite version of Windows – but frankly if you’re on XP and not using Firefox or Chrome then you (or your IT department) need a strong light shining up your nose.
Round corners at the foot of a page though are harder still. Look closely and you’ll see that the corkboard background pattern overlaps below the corner. (The random nature of the pattern helps to disguise this.) What’s happening is that this is an extra piece of the background overlying the rest of the design – with a bottom end for the page, complete with rounded corners, overlying that again. This whole unit then sticks to the foot of the page’s contents. Carefully-chosen margins meanwhile make sure that it always has precisely the same width as the rest, no matter what size the screen. Oh and those margins have a length described as a negative percentage, which is a little mindbending in itself.
Next problem is that 3D shadow, to make the page look like it’s inset into the background. CSS3 now has a very attractive way to do soft 3D borders, called “box-shadow”. Unfortunately, as the name suggests it only works for things with four sides. My footer wants a shadow on just two of its sides, and for that my only reasonable option is an ordinary border.
The tricky bit then is where they meet. While a border looks much the same in every browser, the shadow has properties of ‘blur’ and ‘spread’; these make it more realistic, but also more open to interpretation. Therefore it comes out looking wider in some browsers than others. What do you do then when the inconsistent shadow meets the consistent border?
The solution I found is a mad hack: I made the border 2.5 pixels wide. This of course is nonsense. The pixel is the base physical unit of the display screen, you can’t have half of one. What happens in practice is that different browsers interpret this nonsense instruction differently – crudely speaking, some round up and some round down – but they do so in a way that broadly matches how they interpret the box-shadow. The upshot, as the images above show, is that the borders join pretty smoothly in the four most popular browsers. It takes magnification in fact to show that there’s a join at all.
I’d like to say this was unusual, but really this is the essence of the Web design job – a strange blend of technical precision and lateral thinking. Part tweezers and microscope, part bent paperclip and sharpened spoon. It’s a voyage deep into an unusual problem-space, one that takes over both my waking and my sleeping mind.
Do Not Try This At Home. Do Not Try Something That Looks Even Vaguely Like This At Home.
Deadlines were passed and I could at last return to the furniture restoration. Working in the sun, I was making fine progress with a new fancy flappy sanding attachment. And then my drill decided to start stopping.
Bugger. Checked the cable, it didn’t seem to be that. This job might be non-urgent but I can’t really afford to be without a drill – or, to replace it right now. Nothing to do but strip the thing. It seemed to stop working when held at certain angles so I worried that the bearings were worn, allowing the moving parts to slide around excessively and foul – that is, hit something they ain’t meant to hit. My drill is old.
Fortunately though it’s a Bosch, nicely robust and built with a view to maintenance. Eight screws and it’s open. Here be the innards; the yellow bit on the left is the trigger and speed control, the white bit holds the carbon brushes that transmit current to the moving core of the motor, the black part is the torque control, and the big grey lump on the right is the outer, non-moving coil of the motor.
And here’s the core of the motor and the gearing, placed back into the casing without the parts that should surround it so that I could check that it moved smoothly and looked right. It did. The mystery deepens; nothing appears to be wrong with this drill.
Here it is all cleaned and reassembled. As you can see in the video up top, it runs. But only sometimes… This was infuriating now. Hours of re-checking and tweaking later, I finally realised.
It was the cable all along. Though I’d looked to that first as the most obvious thing, I hadn’t checked it thoroughly enough. The fault was intermittent – a break in a wire somewhere near where it entered the handle. Which of course caused it to stop only when held at certain angles… And it shouldn’t have been a surprise; the rubber boot thinger meant to prevent too much flexing at precisely that point had worn out years ago. I cut a few centimetres off the cable, rewired it, and remade the rubber boot thinger.
It now runs perfectly. So, good to do some maintenance on an essential tool of course. But basically I lost most of an afternoon and the whole evening because I’d leapt right in instead of being slow and methodical. I’d like to say that life taught me a lesson here, but to be honest life keeps trying to teach me that one.
Ain’t it spacey though?