Selasa, 26 Januari 2010

JS Framework Tutorial




Mootools Basic Tutorial

What is Mootools?
Stand for My Object-Oriented "JavaScript" Tools
Lightweight, modular, object-oriented JavaScript Framwork
created by Valerio Proietti - who originally intended it to be an extension to the Prototype JavaScript Framework
MooTools provides a cleaner, easier, and more elegant way to manipulate the object to our will
MooTools helps make the JavaScript code cross-browser compatible
Why Mootools?
JavaScript isn't perfect
JavaScript doesn't have a lot of native functions and methods to deal with modern user demands
Independent, open-source,and very robust JavaScript framework
Solid team of core developers and thousands of users who support, contribute
Where You can get it?
You can download a copy of MooTools from the offician MooTools website, http://www.mootools.net
How to use Mootools?
Downloading and Installing MooTools Core
Using MooTools Builder
To be continued...


jQuery Introduction



jQuery: Installation »


jQuery Introduction Step By Step Tutorial - Part 1: JQuery is a popular JavaScript library. With jQuery, you can build more interesting and interactive web page easy. jQuery automate common tasks and simplify complicated writing code. jQuery have ability to assist in wide range of task. This is one reason this library become popular choice.


What JQuery Does

Access parts of page. jQuery offers a robust and efficient selector mechanism for retrieving exactly the piece of the document that is to be inspected or manipulated.

Modify the appearance of a page. jQuery can bridge CSS browser standard gap.

Alter the content a page. jQuery can modify texts, images,list, and entire of the HTML. All with a single easy-to-use API.

Respond to a user's interaction with a page. The jQuery library have an elegant way to intercept a wide variety of events without the need to clutter the html code itself with event handlers.

Add animation. Implementing such interactive behaviors.

AJAX support. Retrieve information from server without refreshing a page.

Simplify common JavaScript task.


We want to modify page in order to be like this:
 
 // JavaScript Document
$(document).ready(
function(){
$('.lyric-text').addClass('lyric-full');
}
);

What mean? The fundamental operation in jQuery is selecting a part of the document. This is done with the $() construct. In this case, jQuery find lyric-text class. Then, jQuery inject new class named "lyric-full". This job use .addClass() method. So, we must add new class in our css, like this:



.lyric-full {
font-style: italic;
background-color:#FFFFCC;
border: 1px solid #FF0000;
padding: 0.5em;
}

Thus, open your mycss.css. Update like this:

@charset "utf-8";


/* CSS Document */



body {

font: 75% Arial, Helvetica, sans-serif;

}



h1 {

font-size: 2.5em;

margin-bottom: 0;

}



h2 {

font-size: 1.2em;

margin-bottom: .5em;

}



h3 {

font-size: 1.0em;

margin-bottom:0;

}

.lyric{

margin: 0 2em;

}

.lyric-full {

font-style: italic;

background-color:#FFFFCC;

border: 1px solid #FF0000;

padding: 0.5em;

}

Point your browser to http://localhost/test/jquery/myfirstjquery.html.


jQuery: Using Event Handler

JQuery Introduction Step By Step Tutorial - Part 4:We know, JavaScript have event handlers. Many handlers are available for user-initiated events, such as mouse clicks, key presses, load. In this post, we will see how to apply it.


In this practice, we use onload event at body. Like this:


// JavaScript Document


$(document).ready();
function lyricstyle(){
$('.lyric-text').addClass('lyric-full');
}

We create new function: lyricstyle(). We don't put in $(document).ready(). What is impact? This causes our code to run after the page is completely loaded.


PHP XML Tutorial




PHP XML Tutorial


XML PHP Step By Step Tutorial. XML is a format for storing text and transporting data. The use of XML is very broad and flexible. Did you know, a lot of structure / format of the document based on XML language. For example, RSS, Atom, and XHTML.

Because the plain text format so it can be accepted by all platforms. XML allows you to store data information (like a database), but also you can use to store application configuration information, and so on. Many processor can handle XML document, such as PHP.

In this tutorial, you will learn how to use XML for your web applications. You will learn how to use PHP, you can communicate and manipulate data in XML. After completing this tutorial, we hope you will read about SimpleXML at here.

