postgres: window functions
Good article about window functions. Also note how they use a postgres feature called common table expressions.
Related cards:
Postgresql: Paginate and count in one query using window functions
When paginating records, we usually need to know the number of total records in order to render pagination links. Popular pagination libraries like will_paginate or [Kaminari](https://github.com/kaminari/...
postgres_ext: additional Rails bindings for PostgreSQL
Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel for Rails 4.x
Common table expressions
- Relation#with
- Model.from_cte
Arrays
Face.where.contains tags: %w[hap...
Ubuntu: Fix "An error occurred while installing pg"
If you get an error like this:
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure thatgem install pg -v '0.17.1'
succeeds before bundling.
Then do this:
sudo apt-get install libpq-dev
... an...
Rails: How to get PostgreSQL version being used
To check the currently running PG version from your Rails application (e.g. Rails console on your production server), simply do this:
ActiveRecord::Base.connection.select_value('SELECT version()')
Running the Awesome window manager within Gnome
Note: Consider using MATE instead of Gnome 3 on newer system
Awesome is a very good tiling window manager that provides neat features like automatic layouting of windows, good multi-display s...
PostgreSQL: How to add/remove/modify array values (and how to replace 1 value with multiple values)
PostgreSQL's array data type is pretty useful, but manipulating values of arrays can be awkward because of its syntax.
Consider the following users
table which each example below will sta...
Heads up: You should always use "current_window.resize_to" to resize the browser window in tests
I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were running on smaller screen sizes than [specified in the device metrics](https://makandracards.com/makandra/492109-capybara-running-test...
Internet Explorer to Start Automatic Upgrades across Windows XP, Windows Vista, and Windows 7
This will hopefully kill IE6 and IE7 for good. The latest available IE for Windows XP is IE8 though.
postgresql create extension without giving the application superuser rights
If you need a postgresql extension for your database it isn't a good idea to give your applications database user superuser rights (like many people on stackoverflow think)
Just login to the database with a superuser account (e.g. postgres) and c...
How to change the locale of a PostgreSQL cluster
There may be reasons to change the locale of your Postgres cluster. A popular one is your development system's locale being used by default (which may be annoying). Here is how to do that.
Beware: By following the steps below, you will drop and r...