Robert Kiyosaki Recommends USANA

October 19, 2011 in Resources by Edwin Deloso

Investor, Entrepreneur, Author, and Educator Robert Kiyosaki – author for best-seller “Rich Dad, Poor Dad” – recommends everyone to take a serious look at the USANA network marketing business as a way to get launched into the “Business Quadrant.”

Click the link to Learn more about usana health sciences

Entrepreneurs can change the world – Grasshopper

October 3, 2011 in HNUCSA News by Edwin Deloso

Do you have a dream? Do you have a notable goal that you want to accomplish, but feel that you are alone and unprepared for it. Many successful people in the world today are just where you are at right now, but they learned to take hold of opportunity when it came to them.

Those who have achieved personal and financial success have learned to NEVER say they could not do something they set their mind to. They found those few bits of information that they needed to be catapulted into success. Maybe, those few bits of information you need, or that opportunity that you have been looking for is here, on our Website. Let us know what you want to do, and we will help you plot out a plan to get there. Opportunity is knocking. Will you open that door? Let’s start making money together and live better – TODAY!

simple demo in creating mobile portal using jquerymobile

August 5, 2011 in Resources by Edwin Deloso



Develop Mobile Portal using jquerymobile

Save this file as index.php or any filename you want in your web server.

<!DOCTYPE html>

<html>

<head>

<title>Submit a form via AJAX Demo</title>

<link rel=”stylesheet” href=”http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css” />

<script src=”http://code.jquery.com/jquery-1.5.2.min.js”></script>

<script src=”http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js”></script>

</head>

<body>

<script>

function onSuccess(data, status)

{

data = $.trim(data);

$(“#notification”).text(data);

}

 

function onError(data, status)

{

// handle an error

}

 

$(document).ready(function() {

$(“#submit”).click(function(){

 

var formData = $(“#callAjaxForm”).serialize();

 

$.ajax({

type: “POST”,

url: “callajax.php”,

cache: false,

data: formData,

success: onSuccess,

error: onError

});

 

return false;

});

});

</script>

 

<!– call ajax page –>

<div data-role=”page” id=”callAjaxPage”>

<div data-role=”header”>

<h1>Develop Mobile Portal using jquerymobile.</h1>


</div>

 

<div data-role=”content”>

<form id=”callAjaxForm”>

<div data-role=”fieldcontain”>

<label for=”firstName”>First Name</label>

<input type=”text” name=”firstName” id=”firstName” value=”"  />

 

<label for=”lastName”>Last Name</label>

<input type=”text” name=”lastName” id=”lastName” value=”"  />

<h3 id=”notification”></h3>

<button data-theme=”b” id=”submit” type=”submit”>Submit</button>

</div>

</form>

</div>

<div data-role=”footer”>

<h1><a href=”http://face.edwindeloso.com”>Learn more tutorials.</a></h1>

</div>

</div>

</body>

</html>


Save this as callajax.php

<?php
$firstName = $_POST[firstName];
$lastName = $_POST[lastName];

echo(“First Name: ” . $firstName . ” Last Name: ” . $lastName);
?>


Now, browse the page using your web server. example http://localhost/index.php

 

 

 

The MVC design pattern approach.

August 1, 2011 in Resources by Edwin Deloso

MVC – Model Viewer Controller.


What is Model? What is Controller? What is Viewer? sounds interesting ?According to wikipedia.org. MVC is a software architecture,[1] currently considered an architectural pattern used in software engineering. The pattern isolates “domain logic” (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns). Truly enough this is good allowing designer to design the page and back end developer to formulate the business logic and the back end processing or the data layer.

In kohana framework, ORM is used. I remember from my previous job that we’re using ORM approach but I was not involved in the that since it was assigned to other member developer.

What is ORM?

Object Relational Mapping (ORM) Library

Object Relational Mapping (ORM) allows manipulation and control of data within a database as though it was a PHP object. Once you define the relationships ORM allows you to pull data from your database, manipulate the data in any way you like and then save the result back to the database without the use of SQL. By creating relationships between models that follow convention over configuration, much of the repetition of writing queries to create, read, update and delete information from the database can be reduced or entirely removed. All of the relationships can be handled automatically by the ORM library and you can access related data as standard object properties.

Here is an example of purely sql statements:

SELECT
  video_info.id,
  product.productID,
  product.productqty,
  product.price,
  video_info.title,
  video_info.film,
  video_info.description,
  video_info.ownerRef,
  video_info.tags,
  video_info.video_type_id,
  video_info.bubble_thumb_url,
  video_info.video_s3_key,
  video_info.IsFromMedia
FROM
  video_info
  INNER JOIN product ON (video_info.id = product.videoId)


and below is the equivalent in ORM approach.
public function getAllProducts()
{
                    	$this->db->from('video_info');
                        $this->db->join	'product','product.videoId',  'video_info.id');

			return $this->;db->get();
}



What’s the difference ? ORM provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

Sample cart model of a shopping cart.


 c) 2011 http://klooma.com
 * @created date : July 26, 2011
 * created function to add product to shopping cart
 * @date modified: July 27, 2011
 * @modifications
 *  1. check product if existing in shopping cart and update it.
 * @date modified : July 29,2011
 *  add function to get cart items
 */



class Cart_Model extends Model {

   //    protected $table_name = 'shoppingcart';
        const TBL_CART = "shoppingcart";

        public function __construct()
        {
            parent::__construct();

        }

	/**
	 * Add item to cart
	 * @return void
	 * @param integer ProductID of product
	 */



