Developer Blog - Inventic.eu
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Category: Programming

Incredibuild and "cannot create temporary il file"

This is caused by latest MS security update. After applying these two 3126587 and 3126593 previous versions of Incredibuild stopped working.

Command line error D8037 : cannot create temporary il file

The solution is to uninstall it

https://support.microsoft.com/en-us/kb/3126587
https://support.microsoft.com/en-us/kb/3126593

On Windows 10 the responsible update is KB3135173

Next steps

Also it's necessary to disable these updates in auto-update!

explorer_2016-04-04_10-02-20

More info:

http://xoreax.helpserve.com/Knowledgebase/Article/View/131/8/command-line-error-d8037--cannot-create-temporary-il-file

04 Apr 2016

Posted by: ludek.vodicka

Programming #Qt #incredibuild #cpp

Crash in QTreeWidget / QTreeView index mapping on Mac OSX 10.10 part III

So, one more attempt. Previous articles (part1, part2) mentioned possible solutions to fix crash insinde the QTreeWidget and QAccessibleTableCell.

Unfortunately, deselecting current item still doesn't fix all issues. The problem with deselection is that it's not handled correctly via QAccessibleTableCell:

If current index isn't valid, QAccessible doesn't correctly update currect QAccessibleTableCell object which caused all this evil crashes.

So there are two ways how to fix it. One is to manually set QAccessibleTableCell but I didn't find a way how to do that. The second way is to disable QAccessible for Property editor. Unfortunately it's not an easy task. In QAccessible exists method setActive:

QAccessible::setActive(false)

But this method works only with AccessibleObserver class but not with QPlatformAcessibility which handles real QAcessible::isActive result. Because of this it's necessary to update setActive method in file qacessible.cpp inside the Qt.

Original method:

</p>
<p>void QAccessible::setActive(bool active)<br />
{<br />
  for (int i = 0; i &lt; qAccessibleActivationObservers()-&gt;count() ;++i)<br />
    qAccessibleActivationObservers()-&gt;at(i)-&gt;accessibilityActiveChanged(active);<br />
}</p>
<p>

and updated version:

void QAccessible::setActive(bool active)<br />
{<br />
  #ifndef QT_NO_ACCESSIBILITY<br />
    if ( QPlatformAccessibility *pfAccessibility = platformAccessibility() )<br />
      pfAccessibility-&gt;setActive(active);<br />
  #endif</p>
<p>  for (int i = 0; i &lt; qAccessibleActivationObservers()-&gt;count() ;++i)<br />
    qAccessibleActivationObservers()-&gt;at(i)-&gt;accessibilityActiveChanged(active);<br />
}</p>
<p>

In case you will find better way how to turn off accessibility, please let me know.

But there is still one more problem. Occasionally OS X decides to switch accessible back on:

And this is probably the reason why everything works ok on older OS X but not on 10.10. Because OS X 10.10 randomly turns accessible on which causes this crash. Accessible is usually turned on when opening some modal dialog.

This explains why opening an empty dialog increased the probability to crash the application. The only solution I have found is to disable QAccessible every time the PropertyEditor is cleared up.

21 May 2015

Posted by: ludek.vodicka

Programming Qt Mac OS #Qt #crash #tree #property-editor

Crash in QTreeWidget / QTreeView index mapping on Mac OSX 10.10

This crash took me about 40hr+ to replicate and find a way how to eliminate it (unfortunately not to fix it). This crash occurred only on OS X 10.10, not 10.9, not Linux, not Windows.

2015-05-18_0850

Bug occurred in slightly modified QtTreePropertyBrowser where we have additional buttons for each property.

2015-05-18_0847

When any of these buttons caused property tree refresh, application randomly crashed. But when these actions were executed by buttons outside of the property tree, everything worked fine.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread<br />
0   org.qt-project.QtWidgets      	0x0000000103f49290 QTreeModel::index(QTreeWidgetItem const*, int) const + 176<br />
1   org.qt-project.QtWidgets      	0x0000000103f4950b QTreeModel::parent(QModelIndex const&amp;) const + 75<br />
2   org.qt-project.QtWidgets      	0x0000000103f23bb7 QTreeView::isIndexHidden(QModelIndex const&amp;) const + 71<br />
3   org.qt-project.QtWidgets      	0x0000000103f17e0d QTreeView::visualRect(QModelIndex const&amp;) const + 93<br />
4   org.qt-project.QtWidgets      	0x0000000103ec490d QAccessibleTableCell::rect() const + 29<br />
5   org.qt-project.QtWidgets      	0x0000000103ec46f2 QAccessibleTableCell::state() const + 146<br />
6   libqcocoa.dylib               	0x00000001071913aa QCocoaAccessible::hasValueAttribute(QAccessibleInterface*) + 58<br />
7   libqcocoa.dylib               	0x000000010718df7e -[QMacAccessibilityElement accessibilityAttributeNames] + 398<br />
8   com.apple.AppKit              	0x00007fff95dea26e NSAccessibilityEntryPointAttributeNames + 115<br />
9   com.apple.AppKit              	0x00007fff95e275af -[NSObject(NSAccessibilityInternal) _accessibilityAttributeNamesClientError:] + 56<br />
10  com.apple.AppKit              	0x00007fff95e2a62a CopyAttributeNames + 216<br />
11  com.apple.HIServices          	0x00007fff9768cbce _AXXMIGCopyAttributeNames + 252<br />
12  com.apple.HIServices          	0x00007fff976950c6 _XCopyAttributeNames + 385<br />
13  com.apple.HIServices          	0x00007fff97671109 mshMIGPerform + 199<br />
14  com.apple.CoreFoundation      	0x00007fff99259c79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41<br />
15  com.apple.CoreFoundation      	0x00007fff99259beb __CFRunLoopDoSource1 + 475<br />
16  com.apple.CoreFoundation      	0x00007fff9924b767 __CFRunLoopRun + 2375<br />
17  com.apple.CoreFoundation      	0x00007fff9924abd8 CFRunLoopRunSpecific + 296<br />
18  com.apple.HIToolbox           	0x00007fff9695d56f RunCurrentEventLoopInMode + 235<br />
19  com.apple.HIToolbox           	0x00007fff9695d2ea ReceiveNextEventCommon + 431<br />
20  com.apple.HIToolbox           	0x00007fff9695d12b _BlockUntilNextEventMatchingListInModeWithFilter + 71<br />
21  com.apple.AppKit              	0x00007fff95a489bb _DPSNextEvent + 978<br />
22  com.apple.AppKit              	0x00007fff95a47f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346<br />
23  libqcocoa.dylib               	0x000000010717b29d QCocoaEventDispatcher::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) + 2093<br />
24  org.qt-project.QtCore         	0x0000000104b0337d QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) + 381<br />
25  org.qt-project.QtWidgets      	0x0000000103e6c192 QDialog::exec() + 514<br />

I updated methods from signals-slots mechanism to QEvent system. Unfortunately this didn't help as well. Next attempt was QTimer usage instead of QEvent or signal-slot to simulate real click. But also without any success.

0   org.qt-project.QtWidgets      	0x000000011112f62e QTreeModel::data(QModelIndex const&amp;, int) const + 46<br />
1   org.qt-project.QtWidgets      	0x00000001110aa7bb QAccessibleTableCell::state() const + 347<br />
2   libqcocoa.dylib               	0x00000001143913aa QCocoaAccessible::hasValueAttribute(QAccessibleInterface*) + 58<br />
3   libqcocoa.dylib               	0x000000011438df7e -[QMacAccessibilityElement accessibilityAttributeNames] + 398<br />
4   com.apple.AppKit              	0x00007fff95dea26e NSAccessibilityEntryPointAttributeNames + 115<br />
5   com.apple.AppKit              	0x00007fff95e275af -[NSObject(NSAccessibilityInternal) _accessibilityAttributeNamesClientError:] + 56<br />

With a lot of luck I finally found the reason for the crash. It's caused by erasing a property tree (and inner QTreeWidget) together with an active focus on this widget. Unfortunately I'm not able to fix it in the QtCore because according to callstack there is only some QModelIndex manipulation without any sight of what's going wrong.

2015-05-18_0853

The effective solution how to fix this wrong behaviour is to temporally set focus to another widget (or parent), clear the tree and set focus back to property tree. Unfortunately this solution doesn't work. Check part II of this article for better solution

  QWidget* pObject = qobject_cast&lt;QWidget*&gt;(m_propertyBrowser-&gt;parent());<br />
  if (pObject!=NULL);<br />
    pObject-&gt;setFocus();<br />
	m_propertyBrowser-&gt;clear();<br />
  m_propertyBrowser-&gt;setFocus();<br />

If anyone know how to fix that, I will be glad for any info.

18 May 2015

QDialog::reject can be invoked multiple times

When user use ESC to close the dialog and press it very quickly two or more times in a row, QDialog::reject can be invoked also multiple times.

This is very dangerous and unpredictable because in case your reject will contain some one-time-execute routine the application will start crashing.

The only solution I found is to add these routines to QDialog destructor instead of to reject/accept.

24 Feb 2015

Posted by: ludek.vodicka

Programming Qt #Qt #qtgui

S3 usage statistics

13 Feb 2015

Posted by: ludek.vodicka

Programming Linux #s3 #statistics

Execute jenkins build from command line

curl -X POST --user user:apitoken http://server/job/JOB_NAME/build?delay=0sec<br />

Api token:

http://server/user/USER_NAME/configure<br />
11 Feb 2015

Posted by: ludek.vodicka

Programming #jenkins

Keyboard and mouse recording tools

09 Feb 2015

Codesign asking for credentials for on every usage

Apple OS X codesing

to fix that, it's sufficient to configure certificate to allow any application to use it without asking:

KeyChain - allow access (step 1)

KeyChain - step 2

 

External links

08 Feb 2015

Posted by: ludek.vodicka

Programming Mac OS #certificate #codesign

How to update gcc to 4.8.1 on any ubuntu

Everything is perfectly explained in this post:

http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

List of commands

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
gcc --version
06 Feb 2015

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #gcc

Mac OS - app can't be opened because the identity of the developer cannot be confirmed.

Starting with OS X 10.10 existing code signing method doesn't work. If you have application signed for 10.9 and application works without problems, with 10.10 you will get following error:

2015-02-05_1003

How to verify application sign status from command line:

codesign -dvvv /Applications/APP.app</p>
<p>Executable=/Applications/Skipper.app/Contents/MacOS/Skipper<br />
Identifier=com.skipper.Skipper<br />
Format=bundle with Mach-O thin (x86_64)<br />
CodeDirectory v=20100 size=239848 flags=0x0(none) hashes=11986+3 location=embedded<br />
Hash type=sha1 size=20<br />
CDHash=98839e7aa72de4105ac5ad8a2612682ba3bca53f<br />
Signature size=4237<br />
Authority=Developer ID Application: Inventic s.r.o. (6BYV46LH6T)<br />
Authority=Developer ID Certification Authority<br />
Authority=Apple Root CA<br />
Signed Time=03 Feb 2015 17:38:21<br />
Info.plist entries=10<br />
TeamIdentifier=not set<br />
Sealed Resources version=1 rules=4 files=44<br />
Internal requirements count=1 size=300<br />

As it's seems from the verification output, application is correctly signed but OSX doesn't accept it. Another way how to verify application sign status is via **spctl **command:

spctl --assess --type execute --verbose Skipper.app/</p>
<p>Skipper.app/: rejected<br />
source=obsolete resource envelope<br />

We have some error at least. Now it's necessary to find out what is wrong. We can try one more test:

codesign -v Skipper.app/<br />
Skipper.app/: resource envelope is obsolete (version 1 signature)<br />

where we dest little bit more details. All these errors we get only on 10.10 mac, not on 10.9 or older.

After another investigation I found following article. The most important part is:

"Important: For your apps to run on updated versions of OSX they must be signed on OS X version 10.9 or later and thus have a version 2 signature."

Another post about this topic is in felix-schwarz.org blog.

So ,it's bad. We need to update our build machine to 10.9 or at least create new "sign machine" and make sure that everything will work as expected.

Additional links

05 Feb 2015

Posted by: ludek.vodicka

Programming Mac OS #developer #mac #sign

MySQL Strict mode

</p>
<p>SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';</p>
<p>SET GLOBAL sql_mode = 'modes';<br />
SET SESSION sql_mode = 'modes';</p>
<p>SELECT @@GLOBAL.sql_mode;<br />
SELECT @@SESSION.sql_mode;<br />

30 Jan 2015

Posted by: ludek.vodicka

Programming #mysql

Error Code: 2006 - MySQL server has gone away when importing backup

