Querying CSV with SQL

Excel is not the only tool available when it comes working with CSV files.  I have previously mentioned TextQL (here).  Yesterday, I tried another tool, called “q”.  But since searching for “q” is not very effective, it’s also known “q text as data“.

For those using Fedora, you can install it by simply running “dnf install q-text-as-data“.   Here’s an example of how it works:

$ q-text-as-data -H -d ',' "SELECT COUNT(DISTINCT(Project)) FROM deploy.csv"
95

In the above example, I’m querying the deploy.csv file, which is in the current folder. q supports both command and tab separated values, so I’m helping it out with the “-d ‘,’” parameter, saying that this particular one is a CSV. “-H” tells q that the first row in this file is used for headers. CSV files with headers are more convenient, as you can use headers as column names, instead of numerical indexes.

RRULE will make you hate calendars

Calendars are not the simplest applications by far.  There are many different features, lots of different implementations, multitude of standards (just a few being RFC 2445, which was obsoleted by RFC 5545, which was updated by RFC 5546, RFC 6868, RFC 7529, RFC 7953, RFC 7986) , and plenty of other complexities.

One area in particular, which is cryptic and annoying is RRULE, or recurrence rule.  You know, those events that don’t just happen once, but repeat once in a while.  Starting with the most basic rules of repeating every day, and going into complete insanity of repeating every other Thursday, starting from next week and until the beginning of next year every other month, RRULEs can drive even the calmest of people completely insane.  Here’s a screenshot to give you an idea.

Here are a couple of tools that we found useful, when implementing and testing this functionality:

  • rrule.js – a JavaScript library for working with RRULEs.  See the demo here.
  • recurr – a PHP library for working with RRULEs.

nginx-module-vts – Nginx virtual host traffic status module

nginx-module-vts is a handy Nginx module for those who run complex Nginx configurations, with multiple servers, virtual hosts, caches, etc.  Here’s an example partial screenshot of the output.

GitHub : Security Alerts and Team Discussions

GitHub blog recently announced a couple of interesting new features.

Firstly, Security Alerts.   For now it only supports Ruby and JavaScript, but hopefully other languages are coming soon (PHP/Composer please!).  Security Alerts will notify repository owners if there are any known security issues in any of the packages that the repository is using.  Similar, I guess, to who SensioLabs Security Check works, but integrated with your GitHub.

Secondly, Team Discussions. This is yet another way place for the team to communicate.  There are Issues and Pull Requests already.  But those are more specific and more focused.  For anything that doesn’t have a single issue, or doesn’t have a PR yet, a Team Discussion might be a better place.

ninja-mutex – Mutex implementation for PHP

ninja-mutex is a simple to use mutex implementation for php. It supports different adapters (flock, memcache, mysql, redis, …) so you can setup it as you wish. All adapters (if set up properly) can be used in multi server environment – in other words lock is shared between web servers.