Wednesday, September 30, 2015

Tuesday, September 29, 2015

Get latest files from master branch and overwrite local files

Peace be upon you,
Sometimes, I forgot to commit the local changes and after a few days when I opened the project, I getting lost of what I am doing, So I prefer to sync back my local files with current head from master branch and over write file locally then start coding back from fresh.

git fetch
git reset --hard origin/master
git clean -f -d

Using git fetch command will fetch and import commits from a remote repository into our local repo, then the git reset --hard origin/master will reset our index and working tree, any changes before this will be discarded.

Friday, September 25, 2015

Search inside file content using GrepWin with Windows

Well, Windows operating system allow us to search inside file content by activating it from advance search menu but I prefer using alternative tools which allow me to use regular expression (RegEx) for more precise result. For now, I using GrepWin.

You can downnload GrepWin binary and source code at SourceForge : Just right click on you target folder and start digging and searching the content that you want to find.

Display last record from MySQL table row

   penyelengaraan.noSiriTag = 'd123' 

Thursday, September 24, 2015

Wednesday, September 23, 2015

Hide default databases from phpmyadmin

Peace be upon you,
My favorite database are MySQL and PhpMyAdmin are the database administration that I use very frequently. MySQL and PhpMyAdmin comes with default configuration database such information_schema etc. Thus database that I not interact directly, I just interact with my own database set for my web application. So why not, we just hide these database from PhpMyAdmin?

Just locate and open \phpMyAdmin\ with your favorite text editor (I use SublimeText3) and add this regex code:
/* hide database from phpmyadmin */
$cfg['Servers'][$i]['hide_db'] = '^(information_schema|performance_schema|mysql|phpmyadmin|cdcol|foo|webauth)$';

Then reload / restart your apache and mysql, and see changes on http://localhost/phpmyadmin, check it out on the left side. Now, we just see our own created database only.

Alternative way:
Open and browse "PhpMyAdmin" > Click on "Setting" tab > Then click on "Feature" tab and paste this code within "Hide database" field

Thus default database are just hide from PhpMyAdmin and If you are using tool such MySQL Workbench, NaviCat, HeidiSQL,RazorSQL software or else, thus database still there and available. Hope this tips are useful. That all for now. Wassalam...

Wednesday, September 16, 2015

Easy way to convert phonegap into APK or IOS apps file

I saw someone from industrial training facebook group asking how to convert PhoneGap into Android APK. The answer and the easier way is using Phonegap Build. No need to setup SDK and compile by yourself, just upload the WWW directory and download the build of apps then install into your device.

Monday, September 14, 2015

Reload / restart Ubuntu unity desktop environment without logout

Sometimes, I need to reload or restart my Ubuntu unity desktop environment when needed. Mostly I just logout the computer but now I figure out that there are easy way to reload unity:

1. Press Alt+F2 from you keyboard to run a command.
2. Type unity --replace and press Enter.

Our computer screen will flicker for awhile and return to normal a few seconds later.

Friday, September 11, 2015

Google Maps - Latitude & longitude

