Category Archives: Programming

Installing PHPUnit with Composer on Windows

(3)

On Windows to install PHPUnit, need Composer, which you can download from https://getcomposer.org/Composer-Setup.exe. Also need Git, which can be downloaded from http://git-scm.com/download/win. I installed Git with the option "Use Git from the Windows Command Promt". … Continue reading

Disable phpMyAdmin ajax notifications

Installed a new version of phpMyAdmin 4.2.7 and noticed that with ajax version appeared a notification about every action in the middle of the screen. It is often notifies not mandatory actions, such as loading … Continue reading

Android virtual device screen bit depth

Using drawable with a gradient there is visible defects on Android virtual device (emulator) because screen bit depth is 16 bpp by default. AVD bit depth can be increased in settings. Create AVD with checked … Continue reading

Resize and crop image from center with PHP

(30)

Sometimes I need to not only resize the image, but also to change its size by removing unnecessary edges for new size. This function changes image size and if the height or width is too … Continue reading

Outbound links click tracking with Google Analytics

Google Analytics allows you to create events and track them. It can be used to track clicks on links to external sites. For example, we need to track only the outbound links and email clicks, … Continue reading

Show only sticky posts on home page in WordPress

To create a list of posts by WordPress query it is possible to filter it by adding a custom filter to the condition. For example, if you need to show only sticky posts, you have … Continue reading

jQuery Jeditable and Chosen hybrid

Jeditable – edit in place plugin for jQuery. Chosen - jQuery plugin that makes select boxes user-friendly. So why not combine them together. This javascript code will let you select in place with Chosen select … Continue reading

Sort by specific order in MySQL query

If you want to sort the list by a certain order, such as a list of numbers from the beginning of 4,5,1, and then in ascending order, you can create a sort order by IF … Continue reading

Local date format in PHP or MySQL

If locale is installed on the server then with PHP: For MySQL local date:

Display data from long running PHP script with jQuery

When a PHP script is executed for a long time and it is not clear what it is happening, such as a long loop, a prolonged processing, rainy weather, or other magical things. That is, … Continue reading

Text wrap for imagettftext

(6)

One line text does not always fit into a given width of the picture, then you need to word wrap the text to a new line, depending on the width. If only the width is … Continue reading

Calculate days between dates

Using php strtotime function difference between dates: Another way to set date with mktime function: Before PHP 5.1.0 negative timestamps were not supported. Under any known version of Windows date could be from 1970 to … Continue reading

Text language detection with php

(5)

Previously was Google Language API for language detection but it is now paid. I found an alternative way to detect the language of text using Text_LanguageDetect pear package with 52 supported languages. Here is lithuanian … Continue reading

CodeIgniter VS Zend Framework

Just made two simple empty CodeIgniter 2.0.3 and Zend Framework 1.11.11 applications to compare time elapsed for script execution. CodeIgniter about 0.01s and Zend Framework about 0.07s. CodeIgniter Wins.

Android geolocation application demo using PhoneGap, jQuery Mobile and Google Maps

(69)

This android geolocation application uses PhoneGap api for phone geo position and displays the phone position point on Google Maps. jQuery Mobile is used to display the page header, footer and content map. Page is … Continue reading

Check if event exists on element

To check whether the event exists on element is possible with jQuery function date(). For example there is a form and if I need to bind an event submit() but before check submit event exists … Continue reading

Mediawiki 1.17.0 $wgSharedUploadDBname error

(1)

I tried Mediawiki 1.17.0 and set common database for all upload files by variable $wgSharedUploadDBname, and uploading file got warnings and fatal error. So if you need $wgSharedUploadDBname, it is better not to use Mediawiki … Continue reading

JQuery Mobile listview error calling method refresh

Made two pages on JQuery Mobile library, put on every page listview. Lists are dynamically generated. But notice if I call the refresh on the invisible list, an error is returned: Uncaught cannot call methods … Continue reading