The problem is probably caused by too large backup/restore script or SQL commands. The solution which works for me is increasing `max_allowed_packet` setting in my.ini

  • Open "c:\ProgramData\MySQL\MySQL Server 5.6\my.ini"
  • Change max_allowed_packet to 24M
  • Save and restart mysql service

External sources:

30 Jan 2015

Posted by: ludek.vodicka

Programming #mysql

Disable sudo password on Jenkins build machines

edit file sudoers

sudo nano /etc/sudoers</p>
<p>or</p>
<p>sudo visudo<br />

and modify

%sudo ALL=(ALL) ALL<br />

to

%sudo ALL=(ALL) NOPASSWD: ALL<br />

and add following line to the end of the file:

user ALL=NOPASSWD: ALL<br />

Be careful!

When editing sudoers, it's necessary to be very careful. Any error cause that you will not be able to edit this file anymore and also not to use sudo ;-).

Here are links how to fix it (verified ;-) )

Remote links

02 Dec 2014

Posted by: ludek.vodicka

Programming Linux #Linux #jenkins #sudo

Enabling SSL on Mongoose http server

pstrReturn = mg_set_option(serverHttps, &quot;listening_port&quot;, &quot;ssl://443:ssl.pem&quot;);  // Open port 443 with ssl.pem certificate
# openssl version)
OpenSSL 1.0.0-beta2 21 Apr 2009
# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1000 -nodes
# cat key.pem &gt; ssl.pem; cat cert.pem &gt;&gt; ssl.pem

Testing mongoose server via command line (curl), Switch -k allow to use self-signed certificates.

curl -X OPTIONS --header &quot;Access-Control-Request-Method:GET&quot; --header &quot;Access-Control-Request-Headers: accept, x-coral-api-key&quot; https://server.a18/v1/service/method -k
18 Nov 2014

Posted by: ludek.vodicka

Programming

UML tools and c++ code generators

List of UML modellers

UML tools

05 Oct 2014

Posted by: ludek.vodicka

Programming #uml #diagrams #code generator

Qt5 application hangs-up when QNetworkAccessManager and QEventLoop is used on Mac OS

To be more specific, problem occurs only in very specific circumstances. It's in situation, when application is compiled as console-app and it's compiled on Mac OS X version older than 10.9:

CONFIG -= gui<br />
CONFIG -= console<br />

and when you're using QEventLoop::exec in mode processing all events except user events (QEventLoop::ExcludeUserInputEvents):

</p>
<p>//it's only demonstration, not full code...<br />
QNetworkAccessManager manager; ...<br />
QNetworkRequest request; ...<br />
QNetworkReply *reply = manager-&gt;post(request,arData);<br />
...</p>
<p>eventLoop.exec(QEventLoop::ExcludeUserInputEvents);<br />

In this situation, application hangs-up. When the application is compiled with GUI mode or when application is compiled on Linux/Windows (no matter if gui or console), everything works find. To fix this problem, it's necessary to implement hack similar to this (simplified version):

   bool bAllowUserInputEvents = false;</p>
<p>#if defined(PLATFORM_MACOS) &amp;&amp; defined(AX_APP_CONSOLE)<br />
   bAllowUserInputEvents = true;<br />
#endif</p>
<p>  if ( bAllowUserInputEvents == false )<br />
    eventLoop.exec(QEventLoop::ExcludeUserInputEvents);<br />
  else<br />
    eventLoop.exec(QEventLoop::AllEvents);<br />

17 Sep 2014

Qt5 application crashed with error 0xc0000005

This is very interesting crash and I think it should be considered as Qt bug. This problem arise only under very special circumstances. But one after another.

You will identify this problem when your application stopped/exited immediately after the start without any visible error message. It looks like the application isn't executed at all. When you check application log (Computer -> manage -> Event viewer -> Windows logs -> Application), you will see Error logs:

Windows applications logs

The most interesting part of this log is crash location: ntdll.dll

Faulting application name: Skipper.exe, version: 3.0.1.1120, time stamp: 0x53e9c8d7<br />
Faulting module name: ntdll.dll, version: 6.1.7601.18247, time stamp: 0x521ea8e7<br />
Exception code: 0xc0000005<br />
Fault offset: 0x0002e3be<br />
Faulting process id: 0x1c88<br />
Faulting application start time: 0x01cfb606553e594b<br />
Faulting application path: T:\S2\Skipper.exe<br />
Faulting module path: C:\Windows\SysWOW64\ntdll.dll<br />
Report Id: 98cc8228-21f9-11e4-ab5d-005056c00008<br />

At first sight it seems like some problem inside the windows. But the opposite is true, the problem (as almost always) is inside your app ;-).

As the next step, you can try to debug this executable via Visual Studio to see what happens inside. Simply open executable as project together with .pdb files and execute it. Now you can see that application is correctly executed but crashes as soon as it touches Qt library. The location of crash is inside ntdll.dll in RtlHeapFree() function.

Debuging crash in VisualStudio 2013

So the problem is inside the Qt, right? Almost true, but not for the 100%. When I tried to run this application on computers of my colleagues, everything works ok. So why the application doesn't work on my computer too?

Resolution

The problem is in new Qt5 plugin system. Besides the common Qt5*.dll files which are loaded immediately after the application start, Qt5 is also loading plugins/platform-plugins dynamically when the application is executed. To locate this plugins, Qt5 uses following method to identify directories where to search for plugins:

QStringList QCoreApplication::libraryPaths()<br />

For some strange reason this library returns as first directory path where Qt5 libraries were compiled and after that location based on the executable. So if your Qt5 path is C:\Qt5, this will be the first path where all plugins are searched for, no matter if the correct version of plugin is located in APP\plugins or APP\platforms. **I think this is serious bug in Qt5**.

Where is the problem?

And here we're getting to the core of the whole problem.

**If application is compiled on computer with one compiler and used on second  computer which contains the same path to which original computer has installed Qt, the application will load all plugins from your folder instead of itself folder.**

In case your computer will contain different version of Qt, different compiler or different platform, application loads incorrect libraries and crashes. Completely, silently and without easy way to determine what's wrong.

Solution?

The solution is simple, but it isn't achievable from outside of the Qt library. It would be necessary to Qt as first tried to load libraries from application directory. And only if no plugins were found in application directory, the application would try to search for plugins in Qt directory.

Qt change solution

The simplest way how to fix this issue inside the Qt library would be to rename/update appendApplicationPathToLibraryPaths  function to prependApplicationPathToLibraryPaths and change

void QCoreApplicationPrivate::prependApplicationPathToLibraryPaths()<br />
{<br />
#ifndef QT_NO_LIBRARY<br />
    QStringList *app_libpaths = coreappdata()-&gt;app_libpaths;<br />
    if (!app_libpaths)<br />
        coreappdata()-&gt;app_libpaths = app_libpaths = new QStringList;<br />
    QString app_location = QCoreApplication::applicationFilePath();<br />
    app_location.truncate(app_location.lastIndexOf(QLatin1Char('/')));<br />
#ifdef Q_OS_WINRT<br />
    if (app_location.isEmpty())<br />
        app_location.append(QLatin1Char('/'));<br />
#endif<br />
    app_location = QDir(app_location).canonicalPath();<br />
    if (QFile::exists(app_location) &amp;&amp; !app_libpaths-&gt;contains(app_location))<br />
        //CHANGE THIS ROW: app_libpaths-&gt;append(app_location);<br />
        //TO FOLLOWING<br />
        app_libpaths-&gt;prepend(app_location);<br />
#endif<br />
}<br />

InApp solution

Unfortunately it isn't possible to simply change this behavior from your app. All of these operations happen directly in QCoreApplication constructor so if you try to change it after, it's too late.

The temporary solution before this problem will be resolved is to reinitialize library paths before QCoreApplication is initialized. It's necessary to clean libray paths, compute new paths and re-initialize QCoreApplication::libraryPaths before QCoreApplication object is initialized. This can be done in main.cpp of your application before you will create QApplication/QCoreApplication object.

  QString executable = argv[0];<br />
  QString executablePath = executable.mid(0,executable.lastIndexOf(&quot;\\&quot;));<br />
  QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);<br />
  QCoreApplication::removeLibraryPath(installPathPlugins);<br />
  QCoreApplication::addLibraryPath(installPathPlugins);<br />
  QCoreApplication::addLibraryPath(executablePath);<br />

It's not a nice solution, but it works. I tried  to report this issue also to bugreports.QtProject, so maybe in later version this will be fixed.

12 Aug 2014

Tips for versioning systems (Git, svn, mercurial,...)

Get packed archive of changed files from git directory (more info)

zip changes.zip $(git diff --name-only)<br />

Packed last changes of git:

 git archive -o qt-changes.zip head $(git diff --name-only)<br />

How to upgrade svn to 1.7 on Ubuntu 10.4

Here is nice step-by-step manual.

09 Aug 2014

Visual Studio 2013 - Visualizers

One of very useful feature of Visual Studio is custom variables views. It's possible to configure own views to each of your class. For this, VS2013 (and VS2012) uses .natvis files located in following directories:

%VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers<br />
%USERPROFILE%\My Documents\Visual Studio 2013\Visualizers<br />

Files are stored in common .xml format and has following format:

&lt;AutoVisualizer xmlns=&quot;http://schemas.microsoft.com/vstudio/debugger/natvis/2010&quot;&gt;<br />
  &lt;Type Name=&quot;String::CStringHolder&amp;lt;String::string_trait&amp;lt;char&amp;gt; &amp;gt;&quot;&gt;<br />
    &lt;DisplayString&gt;{m_pszData,s8}&lt;/DisplayString&gt;<br />
    &lt;StringView&gt;m_pszData&lt;/StringView&gt;<br />
    &lt;Expand&gt;<br />
      &lt;Item Name=&quot;[m_pszData]&quot;&gt;m_pszData&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nDataLength]&quot;&gt;m_pStringData-&gt;nDataLength&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nAllocLength]&quot;&gt;m_pStringData-&gt;nAllocLength&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nRefs]&quot;&gt;m_pStringData-&gt;nRefs&lt;/Item&gt;<br />
    &lt;/Expand&gt;<br />
  &lt;/Type&gt;<br />
&lt;/AutoVisualizer&gt;<br />

Debugging .natvis files

Visual studio contains a way how to catch syntax and logical errors in natvis format. All warnings/errors can be displayed to Visual Studio output panel by specifying following registry key to "1".

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Debugger<br />
&quot;EnableNatvisDiagnostics&quot;=dword:00000001<br />

Note: It's necessary to restart Visual studio to turn on this feature

Other usefull links

06 Aug 2014

Code signing certificate for windows

We encounter several problems when we tried to deploy our new version of ORM Designer - Skipper to our new web site skipper18.com. Although new Skipper installer is very simmilar to ORM Designer installer, when downloading this exe-file from the new site  we are getting this error:

installer.exe is not commonly downloaded and could harm your computer<br />

IE_No_Digital_Signature

 

The problem is somewhere in chrome/IE when evaluating downloaded file. Probably combination of new site, new executable and new name of product is the problem.

To fix this issue, we decided to sign-in installer and application executable by **Code-signing certificate.** There are a lot of certificate providers and the costs are very different. A lot of providers are selling these certificate for around $500/year. Fortunately it's possible to found certificates also for $75 - $95/year. The cheapest one is from tucows.com but based on the site and additional tools I decided for ksoftware.net, The price $95/year isn't so different but they offer also command line and GUI signing tool for their certificates called kSign.

Order process

Fill your company details, pay with paypal and wait until someone from Comodo will contact you with additional details. It's necessary to have the same contact information on the domain registration as on certificate registration. It is also necessary to have company registered in one of publicly available lists with the same company information as on certificate registration.

Next step is a validation through phone call. It is a quick call when you confirm registration info through the call in order to verify your phone number. Phone call is the last necessary step and then you receive email with certificate:

Windows developer certificate

Usage

Signing of the application and installer is pretty easy. K-Software offers two applications for this purposes. The first one is with GUI, second one is command line based. Both applications need only few parameters like where the certificate is stored, certificate password, application description, link and executable location:

kSign

Command line application is executed through following command:

kSignCMD.exe /d &quot;Skipper application&quot; /du &quot;http://www.skipper18.com&quot; /f PATH\certificate.pfx /p PASSWORD PATH\Skipper.exe<br />

And that's all. Now if you checked your executable through properties in Windows explorer, you see that your application is correctly signed:

Signed application

External links

27 Jun 2014

Qt app crash on mac when executed with parameters

Our reporting tool occasional crashed on MacOs when was executed with several command line params. Command looked like this:

