Emoji and MySQL

I have a hard time saving Emoji character to MySQL column of type text.

Here are the steps I did to make it work:

1. Open app/config/database.php and change the charset from utf8 to utf8mb4. Change collation from utf8_unicode_ci to utf8mb4_general_ci.

2. I go to phpmyadmin and then modify the column collation to utf8mb4_general_ci.

It Works :)

Laravel 4 Validation in Codeigniter

I decided to convert my Codeigniter application to Laravel 4 but since the code base of my application is pretty stable I decided to used some of Laravel 4′s components inside Codeigniter until my web application is fully Laravel-based apps.

First thing I did was to used Laravel’s Eloquent

Next thing I would like to do is to show how to use Laravel 4′s Validation inside of Codeigniter apps.

So lets get started.


Using Eloquent ORM inside Codeigniter

Last time I wrote an article on how you can use Eloquent ORM outside of Laravel 4. This time we are going to integrate Eloquent ORM inside our Codeigniter apps. As most of us know, Laravel used composer for bundles including its database (Illuminate Database). In my application I use Codeigniter Active Record, Datamapper Orm. Now that I create application using Laravel, I want to use Laravel’s Eloquent ORM in my existing Codeigniter application.

Install Composer

The first thing we need to do is to install composer. If you are new to composer you may want to read some article about it here

Create json File

Create file and name it composer.json in the root folder of your Codeigniter application. Since Eloquent ORM only runs on PHP 5.3 or later I assume you use that PHP version. Notice that I add key for autoload then the classmap. Change the path where your eloquent models resides. Dont forget to run $ composer dump-autoload after you created a new Eloquent Model

Install Illuminate Database

Open you terminal (command prompt in Windows) then navigate to you Codeigniter’s root folder then enter the following command:

You should see message something like this:


This will create “vendor” folder in your apps root directory.


Add require ‘vendor/autoload.php’; just before the codeigniter bootsrap

Create models and connection files

Create two files and save it in your models directory.

Test it

Fingerprint Redirection

We received a call from a customer very recently, where the issue was that when customer remotes into a system which has an application using Digital Persona SDK installed on the box and tries to run it ,it says fingerprint reader not connected although the reader was connected to the system. Now if the user is directly at the terminal and runs the application, it recognizes the fingerprint reader.The reason for this is that Digital Persona readers do not support USB virtualization (i.e) when we RDP into a box we cannot virtualize USB like we do with printers, but we do support fingerprint data redirection which means we can transfer fingerprint template data on wire.

For example, for one of our Enterprise products online client you can have a citrix server where you can  install the Online client software, have reader plugged into a client machine, RDP into a citrix server, scan finger on the client machine, thus transferring fingerprint image via wire.

To configure Citrix client following are instructions

  1. Locate the DPICACnt.dll file on the Misc\Citrix Support folder on the Online Client CD, and copy it to the folder on the client computer where the Citrix client components are located (that is, or the Program Neighborhood client, the file might be in the Program Files\Citrix\ICA Client folder).
  2. Using the regsvr32.exe program, register the DPICACnt.dll library.
  3. If you have several Citrix clients installed on a computer, repeat steps 1 and 2 for each client

To RDP  below are instructions

    1. On the client, Create a new .reg file and add the following:
    2. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\DigitalPersona\Policies\Default] “AllowFPRedirect”=dword:00000001 “ForceAuthOnServer”=dword:00000001 “ForbidFPCompression”=dword:00000001

From http://digitalpersonablog.com/devportal/2012/10/11/fingerprint-redirection/

Imagemagick for Windows

I got a lot of problem installing imagemagick for windows!

My project requires me to convert PDF files to jpg to able to view the files into browser of Tablets that we have purchased.

So here is the steps I did:

1. Install the XAMPP 1.8.1 at the time of writing.

2. Install imagemagick 6.8.0-4-Q16-dll

3. Then restart

4. Install image magick extension to php.ini (http://www.peewit.fr/imagick/) I use thread safe.

5. Install the ghostscript. then restart. imagemagick 5.4 does not support relative path http://stackoverflow.com/questions/9954764/imagick-php-5-4-extension-does-not-work-with-relative-paths-windows

6. Happy me :)


Some old ref.