Hacks, tips and goodies for developers

sharing my expirience on broken english

Kohana + phpunit + Selenium-hub + Selenium Firefox + Selenium Phantomjs + XCFE4 + xrdp — December 27, 2014

Kohana + phpunit + Selenium-hub + Selenium Firefox + Selenium Phantomjs + XCFE4 + xrdp

Attention! Blog has been moved. Please visit blog at new address devhacksandgoodies.pw.

Ok, you have a Kohana project and what to improve it quality using deep code refactoring. This only possible with functional integrational tests. For PHP there is two popular testing frameworks PHPUnit and Codeception. For Kohana it is easier to integrate the first one because Kohana comes with unittest module written using PHPUnit.
Continue reading

A little fix to your work in NetBeans IDE — December 26, 2014
How to include SORM 0.4.1 to your Play application — December 7, 2014

How to include SORM 0.4.1 to your Play application

Attention! Blog has been moved. Please visit blog at new address devhacksandgoodies.pw.

Seems very some controversy happening inside Typesafe between developers: someone prefers Slick, others are SORM. SORM is much more concise, but still too young and lacks some features. There is SORM 0.3.x developed by original author Nikita Volkov and SORM 0.4.x adapted by Typesafe developer? and not yet merged into official repository. I’m going to show how to include the latter.

Continue reading

ORDER BY RAND() LIMIT 1 is bad — December 5, 2014

ORDER BY RAND() LIMIT 1 is bad

Attention! Blog has been moved. Please visit blog at new address devhacksandgoodies.pw.

This is very often happening simple task, to select a random single element from table. So why
SELECT `value` FROM `values` ORDER BY RAND() LIMIT 1
is bad? To answer this question we must first answer what this query actually will do. It will sort all rows by RAND() and then select first row. What if you have 1 000 000 or more rows in the table? Order by will sort them all by RAND() – it will be very slow! So how to do it properly:
Continue reading

SourceTree v1.6.x is worsier than SourceTree v1.5.2 — December 3, 2014
Design a site like this with WordPress.com
Get started