/app-path/OrmDesigner2 -crash-report -dump-directory /var/folders/4z/k1r35jnn4v77mzl7hzf8wvvw0000gn/T/OrmDesigner2/CrashReports<br />

When inspecting exception report, we found following stack trace:

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread<br />
0   QtCore                         0x0000000100d671da QString::fromLocal8Bit(char const*, int) + 42<br />
1   QtCore                         0x0000000100e72dac QCoreApplication::arguments() + 124<br />
2   QtGui                          0x00000001000de8ef -[QCocoaApplicationDelegate application:openFiles:] + 223<br />
3   com.apple.AppKit               0x00007fff805f3b52 -[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:] + 505<br />
4   com.apple.AppKit               0x00007fff804c0065 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 217<br />
5   com.apple.Foundation           0x00007fff800f90d6 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 360<br />
6   com.apple.Foundation           0x00007fff800f8f06 _NSAppleEventManagerGenericHandler + 114<br />
7   com.apple.AE                   0x00007fff82b1c32b aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 162<br />
8   com.apple.AE                   0x00007fff82b1c224 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 32<br />
9   com.apple.AE                   0x00007fff82b1c12b aeProcessAppleEvent + 210<br />
10  com.apple.HIToolbox            0x00007fff875ed619 AEProcessAppleEvent + 48<br />
11  com.apple.AppKit               0x00007fff803c5095 _DPSNextEvent + 1191<br />
12  com.apple.AppKit               0x00007fff803c4801 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155<br />
13  com.apple.AppKit               0x00007fff8038a68f -[NSApplication run] + 395<br />
14  QtGui                          0x00000001000e7c04 QEventDispatcherMac::processEvents(QFlags) + 1588<br />
15  QtCore                         0x0000000100e70774 QEventLoop::processEvents(QFlags) + 68<br />
16  QtCore                         0x0000000100e70a94 QEventLoop::exec(QFlags) + 180<br />
17  QtCore                         0x0000000100e720bc QCoreApplication::exec() + 188<br />
18  com.inventic.ormdesigner       0x0000000100003447 main + 46 (main.cpp:31)<br />
19  com.inventic.ormdesigner       0x00000001000032e0 start + 52<br />

After some google-searching I found out that the problem is in core of our application. When subclassing Qt QApplication, it's necessary to pass argc with reference, not by value. So after adding one little &, everything works like charm!

//construct application object<br />
CApplication(int&amp; argc, char **argv);<br />

External links

01 Mar 2014

VS2010 always rebuilding moc files on Qt

My VS2010 on every build always recreate all .moc files and associated .cpp files. Problem was in incredibuild clausule during compilation of my Qt libraries.

 

      &lt;AdditionalInputs Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;Rem;axApplication\axAppException\dialogUnhandledException.ui;%(AdditionalInputs)&lt;/AdditionalInputs&gt;<br />
      &lt;Command Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;Rem IncrediBuild_AllowRemote &amp;#x000D;&amp;#x000A;if errorlevel 1 goto VCEnd&amp;#x000D;&amp;#x000A; Rem IncrediBuild_OutputFile ..\GeneratedFiles\ui_dialogUnhandledException.h &amp;#x000D;&amp;#x000A;if errorlevel 1 goto VCEnd&amp;#x000D;&amp;#x000A; Q:\ExternalLibraries\qt-git-32bit\bin\uic.exe axApplication\axAppException\dialogUnhandledException.ui -o ..\GeneratedFiles\ui_dialogUnhandledException.h&lt;/Command&gt;<br />
      &lt;Message Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;UIC axApplication\axAppException\dialogUnhandledException.ui&lt;/Message&gt;<br />
      &lt;Outputs Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;..\GeneratedFiles\ui_dialogUnhandledException.h;%(Outputs)&lt;/Outputs&gt;<br />

instead of

      &lt;AdditionalInputs Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;Q:\ExternalLibraries\qt-4.8.2-32bit\bin\uic.exe;axApplication\axAppException\dialogUnhandledException.ui;%(AdditionalInputs)&lt;/AdditionalInputs&gt;<br />
      &lt;Command Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;Q:\ExternalLibraries\qt-4.8.2-32bit\bin\uic.exe axApplication\axAppException\dialogUnhandledException.ui -o ..\GeneratedFiles\ui_dialogUnhandledException.h&lt;/Command&gt;<br />
      &lt;Message Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;UIC axApplication\axAppException\dialogUnhandledException.ui&lt;/Message&gt;<br />
      &lt;Outputs Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|Win32'&quot;&gt;..\GeneratedFiles\ui_dialogUnhandledException.h;%(Outputs)&lt;/Outputs&gt;<br />

Although qmake added all these incredibuild defines to my VS project, Incredibuild still doesn't compile it in parallel so it was totally useless. The most simply way is edit incredibuild_xge.prf and turn-off it.

mkspecs\features\incredibuild_xge.prf </p>
<p>contains(TEMPLATE, &quot;XXXvc.*&quot;) {<br />

How to enable VS2010 logging

06 Jan 2014

Posted by: ludek.vodicka

Programming Qt #Qt #incredibuild #qmake #vs2010

Qt on OSX Maverick - Undefined symbols for architecture x86_64

The problem is that starting with OSX 10.9 Apple changed default standard c++ library from libstdc++ to libc++.

Qt binary distribution compile with -stdlib=libstdc++ to be compatible with 10.6, Xcode 5 on 10.9 will select -stdlib=libc++ by default (for OS X 10.7 and better only). So symbol using classes from the standard library (like std::string in this case) will not resolve correctly at link time.

Undefined symbols for architecture x86_64:<br />
&quot;boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string&amp;lt;wchar_t, std::char_traits&amp;lt;wchar_t&amp;gt;, std::allocator&amp;lt;wchar_t&amp;gt; &amp;gt;&amp;amp;, std::codecvt&amp;lt;wchar_t, char, __mbstate_t&amp;gt; const&amp;amp;)&quot;, referenced from:<br />
boost::filesystem::path::wstring(std::codecvt&amp;lt;wchar_t, char, __mbstate_t&amp;gt; const&amp;amp;) const in filePath.o<br />
boost::filesystem::path::wstring(std::codecvt&amp;lt;wchar_t, char, __mbstate_t&amp;gt; const&amp;amp;) const in fileEnumerator.o<br />
boost::filesystem::path::wstring(std::codecvt&amp;lt;wchar_t, char, __mbstate_t&amp;gt; const&amp;amp;) const in directoryHelper.test.o<br />

So it's necessary to compile all libraries with one type of libstdc++ (or libc++). Because I need to keep 10.6 compatibility, it's necessary to compile boost and other libraries with libstdc++ dependency.

To check which library is used, use otool tool:

otool -L library.dylib<br />

As result you will get something like this (check /libc++1.dylib):

otool -L boost/lib/libboost_filesystem.dylib<br />
boost/lib/libboost_filesystem.dylib:<br />
	boost/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
	boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)<br />
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)<br />

How to fix it for boost

it's necessary to recompile boost (and don't forget to remove ./bin.v2 directory) with these params:

  ./b2 cxxflags=&quot;-stdlib=libstdc++&quot; linkflags=&quot;-stdlib=libstdc++&quot; ...<br />

and run otool again:

boost/lib/libboost_filesystem.dylib:<br />
	boost/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
	boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)<br />
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)<br />

How to fix it for CMake libraries

In case you're using library which is built by CMake system, you  need to add following flag:

cmake -DCMAKE_CXX_FLAGS=&quot;-stdlib=libstdc++&quot;<br />

How to fix other libraries

For any other library it's necessary to pass libstdc++ flag in any available way, for example modify makefile and add :

CXXFLAGS = -stdlib=libstdc++

Second way how to fix it, compile app using latest compiler

Another way is to update mkspecs to compile for latest MacOS version, after that, compiler will be the same like compiler used on all other libraries. To do that, it's necessary to update file:

/usr/local/Qt-5.3.1/mkspecs/macx-clang/qmake.conf

and change following line:

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

to latest 10.9 version:

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9

More info about this process check here:

http://stackoverflow.com/questions/20342896/solved-qt5-1-qt5-2-mac-os-10-9-mavericks-xcode-5-0-2-undefined-symbols

And that's all

Hope this post saves you a lot of time I have to spent by searching these answers ;-)

External links:

05 Jan 2014

Posted by: ludek.vodicka

Programming Mac OS #Qt #mac #libstdc++ #maverick #clang

nginx and fast-cgi - tips and tricks

How to pass full path to fast-cgi app

It's necessary to configure which parameters are passed to fast-cgi application from nginx server. For this purposes serves fastcgi_param keyword. It's a good practice to keeps all fastcgi params together. For this purposes nginx has fastcgi.conf file. This file already contains most of useful fastcgi_param bindings.

fastcgi_param  QUERY_STRING       $query_string;<br />
fastcgi_param  REQUEST_METHOD     $request_method;<br />
fastcgi_param  CONTENT_TYPE       $content_type;<br />
...<br />

To include this file use include statement:

location / {<br />
   include fastcgi_params;<br />
   fastcgi_pass 127.0.0.1:9345;<br />
 }<br />

How to pass custom headers to fast-cgi app

Default configuration pass only default headers to fast-cgi. It's necessary to add few more configurations statements:

fastcgi_pass_request_headers on;<br />

After that headers are passed as HTTP_* parameters:

HTTP_HEADER1=2222<br />

External links

18 Nov 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #nginx

How to compile FastCGI library in Visual Studio 2010 C++

FastCGI comes with Win32 project for VisualStudio6. Unfortunately when you try to open it in VisualStudio2010 the project will be corrupted. To correctly compile it for VS2010 it's necessary to download library sources, get patches from cybozu.co.jp site and apply it.

Download library

Download latest version of Development Kit here and extract it to standalone directory.

FastCGI

Get and update patches

Download all five patches from Cybozu site. Now when you have patches it's necessary to convert all files to correct windows-ending format. This can be done for example in Notepad++.

Convert to windows EOL

Get patch.exe application

Now you need some application capable to apply the patches. Unfortunately windows doesn't contain any application for this task and also lot of comparing/merging applications can't do that.

The simplest way is to download windows conversion of linux patch.exe app. Get it from gnuwin32 site - patch for windows.

Apply patch to project files

Apply patches

Open directory with fastcgi library, copy all patch files to this directory and open command line. As next run patch command for all fives patches:

...\fcgi-2.4.1-SNAP-0311112127&gt;patch -Np1 &lt; 4-vc9.patch<br />
patching file Win32/FastCGI.sln<br />
patching file Win32/authorizer.vcproj<br />
patching file Win32/cgifcgi.vcproj<br />
patching file Win32/config_h.vcproj<br />
patching file Win32/echo-cpp.vcproj<br />
patching file Win32/echo.vcproj<br />
patching file Win32/echox.vcproj<br />
patching file Win32/libfcgi.vcproj<br />
patching file Win32/logdump.vcproj<br />
patching file Win32/size.vcproj<br />
patching file Win32/threaded.vcproj<br />

In case you will see following error message:

patching file Win32/FastCGI.sln<br />
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354</p>
<p>This application has requested the Runtime to terminate it in an unusual way.<br />
Please contact the application's support team for more information.<br />

it's necessary to convert ALL patch files to correct Windows format (correct EOL) as mentioned in previous section.

More patches...

When you apply patches by cybozu it's time to apply my own patches ;-).

Manually updated rejected file

As first, it's probably that you will see following message:

1 out of 26 hunks FAILED -- saving rejects to file libfcgi/os_win32.c.rej<br />

It's because original patch is for older version of library and file os_win32.c  is slightly different. To fix that, edit this file at line 841 and manually update following line:

//original<br />
int len = p - bindPath + 1;</p>
<p>//updated line<br />
intptr_t len = p - bindPath + 1;<br />

Update VS project file

Now turn off generating the Map Files in project configuration. These files aren't necessary and it isn't possible to compile project correctly with this settings.

Turn off .map files

DONE

And that's all. Now you will be able to sucesfully compile fast-cgi library.

Compilation complete

External links

18 Nov 2013

Posted by: ludek.vodicka

Programming Windows #C++ #fastcgi #nginx

FastCGI c++ library for all platforms (Windows, Mac and Linux)

List of existing libraries

Snippets

Stackoverflow articles

Tutorials

Other links

CGICC - how to update it for VS2010 COMPILATION

  •  **error C2668: 'cgicc::copy_if' : ambiguous call to overloaded function** - add cgicc:: to all cgicc::copy_if instances
  •  **error LNK2019: unresolved external symbol** - add compiled .lib path (...Debug\cgicc.lib) to all dependend projects
17 Nov 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #C++ #fastcgi #nginx

Slow execution of application from Visual studio

Today my Visual Studio 2010 started to execute my application super slowly. When I tried to execute my application (without any changes in source-code) the delay between "Start Debugging" and application start was about one minute.

I know that too many breakpoints or breakpoints in templates could caused this, but I don't see any breakpoint in my Breakpoints window.

Breakpoint window

But as I have found that the problem was really caused by breakpoints. In some special cases - when you're using some external tools to modified your project file (.sln/.vcxproj) - breakpoints can disappear and begin to make a trouble (I'm using Qt qmake to update my project based on .pro files.)

The solution is pretty easy. Use **Delete All Breakpoins** from Debug menu:

Delete all breakpoints

And your problem will be solved ;-).

21 Sep 2013

HTML5 + Javascript chart libraries

For our side-project used for customer analytic we need simple way how to generate HTML pages with tables and charts. As HTML5 UI framework we're using Foundation and for tables jQuery Tablesorter. Now the question is which chart library use for charts.

Chart libraries

Tested and usefull

Not tested, hard to use, not attractive ...

01 Sep 2013

Posted by: ludek.vodicka

Programming Web tools #html5 #javascript #chart

GetTickCount64 problem on WindowsXP

[caption id="" align="aligncenter" width="637"]
The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll
The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll[/caption]

Today we received report from one of our customers about problem with our ORM Designer on WindowsXP - 32bit. Our latest version returns following error:

The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll

**The problem is that GetTickCount64 doesn't exists in XP system**.

**Solution:**

It's necessary to compile your application (and any library which uses GetTickCount64) with correct **WINVER** and **_WIN32_WINNT **defines value. List of WINVER values for all Windows version can be found here.

You can define these values in your resource.h file:

#define WINVER 0x0501
#define _WIN32_WINNT 0x0501

or add it to a project property -> C/C++ -> Preprocessor -> Preprocessor Definitions:

2013-08-29_15-45-10

**Qt Solution:**

If you want to define these values automatically in Qt project, add following lines to your .pro file:

#Windows XP compatability
DEFINES += "WINVER=0x0501"
DEFINES += "_WIN32_WINNT=0x0501"

External links:

29 Aug 2013

Why I am not using phpMyAdmin on production servers

Even though I find phpMyAdmin and similar tools useful I don't like them on production servers. When I spent a lot of my time protecting website against SQL injection I don't want to leave opened doors to access the database through phpMyAdmin. Many phpMyAdmin installations are not protected with HTTPS and just one login on a public or attacked wifi can lead to a lot of troubles. So I recommend to delete the phpMyAdmin installation from the server and start with a more comfortable and secured way to do the task.

SSH tunnel will give you the security you're looking for. Start your Putty, load the session and configure tunnel:

Putty tunnel screenshot

I've selected port 3366 to be used on my local machine so it avoids conflict with my other installation. Now I can connect from any tool to MySQL database at localhost:3366. I prefer Netbeans IDE and MySQL Workbench which is also really great for server/user configuration.

28 Aug 2013

Posted by: ludek.vodicka

Programming Linux #Linux #ssh

Secure SSH with RSA/DSA key

We are using SSH a lot to deploy our projects and to do common maintenance tasks. If you are accessing your server many times a day you might find frustrating typing the password all the time. You can use private key instead. Here are some detailed articles about adding RSA key and configuring SSH daemon. Bellow is a summary of the basic steps for Windows users.

Putty which is a great alternative to the Linux tools. To generate private/public key you should use PuttyGen.exe. Run the application, click generate and follow the instructions. It's a good idea to put your name into the key comment so you could easily recognize your public key in configuration files. You should also protect your key with a password.

PuttyGen screenshot

Copy the public key which is located in the big text field above Key fingerprint field. Append the public key into /root/.ssh/authorized_keys file (if you want to login as root). You might need to create this file if it doesn't exist already. Click on Save private key button and save the key to a secured place. You can now use this private key to login with putty to the remote server. To make things more comfortable you can use an agent to store unlocked private keys in the memory while you are logged into your computer. Run this command after you login:

pageant.exe john_doe.ppk

Without any further settings you should now be able to login to the remote SSH without password. If everything worked as expected you can now disable password authenticated access to make your server more secure:

# /etc/ssh/sshd_config
PasswordAuthentication no

To load you key after you login to a Linux box (useful for deployment) insert:


# ~/.bash_profile
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

keychain --clear id_rsa
. ~/.keychain/$HOSTNAME-sh

ssh-add

Now we have a little bit more secured but more comfortable way to use SSH.

28 Aug 2013

Posted by: ludek.vodicka

Programming Linux #Linux #ssh #rsa/dsa key

Error in RegEx (atlrx.h) in Visual Studio C++ 2003 and 2005

During our development we found that Microsoft RegEx (Regular expression) implementation contains a bug which caused crashes of our applications. The application module using RegEx passed all unit test, but sometimes under heavy usage the application crashed at our customer. Because we use **BugTrap **for error and crash notifications, we knew the error was in atlrx.h file.

After several hours of testing and searching we found the bug. The crash didn't occur after first code execution, but we had to run thousand iterations of the same code over and over. The bug is located in file atlrx.h at line 708.

Original file looks like this:

  case RE_ADVANCE:
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '
')
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;
    break;

Problem is, that variable szCurrInput have in some circumstances NULL value and this causes the crashes.

**Updated file with bug fix:**

  case RE_ADVANCE:
    if( szCurrInput == NULL || *szCurrInput == '
' )
      goto Error;
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '
')
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;
    break;

We change the first two lines. It is necessary to test szCurrInput variable for NULL and empty string value. If szCurrInput is NULL or empty string, it's necessary to stop processing RegEx. Otherwise stack overflow during processing string occurs.

Note

Some time later we had other problems with Microsoft RegEx implementation and non-standard RegEx syntax. So we left MS RegEx parser and moved to Boost.Regex which is really nice piece of code (as well as other libraries of the Boost pack) and supports Perl and POSIX regular expressions. Whole Boost library is carefully unit test and can be relied on.

28 Aug 2013

Posted by: ludek.vodicka

Programming #C++ #visual studio #regex #bug #atl

XSLT snippet to convert string from CamelCase to hyphens (Hyphenize)

Here is a snippet to convert string in XSLT template from CamelCase to hyphenized text. (Developed today while creating new import/export templates for Doctrine2 YAML support).

Usage:

&lt;xsl:call-template name=&quot;ConvertCamelToXmlStyle&quot;&gt;
	&lt;xsl:with-param name=&quot;text&quot;&gt;OrmDesigner&lt;/xsl:with-param&gt;
&lt;/xsl:call-template&gt;

Result:

orm-designer

XSLT Template:

	&lt;!-- =========================================================================== --&gt;
	&lt;!-- === Convert CameCaseText to camel-case-text                             === --&gt;
	&lt;!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com) === --&gt;
	&lt;!-- =========================================================================== --&gt;
	&lt;xsl:template name=&quot;ConvertCamelToXmlStyle&quot;&gt;
		&lt;xsl:param name=&quot;text&quot;/&gt;
		&lt;xsl:variable name=&quot;Upper&quot;&gt;ABCDEFGHIJKLMNOPQRSTUVQXYZ ,&lt;/xsl:variable&gt;
		&lt;xsl:variable name=&quot;Lower&quot;&gt;abcdefghijklmnopqrstuvwxyz&lt;/xsl:variable&gt;</p>
		&lt;xsl:for-each select=&quot;str:split($text,'')&quot;&gt;
			&lt;xsl:choose&gt;
				&lt;xsl:when test=&quot;contains($Upper,node())&quot;&gt;
					&lt;xsl:if test=&quot;position()&gt;1&quot;&gt;
						&lt;xsl:text&gt;-&lt;/xsl:text&gt;
					&lt;/xsl:if&gt;
					&lt;xsl:value-of select=&quot;translate(node(),$Upper,$Lower)&quot;/&gt;
				&lt;/xsl:when&gt;
				&lt;xsl:otherwise&gt;
					&lt;xsl:value-of select=&quot;node()&quot;/&gt;
				&lt;/xsl:otherwise&gt;
			&lt;/xsl:choose&gt;
		&lt;/xsl:for-each&gt;
	&lt;/xsl:template&gt;

Feel free to use in whatever way you find it useful.

28 Aug 2013

Posted by: ludek.vodicka

Programming #xslt

XSLT snippet to convert string from hyphens to CamelCase

Here is a snippet to convert string in XSLT template from hyphenized text to CamelCase. (Developed today while creating new import/export templates for Doctrine2 YAML support).

Usage:

First:
		&lt;xsl:call-template name=&quot;ConvertXmlStyleToCamelCase&quot;&gt;
			&lt;xsl:with-param name=&quot;text&quot;&gt;orm-designer&lt;/xsl:with-param&gt;
		&lt;/xsl:call-template&gt;</p>
<p>Second:
		&lt;xsl:call-template name=&quot;ConvertXmlStyleToCamelCase&quot;&gt;
			&lt;xsl:with-param name=&quot;text&quot;&gt;orm-designer&lt;/xsl:with-param&gt;
			&lt;xsl:with-param name=&quot;firstLower&quot; select=&quot;false()&quot;/&gt;
		&lt;/xsl:call-template&gt;

Result:

First: ormDesigner
Second: OrmDesinger

XSLT Template:

	&lt;!-- =========================================================================== --&gt;
	&lt;!-- === Convert camel-case-text to CameCaseText                             === --&gt;
	&lt;!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com) === --&gt;
	&lt;!-- =========================================================================== --&gt;
	&lt;xsl:template name=&quot;ConvertXmlStyleToCamelCase&quot;&gt;
		&lt;xsl:param name=&quot;text&quot;/&gt;
		&lt;xsl:param name=&quot;firstLower&quot; select=&quot;true()&quot;/&gt;</p>
		&lt;xsl:variable name=&quot;Upper&quot;&gt;ABCDEFGHIJKLMNOPQRSTUVQXYZ&lt;/xsl:variable&gt;
		&lt;xsl:variable name=&quot;Lower&quot;&gt;abcdefghijklmnopqrstuvwxyz&lt;/xsl:variable&gt;</p>
		&lt;xsl:for-each select=&quot;str:split($text,'-')&quot;&gt;
			&lt;xsl:choose&gt;
				&lt;xsl:when test=&quot;position()=1 and $firstLower = true()&quot;&gt;
					&lt;xsl:value-of select=&quot;substring(node(),1,1)&quot;/&gt;
				&lt;/xsl:when&gt;
				&lt;xsl:otherwise&gt;
					&lt;xsl:value-of select=&quot;translate(substring(node(),1,1),$Lower,$Upper)&quot;/&gt;
				&lt;/xsl:otherwise&gt;
			&lt;/xsl:choose&gt;
			&lt;xsl:value-of select=&quot;substring(node(),2,string-length(node()))&quot;/&gt;
		&lt;/xsl:for-each&gt;
	&lt;/xsl:template&gt;

Feel free to use in whatever way you find it useful.

28 Aug 2013

Posted by: ludek.vodicka

Programming #xslt

SVN repository maintenance

To perform SVN repository maintenance use following commands

svnadmin verify REPO</p>
<p>
14 Jun 2013

Posted by: ludek.vodicka

Programming Linux Windows Mac OS #svn

Q2A markdown editor with file upload

