I am an INFJ, apparently making me the rarest type in Myers–Briggs Type Indicator: only around 1% of the population. INFJ: Introversion, Intuition, Feeling, and Judging. I walk alongside other INFJ’s such as Martin Luther King, Nelson Mandela, and Mother Teresa.
There is an interesting theory that came around in 1982 by two American social scientists named James Wilson and George Kelling called “Broken Windows”. This stated that maintaining law and order quickly in urban areas would result in fewer crimes and de-escalating crimes of severity.
Service Manuals, Playbooks, Style Guides, call them what you want but to any large-ish organisation they are a vital way to maintain consistency among the different departments and outside organisations, to ensure your brand does not get misused and misrepresented.
Everyone likes a nice clean interface; some of the required scaffolding simply gets in the way of what we want to do. A classic example of this is closing things automatically; there are several ways to do this (using tweaked code examples from the PHP manual):
This guy could be on to something. There is a definite huge gap in the market for a quick and easy way to see what’s going on whilst you get ready, without having to look at your phone and then get distracted on Facebook, Clash of Clans, or an email.
User experience is important, and it’s the little things that matter the most. Make their visit seamless and they’ll come back time and time again. One of many ways you can achieve this is by loading images “nicely”, not by thrusting them in their face but by displaying a default image and then gracefully loading the image.
My stance on CSS preprocessors in the past has been far from glowing, but I’m slowly coming around. Slowly being the keyword. But I’m there now, I love it. I used to think it was just because of variables, but actually the syntax is nicer than CSS. There, I said it, humble pie. And it’s not just because it’s leaner, it’s actually more maintainable, and I’m going to give you three quick examples why.
Everyone’s done it, they’ve missed the second equals sign in an if-statement and created an assignment instead. Much tutting, shaking of the head, and a little chuckle ensues as you realise your error. There is a thought amongst some that Yoda notation is the way to go, so named because it switches the comparative’s to produce errors instead of unexpected behaviour.
I use Mac’s. I think they are leagues ahead of our Windows counterpart. However, I do not own an iPhone and people think I’m crazy. I tell them I use the best tool for the job, for me that is Android, and they laugh at me. I’m not sure why utilising a Mac means I should also have an iPhone, especially since I (and most iPhone owners, come to that…) use Google for most (web)apps.
MySQL is/was deeply integrated within PHP. No doubt you have seen and used the mysql_*() functions at some stage, but there is an alternative that makes your database interactions much more reliable. It’s called PDO (PHP Data Object) and here’s a quick guide that should get you up to speed in no time at all.
I like playing the occasional game of Reversi, and thought it would prove to be an interesting project (creating something like RedHotPawn for chess). Several hours programming later I had a simple working prototype. A couple more hours later I added in some missing features and smartened everything up.
This plugin stemmed from a need to have an effect similar to that of a blind, how it displays the content beneath slowly from left to right in strips.
Quite an interesting little test, I thought. Has zero practical world application, but it does require the person to have a somewhat analytical mind and problem solving skills. Also a reasonable knowledge of PHP. So I thought I would have a go (without looking at others’ solutions). 10 minutes later a working script which does exactly what was requested.
Today I learnt a new word, knolling; arranging items in parallel and 90º to each other in an aesthetically pleasing manner.
It was hard to track down if these two features were possible with the latest Amazon S3 SDK, but they are and have documented them for you below.
The need for encryption and decryption in general day-to-day Web programming is quite rare. But it can crop up from every now and again. I use a class that handles both encryption and decryption using mcrypt and the Rijndael algorithm (AES) and a 256 bit key size.
The autoload function is one of my favourite aspects of PHP. I’ve even blogged about it before. It makes writing code quicker and more reliable (no more typos or worrying about whether you forgot to include a class file) giving you more time to actually program.
As you might have grasped from the name of the pattern its role is to produce and dispatch a product. In this case a classes. We use the Factory pattern as it is a standard way to create a class which is very similar to other classes by containing the same functions, but implemented in a different way. I always like to use non-technical terms when explaining, and this example will be no different.
So let’s jump straight in, what is a replay attack? Essentially a security breach whereby someone poses as someone else using some unique piece of data the user supplied/was issued to/from the Web server. It’s kind of similar to a man-in-the-middle attack. We’re going to be looking at the attack using specifically cookie authorisation, a very common means of implementing a “remember me” function.
Earlier in the week, whilst implementing a domain registration API into another client project (and pulling my hair out), I thought back to a seminar from university. The module was Component Based Design and it was all about writing code in a standard way, helping to aid both the supplier (API creator) and the client (the person using the API). Although I didn’t realise it until now it actually played a large role…
1246402800. A perfectly valid UNIX timestamp, but one that created some confusion and head scratching in our office for one of our latest internal projects. The problem came around when converting the timestamp into a MySQL date using the FROM_UNIXTIME function which produced the wrong output. The timestamp is perfectly valid, it’s the timestamp for 1st June 2009, 00:00:00 (check it, if you don’t believe me).
PHP5 reared it’s head mid 2004, 5 long years ago and all PHP developers rejoiced. Especially me. It gave us lots of new shiny tools to play with, including the obvious improved OO support and my particular favourite: the __autoload function. For all you Java developers out there you know that you never have to include or require files, the Java language instinctively knows where to find them thanks to the…
It all began a couple days ago, one slightly dull Tuesday afternoon. The air was thick and the light was dimmed. Ahem, I have a challenge for you; try and place a div underneath another. “Piece of cake,” you say. “That’s hardly a challenge”. Well, not so it would seem. I was perplexed by what I saw for a few minutes, at least. So much that I wrote this article and created a little demonstration.
I have just spent the last half hour scratching my head over how to delete from 2 tables, joined by a unique ID. For some reason, MySQL kept spitting out: Unknown table ‘myTable’ in MULTI DELETE. Many visits to the MySQL manual still made me scratching my head (Yes, looking back on the manual makes me hit my head for not noticing the “Note” about a third of the way down the page).
Sorry for the lack of updates recently but I have been swept off my feet with work. A couple days ago I redesigned part of my companies website, Centation, whereby I needed to make a little jQuery tooltip to add a dynamic flair to the page. Well, I didn’t need to make one, but the lack of quality jQuery tooltip plugins forced me to. I thought I would give you the code of how I did this, and give you a couple demonstrations.
One thing I have found is the lack of really simple XML classes—that’s not to say there aren’t any good ones out there, I have used several really cracking ones. For my new version of my personal site (yes, this site is planned for a revamp) I wanted to integrate my Twitter feed somewhere. I looked and looked for a really simple XML class but was unable to find one. So I made one. And here is the result:
I was on a site today which offered text resizing. Great I thought, let me increase the font a wee bit—it was a bit small. It proceeded to reload the page completely to set the cookie using some server-side language. The site in question was running quite slow, so it took me upwards of 5 seconds to see the changes. It would have been quicker for me to tap cmd+plus a couple times.
Wow, I have been busy lately, what with a hectic workplace and personal life. But I am here to tell you about a little problem I have known about for years but recently popped up when a friend couldn’t work out what was happening.
I found out a pretty interesting, and slightly strange, feature of the HTTP protocol today. When submitting a form as a POST request, if you set the action to the targeted files folder name without the trailing slash it submits the form as a GET request—this caused me to scratch my head over a script for a couple minutes.
I recently had a client who sent me a 300+ list of items they wanted placing into a drop down select menu. Beside the obvious accessibility issues they were quite set in their ways about what they wanted—per usual.
In this first episode of PHP design patterns, we will be looking at the Singleton. The Singleton is available in most, if not all, OO languages. The purpose of the Singleton is to only ever have 1 instance of a class available which supplies the rest of the application with consistent data. I would like to point out that my version of a Singleton may differ slightly from other peoples; design patterns are not exact nor are they set in stone.
I was browsing a couple of PHP forums the other day, and it seems people require a simple authentication script for their website. So, I thought I would make just that.
There are several functions in the PHP language which were made to make classes more accessible and dynamic. I am going to be talking about two of these so called “magic functions” which allow you to set and get information dynamically, whilst also providing a simple log to show you what is really going on behind the scenes. These two functions are of course __set() and __get().
Arguably one of the best things to come out of PHP5 was its improved OO support. With OO comes easier separation of presentation, data, and business logic layers which leads to reusable code and better code management, amongst a host of others.