Category Archives: development

JavaScript developer interview questions.

I searched for a job not far ago and visited a lot of interviews. Here I would like to post some of questions, which I find interesting. 1) explain the difference: apply, call and bind 2) rules and order of determination of this (context) 3) count some of the two arrays with Array.reduce. For ex.: […]

$ctrl, this, $scope, assigning variable to view

I wrote this article basically for myself. Maybe it will be useful for someone. Angular allows to access variables via: $ctrl, controllerAs, this, $scope, simple variable name $ctrl – is default name for controller in view. So you can use it to access variables inside templates: function SearchInputController($scope, $log){ var ctrl = this; $scope.$log = […]

Exporting data recipy, Memory limit exceeded PHP error

While exporting data from database to a file via PHP, such libraries as PHPExcel will cause an error Memory limit exceeded. Because they read data from database to RAM. You can avoid that using file system only. So the recepy is:Get data from database and write it to a temporary file and then read it […]

WordPress: image upload from url

In case you have WordPress powered e-shop you most probably will need to add products to it filling them with pictures from web. When adding it you will see such an dialog: ‘Select Files’ dialogue will open (in case you are on Windows) Windows Explorer, so you can choose file from your PC to upload. It […]

Doctrine 2 QueryBuilder getResult and getArrayResult

When using Doctrine 2 hydration you can sometimes encounter issue when you get one result instead of many results. Doctrine 2  requires every entity to have Id annotation. Please use it carefully, because when using Doctrine 2 QueryBuilder \Doctrine\ORM\AbstractQuery::getResult You will not get records having not unique @Id fields. And no even PHP warnings. \Doctrine\ORM\Internal\Hydration\ObjectHydrator::hydrateRowData will […]

MySQL: NULL value comparison issue

As a PHP developer I was surprised when query like this: SELECT IF(‘Bonus’ <> NULL, 1, 0) returned 0 Any arithmetic comparison with NULL does not return true or false, but returns NULL instead As an alternative guys propose <=> operator called NULL – safe equal to operator. So my query will look like this: SELECT IF(!(‘Bonus’ <=> […]

background-attachment CSS property

Recently I came into and issue. I checked background size on Chrome devtools and it looked okay: But then when I looked on the iPhone gadget: background looked horribly, it was zoomed: After a small search I found explanation (http://caniuse.com/ – feat=background-attachment) . By the fact that mobile browser does not support background-attachment: fixed property. So Chrome devtools(51.0.2704.106 […]