Snippets of the day – Saturday, November 2, 2013

Posted on Posted in Snippets


Here are some of the most recently published snippets!

Using lambda function to pass extra argument to slots using PyQt4 python

When programming with PyQt is useful to pass extra arguments to slots callback methods, in order to execute some code when a UI control’s action is invoked.

In this example you can see the usage of lambda expression to pass the extra argument to the method invoked when pressing a button.

Thanks to

Open the snippet

Author:    lbottaro

Testing script for Stored Procedures

This script helps developers test the performance of a stored procedure or block of code. Although it was written specifically to assist me in comparing stored procedures, it can easily be modified for other testing purposes.

The script expects two tables, ‘Seq1’ and ‘Seq2’ to exist, and be of the structure as listed in the header comment of the script. It will test the code of interest by running it using different input sizes, multiple times, and record the performance of each run.

The user should modify the values of these variables:

@RunsPerInputSize – the more runs at each input size, the more consistent the results

@InputSizeIncrement – the algorithm will start at this input size and also increment by it

@TotalNumberIncrements – the total number of different input sizes to test

For example, with @RunsPerInputSize = 2, @InputSizeIncrement = 50, and @TotalNumberIncrements = 3, the testing script will run the code to be tested with the following input sizes, in this order: 50, 100, 150, 50, 100, and 150.

Written by Jesse McLain

Open the snippet

Author:    cghersi

One thought on “Snippets of the day – Saturday, November 2, 2013

Leave a Reply

Your email address will not be published. Required fields are marked *