Duplicity bug in current Ubuntu LTS 

If attempting to resume a partial backup with duplicity on Ubuntu 12.04 LTS the bug #946988 affects the current duplicity-0.6.18-0ubuntu3 package available.

Indications of this are "gpg: public key decryption failed: bad passphrase" when using GPG to encrypt and/or sign the backup.

The correction in comment #9 fixed the issue. /usr/bin/duplicity is a Python script so the modification can be applied manually.
[ add comment ] ( 32 views ) permalink
Counting lines of code 

To measure the lines of code in a codebase (on a standard Linux machine):

find -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.hpp" | while read i; do wc -l "$i"; done | cut -d " " -f 1 | awk '{total = total + $1}END{print total}'

The while read is needed to join together file names with spaces (versus using -exec wc -l {} \;).
[ add comment ] ( 30 views ) permalink

MySQL REGEXP accepts the standard entries like [:digit:] (equivalent to [0-9] but better practice due to languages etc). However in MySQL (or perhaps SQL in general) [ and ] are special characters, and need to be escaped by doubling them. [:digit:] needs to be [[:digit:]] in the SQL query.
[ add comment ] ( 30 views ) permalink
Python MySQLdb and string substitution 

The Python DB API specifies multiple formats for substituting strings into query strings.

pyformat implies it uses the Python % string substitution rules. However, one difference is any string substitutions will be quoted (have '' put around the value). This is a problem if you embed the value inside an existing string.

cursor.execute( "SELECT * WHERE `name`='prefix.%(val)s.postfix'", {'val':'foobar'} ) is parsed into "SELECT * WHERE `name`='prefix.'foobar'.postfix'" which is not valid SQL.

To work around this, I used cursor.execute( "SELECT * WHERE `name`=CONCAT('prefix.', %(val)s, '.postfix')", {'val':'foobar'} )
[ add comment ] ( 33 views ) permalink
LIRC on Ubuntu 12.04 

The lircd init script (/etc/init.d/lirc) sets the ir driver to exclusively use the "lirc" protocol (which forwards all IR to LIRCD?). However, if you want to use the devinput system, I had to enable "nec" protocol, and use /dev/input/by-path/ as appropriate (versus /dev/lirc0). The protocol required may vary depending on the remote you are using (or emulating in the case of a programmable remote). Search for "/sys/class/rc/" and protocols in the lirc init script.
[ add comment ] ( 33 views ) permalink

<<First <Back | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Next> Last>>