


<?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>Learn DooPHP &#187; Leng</title>
	<atom:link href="http://learn.doophp.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn.doophp.com</link>
	<description>Learn DooPHP - a high performance MVC based PHP framework</description>
	<lastBuildDate>Thu, 18 Aug 2011 19:47:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get DooPHP running on Google App Engine</title>
		<link>http://learn.doophp.com/2011/07/get-doophp-running-on-google-app-engine/</link>
		<comments>http://learn.doophp.com/2011/07/get-doophp-running-on-google-app-engine/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 08:17:50 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[quercus]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=225</guid>
		<description><![CDATA[<p>Google App Engine is a PaaS that enables you to build and host web apps on the same systems that power Google applications. App Engine offers fast development and deployment; simple administration, with no need to worry about hardware, patches or backups; and effortless scalability. With the latest <a href="http://code.google.com/appengine/docs/java/channel/overview.html">Channel API</a> it enables applications to send messages in real time without the use of polling. App engine currently only supports Python and Java and there are no PHP APIs available yet.</p>
<p>However, there&#8217;s a workaround to get PHP running on GAE.  With Quercus, you can run PHP on JVM which is supported in GAE infrastructure<span><em>. <a href="http://www.caucho.com/resin-3.0/quercus/">Quercus</a></em> is Caucho Technology&#8217;s fast, open-source, 100% Java implementation of the PHP language. Latest version of Quercus supports PHP 5.3.2 thus features like namespace and closure in PHP 5.3 are available. You can use Java </span>classes from PHP(with Quercus) to access various API such as Mail, URL Fetch, XMPP, Task Queues, Google Accounts on App Engine.</p>
<p>Here is an example of DooPHP <a href="http://doophp.appspot.com/">URI routing demo</a> running on GAE</p>
<p>Now, there are a few steps to get you started with Quercus and GAE.</p>
<p><strong>Step 1:</strong> Download and install Resin from http://www.caucho.com/download/</p>
<p><strong>Step 2: </strong>Download and install Google App Engine SDK for Java from http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Java</p>
<p><strong>Step 3:</strong> Download this example <a href="http://doophp.appspot.com/doophp-gae.zip">doophp-gae.zip</a> and upzip it to your preferred location</p>
<p><strong>Step 4:</strong> Copy resin.jar</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2011/07/get-doophp-running-on-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to DooPHP slides (PHP Malaysia meetup 2011)</title>
		<link>http://learn.doophp.com/2011/02/intro-to-doophp-slides-php-malaysia-meetup-2011/</link>
		<comments>http://learn.doophp.com/2011/02/intro-to-doophp-slides-php-malaysia-meetup-2011/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 07:51:17 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[News & Updates]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[doophp]]></category>
		<category><![CDATA[doophp 1.4]]></category>
		<category><![CDATA[introduction to doophp]]></category>
		<category><![CDATA[php meetup]]></category>
		<category><![CDATA[slides]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=223</guid>
		<description><![CDATA[<p>For those who are looking for the presentation slides for DooPHP used in  PHP Malaysia Meetup 2011. You can also click on the link to <span id="IL_AD1">download</span> the <a title="intro to doophp" href="http://doophp.com/files/intro-to-doophp.pdf">PDF</a> or <a title="intro to doophp" href="http://doophp.com/files/intro-to-doophp.apk">android apk</a></p>
<div id="__ss_7008383" style="width: 100%; text-align: center;"><strong style="display: block; margin: 12px 0pt 4px;"><a title="Intro to DooPHP" href="http://www.slideshare.net/darkredz/intro-to-doophp">Intro to DooPHP 1.4</a></strong></div>
]]></description>
		<wfw:commentRss>http://learn.doophp.com/2011/02/intro-to-doophp-slides-php-malaysia-meetup-2011/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upload and Resize Pictures with DooGdImage</title>
		<link>http://learn.doophp.com/2010/01/upload-and-resize-pictures-with-doogdimage/</link>
		<comments>http://learn.doophp.com/2010/01/upload-and-resize-pictures-with-doogdimage/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 04:19:51 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[DooGdImage]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[image resize]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=186</guid>
		<description><![CDATA[<p>First you must have an upload form in your HTML, notice that the file input field in the form below is <strong>profile_pic</strong></p>
<pre class="brush: php;">&#60;form action=&#34;/uploadme&#34; method=&#34;post&#34; enctype=&#34;multipart/form-data&#34; name=&#34;upload-photo&#34;&#62;
 &#60;input name=&#34;profile_pic&#34; type=&#34;file&#34; /&#62;
 &#60;input type=&#34;submit&#34; value=&#34;submit&#34;/&#62;
&#60;/form&#62;
</pre>
<p>In Controller, create an instance of <strong>DooGdImage</strong>, along with the upload/source path and the path to save your resized pictures:</p>
<pre class="brush: php;">
 Doo::loadHelper('DooGdImage');
 //upload/source path, and output saved path
 $gd = new DooGdImage('/var/www/uploaded/', '/var/www/resized_pic/');
</pre>
<p>Call uploadImage() to save the uploaded file with a new name. The example below save the picture with the date as file name, <strong>img_20100104203245.jpg</strong></p>
<pre class="brush: php;">$uploadImg = $gd-&#62;uploadImage('profile_pic', 'img_' .date('Ymdhis'));
</pre>
<p>Before your resize the picture, you can set the quality, generated image type and file name suffix (optional)</p>
<pre class="brush: php;">
 $gd-&#62;generatedQuality = 85;
 $uploadImage-&#62;generatedType=&#34;jpg&#34;;

 //This thumbnail is 46x46 pixels, resize adaptively (perfect 46x46 crop from center)
 //Pic name is img_201001011200_46x46.jpg
 $gd-&#62;thumbSuffix = '_46x46';
 $gd-&#62;adaptiveResize($uploadImg,46,46);
</pre>
<p>You can use createThumb/createSquare to resize the pictures too.</p>
<pre class="brush: php;">
 //Resize propotionally (so will not be perfect 75x75 depends on the image ratio, no cropping done)
 //Pic name is img_201001011200_75x75.jpg
 $gd-&#62;thumbSuffix = '_75x75';
 $gd-&#62;createThumb($uploadImg, 75, 75);
</pre>
<p>Some updates*</p>
<p>You can validate if the uploaded images meet your requirements by using checkImageType(), checkImageSize() and checkImageExtension()</p>
<ul>
<li><strong>checkImageType()</strong> &#8211; check if image mime type is in the allowed list. Default: JPEGs, GIFs and PNGs</li>
<li><strong>checkImageExtension()</strong> &#8211; check if image file extension is in the allowed list.</li></ul>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2010/01/upload-and-resize-pictures-with-doogdimage/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Profiling and DB Profiling with DooPHP</title>
		<link>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/</link>
		<comments>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 15:41:08 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Demos & Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db profiling]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=174</guid>
		<description><![CDATA[<p>If you have read the previous tutorial on <a href="http://learn.doophp.com/2009/12/using-doophp-logging-tools/">logging</a> you will find that <strong>profiling </strong>with DooPHP framework is relatively similar to the way you log messages.</p>
<p>Performance profiling can be used to measure the time &#38; memory needed for the specified code blocks and find out what the performance bottleneck is. Instead of calling log() you change it to<strong> beginProfile()</strong> and <strong>endProfile()</strong>. We need to mark the beginning and the end of each code block by inserting the following methods:</p>
<pre class="brush: php;">
Doo::logger()-&#62;beginProfile('block_id_here');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('block_id_here');
</pre>
<p>Code blocks need to be nested properly. A code block cannot intersect with another. It must be either at a parallel level or be completely enclosed by the other code block.</p>
<p>All of the profiled results can be organized in category, simply pass in another parameter at the end of the method beginProfile():</p>
<pre class="brush: php;">
//default category is 'application'
Doo::logger()-&#62;beginProfile('id', 'editpost');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('id');
</pre>
<p>To retrieve the profiled results, you called <strong>getProfileResult()</strong>. You have to pass in the block ID as parameter and you will get an associative array which shows you the time and memory used when processing the code block.</p>
<pre class="brush: php;">
Doo::logger()-&#62;beginProfile('block_id');
//...everything here will be profiled
Doo::logger()-&#62;endProfile('block_id');
$result = Doo::logger()-&#62;getProfileResult('block_id');
</pre>
<p>To view the profiled results, you just have to call showLogs(). By default it will return a neatly</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/12/profiling-and-db-profiling-with-doophp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using DooPHP Logging Tools</title>
		<link>http://learn.doophp.com/2009/12/using-doophp-logging-tools/</link>
		<comments>http://learn.doophp.com/2009/12/using-doophp-logging-tools/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:58:16 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Demos & Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[normal]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=154</guid>
		<description><![CDATA[<p>DooPHP comes with its own <strong>profiler and logging tool</strong> by default. The class that handle this in the framework is DooLog (<em>dooframework/app/logging/DooLog.php</em>)</p>
<p>There are a few methods in this file where you can use for profiling and logging queries or important message in your application. You can log a message by calling:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::Alert);
</pre>
<p>Or you can use the Alias methods instead of passing the log level:</p>
<pre class="brush: php;">
Doo::logger()-&#62;alert('Something fishy here!');
Doo::logger()-&#62;emerg('message...');
Doo::logger()-&#62;crit('message...');
Doo::logger()-&#62;err('message...');
Doo::logger()-&#62;warn('message...');
Doo::logger()-&#62;notice('message...');
Doo::logger()-&#62;info('message...');
Doo::logger()-&#62;trace('message...');
</pre>
<p>All of the log messages can be organized by category, simply pass in another parameter at the end of the methods:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::ALERT, 'editpost');
Doo::logger()-&#62;emerg('message...', 'editpost');
Doo::logger()-&#62;alert('message...', 'editpost');
</pre>
<p>To view the logged messages, you just have to call showLogs(). By default DooLog will return a neatly formatted XML log which can be filtered by level or category. You can get a plain text log if you need so:</p>
<pre class="brush: php;">
//display all logs
echo Doo::logger()-&#62;showLogs();

//display plain text log
echo Doo::logger()-&#62;showLogs(false);

//display only logs in category editpost
echo Doo::logger()-&#62;showLogs(true, null, 'editpost');

//display only logs in level Alert and category editpost
echo Doo::logger()-&#62;showLogs(true, DooLog::ALERT, 'editpost');
</pre>
<p>When you have to write the log messages into file, all you have to do is call writeLogs(). Similar to showLogs(), it writes the XML string to file by default.</p>
<pre class="brush: php;">

//Creates a log file</pre>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/12/using-doophp-logging-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving protected folder outside your Web Root</title>
		<link>http://learn.doophp.com/2009/10/moving-protected-folder-outside-your-web-root/</link>
		<comments>http://learn.doophp.com/2009/10/moving-protected-folder-outside-your-web-root/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 12:47:57 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[folder structure]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=126</guid>
		<description><![CDATA[<p>In the latest trunk of the framework, we are able to move the protected folder in an application outside your web server root directory. Let&#8217;s say you have a structure as below:</p>
<pre class="brush: php;">www/
    superapp/
        proctected/
            index.php
            global/</pre>
<p>To move it outside the WWW folder:</p>
<pre class="brush: php;">     superapp/
        proctected/

    www/
        superapp/
            index.php
            global/</pre>
<p>Just change the configs after you move your files, <strong>SITE_PATH</strong> setting</p>
<pre class="brush: php;">//original
C:/wamp/www/superapp/

//changes
C:/wamp/superapp/</pre>
<p>If you don&#8217;t wish to keep the name protected and wanted everything under <strong>superapp</strong>, try this:</p>
<pre class="brush: php;">    superapp/
        view/
        controller/
        .....
    www/
        superapp/
            index.php
            global/</pre>
<p>Add on a new setting to common.conf.php, <strong>PROTECTED_FOLDER</strong>:</p>
<pre class="brush: php;">
$config['PROTECTED_FOLDER'] = '';
</pre>
]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/10/moving-protected-folder-outside-your-web-root/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using DooModel for Database Operations</title>
		<link>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/</link>
		<comments>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 18:30:31 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DooModel]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=86</guid>
		<description><![CDATA[<p>If you have ever read DooPHP <a href="http://doophp.com/doc/guide/basic/model">guide</a> on model, you will see that a basic Model class does not have to extend any superclass.</p>
<p>A basic Model class looks like this:</p>
<pre class="brush: php;">
class User{
    public $id;
    public $uname;
    public $pwd;
    public $group;
    public $vip;

    public $_table = 'user';
    public $_primarykey = 'id';
    public $_fields = array('id', 'uname', 'pwd', 'group', 'vip');
}</pre>
<p>With the basic Model class, you can search for a database record by:</p>
<pre class="brush: php;">
//$this-&#62;db()-&#62;find('User');  is the same
Doo::db()-&#62;find('User');

//search for one record
Doo::db()-&#62;find('User', array('limit'=&#62;1) );

//search for a user named 'david'
Doo::db()-&#62;find('User', array('where'=&#62;&#34;uname='david'&#34;, 'limit'=&#62;1) );

//using prepared statement to avoid sql injection
Doo::db()-&#62;find('User', array(
                    'where' =&#62; 'user=?',
                    'param' =&#62; array($_GET['name']),
                    'limit' =&#62; 1
                )
           );

//Or simply use this for shorter code.
Doo::loadModel('User');
$u = new User;
$u-&#62;uname = $_GET['name'];
$result = Doo::db()-&#62;find($u, array('limit'=&#62;1));
</pre>
<p>Although the above code is pretty straightforward, we can make it even shorter and cleaner. First of all, we would need to have our Models to extend the DooModel class. We will have our Model class as the code below, notice the constructor:</p>
<pre class="brush: php; highlight: [14];">Doo::loadCore('db/DooModel');
class User extends DooModel {
    public $id;
    public $uname;
    public $pwd;
    public $group;
    public $vip;

    public $_table = 'user';
    public $_primarykey = 'id';
    public $_fields = array('id', 'uname', 'pwd', 'group', 'vip');

    function __construct(){
         parent::$className = __CLASS__;
    }
}
</pre>
<p>By</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>DooPHP Sitemap Generator Tool Demo</title>
		<link>http://learn.doophp.com/2009/09/doophp-sitemap-generator-tool-demo/</link>
		<comments>http://learn.doophp.com/2009/09/doophp-sitemap-generator-tool-demo/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 04:30:39 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Screencast]]></category>
		<category><![CDATA[code generation]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=69</guid>
		<description><![CDATA[<p>This is a demo showing you how to use DooPHP sitemap generator tools to generate routes as well as Controller classes.</p>
<p><a href="http://www.vimeo.com/6069049">DooPHP Sitemap Generator tool</a></p>
<p></p>
]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/doophp-sitemap-generator-tool-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Welcome to DooPHP Learning Blog!</title>
		<link>http://learn.doophp.com/2009/09/welcome/</link>
		<comments>http://learn.doophp.com/2009/09/welcome/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 17:15:10 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[News & Updates]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=1</guid>
		<description><![CDATA[<p>Welcome to DooPHP Learning Blog!</p>
<p>This is a community blog for learning DooPHP where tutorials, demos, article and code snippets will be contributed by DooPHP users.</p>
<p>We hope that you can learn a lot in web development with DooPHP through this blog.</p>
<p>If you would love to submit articles/tutorials of yours, do let us know. Any languages are welcomed.</p>
<p>Just drop us a message at the <a href="http://learn.doophp.com/contact">contact </a>page.</p>
]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/welcome/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
