Posts

Showing posts from April, 2014

CAKEPHP: COUNT DATA AND GROUP BY DATE

Image
Goal: Count Tip Offs created per day for a month to use for graph Problem: created field name is in datetime format: Y-m-d H:i:s Solution: format SQL Query date: DATE_FORMAT(TipOff.created, '%Y-%m-%d') Inside the function of controller <?php $ tipOffsMonthly = $ this -> TipOff -> find( ' all ' , array ( ' conditions ' => array ( ' AND ' => array ( ' TipOff.electric_cooperatives_id ' => AuthComponent :: User ( ' electric_cooperatives_id ' ) , ' TipOff.created BETWEEN ? AND ? ' => array ( $ first_day , $ last_day ) ) ) , ' fields ' => array ( " COUNT('created') as per_day " , ' created ' ) , ...

INSTALLING PHALCON DEVELOPER TOOLS 1.3.1 IN UBUNTU 13.10 / 14.04

Image
Installing developer tools requires slightly more effort. Download phalcon-developer-tools package here:           https://github.com/phalcon/phalcon-devtools   Extract it to some convenient path. Via git :          git clone git://github.com/phalcon/phalcon-devtools.git  Install and create a phalcon symlink:        cd  phalcon-devtools        sudo ./phalcon.sh Create a symbolink link to the phalcon.php script, replace this with the right path:         alias phalcon="/home/sherwinrobles/phalcon-devtools/phalcon.php" Remember to restart the console to reload the environment variables. Let’s try it out by listing available commands.         phalcon commands Gives me this error:       PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/phalcon.so' - /usr/lib/ph...

INSTALLING PHALCONPHP IN UBUNTU 13.10 / 14.04

Image
On Linux you can easily compile and install the extension from source code. Requirements We need some packages previously installed: LAMP PHP 5.x development resources GCC compiler                      sudo apt-get install php5-dev php5-mysql gcc Compilation 1. To create the extension from C source follow these steps: If you dont have git installed you can install it with this command sudo apt-get install git                    git clone --depth=1 git://github.com/phalcon/cphalcon.git                    cd cphalcon/build                    sudo ./install It gives me error:           In file included from /usr/include/php5/ext/spl/spl_iterators.h:27:0,                             ...

INSTALLING AND SETTING UP ANDROID DEVELOPER TOOLS IN UBUNTU 13.10

Image
1. Check whether your Ubuntu is running 32bit or 64 bit OS. In terminal window, type in                       uname –m          If the response is  i686 , you have a 32-bit version of Linux. If the response is  x86_64 , you have a 64-bit version of Linux. 2. Download   Android Developer Tool   and extract anywhere you want and rename it with no space.            /Home/ADT 3. Download   Java Runtime Environment (JRE)  extract inside eclipse directory of your Android Developer Tool and rename it to jre.           /Home/ADT/eclipse/jre If your are running Ubuntu with 64 bit system, it is required to install  lib32z1 lib32ncurses5 lib32bz2-1.0 to avoid this error:  /home/username/ADT/sdk/platform-tools/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directo...