[Qt] Easily print to console (i.e. for debugging)

How to print to console when using Qt?
Use QTextStream:

Error on file upload: UPLOAD_ERR_PARTIAL

When I was trying to send a file via the HTML form, I saw “error=3” in the $_FILE variable, what means:
UPLOAD_ERR_PARTIAL – The uploaded file was only partially uploaded.

The php_sapi_name() function returned me ‘apache2filter’.
I removed libapache2-mod-php5filter and installed libapache2-mod-php5.
Now php_sapi_name() returns ‘apache2handler’ and files uploading works good now 🙂

Quickly define the file lines limit and cut the first lines

Use this command if you want to keep only a certain number of the most recent lines in the file without using an additional file.

Replace:
* yourFileName – your filename
* 200 – the number of lines you want to keep

 

Create friendly URL based on product name in Prestashop using SQL query

Below you will find simple SQL queries which creates product friendly url from product’s name and saves them in the database SEO section.

You can run this i.e. in phpmyadmin or MySQL Workbench.

Example of action

From product name $ My super product 1 !!! it will create friendly url my-super-product-1

Queries

Continue reading Create friendly URL based on product name in Prestashop using SQL query

How to easily copy table rows using only SQL queries

To easily copy table rows using only queries, you need to create temporary table, copy rows to this table from from table where you want to copy rows, optionally change some values and put them back to table where you want to have copied rows.

How to do this using queries

Continue reading How to easily copy table rows using only SQL queries

Symfony, Doctrine – Manage user timezone

By default when you use entity field DateTimeType the date is saved in default timezone configured in your php configuration. Sometimes we need to show and manage dates from database in different timezones.

Using code placed below, date in the database will be saved in UTC +00:00 and during every insert/update data, dates will be converted into this timezone. Every time when you will load data from database, dates will be converted into user defined timezone.

How to do this:

Continue reading Symfony, Doctrine – Manage user timezone