**Note**: After first excitement I find out that service returns only thumbnails without possibility to get link to full image ;-(. Right now I'm searching another way.

**Note**:I figured out how to show image together with point to original image as link. Only drawback of this solution is that inserted image is only thumbnail.

This is a short tutorial how to configure your Q2A site to use markdown editor together with file upload feature.

function add_code()<br />
{<br />
  var text = unescape(document.location.search.substring(0));<br />
  var imgStart = text.indexOf(&quot;[img]&quot;)+5;<br />
  var imgEnd = text.indexOf(&quot;[/img]&quot;);<br />
  var refStart = text.indexOf(&quot;[url=&quot;)+5;<br />
  var refEnd = text.indexOf(&quot;]&quot;);<br />
  var urlImg = text.substr(imgStart ,imgEnd-imgStart );<br />
  var urlRef = text.substr(refStart ,refEnd-refStart );<br />
  var area_ignore_name = /username_list|search/i;<br />
  var area=opener.document.getElementById('wmd-input-content');<br />
  if ( area==null )<br />
   area=opener.document.getElementById('wmd-input-a_content');<br />
  if ( area==null )<br />
    area=opener.document.getElementById('wmd-input-q_content');<br />
  area.value = area.value + &quot;[![Image caption](&quot; + urlImg + &quot;)](&quot; + urlRef + &quot;)\n&quot;;<br />
  opener.focus();<br />
  area.focus();</p>
<p>  //refresh preview area<br />
  var evt = document.createEvent(&quot;KeyboardEvent&quot;);<br />
  evt.initKeyboardEvent(&quot;keypress&quot;, true, true, null, false, false, false, false, 0, 0);<br />
  area.dispatchEvent(evt);</p>
<p>  window.close();<br />
}<br />
  • Now upload updated file addform.html to the root of your q2a site.
  • Now it's need to update qa-markdown-editor.php file located in qa-plugin/q2a-markdown-editor-master. Insert [a style="...."] line after [div id="wmd-button-bar-"] line.
$html .= '&lt;/pre&gt;<br />
&lt;div id=&quot;wmd-button-bar-'.$fieldname.'&quot; class=&quot;wmd-button-bar&quot;&gt;';<br />
$html .= '&lt;a style=&quot;float: right; display: block; background: #CCC; color: #444; padding: .2em 1em; font-weight: bold;&quot; onclick=&quot;window.open(\'http://www.postimage.org/index.php?mode=phpbb&amp;lang=english&amp;forumurl=\' + escape(document.location.href), \'_imagehost\', \'resizable=yes,width=500,height=400\');return false;&quot; href=&quot;javascript:void(0);&quot;&gt;Upload image to post&lt;/a&gt;';<br />
$html .= '&lt;/div&gt;<br />
&lt;pre&gt;';<br />
  • And finally, insert following fragment of css (it's slightly updated) to your theme file. In my case it's qa-theme/Snow/qa-styles.css
/* Markdown editor plugin */</p>
<p>.wmd-button-bar {<br />
	width: 604px  !important ;<br />
	padding: 5px 0;<br />
}<br />
.wmd-input {<br />
	/* 604 */<br />
	width: 598px;<br />
	height: 250px;<br />
	margin: 0 0 10px;<br />
	padding: 2px;<br />
	border: 1px solid #ccc;<br />
}<br />
.wmd-preview {<br />
	/* 604 */<br />
	width: 584px;<br />
	margin: 10px 0;<br />
	padding: 8px;<br />
	border: 2px dashed #ccc;<br />
}<br />
.wmd-preview pre,<br />
.qa-a-item-content pre {<br />
	width: 100%;<br />
	max-height: 400px;<br />
	overflow: auto;<br />
}</p>
<p>.wmd-button-row {<br />
	position: relative;<br />
	margin: 0;<br />
	padding: 0;<br />
	height: 20px;<br />
}<br />
#wmd-button-row-content.wmd-button-row { width: 70% !important }<br />
#wmd-button-row-q_content.wmd-button-row { width: 70% !important }<br />
#wmd-button-row-a_content.wmd-button-row { width: 70% !important }</p>
<p>.wmd-spacer {<br />
	width: 1px;<br />
	height: 20px;<br />
	margin-left: 14px;<br />
	position: absolute;<br />
	background-color: Silver;<br />
	display: inline-block;<br />
	list-style: none;<br />
}</p>
<p>.wmd-button {<br />
    width: 20px;<br />
    height: 20px;<br />
    padding-left: 2px;<br />
    padding-right: 3px;<br />
    position: absolute;<br />
    display: inline-block;<br />
    list-style: none;<br />
    cursor: pointer;<br />
}</p>
<p>.wmd-button &gt; span {<br />
	/* note: background-image is set in plugin script */<br />
    background-repeat: no-repeat;<br />
    background-position: 0px 0px;<br />
    width: 20px;<br />
    height: 20px;<br />
    display: inline-block;<br />
}</p>
<p>.wmd-spacer1 {<br />
    left: 50px;<br />
}<br />
.wmd-spacer2 {<br />
    left: 175px;<br />
}<br />
.wmd-spacer3 {<br />
    left: 300px;<br />
}</p>
<p>.wmd-prompt-background {<br />
	background-color: #000;<br />
}<br />
.wmd-prompt-dialog {<br />
	border: 1px solid #999;<br />
	background-color: #f5f5f5;<br />
}<br />
.wmd-prompt-dialog &gt; div {<br />
	font-size: 0.8em;<br />
}<br />
.wmd-prompt-dialog &gt; form &gt; input[type=&quot;text&quot;] {<br />
	border: 1px solid #999;<br />
	color: black;<br />
}<br />
.wmd-prompt-dialog &gt; form &gt; input[type=&quot;button&quot;] {<br />
	border: 1px solid #888;<br />
	font-size: 11px;<br />
	font-weight: bold;<br />
}</p>
<p>/* highlight.js styles */</p>
<p>pre code {<br />
  display: block;<br />
  padding: 0.5em;<br />
  background: #f6f6f6;<br />
}</p>
<p>pre code,<br />
pre .ruby .subst,<br />
pre .tag .title,<br />
pre .lisp .title,<br />
pre .nginx .title {<br />
  color: black;<br />
}</p>
<p>pre .string,<br />
pre .title,<br />
pre .constant,<br />
pre .parent,<br />
pre .tag .value,<br />
pre .rules .value,<br />
pre .rules .value .number,<br />
pre .preprocessor,<br />
pre .ruby .symbol,<br />
pre .ruby .symbol .string,<br />
pre .ruby .symbol .keyword,<br />
pre .ruby .symbol .keymethods,<br />
pre .instancevar,<br />
pre .aggregate,<br />
pre .template_tag,<br />
pre .django .variable,<br />
pre .smalltalk .class,<br />
pre .addition,<br />
pre .flow,<br />
pre .stream,<br />
pre .bash .variable,<br />
pre .apache .tag,<br />
pre .apache .cbracket,<br />
pre .tex .command,<br />
pre .tex .special,<br />
pre .erlang_repl .function_or_atom,<br />
pre .markdown .header {<br />
  color: #800;<br />
}</p>
<p>pre .comment,<br />
pre .annotation,<br />
pre .template_comment,<br />
pre .diff .header,<br />
pre .chunk,<br />
pre .markdown .blockquote {<br />
  color: #888;<br />
}</p>
<p>pre .number,<br />
pre .date,<br />
pre .regexp,<br />
pre .literal,<br />
pre .smalltalk .symbol,<br />
pre .smalltalk .char,<br />
pre .go .constant,<br />
pre .change,<br />
pre .markdown .bullet,<br />
pre .markdown .link_url {<br />
  color: #080;<br />
}</p>
<p>pre .label,<br />
pre .javadoc,<br />
pre .ruby .string,<br />
pre .decorator,<br />
pre .filter .argument,<br />
pre .localvars,<br />
pre .array,<br />
pre .attr_selector,<br />
pre .important,<br />
pre .pseudo,<br />
pre .pi,<br />
pre .doctype,<br />
pre .deletion,<br />
pre .envvar,<br />
pre .shebang,<br />
pre .apache .sqbracket,<br />
pre .nginx .built_in,<br />
pre .tex .formula,<br />
pre .erlang_repl .reserved,<br />
pre .input_number,<br />
pre .markdown .link_label,<br />
pre .vhdl .attribute {<br />
  color: #88f;<br />
}</p>
<p>pre .keyword,<br />
pre .id,<br />
pre .phpdoc,<br />
pre .title,<br />
pre .built_in,<br />
pre .aggregate,<br />
pre .css .tag,<br />
pre .javadoctag,<br />
pre .phpdoc,<br />
pre .yardoctag,<br />
pre .smalltalk .class,<br />
pre .winutils,<br />
pre .bash .variable,<br />
pre .apache .tag,<br />
pre .go .typename,<br />
pre .tex .command,<br />
pre .markdown .strong,<br />
pre .request,<br />
pre .status {<br />
  font-weight: bold;<br />
}</p>
<p>pre .markdown .emphasis {<br />
  font-style: italic;<br />
}</p>
<p>pre .nginx .built_in {<br />
  font-weight: normal;<br />
}</p>
<p>pre .coffeescript .javascript,<br />
pre .xml .css,<br />
pre .xml .javascript,<br />
pre .xml .vbscript,<br />
pre .tex .formula {<br />
  opacity: 0.5;<br />

And that's all. If you want to see it in action, take a look to this site: http://q2a.orm-designer.com/

08 Nov 2012

Posted by: ludek.vodicka

Programming #q2a #customization

List of C++ profilers for windows (commercial and non-commercial)

24 Oct 2012

Posted by: ludek.vodicka

Programming Windows #C++ #development

MacOS open file hander, app icon and other PLIST features

How to configure PLIST

This is how look ORM Designer plist file to correct setup file handler and application icon:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />
&lt;!DOCTYPE plist SYSTEM &quot;file://localhost/System/Library/DTDs/PropertyList.dtd&quot;&gt;<br />
&lt;plist version=&quot;1.0&quot;&gt;<br />
&lt;dict&gt;<br />
  &lt;key&gt;CFBundleVersion&lt;/key&gt;        &lt;string&gt;1.0&lt;/string&gt;<br />
  &lt;key&gt;CFBundlePackageType&lt;/key&gt;    &lt;string&gt;APPL&lt;/string&gt;<br />
  &lt;key&gt;CFBundleExecutable&lt;/key&gt;     &lt;string&gt;@EXECUTABLE@&lt;/string&gt;<br />
  &lt;key&gt;CFBundleIdentifier&lt;/key&gt;     &lt;string&gt;com.orm-designer.OrmDesigner2&lt;/string&gt;<br />
  &lt;key&gt;CFBundleSignature&lt;/key&gt;      &lt;string&gt;????&lt;/string&gt;<br />
  &lt;key&gt;CFBundleGetInfoString&lt;/key&gt;  &lt;string&gt;ORM Designer2, Copyright 2012 Inventic s.r.o.&lt;/string&gt;<br />
  &lt;key&gt;CFBundleIconFile&lt;/key&gt;       &lt;string&gt;@ICON@&lt;/string&gt;<br />
  &lt;key&gt;NOTE&lt;/key&gt;                   &lt;string&gt;ORM Designer2 by Inventic Corporation&lt;/string&gt;</p>
<p>  &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;<br />
  &lt;array&gt;<br />
    &lt;dict&gt;<br />
      &lt;key&gt;CFBundleTypeName&lt;/key&gt;         &lt;string&gt;ORM Designer project file&lt;/string&gt;<br />
      &lt;key&gt;CFBundleTypeRole&lt;/key&gt;         &lt;string&gt;Editor&lt;/string&gt;<br />
      &lt;key&gt;CFBundleTypeIconFile&lt;/key&gt;     &lt;string&gt;@ICON@&lt;/string&gt;<br />
      &lt;key&gt;LSHandlerRank&lt;/key&gt;            &lt;string&gt;Owner&lt;/string&gt;<br />
      &lt;key&gt;LSIsAppleDefaultForType&lt;/key&gt;  &lt;true/&gt;</p>
<p>      &lt;key&gt;CFBundleTypeExtensions&lt;/key&gt;<br />
      &lt;array&gt;<br />
        &lt;string&gt;ormdesigner&lt;/string&gt;<br />
        &lt;string&gt;ormdes&lt;/string&gt;<br />
        &lt;string&gt;ormdesigner2&lt;/string&gt;<br />
        &lt;string&gt;ormdes2&lt;/string&gt;<br />
      &lt;/array&gt;<br />
    &lt;/dict&gt;<br />
  &lt;/array&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;<br />

Qt links:

Apple developer links:

Icon converting online tools

19 Sep 2012

Posted by: ludek.vodicka

Programming Mac OS #deploy #mac os

Trac commands

Create new project

trac-admin c:\PATH\TO\PROJECT initenv<br />

Enable web admin

trac-admin c:\PATH\TO\PROJECT<br />
&gt;permission add &lt;username&gt; TRAC_ADMIN<br />
&gt;permission list &lt;username&gt;<br />
05 Sep 2012

Posted by: ludek.vodicka

Programming #trac

QWidget: Must construct a QApplication before a QPaintDevice

Today I encounter this error after applying **macdeployqt** to my application. There is a lot of questions about this topic on google but not very answers.

The most important thing is setup following variable.

export DYLD_PRINT_LIBRARIES=1<br />

Using this you will se which libraries are loaded during execution of your application. The interesting thing is, that I see loading a libraries from their original directories instead of Application.app. But when I temporary moved these libraries from their location, libraries begin to load from then bundle location.

The reason for my "QWidget: Must construct a QApplication before a QPaintDevice" was executing an older version of QTitanRibbon from shared libraries path instead of the newest one compiled directly to /usr/lib.
The second reason for this issue was caused by another path in "export DYLD_LIBRARY_PATH". It seems that application search for libraries first in DYLD_LIBRARY_PATH and after in paths from their inner records.

To turn off this debug output, use:

unset DYLD_PRINT_LIBRARIES<br />

29 Aug 2012

Posted by: ludek.vodicka

Programming Qt Mac OS #Qt #MacOs #deploy

Strange "no matching function for call to ..." error on MacOS

Error appear when using BOOST::fusion::map<....>

Error message:

In file included from axOrm/ormObject/ormObject.test.cpp:5:<br />
axOrm/ormObject/testObjects/objContactAndAddress.h: In member function 'void Atomix::Orm::Tests::CBaseOrmContact::SetName(XString)':<br />
axOrm/ormObject/testObjects/objContactAndAddress.h:92: error: no matching function for call to 'Atomix::Orm::Tests::CBaseOrmContact::GetPropertyHolder()'<br />

Invalid source code

template &lt;class TNameParam&gt; typename fus::result_of::at_key&lt; TmapAssociations,TNameParam&gt;::type &amp; GetAssociationHolder()<br />
{ return fus::at_key&lt;TNameParam&gt;(m_mapAssociations); }<br />

for fix simply change result_of::at_key to result_of::value_at_key

template &lt;class TNameParam&gt; typename fus::result_of::value_at_key&lt;TmapAssociations,TNameParam&gt;::type &amp; GetAssociationHolder()<br />

After fixing this error, you can achieved problem with const modifier. Correct syntax for const definition is:

template <typename TNameParam> typename fus::result_of::value_at_key<const TmapProperties,TNameParam>::type const & GetPropertyHolder() const
{ return fus::at_key<TNameParam>(m_mapProperties); }

28 Jun 2011

Posted by: ludek.vodicka

Programming Mac OS #MacOs #C++ #g++

C++ - unpack sub-type from template structure only for specified object type

#include &lt;assert.h&gt;<br />
#include &lt;typeinfo&gt;</p>
<p>struct CTreeObject1<br />
{<br />
};</p>
<p>/************************************************************************/<br />
/* Nammed structs - for using one type more than once in SinglesCont.   */<br />
/************************************************************************/<br />
template&lt; class TObject, class TName&gt;<br />
struct NammedObject : public TObject, public TName<br />
{<br />
        typedef TObject object_type;<br />
};</p>
<p>struct stFirst{};<br />
struct stSecond{};</p>
<p>template &lt;typename T&gt;<br />
struct UnpackObjectType<br />
{<br />
        typedef T TT;<br />
};</p>
<p>template&lt;typename T, typename U&gt;<br />
struct UnpackObjectType&lt; NammedObject&lt;T, U&gt; &gt;<br />
{<br />
        typedef T TT;<br />
};</p>
<p>int main()<br />
{<br />
        typedef NammedObject&lt;CTreeObject1,stFirst&gt;  T1;<br />
        typedef NammedObject&lt;CTreeObject1,stSecond&gt;  T2;<br />
        typedef CTreeObject1                        T3;</p>
<p>        UnpackObjectType&lt;T1&gt;::TT d1;<br />
        UnpackObjectType&lt;T2&gt;::TT d2;<br />
        UnpackObjectType&lt;T3&gt;::TT d3;</p>
<p>        //required<br />
        assert( typeid(d1) == typeid(d2));<br />
        assert( typeid(d2) == typeid(d3));</p>
<p>        return 0;<br />
}<br />
10 Jun 2011

Posted by: ludek.vodicka

Programming #C++ #templates

g++ error: conversion from XTestObjectA to non-scalar type XTestObjectBase requested

//error<br />
XTestObjectBase objTestObjectBase1 = objTestObjectA;</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase2(objTestObjectA);</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase3; objTestObjectBase3 = objTestObjectA;<br />

cite from: http://stackoverflow.com/questions/6120240/why-constructor-is-not-called-for-given-casting-operator

The problem is that the number of user-defined conversions that are invoked implicitly is limited (to 1) by the Standard.

B ob = a;
implies two user conversions:

on a: Wrap::operator A*() should be called
on the result: B::B(A*) should be called

The solution is to use explicit conversion

//now ok<br />
XTestObjectBase objTestObjectBase1 = XTestObjectBase(objTestObjectA);<br />
07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++

g++ error: expected primary-expression before > token

For g++ compiler is sometimes necessary to specify more typename / template keywords than for Visual Studio. This is one of examples.

To the following code it's necessary to add template keyword:

TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />

use

TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.template CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />

07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++ #templates

MinGW and compilation 32/64bit libraries

Install MinGW-64

1) Download MinGW 64-bit and 32-bit

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/

- Toolchains targetting Win64 / Toolchains targetting Win32
- Automated Builds
- mingw-w64-1.0-bin_i686-mingw_*.zip
- mingw-w32-1.0-bin_i686-mingw_*.zip

2) Download MSYS compatible with 64-bit MinGW

http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20(Win64%20hosted)/MSYS%20(32-bit)/

3) Extract MinGW32, mingw64 and MSYS to one folder

