Shiboken Multiple Include Path on Windows

In shiboken documentation, it’s saying the separator of include path should be : (colon)

But on Windows every full path is containing colon (e.g. C:\Windows\cmd), it will mess with the colon separator.

In its source code printUsage() function I found it’s actually using a PATH_SPLITTER macro to represent the separator. And under windows it’s semicolon..

 

At past I’m using colon as separator:

–include-paths=D:\Qt\4.8.7\include\:D:\Qt\4.8.7\include\QtCore\:D:\Python27\Lib\site-packages\PySide\include\PySide

And I got lots of error messages like following:

type is specified in typesystem, but not defined

After replacing colon with semicolon, these errors are gone.

WPF ModernUI Tutorial Part 1

Introduction

ModernUI is a nice WPF theme and a styling framework which let you build a modern, beautiful application easily. Are you poor in designing skill and have problem with designing GUI for your WPF applicaiotn? If so, you have to try ModernUI, it is the best choice for you. In web design, there is Bootstrap for building great UI. And for WPF, it is Modern UI.

 

Screenshots

 

Installation

The installation is really easy, just search “ModernUI” in Manage NuGet Package Window, and select “ModernUI for WPF” item and click “Install”

Install ModernUI for WPF in NuGet Package Manager

Install ModernUI for WPF in NuGet Package Manager

Or run following command in Package Manager Console

 Install-Package ModernUI.WPF

 

Create a ModernUI Window

First create a new WPF Application Project named “ModernUISample”. After creating project, select MainWindow.xaml, change the XAML as following:

The ModernWindow class is defined under FirstFloor.ModernUI.Windows.Controls, so add following line to MainWindow.xaml.cs to import this namespace

Then let MainWindow inherit from class ModernWindow

 

Click “Debug” button to run the program, we will see a black rectangle with a light blue border is shown. What’s wrong with it? It’s because that we have not applied the theme files to our application.

Open App.xaml, and add following code:

 

 

Run the program again, you will see a modern window is shown

Modern UI blank window

Check MySQL case-insensitive query or table name

I tried to install Umbrao CMS, it supports MySQL database but it need MySQL to support case-insensitive query and table name.

 

Following is way to check whether case-insensitive query is supported:

show variables where variable_name=’lower_case_table_names’;

or check lower_case_table_names option in my.ini (MySQL configuration file)

 

If this option’s value is set to 1, then case-insensitive query and table name is supported.

QWebEngine crash with exception code 0x80000003

QWebEngine is a new web browser engine introduced in Qt 5.4, it’s used to replace the old QWebView. QWebView is based on WebKit, while QWebEngine is based on Chromium browser, so it’s faster and supports more features.

I wrote a very simple program to test QWebEngine, following is the code:

Compiling and running is smooth. But when I tried to run this demo on another machine, it crashed, and an error dialog is shown with the message “An unknown software exception (0x80000003) has occurred at 0x023c5b7e. Click OK to terminate the program.

By chekcing the log file (debug.log) I found some helpful information:

[ERROR:icu_util.cc(154)] Couldn’t mmap D:\Qt\Qt5.4.0\5.4\msvc2013_64\icudtl.dat
[FATAL:content_main_runner.cc(719)] Check failed: base::i18n::InitializeICU()

We can see the icudtl.dat path is not correct, because it doesn’t exist at all.

To fix it we need to create a new file named “qt.conf” under the application directory, and fill it with following content:

 

(This bug is posted at https://bugreports.qt.io/browse/QTBUG-42083)

WebServlet cannot be resolved to a type

WebServlet annotation is introduced in Servlet 3.0, it’s used to simplify the servlet creation (we don’t need to define it and its URL mapping in web.xml)

The WebServlet annotation usage is

e.g.

Then the user can visit /servlet/GetMailFileOwner to access this servlet

 

But today I met a problem with using WebServlet annotation. First I added WebServlet on the Linux machine (Eclipse Luna), and switched to another Windows machine (MyEclipse), then I tried to rebuild the project, I got following error:

On the Windows machine, I use the default servlet.jar which is added when I create the new Dynamic Web Project. But I replaced the default servlet.jar file with Tomcat 8.0 libraries.

So the solution is to add Tomcat 8.0 libraries to Java Build Path (We need first download Tomcat 8.0 and set it up for Eclipse, otherwise Eclipse will not find this Tomcat 8.0 libraries)

HTML set checkbox as readonly

Sometimes we don’t want to make some form fields non-editable to users, like Product ID, Order Created Date, Post Author, etc.

For HTML text input and textarea controls, we can add “readonly” attribute to disallow users to modify their value, but this attribute will not work for checkbox control. So how should we disable the checkbox (or set it as readonly)? The “disabled” attribute will do the job

(It works for both radio box and checkbox)

 

You will see following checkbox and radio button is disabled:


The URL is not accessible when installing Magento

When installing Magento, we may get such error “The URL is not accessible”.

In some earlier versions of Magento, we can fix this problem by change code of app/code/core/Mage/Install/Model/Installer/Config.php
Just change

to

Will solve the problem. It’s because that the URL rewriting doesn’t work for some reasons. (Magento uses .htaccess files to add URL rewriting rules)

 

But in Magento 1.9, checking the “Skip the base url validation” option will solve this problem

Access PHP built-in web server from other devices

We often use following command to start the PHP built-in web server.

php -S localhost:port

But in this way only the machine which starts the server can access it, any other computers cannot access it.
To solve this problem, we can use 0.0.0.0 as the binding IP address

php -S 0.0.0.0:8000

Then other devices are able to access our server as well. Using 0.0.0.0 as the IP addres will make the server bind all available IP addresses on the machine.

PySide message box

When you want to display a warning message (like “File doesn’t exist”) to user, using message box is a good choice. Following code is how to create a message box in PySide:

QMessageBox is the message window class, it’s defined in PySide.QtGui module. setText method will set the information text, and exec_ method will display the message box and waiting for user’s operation.

Job found still running after platform shutdown

When I’m coding in Eclipse, suddenly a popup window displayed. And it’s saying “SWT crashed” such things. Then Eclipse doesn’t respond any more.

I tried restarting Eclipse several times, but it always stop and exit before reaching 50% of the loading progress bar.

To get a friendly error message, I opened command line and run “eclipsec.exe”, now the long exception is shown:

Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.ui.internal.Workbench

 

Solution

The solution is to delete file workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi