Google reCAPTCHA, an alternative to Akismet

A few weeks ago Automattic started sending emails to users that have Akismet and ads on their sites. For a few this makes sense as the money they make from ads is enough to pay for the anti-spam plugin, but for most the cost of Akismet is higher than what they make from ads.

Google reCAPTCHA, a (mostly) free replacement for Akismet

reCAPTCHA is free for commercial sites with low traffic and can be easily included using some of the WordPress plugins available:

  • reCaptcha by BestWebSoft
  • Simple Google reCAPTCHA
  • Advanced Google reCAPTCHA

After installing the plugin the next step is to go to www.google.com/recaptcha/admin/ and register the site, with that you get the keys that the plugins ask for after the installation.

For most users that’s it, but you can get an error in which case you might need to install reCAPTCHA manually, which is very easy. If you need help get in touch.

Google Sheets IMPORTDATA, parsing dates and money

Google Sheets are probably the most popular no-code tool on the whole solar system. The poor man’s Zapier. If you are here probably you are scratching your head trying to stop GSheets from parsing something.

When using Sheets as a no-code tool the IMPORTDATA function is one of the ways available to get data from external sources, it accepts data in CSV or TSV format, with the former being one of the most popular ways of exporting data on the web.

IMPORTDATA’s locale parameter is really important

The function’s docs are -to put it lightly- lacking, you can check it here, for the sake of history I’m gonna quote the syntax of the function down here.

Syntax
IMPORTDATA(url)

