Sunday, October 28, 2012

Phonebook Application with PHP and MySQL CRUD Operation


It is a simple Web-based phonebook application which stores and displays ID, Name, Contact No, and Address of a person. It is also capable of updating/editing and deleting phonebook entries.


CREATE TABLE `phonebook` (
    `name` VARCHAR(50) NOT NULL,
    `phone_no` VARCHAR(15) NOT NULL,
    `address` VARCHAR(50) NOT NULL,
    `date_created DATETIME` NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
    PRIMARY KEY(`id`)

Saturday, October 27, 2012

Least Common Denominator (LCD) in C++

I'm reposting this blog from my old blogsite which I have not been maintaining for long period of time.

A friend of mine asked me to give him code of LCD(Least Common Denominator) program in C++ via text. I Googled and I found the ff. (sorry I forgot the website) code with some modification myself:

#include <iostream>
using namespace std;

int main() {
    int a, b, d, min;

    cout << "Enter first number: ";
    cin >> a;
    cout << "Enter second number: ";
    cin >> b;

    min = a > b ? b : a;

    for(d = 2; d<min; d++) {
        if(((a%d)==0) && ((b%d)==0))
        if(d==min) {
            cout << "No common denominators." << endl;
            return 0;
    cout << "The lowest common denominator is " << d << "." << endl;
    return 0;

I tested this code using Dev-C++ editor with GNU C++ compiler and utilities.

Any suggestions for improvement of above codes are welcome. Thank you.

Tuesday, October 9, 2012

Ubuntu 12.04 LTS Installation

"... Because free software was built in an open way, anyone could contribute to software by looking through the code, finding bugs, and fixing them. Because software ended up being examined by larger numbers of programmers, free software was higher in quality, performed better, and offered more features than similar software developed through proprietary development mechanisms. It turned out that in many situations, the development model behind free software led to software that was inherently better than proprietary alternatives."

- The Official Ubuntu Book Sixth Edition

1. Download Ubuntu 12.04 LTS Desktop from
2. Burn .ISO image of Ubuntu into CD using your burning software (InfraRecorder, Nero).
3. After burning image, insert to you CD drive and reboot your computer.
4. Your computer should boot CD drive in priority. When Ubuntu boots up, click Try Ubuntu as shown below wait until Desktop appears.
5. The following is the default desktop of Ubuntu live CD:

(To be continued ...)

Setting Up PHP and MySQL Development Environment on Windows 7

This is a step by step way of installing Apache Web Server, MySQL database and PHP pre-processor on Windows 7.

What You Need To Know To Get Started

Apache HTTP Server is the famous Web server nowadays. It is available for a wide variety oft operating systems such as UNIX, Linux, Solaris, BSD, Windows, Mac OS, etc. Apache is developed and maintained by open community of developers under the hood of Apache Software Foundation (
 PHP ( is the most popular scripting language on the web. PHP is a server-side language as opposed to JavaScript which runs on client side (user agent, e.g. Web browser). It is embedded into HTML and puts the tools for creating dynamic websites in the hands of the people.  PHP is penetrating Web technology so that a number of websites now are developed with PHP. Originally, it stands for Personal Home Page and was created by Rasmus Lerdorf in 1995. However, the main implementation of PHP is now produced by The PHP Group sponsored by Zend Technologies, the company founded by Zeev Suraski and Andi Gutmans, two Israeli developers at the Technion IIT. They redesigned the parser in 1997 and formed the base of PHP 3; they also changed the language's name to the recursive acronym PHP: Hypertext Preprocessor. PHP is free software released under the PHP License. It as an alternative to other scripting languages or tools such as that of Oracle’s JSP and Microsoft’s ASP.NET.

MySQL ( database server is the world's most popular open-source DBMS. Like Apache and PHP, MySQL is a free software, but under the license of GNU General Public License (GPL).  It is originally owned and sponsored by MySQL AB, a single-profit Swedish company , acquired by Sun Microsystems which in turn was acquired by Oracle Corporation.

First Java Swing GUI

This post is to create a Java Swing GUI. Here, I will create a typical window having title of “First Swing GUI” and size of 300 by 200. The window can be resized into larger or smaller one. It also allows dragging anywhere in your desktop window.  The close operation is EXIT_ON_CLOSE which includes ‘minimize’, ‘maximize’ and ‘close’ buttons.import