Blogs

Multi-User Web Phonebook

File hierarchy in Netbeans IDE
PHP Tutorial Hello World Application

Entity-Relationship Diagram
ERD Diagram Multi-User PhoneBook

 

phonebook.sql
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- Database: `phonebookDB`

CREATE TABLE IF NOT EXISTS `account` (
  `user_name` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  PRIMARY KEY (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


CREATE TABLE IF NOT EXISTS `profile` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `address` varchar(100) NOT NULL,
  `phone_number` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_name` (`user_name`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

ALTER TABLE `profile`
  ADD CONSTRAINT `profile_ibfk_1` FOREIGN KEY (`user_name`) REFERENCES `account` (`user_name`) ON DELETE CASCADE ON UPDATE CASCADE;
AddProfile.php
<?php
   session_start();

   include_once('../Bean/Profile.php');
   include_once('../DB/ProfileConn.php');

    if( isset($_SESSION['userName'])){
        $userName = $_SESSION['userName'];
        $name = $_POST['name'];
        $address = $_POST['address'];
        $phoneNumber = $_POST['phoneNumber'];
        //id set to zero since it is not used
        $profile = new Profile(0, $userName, $name, $address, $phoneNumber);
        $conn = new ProfileConn();
        $conn->Add($profile);
        header( 'Location: DisplayProfile.php' );
        
    } else{
        header( 'Location: ../index.html' ) ;   
    } 
?>

Module 9: Private Issues

Tagged:  

Q. Talking about privacy, how far would you go for the sake of social justice?

In publicly available digital or computer services, privacy policy should be presented to its clients. The privacy policy should be clear and agreed before using the services. The privacy policy should include how the owner of the service used the information provided its customers.

For example, in a website, their should be a note on privacy on how the visitors is being track on its visits and the intended purpose of the information gathered.

Module 10: Social Justice Issues

Tagged:  

Q. Is social justice evident in the impeachment trial of Chief Justice Corona?

"Salus Populi est suprema lex" - Welfare of the people is the supreme law.

Social justice means the promotion of the welfare of the people. Government must maintain proper economic and social stability that will promote social justice.

The main issue on the impeachment trial of Chief Justice Renato Corona is corruption. He used his legislated powers for illegitimate private gain which apparent on his properties. The impeachment trial is about corruption, about social justice.

Module 8: Computer Abuses

Tagged:  

Q. What computer abuse would you like to eradicate? How would you do it?

I really hate spam. Receiving unwanted or junk e-mails is annoying for me. The issue on this is not the content of the e-mail but the consent.

Im currently using e-mail services from google (Gmail) and yahoo (Yahoo! Mail). They both have spam filters but I'm still receiving lot of unsolicited e-mail.

I want to be part of the solution to this kind of computer abuse. What I gonna do is to study and implement existing machine learning algorithms that are used in spam filtering. And the last and never ends ambitious thing to do is to improve those existing algorithms.

Module 7: Computer Hoax Categories

Tagged:  

Q. There are still enormous sources of misinformation on the world wide web, so how can you determine what is good information and what is bad information?

Internet nowadays is the most common and widely used source of information. A lot of students rely from it over the traditional libraries. We can get information from web logs, online journals, news, wiki, forums and social networking sites. Relying unchecked information from this emerging web technologies is somewhat dangerous.

Anyone who have internet access can tweet, update their Facebook status, send email, post web logs and update wiki pages. These the most common sources of bad information like urban legends because it can be spread rapidly by just one mouse click. Before we spread this kind of information, we have to do a simple research. We can use search engines to check the root of the information and its validity.

Module 5: Moral Problems

Tagged:  

Q. Today, it is a fact that a lot of Filipino women are into online GOLD digging. You know what it means, right? Suppose one of them is your sister who happens to be your family's breadwinner. What would you do on this matter?

If my sister happen to be engage in a relationship having interest only for material benefits, I have to talk to her. I will advice her to stop what she is doing and look for another source of income, even she is our breadwinner. She can make money online in many ways other than selling herself. She can work remotely as virtual assistant, or she can make money in blogging.

Battle

Struggle even its hard,
Light and start from your heart,
Continue fighting
Even not for winning.

A battle against people
With greedy mind and dark soul,
In a long run will be successful.
That one, I can assure.

Module 6: Computer Ethics

Tagged:  

Q. If you are to choose your top 3 difficult-to-follow computer ethics commandments, what are these?

If I'm going to rearrange the "Ten Commandments for Computer Ethics" according to the most difficult-to-follow, the following will be the top three commandments:

  1. Thou shalt not use or copy software for which you have not paid.
    I'm practicing this before. I learned a lot from a pirated software. But it's almost three years since I used and spread the good news about Free and Open Source Software.
  2. Thou shalt not snoop around in other people's files.
    My curiosity will sometimes break this commandment.
  3. Thou shalt not appropriate other people's intellectual output.
    I sometimes forget to give credit to original idea or work of others specially in a slide presentation for some reporting activities. But right now, a lot of work are licensed under CreativeCommons, so this is not a problem anymore.

Tulay Sa Kahapsay

cellphone photography
@ Matalom Bridge, Matalom, Leyte

Sort Collection in Java

Tagged:  

Example program showing how to sort ArrayList in Java.

 

//SortArrayList.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;


public class SortArrayList {

	public static void main(String[] args){
		//declare generic ArrayList
		ArrayList<Person> list = new ArrayList<Person>();

		//add person to list
		list.add( new Person("Juan", "Cruz", 16) );
		list.add( new Person("Peter", "James", 14) );
		list.add( new Person("James", "Bond", 16) );
		list.add( new Person("JR", "Galia", 20) );
		list.add( new Person("Jack", "Bauer", 11) );

		
		//sort list of Person according to age
		Collections.sort(list, new Comparator<Person>(){
			public int compare(Person p1, Person p2) {
				if( p1.getAge() < p2.getAge() )
					return -1;
				else if( p1.getAge() > p2.getAge() )
					return 1;
				else
					return 0;
			}
		});
		
		
		//display sorted list
		System.out.println("\n\tFirst Name\tLast " +
				"Name\tAge");
		for( Person p: list ){
			System.out.println("\t"+p.getFirstName() +
				"\t\t" + p.getLastName() + "\t\t" 
				+p.getAge());
		}
		
	}
}


Syndicate content