url – The url from which to fetch the .csv or .tsv-formatted data, including protocol (e.g. http://).

The value for url must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.

IMPORTDATA actually has 3 parameters:

  • URL: The URL from which to fetch the .csv or .tsv-formatted data, including protocol
  • Separator: It must be a single character and may not be a double quote or whitespace character other than a tab. If unspecified, the delimiter is inferred from the file name: comma for CSV, tab for TSV.
  • Locale: A language and region locale code to use when parsing the data. If unspecified, the document locale will be used.

The “Locale” is key, it’s what the parsing engine used by GSheets uses to “understand” dates and numbers, and in most cases is what causes strange results, that mostly end with some field showing an integer that it’s not what the original file had.

The “Locale” is also present on the sheet itself, under “File” > “Settings”. Sometimes changing the “Locale” there fixes the issue, but it doesn’t always work.

If the source’s locale is not known there a several sites with a list of locales that show how numbers and date are formatted, Oracle has one that is really simple.

If it looks like a date, it must be a date.

GSheets parser
GSheets import tool

If you can use the Import functionality, use it. It has the option to NOT parse numbers, dates and formulas (see the checkbox) and it’s the easiest way to solve these kind of problems. Unfortunately sometimes using IMPORTDATA is the only option to get the data needed, because one of the limitations of the Import function is that it cannot import data from an URL.

What’s the worst that can happen?

The worst is basically having the wrong values because of the parser trying to interpret something in the wrong way.

One of the files I had to work with had a field that was some text which had 3 numbers separated by commas. That’s gotta be a date! – yelled the parser – but it wasn’t and it ended up trying to interpret the last number as a year, so it converted a “2” to “2002”.

The only way to solve that problem without writing a custom App Script was to change the software that generated the CSV and use a separator that wouldn’t confuse the parser.

Some of the error can be solved from the Sheet, changing the “Format” of the cell.

Thing to try to solve the problem

  • Change the document “Locale” going to “File” > “Settings”
  • Change the column/cell from the “Format” menu
  • Change the “Locale” parameter used by IMPORTDATA

If none of those options help, you could try using Google App Script to fetch the data.

WordPress Litespeed Cache and Shortcodes purging

Litespeed Cache is a really good description of what this plugin does, it’s a caching plugin for sites using Litespeed as a webserver.

At a SaaS I help run we have a couple of WordPress plugins that use shortcodes to show widgets with content, mostly used by news sites, and one of our customers uses Litespeed Cache as the caching solution to keep Google and readers happy.

Edge Side Includes + Litespeed Cache + shortcodes

Luckily the plugin allows an easy ways to update only the content of the shortcode and not the rest of the page. It’s so easy that you can do it just adding one word to the shortcode.

This is the shortcode for our plugin:

[downtack competition="liga-profesional-argentina-2022"]

This is the shortcode using Litespeed’s ESI Blocks:

 [esi downtack competition="liga-profesional-argentina-2022"] 

It’s too easy to be true. But there’s a catch, you also have to specify how long the Time To Live should be, if you don’t Litespeed Cache is gonna use the TTL specified in the “Default Public Cache TTL” option. But one of the solutions is so easy we didn’t have to modify our plugin’s code.

  [esi downtack competition="liga-profesional-argentina-2022" ttl="60"]  

There’s also the option to purge the shortcode programmatically, without the need to add the ttl param.

do_action( 'litespeed_purge', 'esi.downtack' );
method_exists( 'LiteSpeed_Cache_API', 'purge' ) && LiteSpeed_Cache_API::purge( 'esi.downtack' );

This last option is the one we choose as it gives us much more control over the purging of the content and helps the site run smoother as you can purge the cache whenever a change is made.

The shortcode is basically showing a HTML file downloaded from our server so it doesn’t make sense to purge the cache if that file wasn’t updated.

One thing to consider is that if Litespeed is disabled you should update the shortcodes and remove the esi keyword.

Iniciar WeatherLink mediante tareas programadas de Windows

Si te topaste con el siguiente mensaje de error: “Weatherlink installation not complete. Possibly upgraded to the wrong folder“, este post es tu amigo.

Hay 2 formas de solucionarlo, la primera consiste en crear un script .bat para que al ser lanzado se dirija a la carpeta donde está instalado WeatherLink y lo lance desde ahí con el comando “start”.

La otra opción, mas sencilla y posiblemente mejor, es utilizar las configuraciones extra del Programador de Tareas de Windows, el cual permite elegir el directorio en el que se va a ejecutar la tarea, que por el modo en que funciona WeatherLink es necesario ya que debe acceder a los archivos que se encuentran en el directorio de instalación.

programar de tareas de windows

En “Iniciar en:” deben introducir el directorio donde está instalado WeatherLink, si tienen varias opciones se puede pasar mediante parámetros qué estación elegir al lanzar la aplicación.

En el caso de esta estación, la única forma de subir los datos era mediante una PC corriendo 24/7. Por lo que además en la sección “Desencadenadores” se configuró para que la tarea se repita cada una hora en caso de que el programa deje de funcionar.

Prender la PC después de un corte de energía

Algo que deben recordar es que en caso de un corte de la energía eléctrica puede que su equipo no esté configurado para volver a prenderse y se dejen de subir los datos de la estación.

Esto se configura desde la BIOS de la PC, puede figurar de varias maneras, estas son algunas de las opciones que pueden aparecer en el menu de configuración:

  • Restore on AC Power Loss
  • Power On Options: After Power Loss = On
  • AC Back Function
Ejemplo de una BIOS AMI
Ejemplo de la opción de energía en BIOS AMI

Las opciones varían entre los fabricantes, pero normalmente nos permite elegir si siempre encender luego de que vuelve la energía, no hacerlo o volver al estado en el que estaba al momento del corte (se prende si estaba prendida cuando se interrumpió el suministro eléctrico).

Chrome se queda sin The Great Suspender (extension para suspender pestañas abiertas)

Para quienes tenemos decenas de tabs abiertas constantemente, este tipo de extensiones son la diferencia entre que Chrome consuma 4GB y 8GB de RAM, una pequeña gran diferencia.

Bueno, resulta que hoy Google deshabilitó esta extension de Chrome porque cambio de dueño y estaba siendo usada para añadir trackers y malware a diversos sitios, por lo que al abrir el navegador todas las tabs suspendidas se perdieron. Bah, casi. En realidad si abren el historial van a ver todas las tabs que estaban suspendidas, y si quieren volver a abrirlas deben copiar de la barra de direcciones el valor que se encuentra en el parámetro “uri=”.

Es una gran momento para aceptar que la mayoría de esas pestañas no deberían estar abiertas y aprender a soltar.

the great suspender malware
El aviso en la sección de Extensiones de Chrome.

Alternativas a The Great Suspender

OneTab es una extension que manualmente al presionar el botón de la extension “acumula” a todas las pestañas abiertas en una sola pestaña.

Google Tab Freeze, era una funcionalidad de Chrome que por el momento no puedo confirmar que siga existiendo o haya sido incorporada en la versión de producción del navegador, ya que en su momento estaba disponible en las versiones Canary (de pruebas).

En desarrollo. Traeré nuevas extensiones, lo prometo.

Pagina 1 de 28912345678910...203040...Ultima »