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”

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.

How to autostart service in linux ubuntu

I was creating a program using python for my linux box and I need this program runs every time when the server booting. I was googling how to get this done, some are suggesting to edit the rc.d file then add our line in there. That’s work though, but I found something better, we can manage what service will be started on booting using rcconf.

You will need to install rcconf from repository to get this work,

apt-get install rcconf

Once installed you can use it by entering this command

rcconf

The rcconf will display what service/program that located in /etc/init.d/, mark the service you want to start manually then save it.

That’s it, so simple and easy 🙂

Powershell enable execution of script

By default powershell prevent the user to run a script file (.ps1), in order to enable the execution of script we have to manually enable it.

First check your powershell execution policy

Get-ExecutionPolicy
Restricted

If it shows “Restricted” then you will have to enable it

We can use "Unrestricted" phrase to enable it

Set-ExecutionPolicy Unrestricted

It will prompt confirmation, if you want it to force put "-f" in the command. The command will look like this

Set-ExecutionPolicy Unrestricted -f

Now you can run your scripts on your Powershell.

How to Flush DNS Cache in Windows XP

If you have a domain and set a new nameserver for your domain, your computer will not access the server behind your new nameserver. It’s happened because your computer cached the DNS so when you trying to access your server using the domain, it will always redirected to previous server. The DNS cache  will be updated automatically after period of time, max time for this update is 2 x 24 hours.

To manually flush your DNS cache on Windows XP, you can use this command in command prompt. Open your command prompt by pressing Windows Button + R, then type cmd.

Use this command.

ipconfig /flushdns

XML-RPC on IPhone

Hi, after play along to implement XML-RPC on IPhone finally I made it. I tried googling to find some articles that related to XML-RPC on IPhone, and those article drag me to WordPress application for IPhone. This application using XML RPC to communicate IPhone with the WordPress Blog, so the idea is grab the XML-RPC function from the WP application and implement it on our application. First we need to download WordPress for IPhone source code, you can download it here. Continue reading “XML-RPC on IPhone”

How to connect MySQL in Prado Framework

Hello!

This is my first article tutorial in this blog, today my friend have a problem connecting SQL databases with PRaDO framework. I have used this framework several years ago, and it’s quite easy to make a website with Prado. This time I will write how to connect MySQL with Prado, insert data, and display it in the web page.

First, I’m using XAMPPLITE as webserver, XAMPPLITE is lite version of XAMPP, but if you are using XAMPP it’s ok. Download XAMPP.

After you finish the XAMPP download, continue with download Prado framework. Download Prado.

Install the XAMPP, and extract the prado framework in htdocs folder.

The optional prado-cli.php PHP script file in the framework directory provides command line tools to perform various tedious takes in Prado. The prado-cli.php can be used to create Prado project skeletons, create initial test fixtures, and access to an interactive PHP shell. We will use command line tool to generate our prado project. Continue reading “How to connect MySQL in Prado Framework”