Win32 app dump debugging on Win64 

If you get an app dump for a 32bit application that was running on Win64, and try to view it, most of the symbols will be variants on wow64cpu and similar names.

In order to view this crash dump as a 32bit application, in WinDbg, use:
.load wow64exts
.effmach x86

to switch the debugger to the appropriate mode.
[ add comment ] ( 29 views ) permalink
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

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