How to post JSON data from Android to PHP Codeigniter

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. This article explains how to client-server web service communication using Android and PHP, we will use JSON as the data.

We will build a simple calculator web service that has features such as add and multiply.

apikey represent key to access the webservice, the server will reject the request if the key is invalid, in this article we use “mykey123”
command represent what command request we want to use, in this article we use “add” or “multiply”
a and b represent input value we want to calculate Continue reading “How to post JSON data from Android to PHP Codeigniter”

Enable PHP display_error on MAMP 2.0.5

By default display_error on MAMP 2.0.5 is off, in my opinion it would be useful for me to turn it on for development phase of my application. This is how to enable display_error

  1. Find MAMP directory under Application Directory
  2. Go to MAMP\bin\php\
  3. Open PHP folder that you are using
  4. Then open \bin\conf\php.ini under your PHP folder
  5. Find error_reporting line, and make sure as “error_reporting = E_ALL
  6. Find display_errors = Off, and change it to display_errors = On
  7. Save then restart your MAMP
  8. Done

Run web.py as a service in linux

web.py is a web framework for Python that is as simple as it is powerful. web.py is in the public domain; you can use it for whatever purpose with absolutely no restrictions.

I was building a simple application with this library and need this run as a background service.

python /opt/server.py 8080 2>/dev/null &

Mac OS X Terminal Color

I was using linux ubuntu for my work now I’m using Mac OS X 10.7.3, I was surprised when I did ls command, the ls result returned had the same color for files and folders. Fortunately there is a trick to set ls command with colors.

Create or edit this file

~/.bash_profile

Then insert this inside it

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

Save it, now open your new terminal instance.