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 ] ( 94 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 ] ( 97 views ) permalink
Logitech Headset 

I tried plugging in a Logitech USB headset, and Windows7 x64 didn't recognize the device (unable to install driver). The solution was to copy usb.inf from C:\Windows\System32\DriverStore\FileRepository\usb.inf_amd64_neutral_e2b28ecac19a29af to C:\Windows\Inf (there was no existing usb.inf) and then re-insert the device.

Currently the microphone is silent, which may be a hardware issue.
[ add comment ] ( 88 views ) permalink
Bastion Exception 

Purchased the Humble Indie Bundle V. Downloaded Bastion (not through Steam) and on startup, an error dialog popped up.

Turns out the .NET Framework was somehow disabled.

Windows 7:
Control Panel, Programs and Features, Turn Windows features on or off
Microsoft .NET Framework 3.5.1 - Make sure this is checked.

[ add comment ] ( 104 views ) permalink
MythTV not scheduling 

If MythTV is not scheduling recordings, tail -f /var/log/mythtv/mythbackend.log while running mythfilldatabase. At the end of it's run, mythfilldatabase will trigger a re-scan of upcoming recordings. If an SQL error occurs, it will be shown in the log.

"Prepared statement needs to be re-prepared" appears to be a MySQL error. This was fixed with mysqlcheck -u mythtv -p --repair mythconverg (using the password from /etc/mythtv/mysql.txt ). Rescheduling appears to happen immediately, without running mythfilldatabase again.
[ add comment ] ( 89 views ) permalink

<<First <Back | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Next> Last>>