Social media. It's a phenomenon, the hottest product of the last couple of years, essential for any business and an insutry worth billions. With it, your company can get more engagement, more conversions, more uniques. Without it, you're not even worth bothering with - unless the person doing the bothering happens to be a so-called social media expert who wants you to pay them to spend the day on Facebook, something which would result in dismissal from any other job. Therein lies the first of our problems. Are all those over-hyper superlatives at the beginning of this paragraph just marketing of a more classical nature?
On the surface it does seem apparent that social media is part of a revolution in marketing; no longer does marketing just happen on billboards, or passive segments of television, or alongside our inbox. Now it's found its way into our social groups and our friends are even sending it to us with the promise of free kippers from the company who's products are being advertised. However the subsequent fact that things like this bring into existence new possible avenues to market seems a bit far fetched. Sure, we've seen this marketing have positive impacts on items that have used it, but not a significant departure from what we had before. Coke are still the biggest soft drink producer, McDonalds are still the largest cause of obesity and Carling/Fosters/Stella still all continue to make and sell s**t beer in enormous quantities. In fact that only brands that I can really think of that have surfaced over the past few years are Facebook, Twitter and LinkedIn - the social networks themselves.
Well, you may say, what about viral marketing, surely that works? To which I say consider it's name - viral. Not exactly a good word is it? Viruses spread maliciously and without concern for what's around them, which doesn't exactly make you feel amicable towards them. For every product that "goes viral" and gets a bucket load of users there are a few hundred that just mulch around in a petri dish and what people are quickly realising is that the ones who's use of "viral" marketing succeeds are ones which were good anyway. That is to say we can't prove they'd have succeeded without "viral" marketing but it's damn sure they'd still have done better than the one's that failed even with attempts at the "viral" effect. For the most part "viral" is just another annoyance, encouraging me to de-friend people who share every last freebie post in the hope of winning a year's worth of free kippers.
So finally on the marketing side we have that word engagement which roughly translated means "now you're aware that all your customers are bitching about you and have a life line to sort yourself out". I have only engaged with companies on social networks to complain about them; that isn't to say I do it a lot, but why the hell else would I (unless they're offering free kippers)? The fact that a company has a Twitter account means I can slag them off and someone sees pretty darn quickly - which is great from a consumer point of view, but it just rights a wrong that's gone on for far too long anyway. On that, unfortunately companies will eventually realise that just like letters appearing in Which? or on BBC Breakfast, it doesn't hurt their sales too much anyway and just stop bothering.
Worse are the companies that, generally on the advice of someone who's seen chance for a fast buck, decide their purpose in life is to post other websites' news stories in the vague hope of getting followers. The fact that people then actually follow these accounts does mystify me (if your Twitter account exists to post links to blog articles with only a summary of the headline I will unfollow it) but even if they do they will certainly not be "engaging" with you - they'll be off reading someone else's content.
The truth is that at best social media is an arms race; the companies that got their first got a short term benefit because they had an uncontested marketing space, but now that everyone's there it's the same old same old - tons of ads vying for your headspace and all you want to do is watch a video of your friends' baby toppling over. Just how we manage to watch thousands of hours of TV without rushing out every 5 minutes to purchase Bird's Eye's latest excuse to put a creepy polar bear on your screen we'll eventually resist sharing photos of a fat man doing a wheelie for the reward of free engine degreaser. Just like companies wanting better SEO are far better off just having a clean website with decent content, companies wanting to benefit from social media would be better off producing a product or service that people actually want to talk about, and shoving the free kippers up their a***.
The word commune isn't used a huge amount in the UK; I first heard it in an episode of the brilliant US TV series, Veronica Mars where Kristen Bell's character is asked to "rescue" a rich boy who's run away to join a commune. She suspects a cult, designed to lure away impresionable kids to fund some form of dodgy venture, but discovers people who just want to leave peacfully in their own sustainable society, and ends up shamed at her attempts to find wrongdoings behind their "pleasant facade". When I left Aidan's college in Durham I found myself pining for the life I had there. It wasn't the lack of "real world pressures" or the cheap beer, or even the friends (thankfully we meet up a lot). It was the fact that the college environment was a genuine and close community, where even if you didn't know someone you probably knew their face, and the shared sense of belonging made personal connections far easier to form.
Of course in the real world things are different; I had a conversation with someone where this was pointed out to me - the college life was a bubble, insulated and separate from society. Because of this nature it could run at its own pace, albeit with a steady turnover of members, and not have to interact with entities outside itself. Whilst in some cases I'm sure this argument could be made I wasn't satisfied at that - in my opinion college did have big interactions with the outside world, both with other colleges, the unversity and the local community. Those weren't always beneficial but to think we were isolated would be to take a distant view of things. The other argument was that even with the yearly churn, new members were aware that their stay would, generally, be at least three years - that sort of future knowledge helps with commitment true, but I was most commited in the final 6 months, even when I knew I wouldn't be staying longer. So it didn't sit right with me that this life was past - the word commune had gained greater meaning for me.
The difficulty from there was how exactly does one go about recreating that kind of communal spirit? College had people packed in tight, and a structure of social events right through to ensure that people met and mingled and got involved. Looking around my street in Bury I realised I didn't know a single neighbour, and the reasons why it was difficult for this to exist in the real world were more obvious - people come and go these days, living in different areas or even cities, a wide variety of ages, races, religions, hobbies, kids etc. This was the reason why the communal spirit didn't exist - everyone had their own things to deal with, their own friends and didn't need it. Still, something wasn't quite right - this shouldn't be an impossible dream.
Fast forward over a year later and I think I'm on to something. Towards the end of last June I met, by chance, a group of people in a pub in Moss Side who, bit by bit, are helping fashion a discernible focussed community out of the melting pot of people and cultures in that area of Manchester. Through a variety of methods and with a variety of reasons (including sustainability, economical, political and environmental reasons as well as social) existing groups of people are finding out about each other and coming together to grow and expand their community. In the same way that people at college had this shared sense of belonging, the simple fact of living in an area has become for people a reason to socialise and get involved with projects affecting the area. Of course for some the involvement in the projects would have come anyway, with social aspects to follow, but for many I think it's that sense of belonging that spurs action. This should hardly be surprising, but today far too many people see things in local communities as I did in Bury - there's no point trying because it'll be hard/you'll move out/you already have friends. What I've seen is hopefully just the beginning - not only is this kind of community building good for people's social lives and local projects but I see it as a precursor to a much larger change in politics and business. I'll write about them soon, but for now let's hear it for the small society!
There's a well documented problem of searching for answers on the internet, which is that people find interesting workarounds to problems but don't comment on the forums or blog posts where the original answer came from. Places like StackOverflow address this problem somewhat, but I think good practice for every developer should be to make note online of problems encountered, along with how they solved it. Now that I have a blog it seems ideal that I follow my own advice.
I encountered the following error whilst running one of my website scripts from shell (which I was doing to test how it would run from Crontab).
error while loading shared libraries: libdb-4.3.so: cannot open shared object file: Error 23
My server in this case is hosted by 1&1 and runs CentOS 5.6. I found a thread on LinuxQuestions which had a few suggestions. It turned out that I didn't have the libdb files installed so running
$ yum install db4
Was all that was needed to solve the problem. You can run $ /usr/lib/libdb-4.3.so if you want to check if the files are already present. If they are, just replace install with reinstall in the yum command above.
It was bound to happen eventually; I just had a major problem as a result of a simple git mistake. I was developing add-ons to an application in one branch, and continuing bug fixing and minor improvements to the master branch. Every now and then I would merge changes from the master into the development branch, copying over the bug fixes. However at some point I must have been in the wrong branch when I merged (or I don't quite understand merging) because suddenly these new features (incomplete ones) appeared in the production version, and had removed an existing feautre. What makes it worse is that one of the bug fixes had gone live, taking with it the incomplete new functions, removing the working function and causing complaints from the client.
On realising the mistake I found that somehow my regular merges had made my repo a tangled web, and none of the commits would let me revert. After panicking, checking out, and trying to remerge about 5 different branches I eventually discovered the option to cherry-pick commits, reverted to the last master commit before the branch had been made and then went through each commit carefully to make sure I cherry-picked the right ones. So now I have a totally screwed master branch, a development branch that's going to need some checking over and a "save-my-ass" branch that seems to be the bug-fixed version of the master without any new additions.
So a) be really careful with git merging on development; some times it seemed the merge just pulled in changes, but at least once it actually combined the two branches. B) if you know git, what actions should I take now to turn the "save-my-ass" branch into my master branch, with the same history of the working commits, and ditch the corrupted master branch to avoid accidentally using it at some point?
If a job's worth doing, it's worth doing well.
A subject common to peoples' conversations, newspapers and mad rantings at present is that of unemployment. In particular youth unemployment, and student unemployment. We're sending record numbers of people to higher education institutes yet it seems that far too many students come out with a piece of paper, a hangover and no prospects. At the same time there's constant wrangling over benefits, what people who are unemployed should be given, who's scamming the system, unpaid work experience and on and on and on. Add to that the frothing masses shouting about how foreigners are coming over here and taking "our" jobs and you have quite a melting pot.
For that reason it would be facetious of me to suggest I suddenly have an answer, but there are a few points that seem to get missed in many discussions and it would be nice if they were brought up more often. We were having exactly one of the conversations described above in the pub the other night (where else) and decided that the two most often traded quips about the jobs/unemployment situation were:
- People won't do jobs that seem beneath them; everyone is too picky, demanding that they get their dream job without necessarily having experience or anything else one usually associates with employability.
- Employers are increasingly skeptical about who they hire; degrees or other qualifications are no longer worthwhile, they need to see experience, extra-curicular involvement, a willingness to work over time without increased pay and more.
Combine these two factors and you'll see a big rift between those who want to work and those who want to employ.
The solutions to these problems are also fairly simple to see; in the first case people looking for jobs need to accept that they can't get their ideal career straight away, they need to take a lower paid or less interesting job and work their way up. For employers, they need to accept that they may have to take on staff who want more free time, or who have to learn on the job.
In the same way that these solutions are obvious they are also less than ideal. Whilst according to employers you're not beneath a certain job, that doesn't make it easier to do a job you hate day in day out; there seems an inherent unfairness, especially if you've worked for qualifications, in having to accept a lower standard of working life. At the same time many companies just can't afford the risk of hiring someone who hasn't already proven themselves; even if you acknowledge the hit on time that comes from on-the-job training you could end up with someone who really can't do the job, and a difficult case on your hands if you want to let them go.
So if these problems exist and their obvious solutions don't really make things any better what else can we do? The first way is one of unemployment, stunted growth and growing distrust; the second way is one of lowering standards, taking risks and relying on precarious mutual disadvantage.
For the third way we have to turn back to that old saying up there. Old sayings can be clichés, but the reason they've survived is that they still hold true. This is as valid for a job you're employing someone to do as a job you're doing yourself. Therefore any job that requires an employee is worth doing well; it follows then that there should be no bad jobs. No jobs that require people to lower their standards, or that require an employer to take on someone who could be a liability. If employers want a job done right then they need to make the value of that job inherent to it, such that it's clear to those taking it on; and if the job is worth doing then this shouldn't be a problem. Similarly when a worker gets a job their first task, before arranging their transport or buying a new shirt, should be to comit themselves to the value that has been placed on that job.
One of the examples that brought this idea to the fore (and let's face it, making jobs not be crap is hardly original) was hearing people in a call centre talk about their work. They were cold calling on behalf of a company to carry out surveys about media consumption - TV channels watched, papers read etc. But the way they had to do it was to call someone, ask if they'd take part and then basically read out a long list of options waiting for a yes or no answer. That isn't valuable human work, that's a machine's job. At the same time when we call one of these centres ourselves we have to spend 5 minutes slowly navigating a painful menu system or mash star to try and speak to someone - that's a job that could be done far quicker with a human on the line. For that human answering & redirecting calls would surely be far more enjoyable, and seem to have greater importance, than reciting a list of 10 obscure local papers for 8 hours.
If neither an employer nor their employee can see the value in a job then should that job even exist? This solution still leans on the employer more than the employee, but as the employer should have more to gain from placing the job this seems fair. Work is necessary for the modern world to continue functioning, but that necessity needs to be communicated to both sides of the employment market; without this, we'll be left with unemployment, risk and dissatisfaction; with it we'll grow an economy of happy motivated workers, whatever the work happens to be.
I posted earlier on Twitter:
Testing a DB which has records by today's date. Is there a more elegant way to test than by removing the "WHERE date=" on dev branch?
To elaborate on this a bit more I'm working on an application which allows a user to specify that a resource is available on a set date. Therefore we have an availability table as follows:
- available_date
- resource_id
- claimed?
Each time a search is done, e.g. a search for 18/04/2012 the site will list all available resources:
SELECT resource_id FROM available WHERE available_date='2012-04-18' and claimed=0
During development I have a few example resources, however each new day I test the search there are no available records for that day. So I'd either have to log in as the owner of each resource and set them as available, log in as an admin and make all available and do something a bit more tricky on the back end.
For example
SELECT resource_id FROM available WHERE ".($dev?"":"available_date='2012-04-18'")." and claimed=0 GROUP BY resource_id
However this adds processing to the live version, not much at all, but it still feels like adding bloat. I've now come up with an alternative, which is a stored procedure in SQL:
CREATE TEMPORARY TABLE available_temp ENGINE=MEMORY SELECT * FROM available GROUP BY resource_id;
UPDATE available_temp SET available_id='',available_date=CURDATE();
INSERT INTO available SELECT * FROM available_temp;
DROP TABLE available_temp;
This will effectively duplicate one record per resource each time it is run. If it runs twice in a day it will produce two sets of available records for that day, which could be confusing if the "claimed" value differs, but that can be avoided by logging it in my build script.
Can you think of a more elegant way to do this?
A few weeks ago the footballer Fabrice Muamba collapsed due to a cardiac arrest during a Bolton Wanderers football match. This event was naturally big news, but the wave of apparent support, solidarity and well wishes that followed was unprecedented. Now, firstly there's an entirely separate article yet to write about a society which considers itself secular spreading the power of prayer via Twitter. That's going to be a rather more positive article, because this one isn't.
The weekend just past, Liverpool FC fans have been remembering Hilsborough, though there's been a bit of controversy there too. The Hilsborough disaster was obviously even more alarming than Muamba's heart attack, with 96 fans dieing in a severe crowd control incident. Like any such disaster it has been rightly remembered ever since. But there is a difference between respectful rememberance and a desire for selfish inclusion.
Observing a minute's silence is respectful. Wishing death upon someone who disagrees with a team refusing to play a football match is despicable. Being aware of, and even including in prayer, a footballer in hospital is respectful. Flooding social networks with ever more overblown superlatives about just how anxious and distraught you are seems a little insincere. I have no problem with people being upset or supportive; however the feelings and support of those who genuinely have them are belittled by clamouring masses eager to be seen as part of something.
What I'm making there is obviously a sweeping statement. Just look at the facts though; when millions of people take to social networks with the latest hashtag of mourning, how many of them flick over to YouTube straight after to watch "world's most deadly car crashes", or how many swipe to the next app on their phone and draw a picture of a camel for their friend to guess. The minute's silence favoured by many large scale rememberance events gives you a full minute to reflect on things, but, November 11th aside, how many people spend the minute wondering whether the guy next to them bought his shoes from Primark?
Of course the second level of this problem is perfectly framed by what happened to Alan Davies. After a remark which, to all intents and purposes seemed reasonable (other football clubs play on the anniversay of tragedies, why shouldn't Liverpool) he was subjected to huge levels of hatred, abuse and public defamation. In other words these massed groups of tearful mourners are quite happy to sully the memories of those who actually died by slinging insults in their name. The idea that the more aggressively you defend something the more you care is usually used to defend a savage dog, not a YouTube commenter. The reality is that these people don't care; they want to feel a part of something and just like the mental images it raises, the mob mentality can sometimes be a bit vicious.
This emotional bandwagon isn't just restricted to pale reflections of sad events though. A month ago a charity called Invisible Children released their astonishingly succesful video as part of their campaign to sell t-shirts bring someone to justice and the internet went mad for it. This tugged on those heart strings and with minimal effort you could give to the chairty or put a scary man's face in your window in case he happens to be selling door-to-door or something. It's cynical to suggest that the people behind this campaign were in it for their own ends, so I'll leave that part out. What it did indicate again was that people are all too happy to jump the emotional bandwagon, tweet, shout and then go stalk their ex on Facebook. With the speed it was shared you'd think the whole internet was well informed and out for justice, but do just a little research and you'd have found what soon became the cornerstone of the official backlash - that the man everyone was after probably wasn't even in the country they said he was in, that the current government are also corrupt and that sending them weapons was, astonishingly, a really bad idea. A friend of mine termed this slacktivism and I like that and will continue to use it and pretend I came up with it.
I could ruffle through millions of tweets, shared items on Facebook, old emails about bonsai kittens etc. to show the twinned worlds of emotional bandwagons and those all too ready to prey on the gullible with scams and hoaxes. Even without the extra risk of getting scammed, even without the second level violent mob mentality I feel it's a bad thing for people to be joining in with these emotional outpourings. As mentioned it belittles the feelings of those who actually care, but even more it puts you in a boy who cried wolf situation in your own life; we all have our own things to care and get upset about, and trying to push them aside in favour of the latest group tragedy is, well; tragic.
I had a phone call today with an interesting question:
How many visitors do you think the Starbucks website gets per day?
Whilst I'd agree that someone who knew me might be well served in calling me to ask a question about the web, I haven't had this one before. The number of visitors a website gets is usually shrouded in mystery, a value often unavailable in its truest sense even to the owners of the site. Nevertheless, hits, visitors and users are often used as quick metrics to measure the success of a website.
This is an obvious scenario. The core feature of every website is that people, actual real people with brains, opinions and, crucially, wallets, visit them. So, assuming you're able to sort the bots and random traffic from real people, you can look at these numbers then grin as they increase, gaze with vague consternation as they stay level and rant about SEO & diversification when they drop. Hits and views are important - without them you're just a server being cached by bots - but what do these numbers actually tell you?
Except in the rare cases that your entire site revenue model is directly priced pay-per-view adverts these metrics don't really tell you much. It's perfectly possible for a site with 10 visitors per day to be making £1000s per week if 1 in 10 buys some plant machinery from you; in the same way 2000 visitors might be losing you the same amount if each is downloading a 30 second HD video. Any website can throw money at Google or other PPC ads and score record traffic. Whether that traffic actually makes you any money is another matter. Even the much coveted email address sign up field is useless unless your only intention is to sell it to spam networks; in which case the unending blight on your soul is probably a bigger worry than website traffic.
The simple answer to "how many hits does your website get?" should either be "enough" or "not enough". If it's the former, keep iterating to keep them up, if it's the latter then your site needs to make more use of it's current visitors, or be a place that more people want to visit. If your boss just wants to know "how many hits are we getting?" what they're really saying is "what the hell is this web thing anyway?"
Users != $$
With the recent purchase of Instagram by Facebook still resounding across multiple social networks the question of how much a user is worth has once again been brought to the forefront. The general assumption is that a user is someone a bit more involved or invested than another faceless hit. As well as giving you precious personal details users might be providing you with content, sharing your content or even paying for your services. Therefore the far more common metric in real web businesses is users, not hits.
But really, users offer that same undefinable value that hits do. For a start, users are always a more consistent drain on your resources. They're using your site and sapping at your bandwidth and nobody gets that for free. The real and harsh reality is that the majority of your users are probably costing you money, and the minority are making it. Sites that don't realise this churn funding until they finally work out a method, or they go bust.
I'm a big user of Facebook. I've been on it since October 2006, I've got a ton of photos and videos there, 600+ friends and over 2000 tagged photos. Aside from not using apps or playing games on there I'm fairly high up in terms of use. However despite this I can recall only a single time, in nearly 6 years, that I've clicked an advert. Now no matter how you swing it, I've costed Facebook money. Whatever arbitrary value the site's valuation places on my existence within (apparently $118) there's no way they're going to see that from me.
Of course I'm not saying here that Facebook don't make money. Their profit this year was $1bn on the dot, which is damned impressive and like every other kid who wrote a website for his friends, I wish I'd done it. But even Facebook, this super enigma of the social web, has been making losses for more than half its existence. They got $240 million from Microsoft for 1.6%; with a $1bn profit Microsoft would have just made $16 million were it not for the upcoming valuation. Hardly a return on the investment just yet.
My worry with the current trend of huge valuations, massive acquisitions and overnight success stories is that we're heading into dangerous territories (again). The internet is really cool and amazing and has rockets and lasers and stuff, but the value we associate with it is starting to become wildly abstracted from the world which it enhances and sustains. Those rockets don't maintain themselves you know.
Any sufficiently advanced technology is indistinguishable from magic.
- Arthur C. Clarke (1961)
When Clarke, the famous science fiction author, wrote Profiles of The Future he made a lasting observation, though interestingly one that necessitates a society to have developed a concept of false magic before progressing to develop suitably advanced technologies. Nevertheless he's completely correct; turn up in the Roman forum with an iPhone and people would barely believe it possible - maybe to the extent that they would outright refuse, destroy the item and feed you to the lions. We deal with each new technology as it makes a sensible progression from the last.
Whilst we remain amazed at each new thing that scientists and engineers come up with, this gradual feel means we rarely get this magic moment. Sure the internet is amazing, but we've watched it grow over decades, and for the majority of them it was a bit crap and disappointing to the average person. However one area where I think we still see magic on a regular basis is in the world of programming.
This entire article was sparked by the reaction of a man called Ian, who works in our office. He's used to computers and is involved in search marketing, but when he came over a few weeks ago and looked at what I was working on he declared "what wizardry is this!" as he viewed my code. No doubt it can seem like wizardry to many; whilst the motorcar is a hugely impressive invention we can take it apart, see bits moving and roughly work out where things go. Even a circuit board makes some sort of visual sense - you'll see wires, batteries, pins, things you associate with electronics.
In code, however, we turn words, characters, tortured examples of the human (usually English) language into working things. Things which can save lives, replace jobs or let you send a small drawing to a friend. Obviously a lot goes in to making this magic happen; we have our circuit boards, our gears and wheels and they've been developed over many decades as well. However the immediacy of coding is where the beauty lies. With a computer already present, the correct compilers or interpreters installed, we can write a few sentences and tell someone how many leap years they've lived through, or discover the number of people with pallindromic surnames living in East London. Coding lets us drill down from the top level, our ideas and understanding of simple logical steps, to a complex electronic system capable of extraordinary things.
It really is magic, more than many other technologies, and the most important part is that anyone can do it. This isn't the Magic Circle, or some arcane sect of shadowy figures hiding behind society. The magic of yesteryear was confined to select practitioners, but in the western world today nearly everyone has access to this. Sadly most of them aren't aware.
So what?
There's been a lot of talk lately about teaching programming to kids. A fellow PHP developer (and someone I'm proud to say I had lunch with once) Andy Young made a brilliant case for this in the Kernel Magazine earlier this year. So fortunately I don't need to. But I will develop my thoughts round to that angle.
If coding is like magic and kids love Harry Potter, isn't it pretty much a no brainer that we should introduce the two to each other? Put more simply, having an understanding of programming should be as fundamental as basic science, and only marginally less so than basic literacy and numeracy. Being able to program isn't only the realm of computer geeks, in the same way that drawing a picture of a dog isn't only the realm of artists in the Tate.
The ability to program not only provides a decent future career path, but provides essential skills for further learning, skills that are really hard to teach in any other sort of quantitative way. Skills like system analysis, logical progression, thinking efficiency - things that probably don't appear in a Primary Teaching PGCE, but the kids that somehow acquire those skills anyway are bound to be the top achievers when they move on to high school. When the teacher comes to explain algebra to kids he should be saying "so, these are like the variables in your code", as opposed to a Computing teacher explaining variables as "like algebra but you're storing stuff instead of solving equations".
Furthermore, if you are going to introduce kids to program, for goodness sake don't give them a reason to dislike it. Whilst coding has that magic aspect the flip side of this is when things go wrong. Compiler errors, dependency issues, libraries crashing. Abandon C and Java and get them writing Python or Ruby (or even CoffeeScript), with a relaxed syntax and convenience built in. Let them enjoy how easily they can do things with these languages, and those that really get into programming can move on to the hard stuff in due course.
If possible don't take too long to add in Test Driven Development and Version Control either. The former, especially, isn't a barrier if introduced early enough, and even gets that instant gold star effect that so helps in encouraging learning. Version Control should be part of any computer workflow, coding or not, but might be best left until the first time they've overwritten an important file - lessons learned and all that.
Not Just Kids
Remember when I mentioned Harry Potter? Well, who loved Harry Potter just as much as kids? That's right, adults. Aduts currently have a higher level of technophobia (a word I really hate actually, people throw it around when I'd hazard it's almost a more serious impedment than many of the other common phobias these days) than kids, but to that I say get them programming; just like with kids, that experience of magic, of creating something could do more wonders for an adult nervous about technology than any series of courses on how to use Microsoft Office down at the local library.
Once again setup is the hurdle to get past; if we want to progress with adult education in code we need ways to get the right tools onto their computers as painlessly as possible. Some websites are sidestepping this entirely, offering interpreted code right inside the browser. An excellent method, and currently the simplest we have. However people should never be able to miss the point that this is real, not just another game on a website.
You There!
So if you are an adult reading this and aren't a programmer, what are you waiting for? Don't you want to experience some wizardry? That moment when a few keystrokes can tell you just exactly how many times the phrase "red light" is used in Roxanne? Because if lexographical analysis of New Wave hits from the 70s isn't magic enough for you, I don't know what is.
Back in June at the monthly meeting of PHP North West, Jeremy of Magma Digital spoke about Phing, a build tool for PHP projects, based on Apache Ant and written in PHP. It took me 6 months before I actually committed the time to change all my projects to use Phing for deployment, but it has been a game changing experience. It has allowed me to streamline processes, avoid forgetting to upload updated libraries or new versions of my framework when deploying projects and add in steps such as PHP Lint and JS Minifying to my deployment process.
In the past month I've also finally begun using SASS, a way to build style sheets with variables functions and all sorts of other useful time saving tools, making stylesheets easier to write and maintain, whilst compiling it into compressed CSS that renders in any browser. Add to this the simply Ruby program JS-Preprocessor to compile multiple JavaScript dependencies into a single file and you've got a great tool set for being able to structure your build environment any way you like, whilst having your output in the most efficient form possible, and all automated by Phing.
What I'd like now is to be able to have Phing not only run these pre-processors on my other output, but be able to do the same with my actual PHP code. The theory is fairly simple; at present, like many developers, I construct or use applications to fit specfic purposes. Because these are often used across multiple clients, each may need to have slightly different interface options, data processing etc. There are 3 conventional ways of doing this directly inside PHP. All require including additional files for each client using the application:
-
The PHP function function_exists() can be used in a page of the application as so:
if ( function_exists( 'do_more_stuff_here ') ) do_more_stuff_here( $parameters);
-
Or the same method but with a fallback:
// app.php
do_something_here( $parameters );
// client_funcs.php
function do_something_here () { }
// default_funcs.php
if ( ! function_exists( 'do_something_here' ) ) function do_something_here() { }
-
If we're doing stuff inside an object we can obviously extend the object:
// app.php
$myObject->doStuff();
// default_class.php
class regularObject { function doStuff() {
if (method_exists( $this ,'doMoreStuff' )) $this->doMoreStuff();
else { }
}
// client_class.php
class clientObject extends regularObject { function doMoreStuff(); }
Or various other methods
However all of those require some level of overhead in the program, whether its checking for functions or even just requiring files - especially if require_once has to be used. The main reason for the existence of these methods in PHP is for dynamically themeable sites, things like Wordpress where a user can change the entire site theme, plugins and widgets directly from their browser. However in complex applications, the user generally has less control over these base functions and themes, in preference to a more solid interface experience. Plugins and the like are sandboxed into specific areas, whilst the normal pages that make up the interface can be streamlined and as quick as possible.
So what I'd like is to do away with the dynamic features and simply write my PHP like this
$var = standard_function();
// if ($CLIENT== business1)
$var = more_advanced_function( $var );
// else if ($CLIENT == business2)
$var = different_function ( $var );
// END
$var = another_function($var);
Then upon running my Phing build, the lines not relevant to whichever CLIENT is set would be removed as the project is deployed (to staging, live or wherever). This way when constructing the application it becomes very easy to see what happens to different clients' interface/data as the script runs, as well as very easily port certain features between clients or (as has often been the case) make a client specific feature a common part of the system. It would also remove the need to constantly rewrite functions as I add new variables or change the previous flow of code.
This seems somewhat of a weird move in a programming language, but with the sudden freedom that SASS and JSPP have added to mix and customise different builds of my front-end code it would be at least a great experiment to see how portable this method was to back-end code.
On Saturday evening I attended a ceilidh as part of Chorlton's Big Green Festival. Aside from being great fun (I went to plenty of ceilidhs during my university years and was missing them) it allowed an interesting level of systems observation.
For the uninitiated a ceilidh is a traditional dance, most often associated with Scotland but generally any folk dancing could be refferred as such. Each dance fits a specific rhythm though not a specific tune, and consists of series' of moves performed with partners or in groups. Different moves can alternate group size, and some dances will at points involved the entire room. It's an obvious point to make that the more people involved in a dance the greater chance of the system being disrupted.
During one of the dances involving everyone, couples were numbered 1 and 2 all round the circle. At the beginning of the dance the even numbered couples stood back (men facing out, women facing in) and the odd numbered couples, hand in hand, gallopped between the two lines, round in a circle. They did this for half a measure, and then gallopped back to their original place. At this point they stood aside, and the even couples performed the same action, returning to the opposite side of the couple they started next to (i.e. moving around one place). At this point an odd and even numbered couple would join into a 4 and dance around with each other before moving back into the circle and the dance starting again.
It is apparent that the exact distance any one couple moves inside the circle at this point isn't fixed, but will be constrained by the couple ahead of them, and their own agility/speed of movement. One couple in particular wasn't great in either of these areas; they caused a roadblock to all the couples following them each time. After a few goes round this led to them arriving back on the wrong side of the couple they were meant to be dancing with, therefore dancing with the couple to the other side, leaving two couples either side of this group with nobody to dance with. Each of these couples was aware of the problem - they could both see that this other couple had made a mistake.
What followed is the interesting bit. The dance then proceeded, with the problem couple managing not to mess up again. However the disruption they had left continued moving around the circle, each time resulting in couples having nobody to dance with. In the initial instance the couples affected were aware of where the problem came from, but as the dance progressed the actual problem got further and further from its source, each time reducing the likelihood that it would be corrected, as nobody was quite sure why it was happening.
A simple loop of processes gradually became unresolvable as people accepted the problem as inherent to the system, despite the fact that it was actually as simple to solve at any future point as when it first occurred.
Additional
Talking on Twitter about this I brought up the point that I was on the left side of the problem couple when the error occurred. This meant that my dance partner and I were the first and second to experience the issue, happening as it did either side of the problem origin.
On the second run through I'd realised the problem and attempted to fix it by repeating the mistake, turning to the wrong couple to form into a 4 and gesturing at the people we should have been dancing with to move back to the problem couple, which would have solved the problem. However in the fast movement and noise of the dance I could only try gesturing to these two separate groups to inform them of what I was doing, and when they didn't catch on I returned to the people we should have been with, in case I actually exacerbated the problem.
This could illustrate how difficulty of communication can prevent a simple fix being implemented by the people who first experience a problem. I only had one chance as the disruption moved away in the next phase of the dance, so as my attempt failed I was then powerless to affect it any further, without risking propagating further disruptions through the system.
This is not a pleasant post to write and it will, I suspect, not be particularly pleasant to read. I began this new blog less than a week ago to write about happenings in my life, and by sad chance the first major happening was one of tragedy. Nevertheless I will write about it; things like this cannot just be swept under a carpet of superficial happiness. In respect for the deceased and those who knew her I will be omitting certain descriptions from my post.
This incident will certainly make me think about the way I operate a motor vehicle, and I would defy anyone to hear me describe what happened in true detail and not consider if their own conduct couldn't be improved. Please only read on if you are assured that hearing about this will not unduly upset you.
On the morning of Thursday 29th March I was taking my usual cycle route to work in the centre of Manchester. The route leaves Victoria Park opposite Daisy Bank road, turning onto Upper Brook Street and shortly to the cross roads with Hathersage Road. Thanks to Google Latitude I have almost exact timings for when I was at specific points. At 9:58am I crossed the lights before the long stretch along the side of Manchester Royal Infirmary; as I crossed the lights I noticed a pair of gloves just on the line, and straight after noticed a black handbag lying almost in the centre of the cross roads. My first thought was to pick it up, but as I slowed down the lights began to change and I cycled on.
Immediately after the lights two busses were stopped. As I pulled out to overtake the rear bus, a StageCoach bus began to indicate to move off. I sped up slightly, and only as I passed the driver did I look up to see that all the cars ahead of me were swerving out to avoid... something in the road. From this distance it was not immediately clear what it was, but the first idea my mind went to turned out to be true. In typical fashion as soon as I first thought of what it could be a hundred alternatives replaced it; in some form of immediate self denial I ignored the other items of evidence lying on the road and followed the line of cars, pulling out past the object.
As I passed I was forced to recognise the awful truth. She was wearing a wrist watch.
Still in some form of denial I busied myself wondering what the large crowd of people were looking at, then with annoyance at that bus that had started to pull out, and then with the state of the road. I was about 100 metres away when I had to pull in. The enormity began to hit me. Over and over in my head I tried to reason what I could have seen. To describe the alternatives would be to give too much detail, but the crowd of onlookers didn't bode well. I began scrabling for something to cling to, some form of personal contact.
Up the road were some builders drinking tea. Tea. Very normal. People wouldn't be drinking tea if something like what I thought I'd seen was actually present. Well, they would if they had no idea, if as seemed apparent from the investigation that was to come it had happened so quickly that nobody was actually certain what had transpired. Still at a loss I turned and saw another cyclist pass the scene. He seemed to cycle normally, maybe it was imagined after all. I pulled out shortly before he passed and tried to match my speed. He slowed behind me and we came to the next set of lights where we stopped. I turned to find him looking around somewhat in confusion. Heart sinking I just asked "was that?" before his slow nod told me that we weren't sharing some joint hallucination, this was real.
The rest of the journey into town is a bit blurred. I'm not sure I usually cycle that fast but it seemed incredibly important that I talk to someone. Anyone. I stopped under Mancunian Way and considered posting on Twitter. But what do you post? Especially when you're still not sure what you saw. Who's going to come and chat to you over that? So I continued to the office, barely sitting in my seat before announcing to Jake and Owen (who's desk I work at) "there's a dead body in the road on Upper Brook Street".
I don't know what people are supposed to do in reaction to that, but credit to both of them for being rational and understanding. Also apologies to them for interrupting their morning with such news. At that point I did go on Twitter, saying the only thing I could think
Shortly after this the internet began to explode with news. I tweeted at the @gmpolice account and got a reply fairly quickly stating that officers had attended. Soon afterwards I got a call from someone at the Manchester Evening News. It was difficult to relate what had happened but I felt that if anyone else had half seen the incident they'd be looking for information, so anything the press could tell them was better than nothing. By the time I got back to my desk there was already an article online, quoting my tweet.
The rest of the day wasn't particularly great for work. Whilst trying to get on with things I was hooked on Twitter, hoping for some news. During the day a man was arrested, then released and images of the deceased prior to the accident were released. Various rumours came out about what had happened, from the horrific (the body was dropped from a van) to the eventual truth, a road traffic accident. On my way home I visited officers at the crime scene to make sure they had the information about the hand bag; I expected that they would but found on the news later that they were still looking for it.
On the evening I attended both a Bible study in Levenshulme and our regular Thursday pub meet up in Moss Side. At both gatherings my friends were very understanding, and tolerant to my need to talk about what had happened. I went to sleep Thursday afraid that the day's events would not do me well overnight, but I got a good sleep in, and was able to resume a more normal pattern on the Friday, though still keeping a watch on incoming news.
It is now a few days since the incident (I've played with the post time). Tomorrow I will go and place some flowers with the few that have already appeared at the scene. I'm not sure I'll ever forget what I saw, but I'm not sure it would be good to. Death is something we must all face, and we will do so multiple times in our lives. God willing it will be in far less tragic circumstances than the poor woman on Upper Brook Street.
It may seem like I'm arriving 8 years late kicking off a blog in spring 2012. However this is more like a long awaited resurrection of my blog run from 2005 to late 2008, which tracked my progress not only through my later education but also of my programming, as it was consistently developed, redeveloped and reskinned as I learned more about the exciting world of making websites.
So here we are back again. I agonised over using Wordpress, or maybe even being a bit more modern and starting a Tumblr or Posterous account. With already being very active on Twitter, and to a lesser extent Facebook, I decided that I'd throw caution and basic sense to the wind, electing to use my own platform and retain some control over my data. So far it's proving good, having set this up over an episode of Green Wing and a cup of tea with my grandparents.
As with any stereotypical blogger I'm intending to post numerous articles with my opinions on life, the universe and other clichés. I'm also intending to go and try importing some of my old blog posts as some are probably still interesting, and of course get this cross posting onto a few million various social networks. I will not follow the basic template of not writing and apologising for it - you don't care and I don't either. I'll get Disqus set up to sort out my comments too.
Here we go again!