When trying to make things “user friendly”, a lot of good ideas seem to get subjected to Chinese Whispers or Cargo Cult treatment, and end up either counter-productive, or at least unnecessarily annoying. One such idea is formatting dates and times as easy-to-read relative terms, like “5 minutes ago”, or “yesterday”. It makes everything look less dull and technical, and someone probably did some studies once showing that it’s easier to read in some particular context. On the other hand, it means actively hiding information from the user, and is implemented badly more often than well, leading to sentences that are misleading, useless, or just plain nonsense.
If you are ever implementing such a feature for an application or as a library, below are some tips which you really should consider. If you have written, or come across, a library that does it right, please let me know in the comments, so I can shout at anyone who uses something braindead instead.
For most of its life, PHP has been a “weakly” typed language: values can freely shift from one state to another, and mould themselves to what an operation requires; or, in the case of objects, largely duck-typed: you don’t need a formal contract to call a method. There is, however, a trend in the language to adopt stronger typing constraints, first in function parameters, and now elsewhere in the language. As with so much in PHP, this is being done piecemeal, and without a clear road map. This is partly deliberate: a gentle introduction of optional features is less disruptive; but it is dangerous: compromises made now will shape the language for years to come.
I think it is time to grasp the nettle and say that there is a definite policy of introducing a new typing model to PHP, and a roadmap of what that means for the language. The implementation may still be incremental, but each change will be a step in a consistent direction. This post is my musings on what such a model might look like.
Although I’ve thought about it for a long time, I find myself increasingly unsure about electoral reform, and questioning much of what is being said after Thursday’s election. I’m certainly no fan of the current system, with its awkward patchwork of safe seats and local tactical battles; and I’m distinctly unhappy to see the Tories handed the power to implement some really damaging policies; but I’m not sure the two things are really connected, or what a better system would actually look like.
I’ve long been fascinated by the social challenges of online communities, and how they mirror and differ from “real life” societies. I was recently pondering this with regards the Facebook “real names” policy, and whether it was necessary, or at least reasonable, for them to assert that level of control. Then I was reading about the #GamerGate situation, and ran into similar thoughts about the necessity, and the perils, of policing online spaces.
We live in a time where there is a lot of debate about religion – is it a force for good, or for bad? Is belief in a supreme being fundamentally less enlightened than acceptance of the scientific consensus? And so on. But a lot of the arguments on both sides are poorly thought through, and make fundamental errors of logic, or simply overstate their case to get attention. I think a large part of the reason for this is that “religion” covers such a complex tapestry of ideas, that arguments that start following one thread in that tapestry get snarled up in other parts, where the original argument no longer makes sense.
Many moons ago, I posted a surprisingly popular answer on StackOverflow regarding how to write to CSV files using PostgreSQL. The answer, in a nutshell, is the COPY statement. But there’s a catch – PostgreSQL imposes strict security limitations on the use of this statement, which are best dealt with using another feature, the SECURITY DEFINER option to CREATE FUNCTION. Here, I will attempt to explain in more detail what these security restrictions are, and how to do what you want without simply disabling that security.
So here I present its boiled down essence, in the form of an imaginary dialog1. It follows the same order as the original post, so if you want the details on any of these points, please look over there before arguing with them. (more →)
and using my favourite under-used HTML element, the definition list 8) [↩]
Ever since a friend posted a quote on Facebook from this article about same-sex marriage by Archbishop John Sentamu, I’ve had a lengthy analysis and response drifting through my mind. The government consultation ended on the 14th of June, and they’ve indicated they intend to press ahead with legalisation, but the debate is still very much alive. To my mind, equalisation of marriage seems entirely sensible, and those objections to it not based on outright prejudice are missing some crucial logical point. This is obviously just my opinion, but I’m going to attempt to back it up with some thorough logical analysis below.
For my birthday, my sister’s fiancé gallantly lugged all the way from California a pre-publication copy of Neal Stephenson’s latest novel, “REAMDE”. At just short of a thousand pages, it must have taken a fair chunk of his luggage allowance, and like a 3-hour movie, you can’t help but feel that a book that long might have benefited from a stricter editor. Certainly, Stephenson’s love of technical detail, and tendency to throw all his ideas into one pot, is very much in evidence. And yet I found myself utterly unable to put it down all the way through. (more →)
Rowan's World Et Cetera is proudly powered by WordPress