When Grass Was Greener

Rants on programming, photography, life, universe and everything

2011-11-03
by Marcin Gil
0 comments

How to create build numbers using Git commits

Why build numbers?

Recently one of our test engineers asked if it would be possible to embed an increasing build number on “About” page in our mobile app. The purpose of such build number is to have a single reference point when reporting failed test suites or new problems in issue management tool (eg. Bugzilla).

It is like a dogtag for software: useless for normal users and in daily use — but much needed in case of emergency. And crashing software is an emergency.

At office we are not using any kind of continuous integration server (like Hudson CI) or separate build scripts for small projects. Such servers/scripts are usually configured to create build numbers themselves. For our purpose builds are prepared either by developer or tester in development environment and shared.

Build number requirements

Requirements for build numbers are simple:

  1. Build numbers must be unique.
    Using the same source code clone/checkout must give the same build number.

  2. Build numbers must reference a single point in project history.
    There can’t be two different checkouts giving the same build number.

  3. Build numbers must be increasing.
    Consecutive and iterative builds must show progress is build numbers. It would be best if they are strictly sequential (N+1) but that’s not a hard requirement.

Usual approach to build numbers includes embedding date/hour and maybe some sequentially generated number. However if you have several builds a day then date-based number is insufficient. It does not identify uniquely a code version that was used to create the target.

Thus you need something more specific.

Continue Reading →

2011-03-15
by Marcin Gil
2 Comments

Starting Android application from browser URI

Recently, when playing with adding OpenID support to one of Android programs – namely Tracks – I have faced a simple problem.

When using OpenID, one has to delegate authentication to some 3rd party website. This is OpenID Provider. Thanks to this our application (the Relaying Party) does not have to know identifier/password and user authenticates himself on a page he knows. Nor do we have to maintain the security of these in application.

So I’ve started looking at JOpenID.

Continue Reading →

2009-12-21
by Marcin Gil
0 comments

QSqlDatabase ODBC connection to MS SQL Express 2005

In last post I’ve written a recipe how to connect from Linux to Microsoft SQL Server Express using ODBC. Now, since I’m using Qt framework for app portability, it is the time to do the same on Windows.

One can connect two ways to MS SQL: using ODBC or TDS – SQL Server’s native protocol. With new release of Qt SDK there is a QSqlOdbc4 driver bundled. No TDS driver is available for Microsoft’s native protocol.

It is quite easy to connect to DB without having to define a DSN first, just use proper connection string:

1
DRIVER={SQL Native Client};SERVER=servername;DATABASE=databasename;UID=login;PWD=pass;

So, in case of default install of SQL Express we would have:

1
2
3
4
5
6
7
8
9
QString serverName = "localhost";
QString dbName = "master";

QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
QString dsn = QString("DRIVER={SQL Native Client};SERVER=%1;DATABASE=%2;UID=sa;PWD=;").arg(serverName).arg(dbName);

db.setDatabaseName(dsn);

db.open();

Note: If you have installed the server with named instance just use form of servername\namedinstance.

1
QString serverName = "localhost\\mssqlexpress";