MinGW-32, MinGW-64 and MSYS to folder MinGW64 (Bin folder from MinGW will be merged with bin folder from MSYS, etc.)

**External links:**

MSYS wiki
MinGW-64 wiki

30 Jan 2011

Posted by: ludek.vodicka

Programming Linux Windows #Linux #C++ #Windows #cygwin

Problem with Qt compilation under Windows 64-bit

This short post will show you how to resolve following error during Qt compilation on 64-bit windows:

Creating library ..\..\..\..\lib\QtWebKitd4.lib and object ..\..\..\..\lib\Qt<br />
WebKitd4.exp<br />
PluginViewWin.obj : error LNK2019: unresolved external symbol _HBeginPaint refer<br />
enced in function &quot;private: static struct HDC__ * __cdecl WebCore::PluginView::h<br />
ookedBeginPaint(struct HWND__ *,struct tagPAINTSTRUCT *)&quot; ([email protected]<br />
[email protected]@@CAPEAUHDC__@@PEAUHWND__@@PEAUtagP AINTSTRUCT@@@Z)<br />
PluginViewWin.obj : error LNK2019: unresolved external symbol _HEndPaint referen<br />
ced in function &quot;private: static int __cdecl WebCore::PluginView::hookedEndPaint<br />
(struct HWND__ *,struct tagPAINTSTRUCT const *)&quot; ([email protected]@Web<br />
Core@@CAHPEAUHWND__@@PEBUtagPAINTSTRUCT@@@Z)<br />
..\..\..\..\lib\QtWebKitd4.dll : fatal error LNK1120: 2 unresolved externals<br />
NMAKE : fatal error U1077: '&quot;C:\Program Files (x86)\Microsoft Visual Studio 9.0\<br />
VC\BIN\x86_amd64\link.EXE&quot;' : return code '0x460'<br />
Stop.<br />
NMAKE : fatal error U1077: '&quot;C:\Program Files (x86)\Microsoft Visual Studio 9.0\<br />
VC\BIN\nmake.exe&quot;' : return code '0x2'<br />

This error is caused by bug in **QMAKE_HOST** variable used in WebCore.pro file. This variable is tested to determine destination platform (x86 or x64).
This variable contains x86 value also on 64-bit builds instead of x86_64 value. This value is tested on the following line in a WebCore.pro file:

win32:!win32-g++*:contains(QMAKE_HOST.arch, x86_64):{<br />

If you want to fix this error, simply replace **QMAKE_HOST** by **QMAKE_TARGET** variable. Updated line should look like this:

win32:!win32-g++*:contains(QMAKE_TARGET.arch, x86_64):{<br />

After this update all required asm defines are correctly included and build of WebKit will be successful.

Update for this error

In newer versions of Qt there is already applied fix the error with QMAKE_HOST / QMAKE_TARGET, but also there is a new problem ;-(.

The Problem is in the following "if" definition:

   if(win32-msvc2005|win32-msvc2008):equals(TEMPLATE_PREFIX, &quot;vc&quot;) {<br />
        SOURCES += \<br />
            plugins/win/PaintHooks.asm<br />
    }<br />

When you compile your project for MSVC 2010, .asm file isn't included. It's necessary to add win32-msvc2010 to this definition. So updated WebCore.pro for Qt 4.8 will look like this:

 if(win32-msvc2005|win32-msvc2008|win32-msvc2010):equals(TEMPLATE_PREFIX, &quot;vc&quot;) {<br />
        SOURCES += \<br />
            plugins/win/PaintHooks.asm<br />
    }<br />

Next problem solution

Next problem which I found during compilation is wrongly set QMAKE_TARGET.arg. For unspecified reason, when I compile 64bit library in 64bit system in 64bit VS command line, this variable has value x86 instead of x86_64.
The problem is in the qmake project.cpp file. QMAKE trying to determine 64/32 bit version based on the %PATH% configuration. Qmake search for VS-PATH\bin\amd64 of \bin\x86_amd64 string. Unfortunately there is a bug in concating searched string. This is how looks original project.cpp file at line 3177:

QString vcBin64 = qgetenv(&quot;VCINSTALLDIR&quot;).append(&quot;\\bin\\amd64&quot;);<br />
QString vcBinX86_64 = qgetenv(&quot;VCINSTALLDIR&quot;).append(&quot;\\bin\\x86_amd64&quot;);<br />

The problem is, that VCINSTALLDIR contains \ at the end of the string, and then we append \ again. So, result is:

QString vcBin64 = qgetenv(&quot;VCINSTALLDIR&quot;);<br />
if ( vcBin64.at( vcBin64.size()-1 ) != '\\' )<br />
  vcBin64.append(&quot;\\&quot;);<br />
vcBin64.append(&quot;bin\\amd64&quot;);</p>
<p>QString vcBinX86_64 = qgetenv(&quot;VCINSTALLDIR&quot;);<br />
if ( vcBinX86_64.at( vcBinX86_64.size()-1 ) != '\\' )<br />
  vcBinX86_64.append(&quot;\\&quot;);<br />
vcBinX86_64.append(&quot;bin\\x86_amd64&quot;);<br />

Now, QMake correctly determine 32/64 bit compilation and then correctly include PaintHooks.asm and your Qt WebCore will be sucesfully compiled.

28 Jan 2011

Collection of links about ORM, Datamapper and design patterns

12 Jan 2011

Posted by: ludek.vodicka

Programming #C++ #orm

Qt programming tips

How to configure mkspec for paralel builds on Windows

Edit qmake.conf file in Qt\mkspecs\win32-msvcXXXX. Add **-MP2** / **-MP4** to the following defines:

QMAKE_CFLAGS_RELEASE    = -O2 -MD -MP4<br />
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi -MP4<br />
QMAKE_CFLAGS_DEBUG      = -Zi -MDd -MP4<br />
03 Jan 2011

Posted by: ludek.vodicka

Programming Qt

How to deploy Qt application on MacOs

Missing dylib libraries

If your application using some externals dynamic libraries (called .dylib in MacOs system), you have to provide all these libraries. The simplest way is to provide these libraries into the Application.app directory.

Find out which libraries are used

Qt provide really useful tool called **"otool"** which serves to lots of purpose. One of them is to detect which shared libraries are required by our application. For this purpose otool has parameter -L. The usage is following:

otool -L ./Test1.app/Contents/MacOS/Test1<br />

Output could looks like this:

./Test1:<br />
        libboost_iostreams.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_thread.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_date_time.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        libboost_regex.dylib (compatibility version 0.0.0, current version 0.0.0)<br />
        /Users/dev/dev/SharedLibraries/libiconv/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxml/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxslt/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)<br />
        /Users/dev/dev/ExternalLibraries/../SharedLibraries/libxslt/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.15.0)<br />
        /Users/dev/dev/ExternalLibraries/yaml-cpp-0.2.5/build/libyaml-cpp.0.2.dylib (compatibility version 0.2.0, current version 0.2.5)<br />
        QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.0)<br />
        QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.0)<br />
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)<br />
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)<br />
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)<br />

Output from "otool" is simmilar to linux tool "ldd".

The Mac Deployment Tool

Because manual copying and configuring all shared libraries to our application could be difficult, Qt have deployment tool which do all work for us. Tool is called "macdeployqt" and can be found in /Developer/Tools/Qt/macdeployqt.

 /Developer/Tools/Qt/macdeployqt ./GeneratedFilesMacOs/Debug/Test1.app<br />

**Note:** Every time when you call macdeployqt tool, project have to be build from scratch. But is sufficient when whole result directory is removed and linked again:

rm -rf ./GeneratedFilesMacOs/Debug/Test1.app/<br />
make<br />
13 Dec 2010

Posted by: ludek.vodicka

Programming Qt Linux #Qt #MacOs #Linux #C++ #Programming

g++ template method problem

Quick post about problem which I already solved, but think that could be handy for someone else.

I have following code:

template&lt;class T&gt;
struct Test
{
	T val;
	template &lt;class T2&gt;
	void DoSomething( T2 &amp;obj )
	{
		obj.FindByType&lt;int&gt;();
	}
};

