This is the personal blog of Felipe Lavín, co-founder & partner at Bloom User Experience.

I’m a web developer with a passion for the open web, WordPress and UX, crafting fine digital goods from Viña del Mar, Chile

Ephemera

The financial market is an algorithm gone rogue

Financial markets are the first rogue AI […] Somebody planted the idea that shareholder value was the right algorithm, the right thing to be optimizing for. But this wasn’t the way companies acted before. We can plant a different idea.

Tim O’ReillyAlgorithms have already gone rogue

The Open Web, Fuck Yeah! | hueniverse

Is your new thing so fucking amazing that people are going to install your app and give it a chance? Statistically speaking, unless you are best friend with a famous celebrity or Apple decides to feature your app in one of their top categories or search results, you are pretty much fucked

Source: The Open Web, Fuck Yeah! | hueniverse

Blog

AI is far from intelligent

Douglas Hofstadter raises a very interesting point regarding AI: can you really say that a machine it’s intelligent if it’s not actually thinking? (and not just crunching huge amounts of data to get a probabilistically advantageous answer)

If you ask me in principle if it’s possible for a computing hardware to do something like thinking, I would say absolutely it’s possible. Computing hardware can do anything that a brain could do, but I don’t think at this point we’re doing what brains do. We’re simulating the surface level of it, and many people are falling for the illusion.

Q&A: Douglas Hofstadter on why AI is far from intelligent

Control HTTP 301 redirects caching

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?

Continue reading “Control HTTP 301 redirects caching”

Hosted ElasticSearch (2017 edition)

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.

Continue reading “Hosted ElasticSearch (2017 edition)”

Simple, automated and low cost MySQL backup strategy

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.

It’s available on the repositories for Debian and Ubuntu. The project it’s officially hosted on SourceForge but you can also find lots of several of forks hosted on GitHub.

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.

Off-site backups

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.

For saving your backups to Drive you can use drive, which it’s a tiny program to pull or push files to the service. There are several platform packages for various distributions.

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

Best way to initialize a class on a WordPress plugin

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: