Archive for the ‘English’ Category

Update MySQL table from a file

Tuesday, January 19th, 2010

Imagine that you got a file with a list of keys that specifies entries in some table that need to be set to some value. The problem is that the list is huge and the table itself is huge too. And as usual, your job needs to be done quickly.  There is one way how to do the job with MySQL:

create table tmp (entry text);
load data infile '/tmp/input.txt' into table tmp
ignore 1 lines
(@var)
set entry=substring(@var, 15, 6);
update data,tmp set data.something=something
 where tmp.entry=data.key;
drop table tmp;

If you get complains about ‘file not found’ try to use ‘load local data’ instead of ‘load data’. And don’t forget that you are not limited on to update only one column to a constant, you can load other values from the input file and update table accordingly too.

Livestation on Linux

Monday, September 21st, 2009

Livestation is now available on Linux as a native application using Qt4 and OpenAl. It is pretty application that allows you to watch many, mostly news, TV channels.

It’s integration with Linux is perfect and it’s dependency on Qt4 is something I really support :-) because it nicely fits with my KDE4 desktop. The application uses OpenAl libraries to do audio. Installation package contains all necessary libraries in form of shared libraries, so it is even possible to remove them and use only system libraries!

My distribution (OpenSuse) uses Pulse over Alsa and the problem is that the OpenAl library coming with Livestation (libopenal.so.0) is a little bit older and doesn’t support pulse audio.

The fix is simple:

Install 32-bit OpenAl library (libopenal0-soft-32bit package on OpenSuse), remove OpenAl library provided by Livestation installation and create following configuration file for OpenAl at /etc directory (it is assumed that you have installed Livestation to /opt/Livestation before and you are performing following commands as a root user):

rm /opt/Livestation/lib/libopenal.so.0
echo '#drivers=pulse' >> /etc/openal/alsoft.conf

Problem solved!