Changing the charset/encoding of a file in Linux

An easy avenue in Windows to change the encoding of a file is to open it in Notepad and then use the Save As option which allows you to specify the encoding that the file should be saved using ...

Linux does offer a bunch of solutions too, albeit perhaps relatively less simple:

SVN: Remove/delete .svn directories recursively

Earlier today, I wanted to recover some files that I'd added to version control (for safe keeping). However, I did not want to retain the pesky .svn files that plague every directory in the tree (unlike the wonderful git). GOOG directed me to solutions that all rely on Linux tools to do the trick. The following does work admirably:

find . -type d -name '.svn' -print -exec rm -rf {} \;

Vim: Rejoin paragraph with forced line breaks / hard-wrapped multiple lines

Some documents contain paragraphs which are wrapped often at the 80 character mark to help with formatting and readability. This is sometimes accomplished using forced line breaks which can be quite annoying especially when you want to reverse it as I did earlier today. Rather than messing with regex and weird edge cases, use Vim which provides a lovely solution! Here it be:

Picasa in Linux under WiNE without Google Plus support

The latest version of Picasa (v3.9) is armed with Google Plus support. I suppose that this is fine even though Google Plus is inherently evil (albeit not as evil as Facebook). However, the application's camera support is lacking and Google has officially stopped supporting the product under Linux. They've also pulled many of the links and even download sites and archive sites are oddly only providing v3.9. However, Google's own servers continue to (knowingly or unknowingly) host to install file for the admirable robust v3.8. Here it is:

Drupal: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'foo.image_dimensions' doesn't exist

I ran into a WSOD on a Drupal site and checking the Drupal 7 log showed me the following:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'foo.image_dimensions' doesn't exist: SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids_0, :fids_1,

Drupal XMLSiteMap: public://xmlsitemap/ not found or not writable

I ran into the following error (or something like it) while setting up Drupal's xmlsitemap module:

public://xmlsitemap/lOtsOfgoBBlDegOOk not found or not writable

This is as expected some kind of permissions issue. Why the module can't sort this on its own, I do not know. As with everything Drupal, clear the cache first to see if that fixes things. It sometimes does. If not, you will need to get your hands dirty on the commandline (if linux):

Drupal's Twitter module: Column 'twitter_uid' cannot be null

I tried installing the Twitter module for a client and ran into the following error during authentication (oauth):

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'twitter_uid' cannot be null: INSERT INTO {twitter_account} …

Postfix: queue management commands

Here are some postfix queue management commands that I find myself using regularly (on an Ubuntu server):

Slow login into Ubuntu via SSH

Fresh install of Ubuntu Server 12.04 LTS: After installed SSHD, I found that logging in remotely was a time-consuming process as the password prompt took ages to pop up after the username prompt. Binging about, I found that this was due to SSHD performing a reverse DNS lookup of my IP to potentially check if all is kosher. Turning this check off fixes the issue:

Screen .screenrc configuration

All those who SSH into servers ought to use GNU Screen. The following is some additional configuration that can be added to a .screenrc file in your home directory. These lines do wonders to the usability of the system:

caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'


Subscribe to RSS