<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Made Simple &#187; level 1</title>
	<atom:link href="http://www.phpmadesimple.info/tag/level-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmadesimple.info</link>
	<description>To support simplicity, possiibility and cost effective of PHP</description>
	<lastBuildDate>Tue, 03 Aug 2010 14:13:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Begin develop Facebook Application</title>
		<link>http://www.phpmadesimple.info/2008/03/01/begin-develop-facebook-application/</link>
		<comments>http://www.phpmadesimple.info/2008/03/01/begin-develop-facebook-application/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 04:50:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[level 1]]></category>

		<guid isPermaLink="false">http://artemis.com.vn/blogvui/index.php/2008/03/01/begin-develop-facebook-application/</guid>
		<description><![CDATA[I&#8217;ve wanted to start an entry about writing Facebook applications  for long time but seem these days I am quite busy with my running projects. From Internet, I got some useful links for people begin with as Facebook developers.
These are very helpful pieces of information highly recommend for reading before you get too far into [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve wanted to start an entry about writing Facebook applications  for long time but seem these days I am quite busy with my running projects. From Internet, I got some useful links for people begin with as Facebook developers.</p>
<p>These are very helpful pieces of information highly recommend for reading before you get too far into making your Facebook application.</p>
<ul>
<li><a href="http://wiki.developers.facebook.com/index.php/Random_questions#Basic_Application_Architecture" target="_blank">Basic Facebook Application Architecture</a></li>
<li><a href="http://wiki.developers.facebook.com/index.php/Random_questions#URLS_in_my_application" target="_blank">How URLs Are Handled Within An Application</a></li>
<li><a href="http://wiki.developers.facebook.com/index.php/Your_callback_page_and_you" target="_blank">Understanding Your Callback Page</a></li>
</ul>
<p>The official documentation / developer site:</p>
<ul>
<li><a href="http://developers.facebook.com/">Facebook Developers Site</a></li>
<li><a href="http://wiki.developers.facebook.com/index.php/Main_Page" target="_blank">Facebook Developers Wiki</a></li>
</ul>
<p>Other Facebook tutorials and how-to articles:</p>
<ul>
<li><a href="http://services.tucows.com/developers/2007/07/25/getting-started-with-facebook-application-development/" target="_blank">Tucows &#8211; Getting Started With Facebook Application Development</a></li>
<li><a href="http://padrenel.blogs.experienceproject.com/3459.html" target="_blank">10 Things That Would Have Been Nice to Know When Starting My Facebook Application</a></li>
<li><a href="http://www.sitepoint.com/article/developing-facebook-platform" target="_blank">Developing with the Facebook Platform and PHP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmadesimple.info/2008/03/01/begin-develop-facebook-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introduction to PHP</title>
		<link>http://www.phpmadesimple.info/2008/02/12/introduction-to-php/</link>
		<comments>http://www.phpmadesimple.info/2008/02/12/introduction-to-php/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 17:38:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[level 1]]></category>

		<guid isPermaLink="false">http://artemis.com.vn/blogvui/index.php/2008/02/12/introduction-to-php/</guid>
		<description><![CDATA[It is now ending of our lunar New Year eve and I start to write some first lessons in the learning PHP series. The fact is that Wordpress blog is not very good in content management and so the PHP lessons will be mixed up with other articles. However, I will try to create a [...]]]></description>
			<content:encoded><![CDATA[<p>It is now ending of our lunar New Year eve and I start to write some first lessons in the learning PHP series. The fact is that Wordpress blog is not very good in content management and so the PHP lessons will be mixed up with other articles. However, I will try to create a Table of content in the Learn series page so you can track the flow easy.</p>
<h1>What does PHP do ?</h1>
<p>PHP can be used in three primary ways:</p>
<h2>Server-side scripting</h2>
<p>PHP was originally designed to create dynamic web content, and it is still best suited for that task. To generate HTML, you need the PHP parser and a web server to send the documents. PHP has also become popular for generating XML documents, graphics, Flash animations, PDF files, and more.</p>
<h2><span id="more-28"></span>Command-line scripting</h2>
<p>PHP can run scripts from the command line, much like Perl, awk, or the Unix shell. You might use the command-line scripts for system administration tasks, such as backup and log parsing.</p>
<h2>Client-side GUI applications</h2>
<p>Using PHP-GTK (http://gtk.php.net), you can write full-blown, cross-platform GUI applications in PHP.</p>
<p>PHP runs on all major operating systems, from Unix variants including Linux, FreeBSD, and Solaris to Windows and Mac OS X. It can be used with all leading web servers, including Apache, Microsoft IIS, etc.</p>
<p>The language is very flexible. For example, you aren&#8217;t limited to outputting just HTML or other text filesany document format can be generated. PHP has built-in support for generating PDF files, GIF, JPG, and PNG images, and Flash movies.</p>
<p>One of PHP&#8217;s most significant features is its wide-ranging support for databases. PHP supports all major databases (including MySQL, PostgreSQL, Oracle, Sybase, and ODBC-compliant databases), and even many obscure ones. With PHP, creating web pages with dynamic content from a database is remarkably simple.</p>
<p>Finally, PHP provides a library of PHP code to perform common tasks, such as database abstraction, error handling, and so on, with the PHP Extension and Application Repository (PEAR). PEAR is a framework and distribution system for reusable PHP components.</p>
<h1>Your first PHP examples</h1>
<h2>A Hello World example:</h2>
<pre class="brush: html">
&lt;pre&gt;&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Look Out World&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt; ?php echo &#039;Hello, world!&#039; ?&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;/pre&gt;
</pre>
<p>The PHP echo command produces output (the string &#8220;Hello, world!&#8221; in this case), which is inserted into the HTML file. In this example, the PHP code is placed between the  tags.</p>
<h2>Checking your configuration</h2>
<p>The PHP function phpinfo( ) creates an HTML page full of information on how PHP was installed. You can use it to see whether you have particular extensions installed, or whether the php.ini file has been customized.</p>
<pre class="brush: php">
&lt;pre&gt;&lt; ?php phpinfo(  ); ?&gt;&lt;/pre&gt;
</pre>
<h2>Processing a form</h2>
<pre class="brush: php">
&lt;pre&gt;&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Personalized Hello World&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt; ?php if(!empty($_POST[&#039;name&#039;])) {
echo &quot;Greetings, {$_POST[&#039;name&#039;]}, and welcome.&quot;;
} ?&gt;

&lt;form action=&quot;&lt;?php $PHP_SELF; ?&gt;&quot; method=&quot;post&quot;&gt;
Enter your name: &lt;input type=&quot;text&quot; name=&quot;name&quot; /&gt;
&lt;input type=&quot;submit&quot; /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;/pre&gt;
</pre>
<p>PHP programs access form values through the $_POST and $_GET array variables. In this example, what you input in the textbox is submit to the page in the $_POST array and the key of the item is &#8216;name&#8217;. If you change the method of the form from &#8216;post&#8217; to &#8216;get&#8217; then the if condition should be changed to $_GET['name'].</p>
<h2>Create a dynamic image button</h2>
<pre class="brush: php">
&lt;pre&gt;&lt; ?php
if (isset($_GET[&#039;message&#039;])) {
// load font and image, calculate width of text
$font = &#039;times&#039;;
$size = 12;
$im = ImageCreateFromPNG(&#039;button.png&#039;);
$tsize = imagettfbbox($size,0,$font,$_GET[&#039;message&#039;]);

// center
$dx = abs($tsize[2]-$tsize[0]);
$dy = abs($tsize[5]-$tsize[3]);
$x = ( imagesx($im) - $dx ) / 2;
$y = ( imagesy($im) - $dy ) / 2 + $dy;

// draw text
$black = ImageColorAllocate($im,0,0,0);
ImageTTFText($im, $size, 0, $x, $y, $black, $font, $_GET[&#039;message&#039;]);

// return image
header(&#039;Content-type: image/png&#039;);
ImagePNG($im);
exit;
}
?&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Button Form&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;

&lt;form action=&quot;&lt;?= $PHP_SELF ?&gt;&quot; method=&quot;GET&quot;&gt;
Enter message to appear on button:
&lt;input type=&quot;text&quot; name=&quot;message&quot; /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Create Button&quot; /&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;&lt;/pre&gt;
</pre>
<p>GD library is one of many PHP extensions available to you. In this example, we use GD library to create an image and draw a text on that image background. If you are not very familiar with the header command, it is MIME type of the output telling the web browser how to treat the returned data.</p>
<p>Now that you have first look of PHP and how easy it is to learn. If you have some basic programming knowledge and HTML skill you will find  that building a fully functional dynamic website with PHP and database enable is just a piece of cake. If you have no programming skill, you may want to check out some basic PHP language syntax before moving on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmadesimple.info/2008/02/12/introduction-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON quick start</title>
		<link>http://www.phpmadesimple.info/2008/01/19/json-quick-start/</link>
		<comments>http://www.phpmadesimple.info/2008/01/19/json-quick-start/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 05:13:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ajax with json]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[level 1]]></category>
		<category><![CDATA[object notation]]></category>

		<guid isPermaLink="false">http://artemis.com.vn/blogvui/?p=23</guid>
		<description><![CDATA[What does it stand for?
JavaScript Object Notation.
According to Douglas Corckford’s website, JSON is a lightweight data-interchange format. It is easy for humans to read and write… JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, [...]]]></description>
			<content:encoded><![CDATA[<h3>What does it stand for?</h3>
<p>JavaScript Object Notation.</p>
<p>According to Douglas Corckford’s website, JSON is a lightweight data-interchange format. It is easy for humans to read and write… JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.&#8221;</p>
<p>Object Notation can be expressed in the following format:</p>
<pre class="brush: javascript">
var obj = {
// string
a : &#039;sampleValue&#039;,
// array
b : [obj1,obj2,&#039;three&#039;,4,obj5],
// function
c : function() {
var bang = this.a;
}
}
</pre>
<h3>JSON is built on two structures:</h3>
<ul>
<li>A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.</li>
<li>An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.</li>
</ul>
<h3>Reasons for JSON</h3>
<ul>
<li>JSON is easy. No really. It’s so easy, it’ll make you sick.</li>
<li>If you’re familiar with writing classes in PHP, then you’ll most definitely be comfortable with writing JavaScript in Object Notation</li>
<li>JSON is nothing more than name : value pairs assigned within an object.</li>
<li>JSON is easy to understand because if written well, it’s a self-documenting structure.</li>
<li>JSON is fast!</li>
<li>JSON organizes the ugly mess of procedural programming. Imagine having more than one init function.</li>
<li>You can impress your friends with JSON because it’s pretty looking</li>
<li>Your co-workers will love you for writing in JSON because it will most likely not conflict with their scripts that are being called within the same web documents.</li>
</ul>
<h3>JSON is like XML because:</h3>
<ol>
<li>They are both &#8217;self-describing&#8217; meaning that values are named, and thus &#8216;human readable&#8217;</li>
<li>Both are hierarchical. (i.e. You can have values within values.)</li>
<li>Both can be parsed and used by lots of programming languages</li>
<li>Both can be passed around using AJAX (i.e. httpWebRequest)</li>
</ol>
<h3>JSON is UNlike XML because:</h3>
<ol>
<li>XML uses angle brackets, with a tag name at the start and end of an element: JSON uses squiggly brackets with the name only at the beginning of the element.</li>
<li>JSON is less verbose so it&#8217;s definitely quicker for humans to write, and probably quicker for us to read.</li>
<li>JSON can be parsed trivially using the eval() procedure in JavaScript</li>
<li>JSON includes arrays {where each element doesn&#8217;t have a name of its own}</li>
<li>In XML you can use any name you want for an element, in JSON you can&#8217;t use reserved words from javascript</li>
</ol>
<h3>But Why? What&#8217;s good about it?</h3>
<p>When you&#8217;re writing ajax stuff, if you use JSON, then you avoid hand-writing xml. This is quicker. Also, with ajax services support JSON output, you can bypass difficulties of cross-domain ajax calls.</p>
<p>Again, when you&#8217;re writing ajax stuff, which looks easier? the XML approach or the JSON approach:<br />
The XML approach:</p>
<ol>
<li>bring back an XML document</li>
<li>loop through it, extracting values from it</li>
<li>do something with those values, etc,</li>
</ol>
<p>versus the JSON approach:</p>
<ol>
<li>bring back a JSON string.</li>
<li>&#8216;eval&#8217; the JSON</li>
</ol>
<h3>Example of using JSON in AJAX to transmit data</h3>
<p>The example is about to submit a form to a PHP page using AJAX. To keep the example simple, no data is sent (through POST) to the PHP page. Rather, data is just retrieved from the PHP page. The JSMX javascript library is very lightweight (code-wise) and sends and retrieves our data for us. The PHP page (that we make our requests to) simply prints out the data it wants to send back in a ready-to-use javascript object format.</p>
<p>&lt;img src=&#8221;http://simpletutorials.com/tutorials/javascript/simple_ajax/ajax_diagram.jpg&#8221; alt=&#8221;" /&gt;</p>
<pre class="brush: php">
&lt; ?php

require_once &quot;json/JSON.php&quot;;
$json = new Services_JSON();

//convert php object to json

$value = array(&#039;first&#039; =&gt; &#039;Steven&#039;, &#039;last&#039; =&gt; &#039;Spielberg&#039;, &#039;address&#039; =&gt; &#039;1234 Unlisted Drive&#039;);

$output = $json-&gt;encode($value);

print($output);

?&gt;
</pre>
<p>The JSON-PHP module can convert a PHP array of key value pairs to this JSON object.</p>
<pre class="brush: javascript">
{&quot;first&quot;:&quot;Steven&quot;,&quot;last&quot;:&quot;Spielberg&quot;,&quot;address&quot;:&quot;1234 Unlisted Drive&quot;}
</pre>
<p>HTML page</p>
<pre class="brush: html">
&lt;html&gt;
&lt;head&gt;

&lt;script src=&quot;ajax.js&quot;&gt;&lt;/script&gt;

&lt;script&gt;

/**Ajax Request (Submits the form below through AJAX
*               and then calls the ajax_response function)
*/
function ajax_request() {
var submitTo = &#039;ajax_request.php&#039;;
//location.href = submitTo; //uncomment if you need for debugging

http(&#039;POST&#039;, submitTo, ajax_response, document.form1);
}

/**Ajax Response (Called when ajax data has been retrieved)
*
* @param   object  data   Javascript (JSON) data object received
*                         through ajax call
*/
function ajax_response(data) {
for(var key in data) {
document.form1[key].value = data[key];
}
}

&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;input type=&quot;button&quot; onclick=&quot;ajax_request()&quot; value=&quot;Do AJAX&quot;/&gt;&lt;br /&gt;&lt;br /&gt;

&lt;form name=&quot;form1&quot;&gt;
First &lt;input type=&quot;text&quot; name=&quot;first&quot;/&gt;&lt;br /&gt;
Last  &lt;input type=&quot;text&quot; name=&quot;last&quot;/&gt;&lt;br /&gt;
Address &lt;input type=&quot;text&quot; name=&quot;address&quot;/&gt;&lt;br /&gt;

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This tutorial demonstrates how to perform AJAX functionality simply and effectively, using the <a href="http://www.lalabird.com/" target="_blank">AJAX JSMX library</a>, coupled with the <a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198" target="_blank">JSON-PHP  library</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmadesimple.info/2008/01/19/json-quick-start/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Apache on Windows</title>
		<link>http://www.phpmadesimple.info/2008/01/17/installing-apache-on-windows/</link>
		<comments>http://www.phpmadesimple.info/2008/01/17/installing-apache-on-windows/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 07:09:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[level 1]]></category>

		<guid isPermaLink="false">http://artemis.com.vn/blogvui/?p=21</guid>
		<description><![CDATA[Because it&#8217;s the most popular web server in use, you might think that Apache is a complicated piece of software, but it&#8217;s not difficult at all.
Installing Apache for Windows is a simple task, due in great part to the installation wizard distributed by the Apache Group. While running any web server on a Windows operating [...]]]></description>
			<content:encoded><![CDATA[<p>Because it&#8217;s the most popular web server in use, you might think that Apache is a complicated piece of software, but it&#8217;s not difficult at all.</p>
<p>Installing Apache for Windows is a simple task, due in great part to the installation wizard distributed by the Apache Group. While running any web server on a Windows operating system is not as fast, stable, or secure as running a web server on a Linux/Unix machine. However, installing and configuring a development web server on a Windows-based operating system is perfectly acceptable, and is how most users get their start.<span id="more-21"></span></p>
<p>To download the Apache distribution for Windows, start at the Apache Server website, http://httpd.apache.org/, and follow the Download link. As of this writing, the current version is 2.0.49, so the file used as an example throughout this section is apache_2.0.49- win32-x86-no_ssl.msi. Once you have downloaded the installation file to your hard drive, double-click the file called apache_2.0.49-win32-x86-no_ssl.msi to start the installation wizard.</p>
<p>Note: When you are ask how to run Apache, choose the Run as Service for All Users radio button.</p>
<p>To run a basic test before moving forward to configuring your server, choose Program Files, Apache HTTP Server 2.0.49, Configure Apache Server, Test Configuration from the Windows Start menu. This will launch a console window showing a successful installation.</p>
<p>Configuring Apache on Windows<br />
The master configuration file for Apache is called httpd.conf, and it lives in the conf directory, within the Apache installation directory. So if your installation directory is C:\Program Files\Apache Group\Apache2\, the httpd.conf file will be in C:\Program Files\Apache Group\Apache2\conf\.</p>
<p>Two values you usually want to change are the listen on port and the document root.</p>
<pre class="brush: xml">
#Listen 12.34.56.78:80
Listen 8080
ServerName localhost:8080
</pre>
<p>By default Apache is installed to listen of default HTTP port 80. However, your Windows might has IIS (Internet Information Server) installed and takes that port already. The alternative port other developers love to use is 8080, like what I configured for my Apache.</p>
<pre class="brush: xml">

DocumentRoot &quot;D:/projects/www&quot;
</pre>
<p>By default, the document root where we will serve data for web client is Path_to_apache/htdocs. You may want to change it to an easier to access location on your development environment. Remember that Apache protect your hard drive data from web user, thus you have to change the permission for users to access your new DocumentRoot.</p>
<p><directory>
<pre class="brush: xml">
&lt;/directory&gt;&lt;directory &quot;D:/projects/www&quot;&gt;
#
# Possible values for the Options directive are &quot;None&quot;, &quot;All&quot;,
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;
# doesn&#039;t give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

&lt;/directory&gt;
</pre>
<p>Restart your apache so that your new configuration can take effect. Now, you can test connect to Apache web server from web browser.</p>
<p>http://localhost OR<br />
http://localhost:8080 if you modify port that Apache listen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpmadesimple.info/2008/01/17/installing-apache-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