When compiling under Visual studio, everything is ok. But when try the same code snippet under g++, have following error:

test.cpp: In member function ‘void Test&lt;T&gt;::DoSomething(T2&amp;)’:
test.cpp:48: error: expected primary-expression before ‘int’
test.cpp:48: error: expected ‘;’ before ‘int’

This is because compiler doesn’t known FindByType method, because T2 is templated argument. The solution which I found is in adding keyword template before FindByType method name. So updated source code will look like this:

template&lt;class T&gt;
struct Test
{
	T val;
	template &lt;class T2&gt;
	void DoSomething( T2 &amp;obj )
	{
		obj.template FindByType&lt;int&gt;();
	}
};

After this update, code will be compiled correctly under both compilers.

03 Dec 2010

How to change DLL default load address (MSVC linker)

Sometimes happened that two DLL libraries wants to be loaded in same address. These DLL libraries can be found in "Modules" window with small red exclamation mark. When you need to change this address, you have to update your linker settings adding the /BASE: parameter.

link.exe &amp;lt;other_praams&amp;gt; /BASE:0x11000000<br />
21 Nov 2010

Posted by: ludek.vodicka

Programming #C++ #Windows

Using Crypto++ stream processing

How to load specific part of file and run several Crypto++ streams

ToDo

External links:

****CryptoPP FAQ****

**How do I use the Filter class?**

****How do I use a stream cipher?****


17 Nov 2010

Posted by: ludek.vodicka

Programming #C++ #Crypto++

Git tips

Show files status

git status #show all files<br />
git statis -u -s #show untracked in short listing<br />

Commit with message

git commit -m&quot;text&quot;<br />

Recursive add files by mask to git

git add *.mask -A<br />

Linux-recursive remove some files

find -iname '*mask' | xargs rm<br />

How to create global .gitignore file

git config --global core.excludesfile /file-path/.gitignore-global<br />
15 Nov 2010

Posted by: ludek.vodicka

Programming #MacOs #Linux #Git #Windows

TENG - c++ templating engine

Project site: http://teng.sourceforge.net/?page=home

External project documentation: http://teng.olmik.net/

Latest TENG source code: http://teng.cvs.sourceforge.net/teng/ (**Note**: Source code referenced from main site isn't latest! )

How to compile TENG on windows

Compilation under Windows is possible only using MinGW and with few modifications in TENG code (because there is few glitch which didn't meet c++ standards). If you want more information or updated TENG version, please let me know.

15 Nov 2010

Posted by: ludek.vodicka

Programming MinGW Linux #MacOs #Linux #C++ #Windows

How to show all defines for compiler

Sometime it's useful to know what defines are available on specific platform and compiler. Here is command which shows these defines:

touch test.export<br />
g++ -dM -E test.export<br />
15 Nov 2010

Posted by: ludek.vodicka

Programming Linux #Linux #C++

How to install and configure git with ssh key

  • Download git client depends on your OS platform
  • Open your .ppk key in PuTTY Key generator and export key to OpenSSH key:
  • Content of this OpenSSH key store to file ~/.ssh/id_dsa (copy exported key to ~/.ssh folder and rename it to id_dsa)
  • Now change security permissions on this file to 400 (chmod 400 ~/.ssh/id_dsa)
  • Now cal ssh-add to load id_dsa key

And it's done. Now you can use your git. For example clone some repository:

git clone ssh:[email protected]/~/repository/example.git<br />

Automatic ssh-key loading during startup:

TODO

14 Nov 2010

Posted by: ludek.vodicka

Programming Linux #Linux #Git

Git on windows with Unicode filename support

Today I found out that Windows version of Git doesn't support Unicode character in file names. After some time spent by searching on google, I found updated version of msysgit with Unicode support. This version is available here: http://tmurakam.org/git/. Thank you Takuya Murakami!

11 Nov 2010

Posted by: ludek.vodicka

Programming #Git #Unicode #Windows

List of usefull links for Visual Studio

How to customize autoexp.dat in Visual Studio 2005

http://mariusbancila.ro/blog/?p=26
http://www.virtualdub.org/blog/pivot/entry.php?id=120

Example visualizator for XString

String::CStringSmart&lt;String::malloc_string_trait&lt;String::string_trait&lt;char&gt; &gt; &gt;{<br />
  preview([$c.m_pszData,s])<br />
  stringview([$c.m_pszData,sb])<br />
}</p>
<p>String::CStringSmart&lt;String::malloc_string_trait&lt;String::string_trait&lt;wchar_t&gt; &gt; &gt;{<br />
  preview([$c.m_pszData,su])<br />
  stringview([$c.m_pszData,sub])<br />
}<br />

How to configure STEP-INTO for Visual Studio 2005

External links:
Google group
www.cprogramming.com

http://blogs.msdn.com/b/andypennell/archive/2004/02/06/69004.aspx

Example how to setup ingoring step-into for MFC CString for VS2005

Windows Registry Editor Version 5.00<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver]<br />
&quot;\&quot;20\&quot;&quot;=&quot;\\scope:CString.*\\:\\:.*=NoStepInto&quot;<br />
&quot;\&quot;21\&quot;&quot;=&quot;\\scope:CSmartObjPtr.*\\:\\:.*=NoStepInto&quot;<br />

Example how to setup ingoring step-into for MFC CString for VS2010 on 64bit system

Windows Registry Editor Version 5.00</p>
<p>[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\NativeDE\StepOver]<br />
&quot;22&quot;=&quot;.*CStringSmart.*=NoStepInto&quot;<br />

10 Nov 2010

Posted by: ludek.vodicka

Programming #C++ #visual studio

Mac OS problem with samba mount

Sometime after some time or when MacOS system is waked-up samba mounts stop working.

Instead of  mounting a drive reporting following error:

mount_smbfs: could not find mount point /mnt/disk_d: Socket is not connected&lt;/div&gt;<br />
mount_smbfs: could not find mount point /mnt/disk_e: Socket is not connected&lt;/div&gt;<br />
mount_smbfs: mount error: /mnt/disk_p: Socket is not connected&lt;/div&gt;<br />

After a little search I found following tip. It could help:

1. Click Start, and then click Run.<br />
2. Type regedit, and then click OK.<br />
3. Navigate to the following key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters<br />
4. In the right pane, double-click the IRPStackSize value.</p>
<p>NOTE: If the IRPStackSize value does not already exist, use the following procedure to create it:a. In the Parameters folder of the registry, right-click the right pane.<br />
b. Point to New, and then click DWord Value.<br />
c. Type IRPStackSize.</p>
<p>IMPORTANT: Type &quot;IRPStackSize&quot; exactly as it is displayed because the value name is case-sensitive. </p>
<p>5. Change the Base to decimal.<br />
6. In the Value Data box, type a value that is larger than the value that is listed. </p>
<p>If you created the IRPStackSize value using the procedure described in step 4, the default value is 15. It is recommended that you increase the value by 3. Therefore, if the previous value was 11, type 14, and then click OK.<br />
7. Close the Registry Editor.<br />
8. Restart the computer.<br />
08 Nov 2010

Posted by: ludek.vodicka

Programming #MacOs

Simple iconv (libiconv) example

Here is a simple example how to use the iconv library.

#include &lt;iostream&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iconv.h&gt;</p>
<p>int main(int argc, char *argv[])<br />
{<br />
	char src[] = &quot;abcčde&quot;;<br />
	char dst[100];<br />
	size_t srclen = 6;<br />
	size_t dstlen = 12;</p>
<p>	fprintf(stderr,&quot;in: %s\n&quot;,src);</p>
<p>	char * pIn = src;<br />
	char * pOut = ( char*)dst;</p>
<p>	iconv_t conv = iconv_open(&quot;UTF-8&quot;,&quot;CP1250&quot;);<br />
	iconv(conv, &amp;pIn, &amp;srclen, &amp;pOut, &amp;dstlen);<br />
	iconv_close(conv);</p>
<p>	fprintf(stderr,&quot;out: %s\n&quot;,dst);<br />
}<br />

During my attempts with libiconv library I encountered two different problems:

Converting function returns 0, but pOut is empty

This is because iconv function modify pOut ptr during string processing. When you need to access output buffer after **iconv()** function finish its work, you have to access it via different pointer than one passed to this function. In my code I'm using *dst and pOut ptrs;

Conversion between different character sets returns strange results

Check if have correct order of parameters in your **iconv_open()** and **iconv()** function. Function **iconv_open()** has as its first parameter OUTPUT encoding, and as second parameter INPUT encoding. While **iconv()** function has as first parameters INPUT variables, and as second parameters OUTPUT variables. This inconsistency is really confusing.

Notes

Official libiconv site: http://www.gnu.org/software/libiconv/

Official libiconv documentation: http://www.gnu.org/software/libiconv/documentation/libiconv-1.13/

08 Nov 2010

Posted by: ludek.vodicka

Programming #C++ #libiconv

How to compile open-source libraries under Windows using MinGW

Lots of open source libraries (like libiconv, libintl, ...) doesn't have MSVC project files or makefiles. Only supported way how to compile given library under Window is using MinGW and MSYS compiler tools.

Here is step-by-step guide how to download, install and compile libraries using MinGW.

Step one download MinGW

From MinGW home web site http://www.mingw.org/ download "Automated MinGW Installer". Current version could be downloaded here: http://sourceforge.net/projects/mingw/files_beta/Automated MinGW Installer

Step two installing

Run downloaded executable. As install directory leave C:\MinGW. It's recommended not to change this path.  On component screen select C compiler, C++compiler, MSYS Basic System and MinGW Developer Toolkit.

After that select next,next,next, finish ;-). After that installer downloads all necessary files. This could take a few minutes.

When installation is done, as next step is necessary to setup PATH variable to c:\MinGW. Installer doesn't modify it automatically. (more info about modifying PATH variable) .

Installing additional gcc compiler and make support

These two packages isn't listed in available components. If you wish to install it, use mingw-get-inst. In c:\MinGW\bin directory run following commands:

mingw-get install gcc g++ mingw32-make msys-base

Step three compiling

Compiling from windows shell

Launch cmd tool, go to directory with source code and use g++.

g++ test.cpp

Compiling from MinGW console

Launching MinGW console

Laung MinGW from startmenu or msys.bat from %INSTALL_PATH%\MinGW\msys\1.0\msys.bat.

How to compile libiconv library

As first, download latest libiconv source files from http://www.gnu.org/software/libiconv. And extract whole package somewhere on your disk.

Launch MinGW console and go to the extracted directory. When you extracted directory to the path:

p:\DependentLibrariesWhole\libiconv-1.13.1

Type following command to MinGW console:

cd /p/DependentLibrariesWhole/libiconv-1.13.1

after that, run **configure** with required library params (in our case we want static and dynamic version of library)**:**

configure --enable-static --enable-shared

and than run make

make

Compiled libraries are located in directory "libiconv-1.13.1\lib\.libs". There is  additional information about building libiconv library on stackoverflow.

Additional How to guides

This list is compilation of answer to questions and informations how to solve some problems which I had during my installations.

How to get list of available parameters for configure script?

Use **"configure --help"** command.

08 Nov 2010

Posted by: ludek.vodicka

Programming MinGW #C++ #MinGW #compile #Windows

First Qt attempts – qmake troubles

External links

qmake documentation: qmake tutorial.html
qmake variables: qmake variable reference

Generate vcproj from .pro file

Command line for generating Visual studio project file from Qt .pro file.

qmake -tp vc test.pro

Missing moc_*.cpp file

When some of moc file isn't properly generated and getting following error:

c1xx : fatal error C1083: Cannot open source file: '.\debug\moc_xxx.cpp': No such file or directory

try following:
Select corresponding .h file (for moc_xxx.cpp select xxx.h) in a project tree and select **Compile** from context menu. If the file is marked as "up-to-date", try to change something in this file and repeat a compilation. If in the output window will be "up-to-date" again, you found a problem.

Use context menu on the corresponding .h file, select properties and edit "Configuration properties |Custom build steps|General|Outputs" to any value (add some char to the end of value), confirm change by Ok button and then return value back to original (remove added char). After that, compilation on correspond file will be successfully performed.

Linux relevant tips

01 Nov 2010

Posted by: ludek.vodicka

Programming Qt #Qt #Windows

List of known issues and tips

This is list of all known issues and problems which we had to solve during our first Qt installation on Linux, Windows and Mac.

Known errors

Error: undefined interface

What to do when compilation of QT crash with message “Error: undefined interface”.
http://www.qtforum.org/article/31561/error-when-building-libraries.html
http://www.qtcentre.org/threads/26245-Qt-4.6-api/qscriptextensionplugin.h(43)-Error-Undefined-interface

