CAPS LOCK issues when VNCing into Kubuntu and krfb

I'm trying to VNC into my Kubuntu box using Jump Desktop from my Android tablet. All works well and everything is quite peachy. Everything that is, except for typing with the keyboard. Typing anything results in letters being displayed in capitals. Using the SHIFT key in the Android keyboard does fuck all. However, when I connected a keyboard to the Kubuntu box and pressed the CAPS LOCK key, my Android keyboard started typing in smalls.

Tranferring a file using PuTTY's pscp

Instead of having to look up the exact syntax for pscp every time, here's a list of examples for future reference. In these examples, I'm transferring a file (bar.zip) from a Windows host to a Linux server (with the destination path of /home/druss/Desktop/).

MySQL encoding error: Warning (Code 1366): Incorrect string value: '\xE9, a <...' for column 'body' at row 3

While performing a CSV import recently, I ran into the following error messages:

Warning (Code 1366): Incorrect string value: '\xE9, a <...' for column 'body' at row 3
Warning (Code 1366): Incorrect string value: '\xE6. He ...' for column 'body' at row 24
Warning (Code 1366): Incorrect string value: '\xE9, and...' for column 'body' at row 26

The first message was triggered due to the accented é in the word, protegé, in the input. The rest of the field was not imported. The others were similarly triggered.

Changing a file's encoding using Vim

During imports and stuff, it's imperative that all steps utilise the same encoding/character set. If a text file is not using the preferred encoding, we can use Vim to change it during its save action as follows:

:set fileencoding=utf8
:w

or if you want to save it to a different file and leave the current file unchanged:

:w ++enc=utf-8 newfile.txt

Vim does not respect certain regex character classes during substitutions

Just now while attempting to perform a substitution in GVim, I found that the regex was not working as expected. Apparently, instead of matching all non-whitespace characters denoted by the shorthand class \S, the engine was matching the letter S instead, which was odd. It turns out that, as usual, I was the one at fault. What I was doing wrong was attempting to use the character class within [] groups.

Vim runs out of memory during a find and replace

Earlier today, I had to perform a substitution in Gvim within a 2GB file. Unfortunately, after a few thousand operations, Vim ran out of memory with the following error:

  Out of memory!
Out of memory!  (allocating XXX bytes)

Windows too complained about running out of virtual memory and my system slowed down to treacle-like response times.

What is a female guru called?

According to a handy Sanskrit dictionary from the library, the female equivalent of a guru (गुरु) is a gurvi (गुर्वी). This is confirmed to an extent in a couple of places. It is also interesting to note that guru literally means grave or weighty and is cognate with the English word grave.

Upgrading KTorrent in Kubuntu Precise

KTorrent on the LTS release of Kubuntu—Precise Pangolin aka 12.04—is perfectly fine except for the fact that it comes only with version 4.1. Unfortunately, this package is missing a few features that I was looking for, especially the option to add magnet links via its web interface.

Upgrading from 4.1 to 4.3 (the latest version at the time of writing) is pretty straightforward if one is happy to accept PPA sources.

Replacing all occurences of a string in a file with another

In Linux, replacing all instances of a string with another string is easy thanks to sed. A simple example is as follows:

To replace the string foo with the string bar in all .txt files:

PDOException: SQLSTATE[HY000]: General error: 144 Table 'cache_menu' is marked as crashed and last (automatic?) repair failed: DELETE FROM {cache_menu};

While trying to edit a menu on a Drupal site, I found that none of my changes were being saved. Looking at the logs led me to the following error message:

PDOException: SQLSTATE[HY000]: General error: 144 Table 'cache_menu' is marked as crashed and last (automatic?) repair failed: DELETE FROM {cache_menu};

Simply restarting MySQL did not fix things and it looked like I had to get my hands a li'l dirty.

Pages

Subscribe to languor.us RSS