	public function add($ProductID){
           	$exists = self::checkProduct($ProductID);
		$data = array(
			'UserID' => '1',  // userid need to get this from user log session
			'ProductID' => $ProductID,
			'Quantity' => '1',
		);

		if($exists==0){
                  	$this->db->insert(self::TBL_CART,$data);

		} else {
                 	$data['Quantity'] = self::getQuantity($ProductID)+1;
			$this->db->update(self::TBL_CART,$data,array('ProductID' => $exists));

		//	print_r($data);
		}
	}

	/**
	 * Return 0 if there is the same product in cart
	 * @param integer ProductID of product
	 */
	public function checkProduct($ProductID){
                $user = 1;// temporary - need to get current user log in the site... soon
		$row = (array) $this->db->select('ProductID')->from(self::TBL_CART)->where('UserID',$user)->where('ProductID',$ProductID)->get()->current();
		if(!empty($row['ProductID'])){
			return $row['ProductID'];
		} else {
			return 0;
		}
	}



	/**
	 * Return quantity of item
	 * @return integer quantity
	 * @param integer ProductID of product
	 */
	public function getQuantity($ProductID){
		$user = '1';//
		$row = (array) $this->db->select('Quantity')->from(self::TBL_CART)->where('UserID',$user)->where('ProductID',$ProductID)->get()->current();
		return $row['Quantity'];
	}

	/**
	 * Return all items in cart
	 * @return cart items per user id
	 */



	public function getCart(){
		$user = '1';
                $this->db->from('product');
                $this->db->join('video_info','video_info.id','product.videoId');
                $this->db->join('shoppingcart','shoppingcart.ProductID','product.videoId');
                $this->db->where('UserID',$user);
                return $this->db->get();
	}

}

read the whole article.

E-Commerce Case Study (using .net 3.5, sql server 2008, multi tier architecture)

July 31, 2011 in Resources by Edwin Deloso

 E-Commerce Case Study (using .net 3.5, sql server 2008, multi tier architecture)

The Project Plan and Design.


Modeling Tool – UML.

UML is a language that represents how a system or application will behave, how it will interact with the user and other components within the system, and how it will process data. To complete this chapter, you do not have to be a UML expert; however, you will need some fundamental knowledge of UML. Since including a complete reference or tutorial on UML is outside the scope of this publication, you can read more about the basics of UML at the Object Management Group site (http://www.uml.org).

 

1.) Activity Diagrams

A common diagram used within UML is an activity diagram, which represents the flow of the business logic of your system. The activity diagram will detail a specific task, or scenario, and how the system will accommodate the individual scenario. It will give a high-level view of th operation and is like a common flowchart.oject Plan and

 


Table 7-1. Activity Diagram Symbols and Objects

Symbol/Object Description

Solid black circle                    Demonstrates the initial state of the activity

Arrow                                      Shows the flow of action between different activities

Oval/rectangular                       Presents a specific action state

Diamond                                  Represents a decision that proceeds in one way or another

Black circle/clear edge              Demonstrates the final state of the diagram

 

Figure 7-1 shows the Search Activity diagram.

 

Figure 7-2 shows the Shopping Cart activity diagram

 

 

Figure 7-3. Checking Out activity diagram

Figure 7-4. Processing Abandoned Shopping Carts activity diagram

Figure 7-5. Account Registration activity diagram

 


Use Cases

The use cases you will be designing and using for the purposes in this chapter will be slightly different from the activity diagrams. More specifically, the use cases will show a macro-level view of the system and how users will interact with it.

Use cases are typically diagrams that outline the usage requirements for the system. They

are helpful in that they show a high-level view in which different elements of the system interact.

Contained within a use case are several elements:

Actors: Represent a person, organization, entity, or external component of the system and

are drawn as stick figures

Associations: Represent situations that are present when an actor is involved with a use case

System boundaries: Provide a specific scope of the use case

Packages: Aid in organizing the use cases into specific groups

Figure 7-6 shows the use cases for case study.

 

 

 


 

 

Class Diagrams

In this section, you’ll model the common objects used with the e-commerce system. These are, of course, individual classes and are certainly not going to be the only classes that the finalized system will contain. They will be the most common objects or classes that the system will use or be based upon. As a result of first identifying and then modeling these common objects, you will have your first blueprint of the database; you’ll use this blueprint to design from in the following chapter. Table 7-2 lists the common classes.

 

Table 7-2. Common Objects

Common Class Description

EndUser                  Describes all users within the system

EndUserType          Describes the classification of the users and their associations

Product                    Describes what is being sold

ProductCategory      Describes the categories in which products can be classified

Orders                     Contains the information about what the customer purchase

OrderDetails            Contains the details about an individual order

Address                   Contains address information for any other related object

ContactInformation Contains contact information for any other related object

ShoppingCart           Contains the information about the products the customer chooses to purchase

CreditCard               Contains the information for payment

 

From each of these common classes, I will provide a class diagram that will depict each of the attributes and properties within the class. These classes will not have any methods or functions because they are simply objects that will contain detailed information about the overall system objects. Let’s now explore the classes.

 

Figure 7-7. EndUser class diagram

 

 

Figure 7-8. EndUserType class diagram

 

 

 

Figure 7-9. Product class diagram

Figure 7-10. ProductCategory class diagram

Figure 7-11. Orders class diagram

 

 

Figure 7-12. OrderDetails class diagram

 

 

 

Figure 7-13. Address class diagram

 

 

 

Figure 7-14. ContactInformation class diagram

 

 

 

Figure 7-15. ShoppingCart class diagram

 

 

Figure 7-16. CreditCard class diagram

 

 

 

Welcome HNUCSA.ORG

March 21, 2011 in HNUCA News by Edwin Deloso

Welcome to our Alumni website! Feel free to participate in our alumni website! This website is open to all alumni of HNU College of Computer Science, present computer science students and faculty members.