URL shortening is something that's been at the back of my mind since listening to SitePoint Podcast #24 which discussed the near closure of tr.im.
Why are short URLs required? Twitter. Tweets are limited to 140 characters, and URLs often seem recklessly long in this context. Of course, Twitter could simply allow us to apply short, meaningful labels to our links as we've been doing in HTML for years. Instead, each time one includes a link in a tweet one must either:
spend a large number of characters on the full URL; or
use a short URL generated by a service such as bit.ly
Many of those who write JavaScript do not come from programming backgrounds (while I've written plenty of PHP, Python, and JavaScript, I don't have much experience with "real" programming languages*). As a result, a significant portion of JavaScript coders do not think of variables as pointers to memory addresses. This leads to confusion in cases such as this:
var fruits = ['orange', 'lime'];
var colours = fruits; // naïve attempt to duplicate array
colours.append('yellow');
One might be surprised to learn that fruits now contains not just "orange" and "lime" but also "yellow". Oops! Here's how it went wrong:
var fruits = ['orange', 'lime']; // fruits points to array containing "orange" and "lime"
var colours = fruits; // colours now points to that same array!
How, then, does one create a copy of the original array? Slice!
Certain things are extremely well documented on the Web; certain other things, however, seem to appear only deep in the comments of obscure blog entries.
The problem I encountered a few minutes ago fell squarely in the latter category. I simply wanted to know how to access the MySQL shell from the OS X Terminal. I expected my Google search for MySQL console Terminal "OS X" to return several useful results, but this was not the case.
I managed to find the solution in a thread with subject error 1044 and 1045: