Home » 2014 » April

Enabling Bash auto-completion in Ubuntu

Virtual Private Servers are usually installed with the minimum required software. More often than not this means Bash auto-completion isn’t enabled, which is a tad bit annoying as it slows down navigation.

To fix this you can install theĀ bash-completion package. Like so:

$ sudo apt-get intall bash-completion

Open taskbar apps with Windows key + number

Something I accidentally discovered is that in Windows 8.1 (and probably 8 as well – and Windows 7) you can use the Windows key + a number to open an application from your task bar!

So lets say you’ve got Google Chrome at position 1, Thunderbird at 2 and Visual Studio 2012 at position 3. To open Thunderbird simply press Windows key + 2. For the other applications use their position number.

Useful? I don’t know, but it’s nice to know this shortcut exists to keep your hand away from your mouse I guess.

SQL: Find & Replace text in all records

On type of query I always have to run when moving a website from its test environment to its live environment is to replace the test domain in all content pages with the live domain. With SQL this can be easily done with the REPLACE(text, search, substitution) function.

For example:

UPDATE some_table
SET some_field = REPLACE(some_field, 'test.example.com', 'example.com')

This updates all records in the table some_table and replaces test.example.com with example.com in the field some_field.

Knowing which SQL functions exist can really help a lot and save time to update data.