Friday, December 20, 2019

Instal RVM on Linux Ubuntu 64 Bit

RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. To install Ubuntu in RVM

1. Check Apache and Mysql existed in your machine.
  •  Type http://localhost or on your browser to check apache running.
  • Check /var/www/ directory.
  • In /var/www/index.html type <?php phpinfo(); ?> , then type http://localhost or on your browser. If apache installation in your machine already correct, your browser will load PHP informations installed on your machine
2.Run on your terminal:
  • bash -s stable < <(curl -s
  • source ~/.bash_profile .Note : This command is for reload opened terminal. 
  • rvm requirements. Note : This command is for searching all libs that still needed, and then install the lib.
 3. Install Ruby according to the version we need:     
  • rvm install 1.9.3
4.Install another version of ruby with this method.
5. To view all installed RVM 
  • rvm list
6.To use specifics RVM 
  • rvm use 1.9.3
 7.If there is an error when running rvm use 1.9.3 try open file ~/.bashrc and ~/.bash_profile and then add this script :

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session

8. To use Specifics Gemset

  • rvm use 1.9.3
  • rvm gemset use rails3.2
  • rvm use 1.9.3@rails3.2
9. Set Default RVM
  • rvm use 1.9.3@rails3.2 --default


Thursday, November 28, 2019

MongoDB in PHP

The MongoDB PHP driver should work on nearly any system: Windows, Mac OS X, Unix, and Linux; little- and big-endian machines; 32- and 64-bit machines; PHP 5.2, 5.3, 5.4 and 5.5.

Install MongoDB Driver PHP

  • sudo pecl install mongo
  • Add in php.ini (/etc/php5/cli/php.ini)
  • Restart Apache: sudo service apache2 restart
Check Installed MongoDB
  • Check is MongoDB extensions already loaded in your PHP php --ini
    already installed: /etc/php5/cli/conf.d/mongo.ini
  • Check is MongoDB extesions already enabled php -i | grep 'Mongo' Already Enabled: MongoDB Support => enabled
  • Type <? phpinfo(); in your PHP applications.

Monday, November 18, 2019

Install MongoDB on Ubuntu

MonggoDB provides package that supported officially. This package contains:

  • mongodb-org
  • mongodb-org-server
  • mongodb-org-mongos
  • mongodb-org-shell
  • mongodb-org-tools
Install MonggoDB Package.

  • Import Public Key used by Management System.
    Type on Terminal: sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
  • Create List File.
    echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
  • Update Package.
    sudo apt-get update
  • Install MongoDB package
    sudo apt-get install -y mongodb-org

Running MongoDB
  • sudo service mongod start
MongoDB Shell
  • type: mongo

Saturday, November 2, 2019

Install JRE on Ubuntu

Java Runtime Enviroment also known as JRE is part of Java Development Kit JDK a software development environment for writing Java applications. JRE consist Java Virtual Machine, core classes, and supporting files.
Installing JRE on ubuntu is a little bit different with installation JDK. First, Download the JRE file in here. Remember to download JRE version based on your system version either it's 32bit or 64bit.
After finished downloading your JRE version, we can begin the installation process.

  1. Create new folder in opt directory. In terminal type this command "sudo mkdir -p -v /opt/java/64".
  2. Go to folder containing your JRE download file(example: use"cd Downloads" to move to Download directory from your home directory) and unpack the file by typing "tar xvzf YOUR JRE FILE".
  3. Moved unpacked contents into system folder that you created in step1. Type "sudo mv -v YOUR JRE FILE /opt/java/64".
  4. Inform the system and make the new JRE become your system default.
    sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/YOUR EXTRACTED JRE FILE/bin/java" 1
    sudo update-alternatives --set java /opt/java/64/YOUR EXTRACTED JRE FILE/bin/java
  5. Install Firefox plugins. Type "mkdir -v ~/.mozilla/plugins".
  6. Removed IcedTea plugin, if it has been installed. type "sudo apt-get remove icedtea-6-plugin && sudo apt-get remove icedtea-7-plugin".
  7. Remove an older version of the Java plugin. Type "rm -v ~/.mozilla/plugins/".
  8. Install the plugin by creating symbolic link. Type "ln -s /opt/java/64/jre1.7.0_60/lib/amd64/ ~/.mozilla/plugins/".
  9. Close and restart Firefox
  10. Type "about:plugins" in Firefox URL bar. If your installation is correct you will see something like this:


Tuesday, October 22, 2019

Veritrans Rails 4 with dynamic server_key and client_key

Veritrans is Indonesian Payment Gateway. Veritrans accepts Credit Card, Direct Debit, e-Wallet,Bank Transfer and Convenience Store. That's why this Payment Gateway is famous in Indonesia. Further explanations about Veritrans .

Veritrans has multiple products with different integration method and pricing. About Veritrans Products

Veritrans Products:


VT-Link facilitates a payment feature for your online store by redirecting the customer to Veritrans payment page through a link.


VT-Web facilitatess merchant to use Veritrans payment system, by redirecting the customer to the Veritrans payment page.


VT-Direct is Veritrans product that allows you to use our payment system directly on your website

Integration Tool Kit

  • Rails 4
  • gem veritrans


Add gem Veritrans to Gem File and bundle install

    gem 'veritrans';

In Console generate veritrans.yml

rails g veritrans:install

Generate Veritrans Form

rails g veritrans:payment_form

This command will generate controller and view for Veritrans.
Because we will built dynamic key for this integrations. You can keep veritrans.yml configurations like this:

  # Register in sandbox veritrans and get your keys here:
  client_key: ""
  server_key: ""
  api_host: ""

  # Register and get your keys here:
  client_key: ""
  server_key: ""
  api_host: ""

  # Register and get your keys here:
  client_key: ""
  server_key: ""
  api_host: ""


VT-Web Integrations

In VT-Web Integrations, you just need to obtain redirect URL to Veritrans . After last check out process, put this function for directing page to veritrans:

@result = Veritrans.charge(
  payment_type: "VTWEB",
  transaction_details: {
    order_id: "order-id",
    gross_amount: 100_000
// For Automatically redirect
redirect_to @result.redirect_url

VT-Direct Integrations

VT-Direct Integrations is a little bit complicated because a lot of sensitive data involved in this process.

Preparing The Form

In /views/shared/_credit_card_form   put your last checkout data in here. For example:

<%= form_for @payment, html: {class: "veritrans-payment-form", id:"card_form"} do |f| %>
<% if @settings.client_key.present? && @settings.server_key.present? && @settings.api_host.present? %>

Payments Page

<%= render "layouts/notification" %> <%= f.hidden_field :token_id, id:"card_token" %>
<%= label_tag "Length Of Membership" %> <%= number_field_tag :length_of_membership, 1,in: 1..10000 ,size: 5,class:"form-control", id:"length_of_membership",style:"width:10%;float:left;margin-right:10px;" %>
<%= label_tag "Membership Expired" %> <%= text_field_tag :membership_expired, (@company[:membership_expired] + 1.month).strftime('%Y-%m-%d'),size: 5,:readonly => true,class:"form-control", id:"date_expired",style:"width:75%;" %>
<%= f.number_field :amount, id:"gross_amount", size: 25,:readonly => true,class:"form-control",style:"width:75%;" %>
<%= label_tag :credit_card_number %> <%= text_field_tag :credit_card_number, '',:required => true,:placeholder => "4811 1111 1111 1114", name: nil, size: 25,class:"form-control", id:"card_number" %>
<%= label_tag :credit_card_cvv %> <%= text_field_tag :credit_card_cvv, '',:required => true,:placeholder => "123", name: nil,class:"form-control", id:"card_cvc" %>
<%= label_tag :credit_card_expire %> <%= text_field_tag :credit_card_expire, '',:required => true, placeholder: "MM / YY", name: nil,class:"form-control", id:"card_exp" %>
<%= f.label :credit_card_secure, "3D-secure" %> <%= f.check_box :credit_card_secure %>
<%= f.label :notes %> <%= text_area(:notes, :text, class:"form-control", size: "20x30") %>
<%= link_to (image_tag "undo-logo.png", title: :back).html_safe, users_path() %> <%= f.submit "Pay via VT-Direct", class:"btn green-btn" %>
<% else %>
<%= link_to (image_tag "undo-logo.png", title: :back).html_safe, users_path() %>
<% end %> <% end %>

Return Process

In Return Process build this functions

    veritrans_callback = {
      transaction_details: {
        order_id: payment.order_id,
        gross_amount: params[:payment][:amount].presence || @payment.amount
    // Get setting from database
    setting = Setting.first
    // Set key and host for Veritrans

    params[:type] = "Credit Card"
    veritrans_callback[:payment_type] = "credit_card"
    veritrans_callback[:credit_card] = {}
    veritrans_callback[:credit_card][:token_id] = params[:payment][:token_id]
    result = Veritrans.charge(veritrans_callback)

    transaction_params = {}
    transaction_params = {

    // If Transaction Success
    if[:status_code] == "200"
      // Success Process 
      // Failed Process

That's All. I hope this will help anyone out there. :D


Wednesday, September 18, 2019

Understanding Rubycritic Smells

Rubycritic is gem that wraps around static analysis gems such as Reek, Flay and Flog to provide a quality report of your Ruby code.

Because this gem was uses as Audit guidelines code quality in my company, I often faced hard time to adjust, optimizing and refactor my code.

I began to summarize Rubycritic detecting behavior and implement it in my code to avoid Smells and easier get at least Grade C to bare pass.

A few my conclusion things to consider when developing code according Rubycritic :

  1. Don't! Never! Avoid! Duplicity Code. Rubycritic love this think and will give you sudden great high score, enough to drop your Code Rating Grade.
  2. Evade complicated nested logic with multiple if, switch, etc. It's saver to use functions to handle logic rather than nested logic. Fox example

    // Rather than this
     if obj == "a"
       if obj1 == "1" && obj2 == "2"
         // Process
       elsif obj1 == "3" && obj2 == "4"
         // Process
         // Process
     elsif obj1 == "b"
       if obj1 == "1" && obj2 == "2"
         // Process
       elsif obj1 == "3" && obj2 == "4"
         // Process
         // Process
      // Process
    // Use this
     if obj == "a"
     elsif obj1 == "b"
      // Process
  3. Evade complicated nested loops with multiple each, for, etc. It's saver to use functions to handle loops rather than nested loops. Fox example

    // Rather than this
     data_sources.each do |data_source|
      data_source.each do |data|
    // Use This
     data_sources.each do |data_source|
  4. If your function using nested hash, redeclare multiple used nested hash using variable.

    // rather than
    if params[:id] == '1'
      user = User.where('id = ?',params[:id])
    // Used This
    id = params[:id]
    if id == '1'
      user = User.where('id = ?',id)

  5.  To combine Hash uses:  .merge!()

          params_data_assign = {}
          params_data_assign[:password_salt] = BCrypt::Engine.generate_salt
          params_data_assign[:password_hash] = BCrypt::Engine.hash_secret(password, self.password_salt)

  6. Use method = const_get(method) to change string into Model Constant. (surprisingly isn't it?).

      def myfunction
       my_return = obj == 'User' ? 'User' : 'Member'
      def process_my_return(my_return)
        method = const_get(my_return)
        data = method.where('id = ?',1)
        // Process
If you have found something more than this or have more effective way. Please, tell us so we can share about this problem more.


Thursday, September 12, 2019

Using Zend ACL for Dynamic Access Control Privileges from Specifics Database

Zend ACL is flexible access control list implementation for  privileges management. Zend ACL has 3 different area Resources, Role, and Rights.

  • Resources : Object which access is controlled.
  • Role: Object which can request access to resources.
  • Right:  Access Role for access resources.
As a default, Zend ACL give deny value to all resources, we have to built white list access roles for each of resources.
In this example, I will use "user_role" table as Resources, "role_access" table as Rights. 


Sunday, July 21, 2019

Build Test Plan in Jmeter Apache 2.11

To build Test Plan in Jmeter Apache. We need several step to configuring the process.
  1. Right click in Test Plan > Add > Thread Group
  2. Customize the Thread Group with your desire configurations like number of threads(User),The Ramp-Up Period, and loop count.
     - Number of threads : Number of   Users
     - The Ramp-Up Period : This property tells JMeter how long to delay between starting each user. For example, if you enter a Ramp-Up Period of 5 seconds, JMeter will finish starting all of your users by the end of the 5 seconds. So, if we have 5 users and a 5 second Ramp-Up Period, then the delay between starting users would be 1 second (5 users / 5 seconds = 1 user per second). If you set the value to 0, then JMeter will immediately start all of your users.
     - Loop Count :
    This property tells JMeter how many times to repeat your test
  3. Right click in Thread Group created before and go to > Add > Config Element > HTTP Request
    • Name -- the name of this HTTP request. The name should be descriptive; remember that it is common to have multiple HTTP Request elements in a thread group.
    • Server Name or IP -- the server name or the IP address of the machine running the application being tested.
    • Port Number -- the port number used by the application. Normally, a Web application runs on port 80.
    • Protocol -- the protocol used, either HTTP or HTTPS.
    • Method -- the request method, either GET or POST.
    • Path -- the path to the resource that will handle this request.
    • Parameters -- the list of parameters sent with this request. Use the Add and Delete buttons to add and remove parameters.
    • Send a file with a request -- simulate a file upload to the Web application.
    • Retrieve all images and Java Applets -- download embedded content.
  4. Right click in Thread Group created before and go to > Add > Listener > View Result Tree.
  5. Right click in Thread Group created before and go to > Add > Listener > Summary Report.

    Label: Recorded HTTP requests.

    Samples: Samples denote to the number of http request ran for given thread.

    Average:  Average is the average response time for that particular http request. This response time is in millisecond.

    Min: Min denotes to the minimum response time taken by the http request.

    Max: Max denotes to the maximum response time taken by the http request.

    Std.Deviation: This shows how many exceptional cases were found which were deviating from the average value of the receiving time.   The lesser this value more consistent the time pattern is assumed.

    Error %: This denotes the error percentage in samples during run. This error can be of 404(file not found), or may be exception or any kind of error during test run will be shown in Error %. In the above image the error % is zero, because all the requests ran successfully.

Saturday, July 20, 2019

Install Jmeter

Apache JMeter is a 100% pure Java desktop application designed to load test client/server software (such as a web application ). It may be used to test performance both on static and dynamic resources such as static files, Java Servlets, CGI scripts, Java objects, databases , FTP servers , and more. JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.

Jmeter can do stress test to client/server application such as simultaneously massive user login and process. Jmeter works in protocol level and using Java desktop applications.

 Start Jmeter Installation :
  • Go to terminal and check your Java version by typing "java -version".
    It will give result something like this depending on your Java version.
        java version "1.7.0_60"
       Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
       Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
    If nothing displays, please re-Install Java SE runtime environment
  • Download Jmeter from here, and unpack it.
  • Launch Jmeter.
    If you are using Window, just run the file /bin/jmeter.bat to start JMeter in GUI mode as shown below

Friday, June 21, 2019

Vagrant: Built Customize Vagrant Box

Built Customize Vagrant Box

We can make customize box from our vagrant existed box. With this, we can change our environment in existing box and customize it according our need.


// In your Vagrant Init file directory
vagrant up
// Get in to your vagrant environment
vagrant ssh

 * Do your custumize in here
 * For example. I will remove my existing ruby version from vagrant box and change it to new one

sudo apt-get update -y

sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline-dev \
git-core curl libyaml-dev libcurl4-dev libsqlite3-dev apache2-dev -y

curl --remote-name

tar zxf ruby-1.9.3-p194.tar.gz

cd ruby-1.9.3-p194/



sudo make install

// Check if my new ruby version successfully installed
ruby -v

// If succeed quit from vagrant ssh

// Adding your customize box to new box
vagrant package

// Name it
vagrant box add lucid64_with_ruby193

// Check for your new box
vagrant box list

- lucid32
- lucid64
- lucid64_with_ruby193

// Activate your vagrant 
vagrant init lucid64_with_ruby193


Tuesday, June 18, 2019

Breakman Rails: How to avoid Mass Assignment Warning

Breakman is static analysis security scanner for Ruby on Rails. It's open source vulnerability scanner specifically designed for Ruby on Rails applications. It statically analyzes Rails application code to find security issues at any stage of development.

I will share some trick to avoid Breakman Mass Assignment medium settings warning.
  1. Pay attention to your model relationship. My suggestion always use Nested Attributes .
  2. If necessary used attr_protected to relationship variable key in your model.
Below is some of example case I've solved:
  • Example Case 1 "Without Relationship" :
         Set relationship variable in attr_protected to avoid Breakman warning.
      attr_accessible :name, :description
      attr_protected : user_id
         Do this saving method:
            create :
         data_list = {:name => name, :description => description}
        saving_create =
        saving_create.user_id = user_id
             update :
        data_list = {:name => name, :description => description}
        user_data = self.find_by_id(1)
        user_data.attributes = data_list 
        user_data.user_id = user_id

  • Example Case 2 "With Relationship" :
      attr_accessible :name, :description
      attr_protected : user_id

      has_one :category
      has_many :products

      accepted_nested_attributes :category, :products

            create :
        products = []
        data_list = {:name => name, :description => description}
        saving_create =
        saving_create.user_id = user_id
        all_data.each do |d|
          saving_process =
          saving_process.product_id = d[:product_id] 
          saving_process.product_name = d[:product_name]
      update :
        products.each do |p|
        data_list = {:name =>, :description => p.description}
         update_process = self.find_by_id(p.user_id)
         update_process.attributes = data_list
         update_process.product_id =
         update_process.product_name =
            raise ActiveRecord::Rollback 



Friday, June 14, 2019

Laravel 4 Scheduller with dispatcher

Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

For Futher Information go to this link Dispatcher.

  • Do you hate to touch crontab to add scheduller in laravel?
  • Do you hate with all crontab configuration when add scheduller in different servers?
Congratulations,  Laravel has package to handle this problem using Dispatcher. Everthing become simple and easy with this package. Doubt? Here we go!

Tool Kit

  • PHP 5.3+ or HHVM
  • Laravel 4


In your application add this to your "require" :{} composer.json

    "indatus/dispatcher": "1.4.*@dev"

remember to do composer update.
In your app/config/app.php providers array add this line:



  scheduled:make              Create a new scheduled artisan command
  scheduled:run               Run scheduled commands
  scheduled:summary           View a summary of all scheduled artisan commands

Build scheduled command

php artisan scheduled:make yourCommands

Register scheduled command

In Your app/start/artisan.php add this line depend on Your Command :

Artisan::add(new yourCommands);


Go to your command app/command/yourCommands and change 

// my artisan command will be php artisan cron:mycommands
protected $name = 'cron:yourCommands';

// Configure this functions to change schedule time
public function schedule(Schedulable $scheduler)
  // Change this function to change time
  return $scheduler->daily();

This is Scheduler Changes time function example list:

//every day at 4:17am
return $scheduler->daily()->hours(4)->minutes(17);

//every Monday/Friday at 8:30am
return $scheduler->daysOfTheWeek([

// Using Raw Commands
//every other day at 1:59am, 13:59pm and 23:59pm
return $scheduler->setSchedule(59, [1,13,23], '*/2', '*', '*');

// Every minutes
return $scheduler->everyMinutes();

// Every 20 minutes
return $scheduler->everyMinutes(10);

// Every hours
return $scheduler->everyHours();

Cron Setup

In console add

crontab -e
* * * * * php {{ path to your app}}/artisan scheduled:run 1>> /dev/null 2>&1


If your cron not running check this

// Via console, check your mcrypt
php -i | mcrypt.

// Via console
php artisan scheduled:run --debug 
backup:avatars: No schedules were due
     command:name: No schedules were due
     myTestCommand:name: No schedules were due
     cache:clean: /usr/bin/env php /Users/myUser/myApp/artisan cache:clean > /dev/null &
     mail:subscribers: /usr/bin/env php /Users/myUser/myApp/artisan mail:subscribers > /dev/null &

// Via Console
php artisan scheduled:summary
//It works if output something like this:
| Environment(s) | Name             | Args/Opts | Minute | Hour | Day of Month | Month | Day of Week | Run as |
| *              | schedule:test    |           | */5    | *    | *            | *     | *           |        |


Tuesday, May 28, 2019

Laravel 4 Queue with Beanstalk and Supervisor

Queue  is great tools in laravel for implementing delayed job. Queue allowing system to put task in background so it can become faster and make users skip waiting until tasks is finished.
Queue can be implemented to handle big process such as generating reports, image processing, sending email, or even heavy CRUD process.

Tool Kit


Installing Queue

In your application add this to your "require" :{} composer.json

    "pda/pheanstalk": "2.0.*"


You can create new class or use controller/model/any class to execute function with Queue. Below is function in controller class executed by Queue.


class ReportsController extends \BaseController {
  function fire($job,$data){
    //Function Process

To execute this method with queue use this command

Queue::push('ReportsController', $data);

Other alternative is to execute function without fire method


class ReportsController extends \BaseController {
  function generateReport($job,$data){
    //Function Process

To execute this method with queue use this command

Queue::push('ReportsController@generateReport', $data);

Queue::push() command can be use in Route, Controller, or even Command.

Running Queue

To running Queue we need Beanstalk as a worker. To activate beanstalk running this command in console

  // To fire last job
  php artisan queue:work

  // To fire running job and listen it
  php artisan queue:listen

  // add listener with flag (you can choose or implement all of this)
  php artisan queue:work --timeout=0 --queue="default" --delay=0 --memory=128 --sleep=3 --tries=0

Install and Configure Beanstalk

Install Beanstalk

sudo apt-get update
// Install in Debian or ubuntu
sudo apt-get install beanstalkd

Configure Beanstalk

sudo nano /etc/default/beanstalkd

// Add or uncomment this line

Start Beanstalk
sudo service beanstalkd start

Configure Beanstalk in Our Laravel App

Set default queue in app to Beanstalk. Go to app/config/queue.php

// Change This
'default' => 'beanstalkd',

// This is default beanstalk configurations
'connections' => array(

    'beanstalkd' => array(
        'driver' => 'beanstalkd',
        'host'   => 'localhost', 
        'queue'  => 'default',
        'ttr'    => 60,



We use php artisan queue:work or php artisan queue:work as listener, but we know that impossible for us to running this command every time we push job to Queue or when we start servers.

To overcome this we use Supervisor to listen all of active worker. Supervisor will listen all of our queue:work --daemon and restart it if failed.

Install Supervisor

// Install Supervisor in Debian or ubuntu
sudo apt-get install supervisor

// Adding configurations
sudo nano /etc/supervisor/conf.d/reportqueue.conf

command=php artisan queue:work --daemon --env=your_environment

Add Configuration to Supervisor

sudo supervisorctl
reread # Tell supervisord to check for new items in /etc/supervisor/conf.d/
add reportqueue       # Add reportqueue process to Supervisord
start reportqueue     # Let's Rock

Check Supervisor

// In Console
ps aux | grep php

# You should see some output similarish this:
php artisan queue:work --daemon --env=your_environment
sh -c php artisan queue:work  --queue="default" --delay=0 --memory=128 --sleep --env=your_environment
php artisan queue:work --queue=default --delay=0 --memory=128 --sleep --env=your_environment

Sunday, April 21, 2019

Setting Vagrant with VHOST

1. Install Vagrant in this article.

2. Log to your Vagrant from directory projects with Vagrantfile.
  •  vagrant ssh
3. From your Vagrant server type: 
  • sudo nano /etc/apache2/apache2.conf
4. Add this text in apache2.conf

<Directory /home/vagrant/public_html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

Directory /home/vagrant/public_html/ : I put my vagrant directory sync in this path. If you use /var/www/ you can skip this step.

5. From your Vagrant server go to: 
  • cd /etc/apache2/sites-available/
6. Create vhost file for example: sample.conf

7. In sample.conf create this configuration:

<VirtualHost *:80>
        ServerName sample.notcom

        ServerAdmin webmaster@localhost
        DocumentRoot /home/vagrant/public_html/php/sample

        ErrorLog ${APACHE_LOG_DIR}/error-sample.log
        CustomLog ${APACHE_LOG_DIR}/access-sample.log combined

ServerName: Use this to access app from browser.
DocumentRoot: path to your sync projects registered in Vagrantfile
ErrorLog and CustomLog: Log Apache2

8. Register sample.conf to sites-enabled
  • sudo a2ensite sample.conf

9. Restart your apache
  • sudo service apache2 restart
10. Access your app using:
  • sample.notcom
  • IP registered in Vagrantfile. "private_network", ip: ""
  • If, it's still not works use registered PORT in Vagrantfile:
11. Remember that you need to install some PHP extensions, PHPMYADMIN, composer, etc in your Vagrant server environment.

Thursday, April 11, 2019

Linkedin Gem: LinkedIn OAuth 2.0 add_share Error

LinkedIn OAuth 2.0 is Rails Gems to integrate Linked Social Media to our Apps through API. This Gem is easy to integrated and use, we can directly GET and POST data from  Linkedin.

But, theres a problem when using add_share API using  documentations. api.add_share(content: "hi") will always generated error.

I've search, read Linkedin documentation, and customize the library but it always generated error. After a few times I found that doing a little change in add_share comments it will works. 

Changes the command into: 
api.add_share(comment: "hi")
Voila, it works... :D

Tuesday, April 9, 2019

Use arsduo/koala in Rails for Facebook Connect

 Koala is a Facebook library for Ruby, supporting the Graph API (including the batch requests and photo uploads), the REST API, realtime updates, test users, and OAuth validation.


In Gemfile:
gem "koala", "~> 2.0"
gem 'oauth', '~> 0.4.7'

Never forget to bundle install

Build Callback URL route:
 get '/facebook_callback' => 'facebook#callback', as: :facebook_callback

Facebook Configurations

Get App ID and Secret Key:

  1. Go to
  2. In My Apps, add or go to your New App
  3. Get your App ID and App secret

App Configurations

In config/environments/{{your-environments}}  add this line

  ENV["facebook_app_id"] = "{{your-app-id}}"
  ENV["facebook_secret_key"] = "{{your-secret-id}}"
  ENV["facebook_callback"] = "{{your-facebook-callback}}"


This process will built redirect function to permission page user account in Facebook and return with App Token and App Token Secret. Facebook doesn't recognize localhost with port, if we want to built this connectivity it's better to do it in staging or live servers. Only to get Token and Secret Token Code.
// Connect
facebook_connect ={{your-app-id}},{{your-secret-id}}, {{callback URL}})

// This function will automatically redirecting user to Facebook permission page and redirect it back to your Callback URL
redirect_to facebook_connect.url_for_oauth_code(:permissions => ["publish_actions", "user_posts"])

About Permission can be found in here

In Return Process built this functions

// Get Token Accces Code
code = facebook.get_access_token(params[:code])

// Get Token Access Secret Code
app_code = facebook.get_app_access_token

// Sample of Get my profile from Facebook
client =, {{your -secret-key}})
me = client.get_object("me")

// Save code and app_code to database. This tokens needed for REST API Process

REST API From Facebook Get Status, Profile,etc

Get Status and Profile

// Connect
client ={{ Token Accces }}, {{Token Access Secret}} )
// Get Profile and Feed/Status
facebook_data = client.get_connections("me", "feed", {}, api_version: "v2.0")

Post Status and Comment

// Connect
client ={{ Token Accces }}, {{Token Access Secret}})
// Post Status
post_content = client.put_wall_post(params[:description])


CodeIgniter 3 Released !

Codeigniter 3 has released in March,30 2015. It's available to download in here.

There's a a lot of huge changes from Codeigniter Version 2 to Codeigniter Version 3. Here is some of the changes I take from Codeigniter sites.

  • License
    • CodeIgniter has been relicensed with the MIT License, eliminating its old proprietary licensing.
  • General Changes
    • PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4 and recommends PHP 5.4+ or newer to be used.
    • Changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase).
    • Changed the default database driver to ‘mysqli’ (the old ‘mysql’ driver is DEPRECATED).
    • $_SERVER['CI_ENV'] can now be set to control the ENVIRONMENT constant.
    • Added an optional backtrace to php-error template.
    • Added Android to the list of user agents.
    • Added Windows 7, Windows 8, Windows 8.1, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms.
    • Added Fennec (Firefox for mobile) to the list of mobile user agents.
    • Ability to log certain error types, not all under a threshold.
    • Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
    • Added support for pgp, gpg, zsh and cdr files to mimes.php.
    • Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
    • Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg, wma Audio files to mimes.php.
    • Added support for kmz and kml (Google Earth) files to mimes.php.
    • Added support for ics Calendar files to mimes.php.
    • Added support for rar, jar and 7zip archives to mimes.php.
    • Updated support for xml (‘application/xml’) and xsl (‘application/xml’, ‘text/xsl’) files in mimes.php.
    • Updated support for doc files in mimes.php.
    • Updated support for docx files in mimes.php.
    • Updated support for php files in mimes.php.
    • Updated support for zip files in mimes.php.
    • Updated support for csv files in mimes.php.
    • Added Romanian, Greek, Vietnamese and Cyrilic characters in application/config/foreign_characters.php.
    • Changed logger to only chmod when file is first created.
    • Removed previously deprecated SHA1 Library.
    • Removed previously deprecated use of $autoload['core'] in application/config/autoload.php. Only entries in$autoload['libraries'] are auto-loaded now.
    • Removed previously deprecated EXT constant.
    • Updated all classes to be written in PHP 5 style, with visibility declarations and no var usage for properties.
    • Added an Exception handler.
    • Moved error templates to application/views/errors/ and made the path configurable via $config['error_views_path'].
    • Added support non-HTML error templates for CLI applications.
    • Moved the Log class to application/core/
    • Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment.
    • Changed detection of $view_folder so that if it’s not found in the current path, it will now also be searched for under the application folder.
    • Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths.
    • Updated email validation methods to use filter_var() instead of PCRE.
    • Changed environment defaults to report all errors in development and only fatal ones in testingproduction but only display them in development.
    • Updated ip_address database field lengths from 16 to 45 for supporting IPv6 address on Trackback Library and Captcha Helper.
    • Removed cheatsheets and quick_reference PDFs from the documentation.
    • Added availability checks where usage of dangerous functions like eval() and exec() is required.
    • Added support for changing the file extension of log files using $config['log_file_extension'].
    • Added support for turning newline standardization on/off via $config['standardize_newlines'] and set it to FALSE by default.
    • Added configuration setting $config['composer_autoload'] to enable loading of a Composer auto-loader.
    • Removed the automatic conversion of ‘programmatic characters’ to HTML entities from the URI Library.
    • Changed log messages that say a class or file was loaded to “info” level instead of “debug”, so that they don’t pollute log files when $config['log_threshold'] is set to 2 (debug).
  • Helpers
    • Date Helper changes include:
      • Added an optional third parameter to timespan() that constrains the number of time units displayed.
      • Added an optional parameter to timezone_menu() that allows more attributes to be added to the generated select tag.
      • Added function date_range() that generates a list of dates between a specified period.
      • Deprecated standard_date(), which now just uses the native date() with DateTime constants.
      • Changed now() to work with all timezone strings supported by PHP.
      • Changed days_in_month() to use the native cal_days_in_month() PHP function, if available.
    • URL Helper changes include:
      • Deprecated separator options dash and underscore for function url_title() (they are only aliases for ‘-‘ and ‘_’ respectively).
      • url_title() will now trim extra dashes from beginning and end.
      • anchor_popup() will now fill the href attribute with the URL and its JS code will return FALSE instead.
      • Added JS window name support to the anchor_popup() function.
      • Added support for menubar attribute to the anchor_popup().
      • Added support (auto-detection) for HTTP/1.1 response codes 303, 307 in redirect().
      • Changed redirect() to choose the refresh method only on IIS servers, instead of all servers on Windows (when auto is used).
      • Changed anchor()anchor_popup(), and redirect() to support protocol-relative URLs (e.g. //
    • HTML Helper changes include:
      • Added more doctypes.
      • Changed application and environment config files to be loaded in a cascade-like manner.
      • Changed doctype() to cache and only load once the doctypes array.
      • Deprecated functions nbs() and br(), which are just aliases for the native str_repeat() with &nbsp; and <br />respectively.
    • Inflector Helper changes include:
    • Download Helper changes include:
      • Added an optional third parameter to force_download() that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
      • Added a work-around in force_download() for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
      • Added support for reading from an existing file path by passing NULL as the second parameter to force_download()(useful for large files and/or safely transmitting binary data).
    • Form Helper changes include:
    • Security Helper changes include:
    • Smiley Helper changes include:
      • Deprecated the whole helper as too specific for CodeIgniter.
      • Removed previously deprecated function js_insert_smiley().
      • Changed application and environment config files to be loaded in a cascade-like manner.
      • The smileys array is now cached and loaded only once.
    • File Helper changes include:
      • set_realpath() can now also handle file paths as opposed to just directories.
      • Added an optional paramater to delete_files() to enable it to skip deleting files such as .htaccess and index.html.
      • Deprecated function read_file() - it’s just an alias for PHP’s native file_get_contents().
    • String Helper changes include:
      • Deprecated function repeater() - it’s just an alias for PHP’s native str_repeat().
      • Deprecated function trim_slashes() - it’s just an alias for PHP’s native trim() (with a slash as its second argument).
      • Deprecated randomization type options unique and encrypt for funcion random_string() (they are only aliases formd5 and sha1 respectively).
    • CAPTCHA Helper changes include:
      • Added word_length and pool options to allow customization of the generated word.
      • Added colors configuration to allow customization for the backgroundbordertext and grid colors.
      • Added filename to the returned array elements.
      • Updated to use imagepng() in case that imagejpeg() isn’t available.
      • Added font_size option to allow customization of font size.
      • Added img_id option to set id attribute of captcha image.
    • Text Helper changes include:
    • Directory Helper directory_map() will now append DIRECTORY_SEPARATOR to directory names in the returned array.
    • Array Helper element() and elements() now return NULL instead of FALSE when the required elements don’t exist.
    • Language Helper lang() now accepts an optional list of additional HTML attributes.
    • Deprecated the Email Helper as its valid_email()send_email() functions are now only aliases for PHP native functionsfilter_var() and mail() respectively.
  • Database
    • DEPRECATED the ‘mysql’, ‘sqlite’, ‘mssql’ and ‘pdo/dblib’ (also known as ‘pdo/mssql’ or ‘pdo/sybase’) drivers.
    • Added dsn configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID).
    • Added schema configuration setting (defaults to public) for drivers that might need it (currently used by PostgreSQL and ODBC).
    • Added save_queries configuration setting to application/config/database.php (defaults to TRUE).
    • Removed autoinit configuration setting as it doesn’t make sense to instantiate the database class but not connect to the database.
    • Added subdrivers support (currently only used by PDO).
    • Added an optional database name parameter to db_select().
    • Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
    • Renamed internal method _escape_identifiers() to escape_identifiers().
    • Updated escape_identifiers() to accept an array of fields as well as strings.
    • MySQL and MySQLi drivers now require at least MySQL version 5.1.
    • Added a $persistent parameter to db_connect() and changed db_pconnect() to be an alias for db_connect(TRUE).
    • db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1).
    • db_select() will now always (if required by the driver) be called by db_connect() instead of only when initializing.
    • Replaced the _error_message() and _error_number() methods with error(), which returns an array containing the last database error code and message.
    • Improved version() implementation so that drivers that have a native function to get the version number don’t have to be defined in the core DB_driver class.
    • Added capability for packages to hold config/database.php config files.
    • Added MySQL client compression support.
    • Added encrypted connections support (for mysqlsqlsrv and PDO with sqlsrv).
    • Removed Loader Class from Database error tracing to better find the likely culprit.
    • Added support for SQLite3 database driver.
    • Added Interbase/Firebird database support via the ibase driver.
    • Added ODBC support for create_database()drop_database() and drop_table() in Database Forge.
    • Added support to binding arrays as IN() sets in query().
    • Query Builder changes include:
      • Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern.
      • Added the ability to insert objects with insert_batch().
      • Added new methods that return the SQL string of queries without executing them: get_compiled_select(),get_compiled_insert()get_compiled_update()get_compiled_delete().
      • Added an optional parameter that allows to disable escaping (useful for custom fields) for methods join(),order_by()where_in()or_where_in()where_not_in()or_where_not_in()insert()insert_batch().
      • Added support for join() with multiple conditions.
      • Added support for USING in join().
      • Added support for EXISTS in where().
      • Added seed values support for random ordering with order_by(seed, 'RANDOM').
      • Changed limit() to ignore NULL values instead of always casting to integer.
      • Changed offset() to ignore empty values instead of always casting to integer.
      • Methods insert_batch() and update_batch() now return an integer representing the number of rows affected by them.
      • Methods where()or_where()having() and or_having() now convert trailing = and <>!= SQL operators toIS NULL and IS NOT NULL respectively when the supplied comparison value is NULL.
      • Added method chaining support to reset_query()start_cache()stop_cache() and flush_cache().
      • Added an optional second parameter to count_all_results() to disable resetting of QB values.
    • Database Results changes include:
      • Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the baseDB_driver class to allow better abstraction.
      • Added method unbuffered_row() for fetching a row without prefetching the whole result (consume less memory).
      • Renamed former method _data_seek() to data_seek() and made it public.
    • Improved support for the MySQLi driver, including:
      • OOP style usage of the PHP extension is now used, instead of the procedural aliases.
      • Server version checking is now done via mysqli::$server_info instead of running an SQL query.
      • Added persistent connections support for PHP >= 5.3.
      • Added support for configuring socket pipe connections.
      • Added support for backup() in Database Utilities.
      • Changed methods trans_begin()trans_commit() and trans_rollback() to use the PHP API instead of sending queries.
    • Improved support of the PDO driver, including:
      • Added support for create_database()drop_database() and drop_table() in Database Forge.
      • Added support for list_fields() in Database Results.
      • Subdrivers are now isolated from each other instead of being in one large class.
    • Improved support of the PostgreSQL driver, including:
      • pg_version() is now used to get the database version number, when possible.
      • Added db_set_charset() support.
      • Added support for optimize_table() in Database Utilities (rebuilds table indexes).
      • Added boolean data type support in escape().
      • Added update_batch() support.
      • Removed limit() and order_by() support for UPDATE and DELETE queries as PostgreSQL does not support those features.
      • Added a work-around for dead persistent connections to be re-created after a database restart.
      • Changed db_connect() to include the (new) schema value into Postgre’s search_path session variable.
      • pg_escape_literal() is now used for escaping strings, if available.
    • Improved support of the CUBRID driver, including:
      • Added DSN string support.
      • Added persistent connections support.
      • Improved list_databases() in Database Utility (until now only the currently used database was returned).
    • Improved support of the MSSQL and SQLSRV drivers, including:
      • Added random ordering support.
      • Added support for optimize_table() in Database Utility.
      • Added escaping with QUOTE_IDENTIFIER setting detection.
      • Added port handling support for UNIX-based systems (MSSQL driver).
      • Added OFFSET support for SQL Server 2005 and above.
      • Added db_set_charset() support (MSSQL driver).
      • Added a scrollable property to enable configuration of the cursor to use (SQLSRV driver).
      • Added support and auto-detection for the SQLSRV_CURSOR_CLIENT_BUFFERED scrollable cursor flag (SQLSRV driver).
      • Changed default behavior to not use SQLSRV_CURSOR_STATIC due to performance issues (SQLSRV driver).
    • Improved support of the Oracle (OCI8) driver, including:
      • Added DSN string support (Easy Connect and TNS).
      • Added support for drop_table() in Database Forge.
      • Added support for list_databases() in Database Utilities.
      • Generally improved for speed and cleaned up all of its components.
      • num_rows() is now only called explicitly by the developer and no longer re-executes statements.
    • Improved support of the SQLite driver, including:
    • Database Forge changes include:
      • Added an optional second parameter to drop_table() that allows adding the IF EXISTS condition, which is no longer the default.
      • Added support for passing a custom database object to the loader.
      • Added support for passing custom table attributes (such as ENGINE for MySQL) to create_table().
      • Added support for usage of the FIRST clause in add_column() for MySQL and CUBRID.
      • Added partial support for field comments (MySQL, PostgreSQL, Oracle).
      • Deprecated add_column()‘s third method. AFTER clause should now be added to the field definition array instead.
      • Overall improved support for all of the drivers.
    • Database Utility changes include:
      • Added support for passing a custom database object to the loader.
      • Modified the class to no longer extend Database Forge, which has been a deprecated behavior for awhile.
      • Overall improved support for all of the drivers.
      • Added foreign_key_checks option to MySQL/MySQLi backup, allowing statement to disable/re-enable foreign key checks to be inserted into the backup output.
  • Libraries
    • Added a new Encryption Library to replace the old, largely insecure Encrypt Library.
    • Encrypt Library changes include:
      • Deprecated the library in favor of the new Encryption Library.
      • Added support for hashing algorithms other than SHA1 and MD5.
      • Removed previously deprecated sha1() method.
    • Session Library changes include:
      • Completely re-written the library to use self-contained drivers via $config['sess_driver'].
      • Added ‘files’, ‘database’, ‘redis’ and ‘memcached’ drivers (using ‘files’ by default).
      • Added $config['sess_save_path'] setting to specify where the session data is stored, depending on the driver.
      • Dropped support for storing session data in cookies (which renders $config['sess_encrypt_cookie'] useless and is therefore also removed).
      • Dropped official support for storing session data in databases other than MySQL and PostgreSQL.
      • Changed table structure for the ‘database’ driver.
      • Added a new tempdata feature that allows setting userdata items with expiration time (mark_as_temp()tempdata(),set_tempdata()unset_tempdata()).
      • Changed method keep_flashdata() to also accept an array of keys.
      • Changed methods userdata()flashdata() to return an array of all userdata/flashdata when no parameter is passed.
      • Deprecated method all_userdata() - it is now just an alias for userdata() with no parameters.
      • Added method has_userdata() that verifies the existence of a userdata item.
      • Added debug level log messages for key events in the session validation process.
      • Dropped support for the sess_match_useragent option.
    • File Uploading Library changes include:
      • Added method chaining support.
      • Added support for using array notation in file field names.
      • Added max_filename_increment and file_ext_tolower configuration settings.
      • Added min_width and min_height configuration settings for images.
      • Added mod_mime_fix configuration setting to disable suffixing multiple file extensions with an underscore.
      • Added the possibility pass allowed_types as an array.
      • Added an $index parameter to the method data().
      • Added a $reset parameter to method initialize().
      • Removed method clean_file_name() and its usage in favor of Security Library‘s sanitize_filename().
      • Removed method mimes_types().
      • Changed CI_Upload::_prep_filename() to simply replace all (but the last) dots in the filename with underscores, instead of suffixing them.
    • Calendar Library changes include:
      • Added method chaining support.
      • Added configuration to generate days of other months instead of blank cells.
      • Added auto-configuration for next_prev_url if it is empty and show_prev_next is set to TRUE.
      • Added support for templating via an array in addition to the encoded string.
      • Changed method get_total_days() to be an alias for Date Helper days_in_month().
    • Cart Library changes include:
      • Deprecated the library as too specific for CodeIgniter.
      • Added method remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility.
      • Added method get_item() to enable retrieving data for a single cart item.
      • Added unicode support for product names.
      • Added support for disabling product name strictness via the $product_name_safe property.
      • Changed insert() method to auto-increment quantity for an item when inserted twice instead of resetting it.
      • Changed update() method to support updating all properties attached to an item and not to require ‘qty’.
    • Image Manipulation Library changes include:
      • The initialize() method now only sets existing class properties.
      • Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
      • Class properties wm_font_colorwm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking thetext_watermark() method if they are set manually after initialization.
      • If property maintain_ratio is set to TRUE, image_reproportion() now doesn’t need both width and height to be specified.
      • Property maintain_ratio is now taken into account when resizing images using ImageMagick library.
      • Added support for maintaining transparency for PNG images when watermarking.
      • Added a file_permissions setting.
    • Form Validation Library changes include:
      • Added method error_array() to return all error messages as an array.
      • Added method set_data() to set an alternative data array to be validated instead of the default $_POST.
      • Added method reset_validation() which resets internal validation variables in case of multiple validation routines.
      • Added support for setting error delimiters in the config file via $config['error_prefix'] and $config['error_suffix'].
      • Internal method _execute() now considers input data to be invalid if a specified rule is not found.
      • Removed method is_numeric() as it exists as a native PHP function and _execute() will find and use that (theis_numeric rule itself is deprecated since 1.6.1).
      • Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
      • Updated method set_rules() to accept an array of rules as well as a string.
      • Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous).
      • Added rule differs to check if the value of a field differs from the value of another field.
      • Added rule valid_url.
      • Added rule in_list to check if the value of a field is within a given list.
      • Added support for named parameters in error messages.
      • Language line keys must now be prefixed with form_validation_.
      • Added rule alpha_numeric_spaces.
      • Added support for custom error messages per field rule.
      • Added support for callable rules when they are passed as an array.
      • Added support for non-ASCII domains in valid_email rule, depending on the Intl extension.
      • Changed the debug message about an error message not being set to include the rule name it is about.
    • Caching Library changes include:
      • Added Wincache driver.
      • Added Redis driver.
      • Added a key_prefix option for cache IDs.
      • Updated driver is_supported() methods to log at the “debug” level.
      • Added option to store raw values instead of CI-formatted ones (APC, Memcache).
      • Added atomic increment/decrement feature via increment()decrement().
    • E-mail Library changes include:
      • Added a custom filename parameter to attach() as $this->email->attach($filename, $disposition, $newname).
      • Added possibility to send attachment as buffer string in attach() as$this->email->attach($buffer, $disposition, $newname, $mime).
      • Added possibility to attach remote files by passing a URL.
      • Added method attachment_cid() to enable embedding inline attachments into HTML.
      • Added dsn (delivery status notification) option.
      • Renamed method _set_header() to set_header() and made it public to enable adding custom headers.
      • Successfully sent emails will automatically clear the parameters.
      • Added a return_path parameter to the from() method.
      • Removed the second parameter (character limit) from internal method _prep_quoted_printable() as it is never used.
      • Internal method _prep_quoted_printable() will now utilize the native quoted_printable_encode()imap_8bit()functions (if available) when CRLF is set to “rn”.
      • Default charset now relies on the global $config['charset'] setting.
      • Removed unused protected method _get_ip() (Input Library‘s ip_address() should be used anyway).
      • Internal method _prep_q_encoding() now utilizes PHP’s mbstring and iconv extensions (when available) and no longer has a second ($from) argument.
      • Added an optional parameter to print_debugger() to allow specifying which parts of the message should be printed (‘headers’, ‘subject’, ‘body’).
      • Added SMTP keepalive option to avoid opening the connection for each send() call. Accessible as $smtp_keepalive.
      • Public method set_header() now filters the input by removing all “\r” and “\n” characters.
      • Added support for non-ASCII domains in valid_email(), depending on the Intl extension.
    • Pagination Library changes include:
      • Deprecated usage of the “anchor_class” setting (use the new “attributes” setting instead).
      • Added method chaining support to initialize() method.
      • Added support for the anchor “rel” attribute.
      • Added support for setting custom attributes.
      • Added support for language translations of the first_linknext_linkprev_link and last_link values.
      • Added support for $config['num_links'] = 0 configuration.
      • Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
      • Added $config['use_global_url_suffix'] to allow overriding the library ‘suffix’ value with that of the global$config['url_suffix'] setting.
      • Removed the default &nbsp; from a number of the configuration variables.
    • Profiler Library changes include:
      • Database object names are now being displayed.
      • The sum of all queries running times in seconds is now being displayed.
      • Added support for displaying the HTTP DNT (“Do Not Track”) header.
      • Added support for displaying $_FILES.
    • Migration Library changes include:
      • Added support for timestamp-based migrations (enabled by default).
      • Added $config['migration_type'] to allow switching between sequential and timestamp migrations.
    • XML-RPC Library changes include:
      • Added the ability to use a proxy.
      • Added Basic HTTP authentication support.
    • User Agent Library changes include:
      • Added check to detect if robots are pretending to be mobile clients (helps with e.g. Google indexing mobile website versions).
      • Added method parse() to allow parsing a custom user-agent string, different from the current visitor’s.
    • HTML Table Library changes include:
      • Added method chaining support.
      • Added support for setting table class defaults in a config file.
    • Zip Library changes include:
      • Method read_file() can now also alter the original file path/name while adding files to an archive.
      • Added support for changing the compression level.
    • Trackback Library method receive() will now utilize iconv() if it is available but mb_convert_encoding() is not.
  • Core
    • Routing changes include:
      • Added support for multiple levels of controller directories.
      • Added support for per-directory default_controller and 404_override classes.
      • Added possibility to route requests using HTTP verbs.
      • Added possibility to route requests using callbacks.
      • Added a new reserved route (translate_uri_dashes) to allow usage of dashes in the controller and method URI segments.
      • Deprecated methods fetch_directory()fetch_class() and fetch_method() in favor of their respective public properties.
      • Removed method _set_overrides() and moved its logic to the class constructor.
    • URI Library changes include:
      • Added conditional PCRE UTF-8 support to the “invalid URI characters” check and removed the preg_quote() call from it to allow more flexibility.
      • Renamed method _filter_uri() to filter_uri().
      • Changed method filter_uri() to accept by reference and removed its return value.
      • Changed private methods to protected so that MY_URI can override them.
      • Renamed internal method _parse_cli_args() to _parse_argv().
      • Renamed internal method _detect_uri() to _parse_request_uri().
      • Changed _parse_request_uri() to accept absolute URIs for compatibility with HTTP/1.1 as per RFC2616 <>.
      • Added protected method _parse_query_string() to URI paths in the the QUERY_STRING value, like_parse_request_uri() does.
      • Changed URI string detection logic to always default to REQUEST_URI unless configured otherwise or under CLI.
      • Removed methods _remove_url_suffix()_explode_segments() and moved their logic into _set_uri_string().
      • Removed method _fetch_uri_string() and moved its logic into the class constructor.
      • Removed method _reindex_segments().
    • Loader Library changes include:
      • Added method chaining support.
      • Added method get_vars() to the Loader to retrieve all variables loaded with $this->load->vars().
      • _ci_autoloader() is now a protected method.
      • Added autoloading of drivers with $autoload['drivers'].
      • $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as <?= will always be available.
      • Changed method config() to return whatever CI_Config::load() returns instead of always being void.
      • Added support for library and model aliasing on autoload.
      • Changed method is_loaded() to ask for the (case sensitive) library name instead of its instance name.
      • Removed $_base_classes property and unified all class data in $_ci_classes instead.
      • Added method clear_vars() to allow clearing the cached variables for views.
    • Input Library changes include:
      • Deprecated the $config['global_xss_filtering'] setting.
      • Added method() to retrieve $_SERVER['REQUEST_METHOD'].
      • Added support for arrays and network addresses (e.g. for use with the proxy_ips setting.
      • Added method input_stream() to aid in using php://input stream data such as one passed via PUT, DELETE and PATCH requests.
      • Changed method valid_ip() to use PHP’s native filter_var() function.
      • Changed internal method _sanitize_globals() to skip enforcing reversal of register_globals in PHP 5.4+, where this functionality no longer exists.
      • Changed methods get()post()get_post()cookie()server()user_agent() to return NULL instead of FALSE when no value is found.
      • Changed default value of the $xss_clean parameter to NULL for all methods that utilize it, the default value is now determined by the $config['global_xss_filtering'] setting.
      • Added method post_get() and changed get_post() to search in GET data first. Both methods’ names now properly match their GET/POST data search priorities.
      • Changed method _fetch_from_array() to parse array notation in field name.
      • Changed method _fetch_from_array() to allow retrieving multiple fields at once.
      • Added an option for _clean_input_keys() to return FALSE instead of terminating the whole script.
      • Deprecated the is_cli_request() method, it is now an alias for the new is_cli() common function.
      • Added an $xss_clean parameter to method user_agent() and removed the $user_agent property.
      • Added property $raw_input_stream to access php://input data.
    • Common functions changes include:
      • Added function get_mimes() to return the application/config/mimes.php array.
      • Added support for HTTP code 303 (“See Other”) in set_status_header().
      • Removed redundant conditional to determine HTTP server protocol in set_status_header().
      • Renamed _exception_handler() to _error_handler() and replaced it with a real exception handler.
      • Changed _error_handler() to respect php.ini display_errors setting.
      • Added function is_https() to check if a secure connection is used.
      • Added function is_cli() to replace the CI_Input::is_cli_request() method.
      • Added function function_usable() to work around a bug in Suhosin <>.
      • Removed the third ($php_error) argument from function log_message().
      • Changed internal function load_class() to accept a constructor parameter instead of (previously unused) class name prefix.
      • Removed default parameter value of is_php().
      • Added a second argument $double_encode to html_escape().
      • Changed function config_item() to return NULL instead of FALSE when no value is found.
      • Changed function set_status_header() to return immediately when run under CLI.
    • Output Library changes include:
      • Added a second argument to method set_content_type() that allows setting the document charset as well.
      • Added methods get_content_type() and get_header().
      • Added method delete_cache().
      • Added configuration option $config['cache_query_string'] to enable taking the query string into account when caching.
      • Changed caching behavior to compress the output before storing it, if $config['compress_output'] is enabled.
    • Config Library changes include:
      • Changed site_url() method to accept an array as well.
      • Removed internal method _assign_to_config() and moved its implementation to CodeIgniter.php instead.
      • item() now returns NULL instead of FALSE when the required config item doesn’t exist.
      • Added an optional second parameter to both base_url() and site_url() that allows enforcing of a protocol different than the one in the base_url configuration setting.
      • Added HTTP “Host” header character validation to prevent cache poisoning attacks when base_url auto-detection is used.
    • Security Library changes include:
      • Added $config['csrf_regeneration'], which makes CSRF token regeneration optional.
      • Added $config['csrf_exclude_uris'], allowing for exclusion of URIs from the CSRF protection (regular expressions are supported).
      • Added method strip_image_tags().
      • Added method get_random_bytes() and switched CSRF & XSS token generation to use it.
      • Modified method sanitize_filename() to read a public $filename_bad_chars property for getting the invalid characters list.
      • Return status code of 403 instead of a 500 if CSRF protection is enabled but a token is missing from a request.
    • Language Library changes include:
      • Changed method load() to filter the language name with ctype_alpha().
      • Changed method load() to also accept an array of language files.
      • Added an optional second parameter to method line() to disable error logging for line keys that were not found.
      • Language files are now loaded in a cascading style with the one in system/ always loaded and overridden afterwards, if another one is found.
    • Hooks Library changes include:
      • Added support for closure hooks (or anything that is_callable() returns TRUE for).
      • Renamed method _call_hook() to call_hook().
      • Class instances are now stored in order to maintain their state.
    • UTF-8 Library changes include:
      • UTF8_ENABLED now requires only one of Multibyte String or iconv to be available instead of both.
      • Changed method clean_string() to utilize mb_convert_encoding() if it is available.
      • Renamed method _is_ascii() to is_ascii() and made it public.
    • Log Library changes include:
      • Added a $config['log_file_permissions'] setting.
      • Changed the library constructor to try to create the log_path directory if it doesn’t exist.
      • Added support for microseconds (“u” date format character) in $config['log_date_format'].
    • Added compatibility layers <general/compatibility_functions> for:
      • Multibyte String (limited support).
      • Hash (hash_equals()hash_pbkdf2()).
      • Password Hashing.
      • Standard Functions ``array_column()`array_replace()array_replace_recursive()hex2bin(),quoted_printable_encode().
    • Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
    • Added support for HTTP-Only cookies with new config option cookie_httponly (default FALSE).
    • $config['time_reference'] now supports all timezone strings supported by PHP.
    • Fatal PHP errors are now also passed to _error_handler(), so they can be logged.