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.

Amazon AWS : Scaling Up to Your First 10 Million Users

This must be one of the greatest presentations on the Amazon AWS that I’ve ever seen.  It uses a gradual approach – from small and simple to huge and complex.  It covers a whole lot of different Amazon AWS services, how they compliment each other, at which stage and scale they become useful, and more.

Even quickly jumping through the slides gave me a lot to think (and Google) about.

Firefox : The Quantum Era

Entering the Quantum Era—How Firefox got fast again and where it’s going to get faster” is an insightful article showcasing the big changes happening with the Firefox browser.  It seems, the pendulum is swinging back towards the browser that almost became irrelevant.  I think that competition is good for everyone, and it has proven much more so in the end-user applications.  New ideas, new approaches, new technologies, and plenty of stimuli for the Google Chrome and other browser teams to respond with something even better.

WordPress 4.9 Field Guide

WordPress 4.9 is just around the corner (scheduled for release tomorrow, November 14th).  This version brings an impressive number of new features and improvements.  The stats so far are:

Roughly 400 bugs, 181 enhancements, 7 feature requests, and 42 blessed tasks have been marked as closed in WordPress 4.9.

Figuring out all these changes and how they affect you is an effort in itself.  But don’t you worry!  Here’s the WordPress 4.9 Field Guide, which showcases all the main changes and provides plenty of additional resources to follow up.

Wow!  WordPress 4.9 packs quit a punch!

GitHub : Archiving Repositories

GitHub archive repositories

Last week, GitHub introduced archiving of repositories. While it might not seem like a news worthy feature, it is quite useful for both individuals and teams.  Two particular scenarios that I find helpful are:

  1. Indicate that a particular repository / project is obsolete and is not maintained.  This should save quite a bit of time for people who randomly end up on a project’s page, via searching GitHub/Packagist/Google or somewhere else.
  2. Provide an insight into how many of the person’s or team’s profile are active.  It’s often difficult to estimate at a first glance, when looking at a GitHub profile of a person or a team who have been developing for a long time, how many of their projects are actually actively maintained.

Easily optimize images using PHP

Via this blog post I came across this PHP image optimization library, which somewhat reminds me of this blog post from a couple of years ago.  As good as ImageMagick is, it takes time and effort to find all the right options.  With Spatie Image Optimizer you have an almost out of the box solution for optimizing images in a variety of formats.

This package can optimize PNGs, JPGs, SVGs and GIFs by running them through a chain of various image optimization tools.