* Given an address, return the longitude and latitude using The Google Geocoding API V3
function Get_LatLng_From_Google_Maps($address) {

    $url = "$address&sensor=false";

    // Make the HTTP request
    $data = @file_get_contents($url);
    // Parse the json response
    $jsondata = json_decode($data,true);

    // If the json data is invalid, return empty array
    if (!check_status($jsondata))   return array();

    $LatLng = array(
        'lat' => $jsondata["results"][0]["geometry"]["location"]["lat"],
        'lng' => $jsondata["results"][0]["geometry"]["location"]["lng"],

    return $LatLng;

* Check if the json data from Google Geo is valid 

function check_status($jsondata) {
    if ($jsondata["status"] == "OK") return true;
    return false;


Source :

Thursday, September 10, 2015

Git proxy connection

Add proxy into git global configuration :
$ git config --global http.proxy "IP address:Port"

Remove proxy from git global configuration:
$ git config --global http.proxy ""

Check git global proxy configuration:
$ git config --global http.proxy

Wednesday, September 9, 2015

Checking which local branch is tracking which remote branch in Git?

For all branches:
git branch -avv

For local branches only:
git branch -lvv

shows you all branches as well as the name of the upstream branch.

Source :

Change git remote from SSH to HTTPS

Peace be upon you.. My office has strict network rules which filtered by proxy on port 8080 and does not allow me to use SSH connection to fetch and pull on my git repository. I tried to use subversion a.k.a svn as alternative but I not familiar with the command and GUI tool such RapidSVN on linux are not very helpful. Then, I google-fu and found that git support HTTPS connection too! Wohaa..good!

Let's check our current remote repository URL:
$ git remote -v
Now change our remote's URL from SSH to HTTPS with the git remote set-url command:
$ git remote set-url origin https:[email protected]/wawang/sistem_repo.git
* I use Bitbucket as example above, means it depends on your git hosting provider
* Bitbucket URL format : https://<username><username>/<reponame>.git
* Github URL format :<username>/<reponame>.git

Now, verify the remote repository URL using the git remote -v command. Easy right? That all,Peace!

Monday, September 7, 2015

How to change JasperSoft iReport locale

Tool -> option -> tab "report" -> tab "compilation and execution" -> tab "execution option" -> report locale

Thursday, September 3, 2015

Laravel 5 - No supported encrypter found. The cipher and / or key length are invalid

Hey, I got an error msg said my laravel 5 installation went wrong :
RuntimeException in compiled.php line 6779:
No supported encrypter found. The cipher and / or key length are invalid.
in compiled.php line 6779
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array()) in compiled.php line 1086
at Container->build(object(Closure), array()) in compiled.php line 1039
at Container->make('encrypter', array()) in compiled.php line 1577
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in compiled.php line 1131
at Container->resolveClass(object(ReflectionParameter)) in compiled.php line 1115
at Container->getDependencies(array(object(ReflectionParameter)), array()) in compiled.php line 1101
at Container->build('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1039
at Container->make('App\Http\Middleware\EncryptCookies', array()) in compiled.php line 1577
at Application->make('App\Http\Middleware\EncryptCookies') in compiled.php line 9274
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2776
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9274
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9264
at Pipeline->then(object(Closure)) in compiled.php line 2053
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2036
at Kernel->handle(object(Request)) in index.php line 54

We need to create a random of 32 char string as application key. Just run the command and get the access key:
$ php artisan key:generate

Copy that generated key and put it inside /config/app.php file, for example :
'key' => env('APP_KEY', 'ql9xRk2DuYTdl8QJrmjmRCfRx3kyCZC2'),

Dont forget to give write permission for /storage directory (chmod -R 755 are enough for that).

Wednesday, September 2, 2015

How to enable PHP debugging with XAMPP for Linux and XDebug

Peace be upon you.. I decide to learn debugging PHP web application using XAMPP for Linux and XDebug. This tutorial are based from XAMPP for Linux 5.6.11, but it suppose will be valid in future because I using xdebug that provided with the XAMPP and I just enable it.

Let's check our PHP installation with php --version command
$ php --version
PHP 5.6.11 (cli) (built: Aug 10 2015 20:47:04) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
* Note : If the output said about Xdebug version, it mean you PHP already debug enable and else are not enable yet.

The another way to check is to read from PHP info, just create a new file with code below and execute from our localhost:
<?php phpinfo() ?>
* Note : Find "xdebug" using ctrl+f and if you found this section it mean you PHP already debug enable and else are not enable yet.

Now, I assume our PHP does not enable Xdebug yet.. and we are going to enable it by edit /opt/lampp/etc/php.ini file
$ gksudo  gedit /opt/lampp/etc/php.ini
Add this line inside that file :
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/
And now, restart the server and after that we can run / debug the PHP web application :
$ sudo /opt/lampp/xampp restart
So easy right? That all we need, Thanks.

Composer - /usr/bin/env: php: No such file or directory

Today, I setup LAMPP (XAMPP) and laravel PHP framework with Ubuntu 15.04 but when I want use composer, this problem occur :
$ sudo composer install
/usr/bin/env: php: No such file or directory
The solution is to symlink the PHP cli with the bin path:
$ sudo ln -s /opt/lampp/bin/php /usr/local/bin/php
Nice and well played :)


Just another throwback memory of Seminar on Computer Science Special Topics 2015 on 26th May 2015 and held at FSKTM, UTHM. This event was handled by final year undergrad students and I was appointed as Program Director and Leader for software engineering course and and Chief of Secretary for the main groups of computer science (Combination of Software Engineering, Multimedia, Info Security and Web Technology students).

Our speakers and special topic discussed are :
1. Software Engineering - Gaining Experience with Open Source Software by En. Mohd Kamal Mustafa and En. Salahuddin Hairai.
2. Web Technology - Web Development Trends and Predictions for 2015 by En. Ahmad Zaman Nuri.
3. Multimedia - Venturing Into Serious Game Development by En. Helmi Adly Mohd Noor.
4. Info Security - Cyber Crime, role of MCMC, Smart click by En. Syed Isa Syed Shekh Alsagoff.

After speak session, we have an forum about Career and direction for Computer Science student after graduation. We also manage to get HP (Hewlett-Packard) Malaysia for walk-in interview for internship at my faculty.

My special thanks to friends, lecturer, speakers and JomWeb Johor.

That all I want to share... wassalam