Skip to content

Instantly share code, notes, and snippets.

View rowlo's full-sized avatar

Robert Wloch rowlo

View GitHub Profile
@rowlo
rowlo / coverage run arguments template
Last active August 29, 2015 13:56
QtCreator run arguments template to testlib unti test executable for complex project structure:
-txt > tlog && (/<path_to_script>/processCoverage.sh <path_to_gcno_files> "*/<name_of_Qt_project_to_test>/src/*" <target_path_for_testcoverage_report> && <browser_executable> <target_path_for_testcoverage_report>/index.html) || (test -f <path_to_UTM>UnitTestMonitor && UnitTestMonitor) &
@rowlo
rowlo / coverage run arguments example
Last active August 29, 2015 13:56
Example run arguments line for QtCreator testlib unit test executable for complex project structure. Coverage is collected for "libRowloSqlitePersistence" project's source files and the generated html report is opened with the Opera browser. If a test fails the UnitTestMonitor will be started if found.
-txt > tlog && (/home/robert/bin/processCoverage.sh ../../work/libRowloPersistenceTest "*/libRowloPersistence/src/*" ../../testcoverage/libRowloPersistence && /usr/bin/opera ../../testcoverage/libRowloPersistence/index.html) || (test -f ~/bin/UnitTestMonitor && UnitTestMonitor) &
@rowlo
rowlo / QListLoopPerformanceDemo
Created January 2, 2014 12:15
Program for demonstrating performance gains by using loop initialization and QList::reserve(int).
#include <QCoreApplication>
#include <QDateTime>
#include <QList>
#include <QObject>
#include <QTimer>
#include <QDebug>
QList<QObject*> buildObjectList()
{
qint64 size = 10000000;
@rowlo
rowlo / QListLoopPerformance
Created January 2, 2014 12:11
Performance of creating QList and reverting it.
building list w/o reserve took 1422 ms
building list w/ reserve took 1263 ms
reversing list stack overflow took 185 ms
reversing list stack overflow with max took 159 ms
reversing list stack overflow with max and size took 133 ms
@rowlo
rowlo / buildObjectListWithReserve()
Created January 2, 2014 12:09
Create a list of a million QTimer objects using reserve(int).
QList<QObject*> buildObjectListWithReserve()
{
qint64 size = 10000000;
QList<QObject*> objectList;
objectList.reserve(size);
for (int i = 0; i < size; i++)
{
objectList << new QTimer();
}
return objectList;
@rowlo
rowlo / timeReverseStackOverflowOneLinerWithMaxAndSize
Created January 2, 2014 11:55
Reverse QList one-line with max and size initialization
for(int k=0, s=list.size(), max=(s/2); k<max; k++) list.swap(k,s-(1+k));
@rowlo
rowlo / ReverseStackOverflowOneLinerWithMax
Created January 2, 2014 11:52
Reverse QList one-line with max initialization
for(int k = 0, max = (list.size()/2); k < max; k++) list.swap(k,list.size()-(1+k));
@rowlo
rowlo / ReverseStackOverflowOneLiner
Last active January 1, 2016 23:39
Reverse QList as suggested by Marc Jentsch
for(int k = 0; k < (list.size()/2); k++) list.swap(k,list.size()-(1+k));
@rowlo
rowlo / buildObjectList()
Created January 2, 2014 11:34
Create a list of a million QTimer objects.
QList<QObject*> buildObjectList()
{
qint64 size = 10000000;
QList<QObject*> objectList;
for (int i = 0; i < size; i++)
{
objectList << new QTimer();
}
return objectList;
}
@rowlo
rowlo / leapup.sh
Created July 25, 2013 20:08
That shell script starts the leapd service and the LeapControlPanel. When used as autostart script in Kubuntu all you need to do is plug in your Leap Motion controller and enjoy.
#!/bin/bash
/usr/bin/leapd &
/usr/bin/LeapControlPanel &