English

Enumerate MySQL table

If you have a table "tablename" with a (non-PK) column "number" and you want to enumerate all existing rows starting with 1000 you can use the following SQL statement:



SET @n = 999;
DROP TABLE IF EXISTS `tablename_tmp`; 
CREATE TEMPORARY TABLE `tablename_tmp` (`tmpid` INT PRIMARY KEY, `n` INT);
INSERT INTO `tablename_tmp` SELECT `id`, @n := @n + 1 FROM `tablename`;
UPDATE `tablename` SET `number` = 
    (SELECT `n` FROM `tablename_tmp` WHERE `tmpid` = `id`);
DROP TABLE `tablename_tmp`;

Flex 3: Upload multiple files via POST with AS3

In my current Abobe Flex project, I needed to upload multple generated files and form fields to a server. UploadPostHelper by Jonathan Marston is a great for uploading one file at time, but sadly I couldn't use (or even modify) it - it's licensed under NonCommercial CC, and my project is a commercial one.

So I had to write my own code which I would like to share with other's (dual-licensed under MPL 1.1 and LGPL 2.1).

nVidia + Intrepid: Install Linux driver version 180

If you experience problems or poor performance using Ubuntu's latest nVidia driver nvidia-glx-177 (as I did with a "nVidia Quadro NVS 160M"), try to upgrade to version 180. A package has been build for the next version of ubuntu (called "Jaunty Jackalope"), but sadly it has not been backported to Intrepid yet.

Who cares, I'll explain how to use Jaunty's repository with Intrepid to install this driver. First, make sure that you installation is up to date:

Create screenshots of a web page using Python and QtWebKit

Update 2009-10-03:

For further development and improvements, contact me or have a look at this public github repository created by Adam Nelson.

Update 2010-04-12:

If you need flash support, you should have a look at the current github version of this script at http://github.com/AdamN/python-webkit2png/ mentioned above. We've extend the script a few month ago.


From time to time you may want to create a screenshot of a web page from command line, for example if you wish to create thumbnails for your web-application. So you might search for such a program and find tools like webkit2png, which is for Mac OS X only, or khtml2png, which requires a lot of KDE stuff to be installed on your server.

But since Qt Software, formerly known als Trolltech, integrated Safari's famous rendering engine WebKit (which is based on Konqueror's khtml engine) into its framework, we are now able to make use of it with the help of some Python and PyQt4.

blog_small1.png

If you are in a hurry, click here to get a full-featured version of webkit2png.py.

Enhance Intrepid Ibex with TuxOnIce

Ubuntu 8.10 ("Intrepid Ibex") uses the kernel's default suspend system, swsusp, but lacks support for TuxOnIce (formally known as "suspend2"). TOI has some advantages to the classic suspend system, for example "suspend to file", "LZW compression" (for faster resuming) and the ability to cancel any suspend request by pressing ESC. Have a look at the feature list for a comparison of these systems.

Pages