Simulation, Consciousness, Existence it’s a lengthy article by Hans Moravec about the theory of reality as simulation, its moral and ethical implications, and ultimately, a discussion of the very notion of reality through the lens of quantum physics… a really perfect way to mess up your mind for the weekend.
HTTP redirects should be your tool of choice when you’re reorganizing or renaming key sections of your site on order to keep visitors from hitting a not found page and make search engines update their location and keep their ranking.
However, sometimes you might run into a situation when you need to update a redirect, only to find out that the redirection it’s aggressively cached by your browser (specially Chrome).
So, how can you avoid (or at least, control) the way that redirects are cached?
ElasticSearch offers an excellent alternative when you need to implement a better alternative to MySQL FULLTEXT search, with nice features such as related results, facets, “did-you-mean” and many, many options to control exactly what you need to get from it.
Unfortunately, as your data grows it also becomes harder to host on your own and keep focusing on your product rather than the operation of your search cluster, which it’s why there are several services that can take care of this.
Here’s some of them and their main differences.
Setting up a mysql backup strategy it’s hardly an exciting task, so having a simple solution it’s key to actually get it out of your to-do list.
Here’s a simple, automated and low-cost alternative that I use to keep MySQL database backups of small to medium-sized projects.
Setting up automatic backups
automysqlbackup it’s a simple shell script that automates the creation of daily, weekly and monthly MySQL backup.
If you’re using Ubuntu, the installation it’s completely straightforward; all you need it’s
sudo apt install automysqlbackup and you’re done.
Backups are saved on
/var/lib/automysqlbackup, organized by daily/weekly/monthly directories and then by database name.
There are a few settings that you can modify on
/etc/default/automysqlbackup, such as the backup dir, whether to send informative e-mails or to keep a “latest” directory.
Of course, having automated backups it’s just part of the solution: you need to keep an off-site copy of your data in case your server it’s compromised.
A very simple and cheap alternative it’s using Google Drive as external storage: for USD 1.99 you get 100 GB which are shared with other Google services such as Photos and Gmail, but even the free 15 GB are plenty.
After the installation, you need to initialize the client, so you can get an OAuth token to authorize the application access to your Drive account.
The client doesn’t do synchronization, it trusts the user to determine the authoritative version of a file or folder, which might be problematic in some cases but it’s specially useful for copying the backups, since that will automatically take care of deleting older backups —which you can still find on your “Trash” for 30 days since deletion.
You can set a daily cron job to upload your latest backups using something like this:
25 4 * * * cd /root/gdrive/mysql-backups && drive push -no-prompt
When you’re developing a WordPress plugin, there are certain patterns and practices that are extremely useful to know and apply in order to get a better fit with the platform as a whole.
One of these things it’s what’s the better way to initialize a class on a plugin, which this answer on the WordPress StackExchange covers in great detail, while also explaining other interesting topics and recommendations such as using an autoloader and global access, registry and service locator patterns.
While you’re at it, you might also want to check these posts from Tom McFarlin:
- Properly writing WordPress plugin constructors, which basically explains why it’s better not to set action or filter hooks on a plugin constructor
- The right hook to initialize a WordPress plugin, about finding the correct hook (not too early, not too late) to initialize a plugin
Every now and then there’s still some people who can’t believe PHP can be used for a big, successful project, when actually there are several examples of huge sites using PHP.
Here’s how some of them share their experience.
With over 1.49 billion active users, Facebook has been forced into finding creative, out-of-the-box solutions to scaling.
First, they introduced HipHop for PHP on 2010, a transpiler that took PHP code and converted it into a C++ binary.
Even though the project was largely successful, it forced an elaborate deployment process and several incompatibilities with some PHP language features.
On December 2011, they released the HipHop Virtual Machine (HHVM), an open source virtual machine based on Just-In-Time compilation that allowed the greatly improved performance with an easier development and deployment process.
HHVM helped boost the PHP language development introducing lots of new features and a massive performance improvement on PHP7.
Design superhero John Maeda is now working at Automattic as Global Head, Computational Design and Inclusion because he believes in the open web…
The fact that so many people are commenting about it on Facebook, just proves how hard his new mission is… And how easy is to just not “get” why it’s so important.
…or “what you must know about designing for retina display and high-density screens”.
Pixel density it’s an often misunderstood subject: some people think that the solution it’s just to design everything at twice the size that they used to, but actually it’s a little simpler and more complicated than that… at the same time.
Be sure to also check the text version on Medium and remember:
- Design in vector shapes
- Design at “1x”
Conversational bots are one of those things that might seem “magical” at first glance, but on a deeper look you can discover that there’s nothing more than a clever new way of doing things.
Matthew Honnibal proposes we call this kind of technology Linguistic User Interface, by analogy with Graphical User Interfaces, explains clearly and simply how language input it’s not that different from a click, and why the opportunity for taking advantage of this kind of interfaces it’s probably much more narrow than people may think.
Read his full article on: A Natural Language User Interface is just a User Interface
Basic Authentication it’s often used as a simple security measure or as a temporary authentication method while developing with certain APIs.
While the WordPress HTTP API doesn’t have explicit support for basic authentication, it’s still possible to use it as a header:
$request = wp_remote_post( $remote_api_endpoint, array( 'body' => array( 'foo' => 'bar' ), 'headers' => array( 'Authorization' => 'Basic '. base64_encode( $username .':'. $password ) ) ) );
Remember that if you’re sending an unencrypted request, all the headers will be sent in plain text, so you should only use it over HTTPS.