PHP - XML: Read from String
PHP - XML: Read from a File
PHP - XML: Retrieving Node Values
PHP - XML: Retrieving Attribute Values
PHP - XML: Processing XML
PHP - XML: Creating XML Document
PHP - XML: Adding XML Nodes
PHP - XML: Removing Node
PHP - XML: Replacing Node
PHP - XML: Filtering XML Nodes with XPath
PHP - XML: Filtering XML Nodes by Namespace

ADOdb: Introduction



ADOdb: Introduction

You can amaze your client by saying "It's no problem you will use mysql, mssql, oracle, etc. Our web application support all major database without change codes". Wow, it's advantage for your promotion. The magic secret is php ADOdb. PHP's database access functions are not standardised. This creates a need for a database class library to hide the differences between the different database API's (encapsulate the differences) so we can easily switch databases. ADOdb currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access, ADO and ODBC. We have had successful reports of connecting to Progress and DB2 via ODBC. Unique Features of ADOdb (from manual):
Easy for Windows programmers to adapt to because many of the conventions are similar to Microsoft's ADO. Unlike other PHP database classes which focus only on select statements, we provide support code to handle inserts and updates which can be adapted to multiple databases quickly. Methods are provided for date handling, string concatenation and string quoting characters for differing databases.
A metatype system is built in so that we can figure out that types such as CHAR, TEXT and STRING are equivalent in different databases.
Easy to port because all the database dependant code are stored in stub functions. You do not need to port the core logic of the classes.
PHP4 session support. See adodb-session.php.
Now, we try test this library.
Download from sourceforge.
Extract zip file to a web directory.
Open a database manager (ex, phpmyadmin).
Create a simple database for test (ex, "inventory").
Create a simple table (ex, "products").
Now, Try simple test. Write code below. Put in the same directory with folder adodb. Give name "adodbtest.php":

<?php     
    include('adodb/adodb.inc.php'); 
    
    $databasetype = 'mysql'; 
    $server = 'localhost';
    $user   = 'root';
    $password = 'r0ot';
    $database = 'inventory';
    
    $db = ADONewConnection($databasetype); 
    $db->debug = true; 
    $db->Connect($server, $user, $password, $database); 
    $rs = $db->Execute('select * from products'); 
    print "<pre>"; 
    print_r($rs->GetRows()); 
    print "</pre>"; 
?>


  • Execute that file.
      Now, it's time to tell our client... "Don't worry, My web application support your database".



    1. PHP ADOdb Tutorial




      PHP ADOdb Step By Step Tutorial. a database class library.

      What is PHP ADOdb?

      A library for accessing various types of databases
      ADOdb Written in PHP Language.
      Use metatype system so can figure out eqivalent of different field types in different databases.
      Idea from Microsoft's ADOdb
      Official website at phplends

      Why PHP ADOdb

      Support various databases such as MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access, ADO and ODBC.
      Not only focus in select statement, this library also support insert, update, and delete statement
      Write one run anywhere
      Portable sql

      Where You can get it?

      Class library, you can download at here
      PHP ADODb documentation at here
      Whenever you need PHP ADOdb?
      Your PHP application support many databases.
      You dont want to write every line code at every kind database

      How to use PHP ADOdb?

      ADOdb: Introduction
      ADOdb: Connection Statement
      ADOdb: Advance Select Statement
      ADOdb: How to show tables
      ADOdb: How to show fields
      ADOdb: How to show databases
      ADOdb: Caching of Recordset
      ADOdb: Recordset to HTML
      ADOdb: Multi Database Connection
      ADOdb: Data Dictionary
      ADOdb: Quick Export Data
      ADOdb: Insert data style
      ADOdb: Replace Data
      ADOdb: Log Query
      PHP ADOdb: Understanding Pivot Table For Reporting

      Senin, 25 Januari 2010

      PHP & MYSQL





      PHP Mysql Database Step By Step Tutorial. Mysql is the most popular open-source database system.


      What is Mysql?


      Open source database system
      like most modern Database Management Systems is based on the relational model, RDBMS.
      Free
      Run on Linux, Windows, Netware, AIX, and so on.
      easily accessible through programming languages like PHP


      Why Mysql?




      Open source database
      consistent fast performance & high reliability
      ease of use High Availability Comprehensive Application Development


      Management Ease


      Lowest Total Cost of Ownership


      Where You can get it?


      You can download at mysql official website, mysql.com




      You can get mysql that packaged with php like in AppServ


      For portable application, you can try XAMPP