make: g++: Command not found

it’s necessary to instal g++ support (sudo apt-get install g+)

Basic XLib functionality test failed!

it’s necessary to instal xlib(xorg??) support (sudo apt-get install xorg-dev)

*** [sub-corelib-make_default-ordered] Error 2

Probably mishmash on 32bit / 64bit  system and QT versions.

undefined reference to `QEventDispatcherGlib::versionSupported()’

Probably missing libglib2.0-dev on your system. (sudo apt-get install libglib2.0-dev).

Undefined reference to QSslSocket::*

Missing OpenSSL library on your system. (sudo apt-get install libssl-dev)

gtk/gtk.h: No such file or directory

Missing gtk package. (sudo apt-get install libgtk2.0-dev ). After that its necessary to update db (sudo updatedb).

if system can’t find file gtk/gtk.h because gtk is stored in gtk-2.0 directory, add -I (capitalised i) param to configure with gtk path:

 ./configure -opensource -I /usr/include/gtk-2.0 

cups/cups.h: No such file or directory

install libcups2. (sudo apt-get install libcups2-dev)

gst/gst.h: No such file or directory

install gstreamer 0.10. (sudo apt-get install libgstreamer0.10-dev)

Missing Include/glibconfig.h

it’s because this file isn’t in /usr/include/glib-2.0, but in /usr/lib/glib-2.0. So you have to include also this /usr/lib path or copy file to include/glib-2.0

Hints and tips

create symbolic link using **ln -nsf /usr/include/gtk-2.0/gtk /usr/include/gtk **

Minimal required libraries

List of libraries required by Qt:

  • libfontconfig1-dev
  • libfreetype6-dev
  • libx11-dev
  • libxcursor-dev
  • libxext-dev
  • libxfixes-dev
  • libxft-dev
  • libxi-dev
  • libxrandr-dev
  • libxrender-dev

And other which are required by some modules of Qt:

To install all required on Linux, use following commands

 sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxcups/cups.h: No such file or directory ft-dev libxi-dev libxrandr-dev libxrender-dev

sudo apt-get install bison flex libqt4-dev libqt4-opengl-dev libphonon-dev libicu-dev libsqlite3-dev libxext-dev libxrender-dev gperf libfontconfig1-dev libphonon-dev  

If error doesn’t disappear after installing correct library

Sometimes it’s necessary to reconfigure Qt using make confclean

How to find where is missing header file located on disk

Use find /path -iname xxx.h command

How to find package which contains missing header file

use apt-file application with following syntax:

 apt-file search gdk/gdk.h 

List of links about installation:
Building Qt on Linux

Qt configuration for succesfull build

This is currently my latest configure command to compile Qt on my Ubuntu 10.10.

Compilation fixes

This is necessary when search path for following libraries isn’t entered to configure.

 sudo ln -nsf /usr/include/gstreamer-0.10/gst /usr/include/gst 

Todo

Figure out how works pkg-config (pkg-config –cflags gstreamer-0.10)



27 Oct 2010

Qt installation and configuration

This is our company step-by-step guide to install and configure Qt on our developer machines.

How to install Qt

Link to Qt download site: http://qt.nokia.com/downloads

Windows (VS2005)

Download VS 2008 distribution from download site. When 2008 distribution is downloaded, it’s necessary to reconfigure and rebuild it for VS 2005 using next steps.

Linux

Download linux/x11 distro from Qt page. Download 32/64bit distro package. Setup downloaded files as executables:

 chmod +x qt-sdk-linux-x86-opensource-2009.01.bin chmod +x qt-creator-linux-x86-opensource-1.0.0.bin 

Install Qt sdk to default directory and begin with configuration.

MacOS

Download latest Qt SDK distribution and latest XCode developer pack from apple site. Then install both.

How to configure Qt

Qt configuration is done via Configure script/executable on all platforms.

Windows

Run “Start menu->Visual studio->Tools-> Visual studio command prompt”
Then go to “c:\Qt\Qt_Version\Qt” and run “configure” with additional params.

Our current configuration:

 configure -debug-and-release -opensource -shared -platform win32-msvc2005 -incredibuild-xge -openssl  

Clean configurations

run nmake confclean and nmake distclean to remove all previous version of QT compilations.

SSL support

For SSL Support add -openssl switch to configure.

Note!

: configure param HAVE TO be executed from Visual studio command prompt!

Linux

Enter Qt directory and enter following configure param:

 ./configure -opensource -I /usr/include/gtk-2.0 -L /usr/lib/gt-2.0 -I /usr/include/gstreamer-0.10 -L /usr/lib/gstreamer-0.10 -I /usr/include/glib-2.0 -L /usr/lib/glib-2.0 -I /usr/include/libxml2 -fast  

Clean configurations

run make confclean and then configure.

MacOS

How to compile Qt

Windows

Compile Qt using command prompt:

  • Run Visual studio command prompt.
  • And run nmake to build a whole library

Second option is open projects.sln located in p:/Qt/4.7.1/ using Visual Studio IDE  and compile it.

Linux

  • As first thing, use configure to setup Qt settings.
  • As next, run make to build a whole library
  • After a while when everything is compiled, use make install. This will install library to /usr/local/Trolltech/Qt-4.7.0

MacOS

Currently not tested, using default compilation.

How to compile application

When we have prepared Qt library, it’s time to compile our application.

MacOS

When using  qmake without additional params, qmake generate xcode project from .pro instad makefile for g++. To generate makefile, use following params:

 qmake -spec macx-g++  
make  

Deploying application

Windows

Not testes.

External link: http://doc.trolltech.com/4.5/deployment-windows.html

Linux

Not testes.

MacOS

Not testes.

27 Oct 2010

Improved icons list with new skin

Today I continued with UI skinning and enhancing visual feel from application. After few hours spent by searching a way how assign two different keyboard layouts to one screen (numerical for cash amount and alpha-numerical for comments), I gave it up and wrote to the Airplay forum. I hope that this function will not be a big problem and will be solved.

So result of my today work is full reworked icon list with automatic layout related to screen resolution and with full skin support. Here is result:

I realy like it and on iPhone with finger ability is icons-list much more better ;-)

07 Oct 2010

Posted by: ludek.vodicka

Programming Features

UI elements for iPhone GUI

Because Airplay SDK doesn’t have direct GUI support for iPhone applications, you have to skin all controls on your own. After a little search I found complete UI Photoshop .psd file where are all necessary controls in separate layers.

http://www.teehanlax.com/blog/2010/06/14/iphone-gui-psd-v4/

From this .psd file is then pretty simple to create your own .psd file which you used for exporting separated .png files to skin all UI controls.

07 Oct 2010

Posted by: ludek.vodicka

Programming

Toolbar icons for iPhone UI

Because I started works on UI interface, I need some toolbar icons. After a lot of search, I found few sets which are nice and free, and few which are nice and paid ;-).

Here is compilation of UI sets links:
http://blog.twg.ca/2009/09/free-iphone-toolbar-icons/ (160 icons for free)
http://glyphish.com/ (130 icons for free, next 80 paid)
http://smykes24.deviantart.com/art/iPhone-Tab-Bar-Icons-Gaming-129467506
http://tabs.icondesign.dk/ (few for free, rest of them paid)
http://www.app-bits.com/free-icons.html (64 icons for free)
http://www.dezinerfolio.com/freebie/30-free-vector-icons (30 vector icons for free)
http://www.iconsweets.com/ (60 free vector icons)

Paid icon sets:

http://www.icon2u.com/icon
http://www.iconsberlin.com/index_black.php (428 icons for 50 €)
http://www.iphonicon.com/ (260 icons for $79)
http://www.pixelpressicons.com/?page_id=118 (350 icons for $69)
http://www.eddit.com/shop/iphone_ui_icon_set/ (160 icons for $69)
http://www.kombine.net/icon-store/iphone-tab-bar-icons (130 icons for $60)
http://www.designkode.com/iphone-ipad-tab-bar-icons (150 icons for $50)
http://www.designkode.com/iphone-ipad-tab-bar-icons (1000 icons for $75)

07 Oct 2010

Posted by: ludek.vodicka

Programming

First attempt with skin framework

Today I spent several hours by reading a documentation and trying lot of examples. Create UI to be like iOS as much as possible in Airplay will not be easy ;-). There is lot of obstacles that I will have to overcome to accomplish a desired GUI. Here is a result from my first day of work:

Airplay SDK is great framework for developing multi-platform applications (but primary games), but create nice iOS GUI is a real challenge ;-).

04 Oct 2010

Posted by: ludek.vodicka

Programming

Screenshots of all screens with default skin

Because the application seems to be ready, it’s time to begin to work on a visual part. Before that I have created screenshots of all screens (Yes, they are really ugly ;-)).

[gallery link=”file”]

01 Oct 2010

Posted by: ludek.vodicka

Programming Features

Application logic complete

Today I finished application logic coding and it seems that all works ok ;) (or at least my unit test says that). Currently application can compute and simplify complicated loans relation and returns a result with minimal payback operations. Because a picture is better than thousand words, there are few examples:

On beginning, a simple example when Alice lends $10 John, and John lends $10 Bob. Instead of complicated payback from one person to another, there is a simply equal solution, where Bob will payback $10 directly to Alice:

Now little bit complicated example:

As you can see, after this optimization you save three steps.

And finally even more complex example:

Alice lends $100 John, John lends $50 Bob, Bob lends $20 Alice and Jane lends $10 Bob. Do you know how to payback money simply without duplicate the transfers? ;-).

And this is all for now. Application can handle also multiple loans to more people. I will try to prepare another examples of what application can do ;-).

01 Oct 2010

Posted by: ludek.vodicka

Programming Features

Implemenation of simple DDX version

After windows implementation and action manager which makes my life a lot of easier, today I continue in extending of my UI framework builded upon Airplay SDK. I’m currently developing screens which have lot of input widgets and getting/setting data to this widget becomes a nightmare ;-). So, I implement simple DDX functions known from C++ MFC framework. This helps me to have a code much more cleaner and to maintain screens easier. And here are few screenshots from my today work:

29 Sep 2010

Posted by: ludek.vodicka

Programming Features #Airplay SDK #Features

Working on date selector under Airplay FW

A next goal during my work on the Party money application was a date selector. Because Airplay doesn’t have a native support for Apple Date widget, the whole element is created by using several CIwUIScrollableView controls. After few hours of trying to figured out how all things work I have finally working date selector ;-). Here is a screenshot from date selector with default (ugly ;-)) skin.

29 Sep 2010

Posted by: ludek.vodicka

Programming Features #Airplay SDK #Features

List of icons II.

Because list of icons looks really good for me, I decided to use it everywhere where it is possible ;-). I extend list classes, so buttons can have different sizes and customized captions. Besides icons choosing this widget will be used for displaying a person in a profile and for choosing person in a transactions.

22 Sep 2010

Posted by: ludek.vodicka

Programming Features

List of Icons implementation

A next screen widget which I need for my Party cash application is scrollable grid of icons. What looks simply became a problem which needs several hours ;-). Again, because Airplay SDK doesn’t have any prepared widget, I have to create a new by using several existing ones. Result looks very promising, but currently without a final skin. So buttons have ugly default gray skin ;-).

20 Sep 2010

Posted by: ludek.vodicka

Programming Features

Simple window framework for Airplay SDK

Altough I still explore lot of features and possibilities of Airplay framework, definitely I know that framework has only limited support for complex UI applications. Guys from Airplay SDK do a lot of work for 2D and 3D applications, and have a basic support for creating and skinning app windows and widgets. But what I really miss is some layer which helps you with window creating, event handling and so on.

So, I decided to create one on my own which is based on my another project Atomix - a large project for Visual C++. Currently I have implemented a window manager and action manager for Airplay SDK. So now, instead of writing lot of code for creating and handling windows, I have everything encapsulated in few objects and all my screen objects are derived from these base clases.

Still a lot of work has to be done to achieve the final application ;-)

struct stProfileOverviewAction : public Atomix::Gui::stActionBase
{
public:
	AX_DECLARE_ACTION_FACTORY(stProfileOverviewAction,"ProfileOverview")
	bool OnExecute();
	void OnFinish();
	void OnOk();
	void OnCancel();
};
15 Sep 2010

Posted by: ludek.vodicka

Programming Features

Party cash application diagram

As the first thing in Part-cash application development we brainstormed an application diagram. I think that during time some screens will be extended or modified, but major part of the app will be the same. And here is a screenshot of our whiteboard after three hours of drawing and erasing ;-)

29 Aug 2010

Posted by: ludek.vodicka

Uncategorized Programming