<?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>eKini Web Developer Blog &#187; General</title>
	<atom:link href="http://blog.ekini.net/category/general/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ekini.net</link>
	<description>Wenbert Del Rosario: PHP, MySQL, Javascript, MVC, Zend Framework, AJAX, jQuery.</description>
	<lastBuildDate>Tue, 24 Aug 2010 00:13:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Django and jQuery AJAX</title>
		<link>http://blog.ekini.net/2010/08/22/django-and-jquery-ajax/</link>
		<comments>http://blog.ekini.net/2010/08/22/django-and-jquery-ajax/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 11:05:37 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=767</guid>
		<description><![CDATA[This is probably my first post for Django. I have only been using it for a few weeks and I am already falling in love with it. Here is how to do an AJAX &#8220;save&#8221; using jQuery and Django. My Javascript would look something like this: $&#40;document&#41;.ready&#40;function&#40;&#41; &#123; $&#40;&#34;#save_button&#34;&#41;.click&#40;function&#40;&#41;&#123; if&#40;save_data&#40;&#41;&#41; &#123; alert&#40;'Saved!'&#41;; &#125; else &#123; [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably my first post for Django. I have only been using it for a few weeks and I am already falling in love with it.</p>
<p>Here is how to do an AJAX &#8220;save&#8221; using jQuery and Django.</p>
<p>My Javascript would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#save_button&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>save_data<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Saved!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Failed!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">function</span> save_data<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $.<span style="color: #660066;">post</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/business/add/&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> 
            csrfmiddlewaretoken<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input[name='id_csrfmiddlewaretoken&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #000066;">name</span><span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#id_name&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            website<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#id_website&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                data <span style="color: #339933;">=</span> json_parse<span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//You must get this file: http://www.JSON.org/json_parse.js</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>data.<span style="color: #000066;">status</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;success&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                    console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;status: &quot;</span><span style="color: #339933;">+</span>data.<span style="color: #000066;">status</span><span style="color: #009900;">&#41;</span>
                    console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;error: &quot;</span><span style="color: #339933;">+</span>data.<span style="color: #660066;">error</span><span style="color: #009900;">&#41;</span>
                    console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;POST DATA: &quot;</span><span style="color: #339933;">+</span>data.<span style="color: #660066;">data</span><span style="color: #009900;">&#41;</span>
                    $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>data.<span style="color: #660066;">data</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&gt;&quot;</span><span style="color: #339933;">+</span>i<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;: &quot;</span><span style="color: #339933;">+</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And my <b>views.py</b> is like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">@login_required
@transaction.<span style="color: black;">commit_manually</span>
<span style="color: #ff7700;font-weight:bold;">def</span> business_add<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span>:
    success = <span style="color: #008000;">False</span>
    error = <span style="color: #008000;">None</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">method</span> == <span style="color: #483d8b;">'POST'</span>:
        business_form       = BusinessForm<span style="color: black;">&#40;</span>request.<span style="color: black;">POST</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>business_form.<span style="color: black;">is_valid</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
            business_name   = business_form.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span><span style="color: black;">&#93;</span>
            business_website  = business_form.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'website'</span><span style="color: black;">&#93;</span>
&nbsp;
            <span style="color: #ff7700;font-weight:bold;">try</span>:
                business = Business<span style="color: black;">&#40;</span>name=business_name,website=business_website<span style="color: black;">&#41;</span>
                business.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">except</span> IntegrityError, e:
                transaction.<span style="color: black;">rollback</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
                success = <span style="color: #008000;">False</span>
                error = e
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                transaction.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
                success = <span style="color: #008000;">True</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        business_form   = BusinessForm<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    data = <span style="color: black;">&#123;</span>
        <span style="color: #483d8b;">&quot;business_form&quot;</span>: business_form,
        <span style="color: #483d8b;">&quot;success&quot;</span>: success,
        <span style="color: #483d8b;">&quot;error&quot;</span>: error
    <span style="color: black;">&#125;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>success<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">is_ajax</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            results = <span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;status&quot;</span>:<span style="color: #483d8b;">&quot;success&quot;</span>, <span style="color: #483d8b;">&quot;message&quot;</span>:<span style="color: #483d8b;">&quot;Business saved.&quot;</span><span style="color: black;">&#125;</span>
            data = json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">return</span> HttpResponse<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;business/business_add.html&quot;</span>,
                              data, context_instance=RequestContext<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">is_ajax</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            data = json.<span style="color: black;">dumps</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;status&quot;</span>:<span style="color: #483d8b;">&quot;failed&quot;</span>, <span style="color: #483d8b;">&quot;error&quot;</span>:error, <span style="color: #483d8b;">&quot;data&quot;</span>:request.<span style="color: black;">POST</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">return</span> HttpResponse<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;business/business_add.html&quot;</span>,
                              data, context_instance=RequestContext<span style="color: black;">&#40;</span>request<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>And last but not the least, my template file:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">More HTML here...
&lt;div id=&quot;add_business_container&quot; title=&quot;Add a business&quot;&gt;
    &lt;form id=&quot;add_business_form&quot;&gt;
        {% csrf_token %}
        &lt;h2&gt;Business info&lt;/h2&gt;
        {{ business_form.as_p }}
        &lt;input id=&quot;save_button&quot; class=&quot;submit&quot; type=&quot;submit&quot; value=&quot;SAVE&quot;/&gt;
    &lt;/form&gt;
&lt;/div&gt;
More HTML here...</pre></div></div>

<p>It is basically just like \doing it in any web framework (Zend Framework). But with Django, everything is so easy to understand &#8212; you have built-in methods like request.is_ajax()</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/08/22/django-and-jquery-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: How to enable widgets in your custom theme</title>
		<link>http://blog.ekini.net/2010/07/22/wordpress-how-to-enable-widgets-in-your-custom-theme/</link>
		<comments>http://blog.ekini.net/2010/07/22/wordpress-how-to-enable-widgets-in-your-custom-theme/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 04:26:45 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=757</guid>
		<description><![CDATA[This is probably in the WordPress documentation but to enable widgets in your own customized theme, do this: ... rest of PHP and HTML code in your here ... &#60;div id=&#34;sidebar&#34;&#62; &#60;ul&#62; &#60;?php if &#40; ! dynamic_sidebar&#40; 'primary-widget-area' &#41; &#41; : ?&#62; &#60;li&#62; id=&#34;gray_box&#34;&#62; &#60;?php get_search_form&#40;&#41;; ?&#62; &#60;/li&#62; &#60;?php endif; ?&#62; &#60;/ul&#62; &#60;/div&#62; After doing [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably in the WordPress documentation but to enable widgets in your own customized theme, do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">... rest of PHP and HTML code in your here ...
&lt;div id=&quot;sidebar&quot;&gt;
    &lt;ul&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> dynamic_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'primary-widget-area'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;li&gt; id=&quot;gray_box&quot;&gt;
                <span style="color: #000000; font-weight: bold;">&lt;?php</span> get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/li&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>After doing that, go to your WP-Admin page and drag-and-drop widgets. The widgets page is found in <b>Appearance > Widgets </b>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/07/22/wordpress-how-to-enable-widgets-in-your-custom-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My notes in Symfony</title>
		<link>http://blog.ekini.net/2010/07/11/my-notes-in-symfony/</link>
		<comments>http://blog.ekini.net/2010/07/11/my-notes-in-symfony/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 14:48:42 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=748</guid>
		<description><![CDATA[Right now, I am working on a pet-project using Symfony. Symfony is a full-stack framework, a library of cohesive classes written in PHP. It provides an architecture, components and tools for developers to build complex web applications faster. Choosing symfony allows you to release your applications earlier, host and scale them without problem, and maintain [...]]]></description>
			<content:encoded><![CDATA[<p>Right now, I am working on a pet-project using <a href="http://www.symfony-project.org/">Symfony</a>.</p>
<blockquote><p><strong>Symfony </strong>is a full-stack framework, a library of cohesive classes written in PHP.</p>
<p>It provides an architecture, components and tools for developers to build complex web applications faster. Choosing symfony allows you to release your applications earlier, host and scale them without problem, and maintain them over time with no surprise.</p>
<p>Symfony is based on experience. It does not reinvent the wheel: it uses most of the best practices of web development and integrates some great third-party libraries.</p></blockquote>
<p>I have spent a few hours today reading their <a href="http://www.symfony-project.org/doc/1_4/">tutorials and books</a>. The learning curve isn&#8217;t that hard if you know Zend Framework or Code Igniter. <a href="http://wiki.ekini.net/main/Symfony">That is why I made notes in my Wiki</a> &#8212; containing the important stuff that will guide me while I am building my application.</p>
<p>It has a robust CLI commands to build and reload your database. Using <a href="http://www.doctrine-project.org/">doctrine</a> needs a little getting used to but the documentation for it is really good. If all goes well, I plan to use Symfony on my succeeding applications.</p>
<p>My notes can be found here: <a href="http://wiki.ekini.net/main/Symfony">http://wiki.ekini.net/main/Symfony</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/07/11/my-notes-in-symfony/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to create a sub-domain in Linode</title>
		<link>http://blog.ekini.net/2010/05/24/how-to-create-a-sub-domain-in-linode/</link>
		<comments>http://blog.ekini.net/2010/05/24/how-to-create-a-sub-domain-in-linode/#comments</comments>
		<pubDate>Mon, 24 May 2010 05:57:48 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[sub-domain]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=740</guid>
		<description><![CDATA[Open the DNS Manager in Linode Login to Linode Members Area Go to the DNS Manager tab. Click the domain name you want to put the sub-domain to. Scroll to the middle of the page and look for the A/AAAA Records. Click on Add a new A/AAAA Record In the Hostname input box, input the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Open the DNS Manager in Linode</strong></p>
<ol>
<li>Login to <a href="https://www.linode.com/members/">Linode Members Area</a></li>
<li>Go to the <strong>DNS Manager</strong> tab.</li>
<li>Click the domain name you want to put the sub-domain to.</li>
<li>Scroll to the middle of the page and look for the <strong>A/AAAA Records</strong>.</li>
<li>Click on <b>Add a new A/AAAA Record</b></li>
<li>In the <b>Hostname</b> input box, input the sub-domain you want. For example, if you want <strong>blog.mydomain.com</strong>, enter &#8220;<strong>blog</strong>&#8221; in the input box.</li>
<li>For the IP Address, input the IP address of your server.</a>
<li>Click <strong>Save</strong>.</li>
</ol>
<p><strong>SSH to your server</strong></p>
<ol>
<li>SSH to your server.</li>
<li>Once you are logged in as root, create a user called &#8220;<strong>shop</strong>&#8221; (same as your sub-domain name).</li>
<li>Go to: /etc/apache2/sites-available OR enter this command:
<pre>cd /etc/apache2/sites-available</pre>
</li>
<li>If you do an
<pre>ls -la</pre>
<p> you should see something like this:</p>
<pre>
-rw-r--r-- 1 root root   385 Apr 24 02:21 default
-rw-r--r-- 1 root root  7364 Mar  9 21:19 default-ssl
</pre>
</li>
<li>Copy the <b>default</b> file into your new sub-domain file. You can issue this command:
<pre>
cp default shop.mydomain.com
</pre>
</li>
<li>Open up <strong>shop.mydomain.com</strong> in VI.</li>
<li>Make the new file look like this:
<pre>
<VirtualHost *:80>
     ServerAdmin admin@mydomain.com
     ServerName shop.mydomain.com
     ServerAlias www.mydomain.com
     DocumentRoot /home/shop/public_html/
     ErrorLog /home/shop/logs/error.log
     CustomLog /home/shop/logs/access.log combined
</VirtualHost>
</pre>
</li>
<li>The next obvious thing to do is to create the directory structure found above. So just do something like this:
<pre>
mkdir /home/shop/public_html/
</pre>
</li>
<li>Enable the site by issuing this command:
<pre>a2ensite shop.mydomain.com</pre>
</li>
<li>Then refresh Apache by using this command:
<pre>/etc/init.d/apache2 reload</pre>
</li>
</ol>
<p>That&#8217;s about it. </p>
<p>FYI: My Linode is using Ubuntu 9.10.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/05/24/how-to-create-a-sub-domain-in-linode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenX Ad Server: Beginner&#8217;s Guide from Packt Publising</title>
		<link>http://blog.ekini.net/2010/04/18/openx-ad-server-beginners-guide-from-packt-publising/</link>
		<comments>http://blog.ekini.net/2010/04/18/openx-ad-server-beginners-guide-from-packt-publising/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 05:33:20 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=733</guid>
		<description><![CDATA[I have not yet considered seriously running ads on my site so I have never heard of OpenX Ad Server before Packt Publishing sent me a free PDF copy of OpenX Ad Server (link here). What is OpenX Ad Server? OpenX is a platform where you can manage your ads across different websites. It is [...]]]></description>
			<content:encoded><![CDATA[<p>I have not yet considered seriously running ads on my site so I have never heard of OpenX Ad Server before Packt Publishing sent me a free PDF copy of OpenX Ad Server (<a href="http://www.packtpub.com/openx-ad-server-beginners-guide/book/mid/121109uw14ki?utm_source=ekini.net&#038;utm_medium=affiliate&#038;utm_content=blog&#038;utm_campaign=mdb_002848<br />
">link here</a>).</p>
<p>What is OpenX Ad Server? OpenX is a platform where you can manage your ads across different websites. It is written in PHP and uses MySQL. The <a href="http://www.packtpub.com/openx-ad-server-beginners-guide/book/mid/121109uw14ki?utm_source=ekini.net&#038;utm_medium=affiliate&#038;utm_content=blog&#038;utm_campaign=mdb_002848<br />
">book</a> from Packt Publishing was written by Murat Yilmaz. He is from Russia and obviously has a lot of experience. He is a software developer and runs his own blog and online advertising network.</p>
<p>The book he has written is very detailed. What I mean by details is that a lot of screenshots are provided to guide the reader. Anyone who knows how to create a website will understand the book by scanning the pages. It is a very good guide if you want to get your hands dirty right away with OpenX Ad Server. The author even included screenshots for the installation. I have been doing some tutorials over the past few years, and I tell you, that is a lot of work. The author even goes through an extra step by giving an explaination at the end of each topic.</p>
<p>The book is for beginners, so you won&#8217;t find advanced topics. But it is good enough to introduce the new comers to the Ad serving community. It also includes chapters on how to use OpenX with WordPress.</p>
<p>In the end, the book convinced me to look into the &#8220;Ad Serving&#8221; part of the internet. I have dealt with other systems and web applications but none of this kind. So if you own a lot of websites and want to run advertisements, I suggest that you get a copy of this book. It will probably make your life easier.</p>
<p>You can find out more about this book by clicking <a href="http://www.packtpub.com/openx-ad-server-beginners-guide/book/mid/121109uw14ki?utm_source=ekini.net&#038;utm_medium=affiliate&#038;utm_content=blog&#038;utm_campaign=mdb_002848<br />
">HERE</a>. And yes, that is an affiliate link. So if you are going to buy the book, use the link. ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/04/18/openx-ad-server-beginners-guide-from-packt-publising/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Beginner&#8217;s Guide to OpenX Ad Server</title>
		<link>http://blog.ekini.net/2010/03/25/beginners-guide-to-openx-ad-server/</link>
		<comments>http://blog.ekini.net/2010/03/25/beginners-guide-to-openx-ad-server/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 08:52:54 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[open x ad server]]></category>
		<category><![CDATA[openx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=727</guid>
		<description><![CDATA[I got an email from Packt Publishing to review a book that they will be releasing very soon (March 2010?). The book is about OpenX. In all honesty, I have not even tried to use OpenX Ad Server yet. Still, I am interested in this book because I also serve ads on this blog; too [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/openx-ad-server-beginners-guide/book/mid/121109uw14ki?utm_source=ekini.net&amp;utm_medium=affiliate&amp;utm_content=blog&amp;utm_campaign=mdb_002848"><img src="http://blog.ekini.net/wp-content/uploads/2010/03/openxbook.png" alt="" title="openxbook" width="100" height="123" class="alignleft size-full wp-image-728" /></a>I got an email from <a href="http://packtpub.com">Packt Publishing</a> to review a book that they will be releasing very soon (March 2010?). The book is about <a href="http://www.openx.org/">OpenX</a>. </p>
<p>In all honesty, I have not even tried to use OpenX Ad Server yet. Still, I am interested in this book because I also serve ads on this blog; too bad though that the ads on the sides are not enough to pay for the hosting :P </p>
<p>I will have another update for this book once I have read it. I got a free ebook so I will have something to read on my 14-hour flight back home. :D</p>
<p>Here is the book in <a href="http://www.packtpub.com/openx-ad-server-beginners-guide/book/mid/121109uw14ki?utm_source=ekini.net&#038;utm_medium=affiliate&#038;utm_content=blog&#038;utm_campaign=mdb_002848#indetail">detail</a>:</p>
<blockquote>
<ul>
<li>Learn the essentials of online advertising from the advertiser and publisher points of view</li>
<li>Install and utilize OpenX Ad Server effectively to make your business run faster</li>
<li>Get to know the usage of all the campaign and banner types</li>
<li>Manage ad campaigns and banners on multiple web sites from a centralized platform</li>
<li>Display ads according to their importance and alter the under-performing ads easily and swiftly</li>
<li>Learn the most effective way to work with web site ad zones</li>
<li>Maximize your profits by selling your ad space on your blogs and web sites effectively</li>
<li>Take full advantage of GeoTargeting for generating maximum revenue by showing ads according to visitor origin</li>
<li>Utilize the channels to show relevant ads based on the content of web sites</li>
<li>Integrate Google AdSense and Amazon ads with your web sites using OpenX</li>
<li>Convert OpenX Ad Server into a multi-user ad management platform for advertisers, publishers, and ad agencies</li>
<li>Track the success of any ad campaign, banner or web site zone using detailed statistics, and reports</li>
</ul>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/03/25/beginners-guide-to-openx-ad-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: How to create a breadcrumb without using any plugins</title>
		<link>http://blog.ekini.net/2010/03/17/wordpress-how-to-create-a-breadcrumb-without-using-any-plugins/</link>
		<comments>http://blog.ekini.net/2010/03/17/wordpress-how-to-create-a-breadcrumb-without-using-any-plugins/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 13:12:38 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[breadcrumbs]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=722</guid>
		<description><![CDATA[A quick post for WordPress users. Go to your functions.php file. If it doesn&#8217;t exist, then create it. wp-content/themes/theme_name/functions.php Then add this inside the functions.php file. function the_breadcrumb&#40;$post_ancestors&#41; &#123; if &#40;!is_home&#40;&#41;&#41; &#123; echo '&#60;a href=&#34;'; echo get_option&#40;'home'&#41;; echo '&#34;&#62;'; echo 'Home'; echo &#34;&#60;/a&#62; &#38;gt; &#34;; if &#40;is_category&#40;&#41; &#124;&#124; is_single&#40;&#41;&#41; &#123; the_category&#40;'title_li='&#41;; if &#40;is_single&#40;&#41;&#41; &#123; echo [...]]]></description>
			<content:encoded><![CDATA[<p>A quick post for WordPress users.</p>
<p>Go to your <strong>functions.php</strong> file. If it doesn&#8217;t exist, then create it.</p>
<pre>
wp-content/themes/theme_name/functions.php
</pre>
<p>Then add this inside the <strong>functions.php</strong> file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> the_breadcrumb<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_ancestors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Home'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/a&gt; &amp;gt; &quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            the_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; &amp;gt; &quot;</span><span style="color: #339933;">;</span>
                the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
         <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_ancestors</span> <span style="color: #b1b100;">AS</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href='&quot;</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span><span style="color: #339933;">.</span>get_the_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt; &amp;gt; &quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">echo</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then in your <strong>wp-content/themes/theme_name/index.php</strong> or anywhere in your <strong>template files</strong>, you can do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;breadcrumbs&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_breadcrumb<span style="color: #009900;">&#40;</span>get_post_ancestors<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;</pre></div></div>

<p>That should display something like this:<br />
<a href="http://#">Home </a>&gt; <a href="http://#">A Sample Page</a>  &gt; Sub for the Sample Page</p>
<p><em><br />
* Most of the source code is from here <a href="http://www.catswhocode.com/blog/how-to-breadcrumb-function-for-wordpress"><strong>Catswhocode.com</strong></a>. I edited it so that you can get the &#8220;parents&#8221; for the pages. Thanks to for the kick-start!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/03/17/wordpress-how-to-create-a-breadcrumb-without-using-any-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A CSV File and SQL Dump for all the zip codes in Philippines</title>
		<link>http://blog.ekini.net/2010/03/14/a-csv-file-and-sql-dump-for-all-the-zip-codes-in-philippines/</link>
		<comments>http://blog.ekini.net/2010/03/14/a-csv-file-and-sql-dump-for-all-the-zip-codes-in-philippines/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 09:23:02 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[philippines zipcode]]></category>
		<category><![CDATA[zip codes]]></category>
		<category><![CDATA[zipcode]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=713</guid>
		<description><![CDATA[I spent a few hours yesterday gathering all the zip codes for the Philippines. This is public data, so I am sharing it with everyone. If you use it, I&#8217;d appreciate it if you credit me (It is not required but it would be great if you can send some traffic to my site &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a few hours yesterday gathering all the zip codes for the Philippines. This is public data, so I am sharing it with everyone. If you use it, I&#8217;d appreciate it if you credit me (It is not required but it would be great if you can send some traffic to my site &#8212; I have been planning to get a <a href="http://www.linode.com/">Linode </a>but I can&#8217;t afford one yet :P).</p>
<p>Here is a preview of the CSV file:</p>
<pre>
"id","country","major_area","zip_code","city"
"1","PH","Abra","2800","Bangued"
"2","PH","Abra","2801","Dolores"
"3","PH","Abra","2802","Lagangilang"
"4","PH","Abra","2803","Tayum"
"5","PH","Abra","2804","Peñarrubia"
"6","PH","Abra","2805","Bucay"
"7","PH","Abra","2806","Pidigan"
"8","PH","Abra","2807","Langiden"
"9","PH","Abra","2808","San Quintin"
"10","PH","Abra","2809","San Isidro"
"11","PH","Abra","2810","Manabo"
"12","PH","Abra","2811","Villaviciosa"
"13","PH","Abra","2812","Pilar"
"14","PH","Abra","2813","Luba"
...
...
...
"462","PH","Cebu","6000","Cebu City"
"463","PH","Cebu","6003","Compostela"
"464","PH","Cebu","6001","Consolacion"
"465","PH","Cebu","6017","Cordova"
"466","PH","Cebu","6013","Daanbantayan"
"467","PH","Cebu","6022","Dalaguete"
"468","PH","Cebu","6004","Danao City"
"469","PH","Cebu","6035","Dumanjug"
"470","PH","Cebu","6028","Ginatilan"
"471","PH","Cebu","6015","Lapu-Lapu City (Opon)"
"472","PH","Cebu","6002","Liloan"
"473","PH","Cebu","6016","Mactan Airport"
</pre>
<p>The MySQL Table is like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`zipcodes`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`country`</span> char<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`major_area`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">300</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`zip_code`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`city`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">300</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`major_area`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`major_area`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`zip_code`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`zip_code`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`city`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`city`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM</pre></div></div>

<p>Updated: <em>March 13, 2010 (2,270 zip codes)</em></p>
<p><strong>Download the files below:</strong></p>
<ul>
<li><a href="http://ekini.net/ph_zipcodes.csv">CSV File</a></li>
<li><a href="http://ekini.net/ph_zipcodes.sql">MySQL Dump File</a></li>
</ul>
<p>Corrections, suggestions, etc. just leave a comment below.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/03/14/a-csv-file-and-sql-dump-for-all-the-zip-codes-in-philippines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS: Creating a horizontal menu/navigation bar</title>
		<link>http://blog.ekini.net/2010/03/10/css-creating-a-horizontal-menunavigation-bar/</link>
		<comments>http://blog.ekini.net/2010/03/10/css-creating-a-horizontal-menunavigation-bar/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 08:22:29 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[horizontal menu]]></category>
		<category><![CDATA[horizontal navigation bar]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=711</guid>
		<description><![CDATA[I always forget how to do this. Every time I forget, it takes me about 10minutes searching for the right one. So I am posting it here for my reference. My HTML would look something like this: &#60;div id=&#34;navbar&#34;&#62; &#60;ul&#62; &#60;li class=&#34;first&#34;&#62;&#60;a href=&#34;#&#34;&#62;Home&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;About&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Services&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;#&#34;&#62;Projects&#60;/a&#62;&#60;/li&#62; &#60;li class=&#34;last&#34;&#62;&#60;a href=&#34;#&#34;&#62;Contact&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; &#60;/div&#62; And [...]]]></description>
			<content:encoded><![CDATA[<p>I always forget how to do this. Every time I forget, it takes me about 10minutes searching for the right one. So I am posting it here for my reference.</p>
<p>My HTML would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;navbar&quot;&gt;
    &lt;ul&gt;
        &lt;li class=&quot;first&quot;&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Projects&lt;/a&gt;&lt;/li&gt;
        &lt;li class=&quot;last&quot;&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>And my CSS would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#navbar</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#d90000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> ul <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> ul li <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> ul li a<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> 
    <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10.5px</span> <span style="color: #933;">11px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> ul li a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> ul li a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#navbar</span> ul li .current<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#bf0000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> <span style="color: #6666ff;">.first</span>  <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/*You can put stuff here for the first item in the navbar*/</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#navbar</span> <span style="color: #6666ff;">.last</span>  <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/*You can put stuff here for the last item in the navbar*/</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Comments or suggestions please ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/03/10/css-creating-a-horizontal-menunavigation-bar/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zend Framework: How to use nested transactions with Zend_Db and MySQL</title>
		<link>http://blog.ekini.net/2010/03/05/zend-framework-how-to-use-nested-transactions-with-zend_db-and-mysql/</link>
		<comments>http://blog.ekini.net/2010/03/05/zend-framework-how-to-use-nested-transactions-with-zend_db-and-mysql/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 13:51:40 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[database transactions]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[transactions]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Db]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=707</guid>
		<description><![CDATA[Steve Hollis first blog post about practical nested database transactions using Zend_Db. He writes really well and his blog is very readable. I love reading long text in Serif :D Thanks Steve! His solution: The Solution Disclaimer: This solution is adapted from the extended Pdo_MySql adapter in Varien’s Magento e-commerce product. A similar approach is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="stevehollis.com">Steve Hollis</a> first blog post about practical nested database transactions using Zend_Db. He writes really well and his blog is very readable. I love reading long text in Serif :D Thanks Steve!</p>
<p>His solution:</p>
<blockquote><p>The Solution<br />
Disclaimer: This solution is adapted from the extended Pdo_MySql adapter in Varien’s Magento e-commerce product. A similar approach is adopted by Bryce Lohr’s Nested Table Support for Zend_Db proposal. You should read Bill Karwin’s comments about that proposal and understand the limitations of this method before implementing it. That said, I still believe this is a useful and practical way of simulating nested transactions and I have used it a number of times.</p>
<p>A simple solution to the problem is to keep track of the “depth” of the transaction, that is, how many times the beginTransaction() method has been called. That way, we can hold off committing the changes to the database until we are certain that all the save operations have completed successfully.</p>
<p>Since transactions apply to the whole database connection, the most logical place to manage this process is in the DB adapter class. To do this, we extend our adapter class like so:</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">App_Zend_Db_Adapter_Mysqli <span style="color: #000000; font-weight: bold;">extends</span> Zend_Db_Adapter_Mysqli
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * Current Transaction Level
     *
     * @var int
     */</span>
    protected <span style="color: #000088;">$_transactionLevel</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Begin new DB transaction for connection
     *
     * @return App_Zend_Db_Adapter_Mysqli
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> beginTransaction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            parent<span style="color: #339933;">::</span><span style="color: #004000;">beginTransaction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel<span style="color: #339933;">++;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Commit DB transaction
     *
     * @return App_Zend_Db_Adapter_Mysqli
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> commit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel <span style="color: #339933;">===</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            parent<span style="color: #339933;">::</span><span style="color: #004000;">commit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel<span style="color: #339933;">--;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Rollback DB transaction
     *
     * @return App_Zend_Db_Adapter_Mysqli
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> rollback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel <span style="color: #339933;">===</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            parent<span style="color: #339933;">::</span><span style="color: #004000;">rollback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel<span style="color: #339933;">--;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Get adapter transaction level state. Return 0 if all transactions are complete
     *
     * @return int
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTransactionLevel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_transactionLevel<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<blockquote><p>Update your bootstrap to use the extended class et voila – a single START TRANSACTION and COMMIT or ROLLBACK is sent to MySQL, regardless of how many levels of nested pseudo-transactions have been created.</p>
<p>Please Note:</p>
<ol>
<li>It’s important that each child save() method re-throws the exception so that transaction depth is reduced by successive calls to rollBack(). The end result is that the originally called save() method then performs the actual rollback.
</li>
<li>
All the tables used in the transaction must use a storage engine that supports transactions. For MySQL, this will most likely mean using InnoDB. To convert a MyISAM or other table type to InnoDB, use “ALTER TABLE table ENGINE = InnoDB”. It could take some time to rebuild the indexes on large tables. There are other considerations about the use of InnoDB – please consult the MySQL manual.
</li>
<li>
If the tables used don’t support transactions, it’ll just fail silently. Bad times. I highly recommend using Firebug and Zend_Db_Profiler to monitor database queries during development (see http://framework.zend.com/manual/en/zend.db.profiler.html);
</li>
</ol>
</blockquote>
<p>And of course, the source can be found here: <a href="http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/">http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/03/05/zend-framework-how-to-use-nested-transactions-with-zend_db-and-mysql/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zend Framework: Using Command Line Scripts</title>
		<link>http://blog.ekini.net/2010/02/25/zend-framework-using-command-line-scripts/</link>
		<comments>http://blog.ekini.net/2010/02/25/zend-framework-using-command-line-scripts/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 07:18:21 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line scripts]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/2010/02/25/zend-framework-using-command-line-scripts/</guid>
		<description><![CDATA[Thanks to David Caunt for this very useful article. The article shows us how to create command line scripts using Zend Framework components. This is very useful especially with the database stuff. &#60;?php &#160; // Define path to application directory defined&#40;'APPLICATION_PATH'&#41; &#124;&#124; define&#40;'APPLICATION_PATH', realpath&#40;dirname&#40;__FILE__&#41; . '/../application'&#41;&#41;; &#160; // Define application environment defined&#40;'APPLICATION_ENV'&#41; &#124;&#124; define&#40;'APPLICATION_ENV', &#40;getenv&#40;'APPLICATION_ENV'&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.davidcaunt.co.uk/2010/02/25/easy-command-line-scripts-with-zend-application/">David Caunt</a> for this very useful article.</p>
<p>The article shows us how to create command line scripts using Zend Framework components. This is very useful especially with the database stuff.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define path to application directory</span>
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #339933;">,</span>
              <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../application'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define application environment</span>
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #339933;">,</span>
              <span style="color: #009900;">&#40;</span><span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span>
                                         <span style="color: #339933;">:</span> <span style="color: #0000ff;">'production'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Zend/Application.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$application</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Application<span style="color: #009900;">&#40;</span>
    APPLICATION_ENV<span style="color: #339933;">,</span>
    APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/configs/config.php'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//only load resources we need for script, in this case db and mail</span>
<span style="color: #000088;">$application</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'db'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mail'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Using it would be something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$application</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//do something!</span>
<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchRow</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT * FROM something'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The source can be found <a href="http://www.davidcaunt.co.uk/2010/02/25/easy-command-line-scripts-with-zend-application/">here</a>. Sorry for the copy-paste. This is so useful that I want to see the code every time I forget.</p>
<p>Thanks to <a href="http://www.zendframeworkinaction.com/2010/02/25/writing-command-line-scripts-for-your-zf-application/">Rob Allen</a> for directing me to <a href="http://www.davidcaunt.co.uk">David Caunt</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/02/25/zend-framework-using-command-line-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Unit Test your Zend Framework Application</title>
		<link>http://blog.ekini.net/2010/02/17/learning-unit-testing-with-zend-frameworking/</link>
		<comments>http://blog.ekini.net/2010/02/17/learning-unit-testing-with-zend-frameworking/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 15:00:12 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=697</guid>
		<description><![CDATA[I am trying to learn Unit Testing using Zend Framework. I have set up a test application called LyZend in Github. Supposedly, the application should be able to display artists, albums, and tracks. The tests are found in: http://github.com/wenbert/lyzend/tree/master/tests/ I have follwed Matthew Weier O&#8217;phinney&#8217;s method of setting up the tests. lyzend / tests / [...]]]></description>
			<content:encoded><![CDATA[<p>I am trying to learn Unit Testing using Zend Framework. I have set up a test application called <a href="http://github.com/wenbert/lyzend">LyZend in Github</a>. Supposedly, the application should be able to display artists, albums, and tracks.</p>
<p>The tests are found in: <a href="http://github.com/wenbert/lyzend/tree/master/tests/">http://github.com/wenbert/lyzend/tree/master/tests/</a> I have follwed <a href="http://github.com/weierophinney/">Matthew Weier O&#8217;phinney&#8217;s</a> method of setting up the tests. </p>
<p><strong>lyzend / tests / TestHelper.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'TestConfig.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Start output buffering
 */</span>
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Set error reporting to the level to which Zend Framework code must comply.
 */</span>
<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">E_ALL</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_STRICT</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Set default timezone
 */</span>
<span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GMT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Determine the root, library, tests, and models directories
 */</span>
<span style="color: #000088;">$root</span>        <span style="color: #339933;">=</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$library</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$root</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/library'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tests</span>       <span style="color: #339933;">=</span> <span style="color: #000088;">$root</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/tests'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$models</span>      <span style="color: #339933;">=</span> <span style="color: #000088;">$root</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/models'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$controllers</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$root</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/controllers'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Prepend the library/, tests/, and models/ directories to the
 * include_path. This allows the tests to run out of the box.
 */</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #000088;">$models</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$library</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$tests</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">get_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">set_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span>PATH_SEPARATOR<span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Register autoloader
 */</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Zend/Loader/Autoloader.php'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Zend_Loader::registerAutoload();</span>
Zend_Loader_Autoloader<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Add library/ and models/ directory to the PHPUnit code coverage
 * whitelist. This has the effect that only production code source files appear
 * in the code coverage report and that all production code source files, even
 * those that are not covered by a test yet, are processed.
 */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TESTS_GENERATE_REPORT'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> TESTS_GENERATE_REPORT <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span>
    <span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span>PHPUnit_Runner_Version<span style="color: #339933;">::</span><span style="color: #004000;">id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'3.1.6'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;='</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    PHPUnit_Util_Filter<span style="color: #339933;">::</span><span style="color: #004000;">addDirectoryToWhitelist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$library</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    PHPUnit_Util_Filter<span style="color: #339933;">::</span><span style="color: #004000;">addDirectoryToWhitelist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$models</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    PHPUnit_Util_Filter<span style="color: #339933;">::</span><span style="color: #004000;">addDirectoryToWhitelist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$controllers</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Setup default DB adapter
 */</span>
<span style="color: #666666; font-style: italic;">/*
$db = Zend_Db::factory('pdo_sqlite', array(
    'dbname' =&gt; $root . '/data/db/bugs.db',
));
Zend_Db_Table_Abstract::setDefaultAdapter($db);
*/</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Unset global variables that are no longer needed.
 */</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$root</span><span style="color: #339933;">,</span> <span style="color: #000088;">$library</span><span style="color: #339933;">,</span> <span style="color: #000088;">$models</span><span style="color: #339933;">,</span> <span style="color: #000088;">$controllers</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tests</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You might noticed that I included a <strong>TestConfig.php</strong> file above. Here is the file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define path to application directory</span>
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../application'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define application environment</span>
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'testing'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Ensure library/ is on include_path</span>
<span style="color: #990000;">set_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span>PATH_SEPARATOR<span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span>APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../library'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">get_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here is a sample test for my Artist Model.<br />
<strong>lyzend / tests / application / models / ArtistTest.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Call Model_ArtistTest::main() if this source file is executed directly.</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PHPUnit_MAIN_METHOD&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PHPUnit_MAIN_METHOD&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Model_ArtistTest::main&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../TestHelper.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** Model_Artist */</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Artist.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'ArtistMapper.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'DbTable/Artist.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Test class for Model_Artist.
 *
 * @group Models
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Model_ArtistTest <span style="color: #000000; font-weight: bold;">extends</span> Zend_Test_PHPUnit_ControllerTestCase 
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * Runs the test methods of this class.
     *
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$suite</span>  <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PHPUnit_Framework_TestSuite<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Model_ArtistTest&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> PHPUnit_TextUI_TestRunner<span style="color: #339933;">::</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$suite</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @return void
     */</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Application<span style="color: #009900;">&#40;</span>
            APPLICATION_ENV<span style="color: #339933;">,</span>
            APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'configs'</span> <span style="color: #339933;">.</span> <span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'application.ini'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        parent<span style="color: #339933;">::</span><span style="color: #004000;">setUp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Tears down the fixture, for example, close a network connection.
     * This method is called after a test is executed.
     *
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> tearDown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testCanTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//this is a sample test</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The XML file is like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phpunit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testsuite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Ly Test Suite&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>./<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testsuite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;php<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- &lt;ini name=&quot;include_path&quot; value=&quot;../library&quot;/&gt; --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/php<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;whitelist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory</span> <span style="color: #000066;">suffix</span>=<span style="color: #ff0000;">&quot;.php&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>../library/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory</span> <span style="color: #000066;">suffix</span>=<span style="color: #ff0000;">&quot;.php&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>../application/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory</span> <span style="color: #000066;">suffix</span>=<span style="color: #ff0000;">&quot;.phtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>../application/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../application/Bootstrap.php<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../application/controllers/ErrorController.php<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/whitelist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;logging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;coverage-html&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;./log/report&quot;</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">yui</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">highlight</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">lowUpperBound</span>=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #000066;">highLowerBound</span>=<span style="color: #ff0000;">&quot;80&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;testdox-html&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;./log/testdox.html&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/logging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phpunit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Running the test would be something like this:</p>
<pre>
phpunit --configuration phpunit.xml
</pre>
<p>Matthew did not provide sample test for Mappers. So I created one something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$mapper</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Ly_Model_ArtistMapper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertTrue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mapper</span> instanceof Ly_Model_ArtistMapper<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>My process was like:</strong></p>
<ol>
<li>Setup Unit Testing in Zend Framework</li>
<li>Create tests (let&#8217;s say for Artist Model).</li>
<li>Make code in my model to pass the tests.</li>
<li>Repeat step 2 and then go to next model if satisfied.</li>
</ol>
<p><strong>FYI:</strong> I am not so sure about my Model. I am not sure if I am breaking any rules when I created them. It would be cool if you could check them out (<a href="http://github.com/wenbert/lyzend/tree/master/application/models/">http://github.com/wenbert/lyzend/tree/master/application/models/</a>) and discuss my mistakes below.</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/02/17/learning-unit-testing-with-zend-frameworking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Akra&#8217;s Zend Framework 1.10 Tutorial</title>
		<link>http://blog.ekini.net/2010/02/08/akras-zend-framework-1-10-tutorial/</link>
		<comments>http://blog.ekini.net/2010/02/08/akras-zend-framework-1-10-tutorial/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:37:28 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[akrabat]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=694</guid>
		<description><![CDATA[From Akrabat&#8217;s blog: As a result, I have updated my Zend Framework tutorial so that it is completely current. The main change I made was to remove the _init methods in the Bootstrap as they are no longer needed. I also take advantage of the new features of the zf tool to enable layouts and [...]]]></description>
			<content:encoded><![CDATA[<p>From Akrabat&#8217;s blog:</p>
<blockquote><p>As a result, I have updated my <a href="http://akrabat.com/zend-framework-tutorial/">Zend Framework tutorial</a> so that it is completely current. The main change I made was to remove the _init methods in the Bootstrap as they are no longer needed. I also take advantage of the new features of the zf tool to enable layouts and create forms. It&#8217;s a shame that it gets the class name of the form wrong though!</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/02/08/akras-zend-framework-1-10-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Canvas Tutorial</title>
		<link>http://blog.ekini.net/2010/02/08/html5-canvas-tutorial/</link>
		<comments>http://blog.ekini.net/2010/02/08/html5-canvas-tutorial/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 08:12:22 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=692</guid>
		<description><![CDATA[The Paint Application from Mugtug.com is very impressive. It uses HTML5. Very responsive. I found it in HN and the hackers seemed to be impressed as well. Around the web, people are already talking about HTML5 and Canvas as a replacement for Flash. Click here to read the Canvas Tutorial.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://mugtug.com/sketchpad/">Paint Application from Mugtug.com</a> is very impressive. It uses HTML5. Very responsive. I found it in <a href="http://news.ycombinator.com/item?id=1106720">HN</a> and the hackers seemed to be impressed as well. </p>
<p>Around the web, people are already talking about HTML5 and Canvas as a replacement for Flash. Click <a href="http://billmill.org/static/canvastutorial/index.html">here</a> to read the Canvas Tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/02/08/html5-canvas-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An example of an Object-relational Mapper in PHP</title>
		<link>http://blog.ekini.net/2010/02/05/an-example-object-relational-mapper-in-php/</link>
		<comments>http://blog.ekini.net/2010/02/05/an-example-object-relational-mapper-in-php/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 15:00:04 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=686</guid>
		<description><![CDATA[Dennis Hotson posted in his blog a brief and good example of an ORM for PHP. What is an Object-relational Mapper? Data management tasks in object-oriented (OO) programming are typically implemented by manipulating objects that are almost always non-scalar values. For example, consider an address book entry that represents a single person along with zero [...]]]></description>
			<content:encoded><![CDATA[<p>Dennis Hotson posted  in his blog a  <a href="http://dhotson.tumblr.com/post/372232082/a-little-object-relational-mapper-in-php">brief and good example</a> of an <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> for PHP.</p>
<p><strong>What is an Object-relational Mapper?</strong></p>
<blockquote><p>
Data management tasks in object-oriented (OO) programming are typically implemented by manipulating objects that are almost always non-scalar values. For example, consider an address book entry that represents a single person along with zero or more phone numbers and zero or more addresses. This could be modeled in an object-oriented implementation by a &#8220;person object&#8221; with &#8220;slots&#8221; to hold the data that comprise the entry: the person&#8217;s name, a list of phone numbers, and a list of addresses. The list of phone numbers would itself contain &#8220;phone number objects&#8221; and so on. The address book entry is treated as a single value by the programming language (it can be referenced by a single variable, for instance). Various methods can be associated with the object, such as a method to return the preferred phone number, the home address, and so on.</p>
<p>However, many popular database products such as structured query language database management systems (SQL DBMS) can only store and manipulate scalar values such as integers and strings organized within normalized tables. The programmer must either convert the object values into groups of simpler values for storage in the database (and convert them back upon retrieval), or only use simple scalar values within the program. Object-relational mapping is used to implement the first approach.</p>
<p>The heart of the problem is translating those objects to forms that can be stored in the database for easy retrieval, while preserving the properties of the objects and their relationships; these objects are then said to be persistent.</p>
<p><a href="http://en.wikipedia.org/wiki/Object-relational_mapping">-Wikipedia</a>
</p></blockquote>
<p>The full source code can be found in <a href="http://gist.github.com/295737">Github</a>.</p>
<p>I&#8217;m sure this will come in handy as a reference in the future. Thanks to <a href="http://dhotson.tumblr.com/">Dennis Hotson</a> for sharing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/02/05/an-example-object-relational-mapper-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Quick Update</title>
		<link>http://blog.ekini.net/2010/01/29/a-quick-update/</link>
		<comments>http://blog.ekini.net/2010/01/29/a-quick-update/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 14:05:44 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/2010/01/29/a-quick-update/</guid>
		<description><![CDATA[Hello All. Sorry for the few updates. I have not been doing any Zend Framework / PHP related work for over a month now. I am in Aurland, Norway for a training. I will be staying here for about three months. I will be back home on April 2010. Right now, I am thinking of [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All. Sorry for the few updates. I have not been doing any Zend Framework / PHP related work for over a month now. I am in Aurland, Norway for a training. I will be staying here for about three months. I will be back home on April 2010.</p>
<p>Right now, I am thinking of starting a new pet project. I have the initial specifications in my head and I will put it into writing when I have time.</p>
<p>I will have more updates and Zend Framework / jQuery / PHP / MySQL / web development related soon.</p>
<p>Thanks!</p>
<p>-wenbert</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/01/29/a-quick-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Excel-like Javascript Grid Editors</title>
		<link>http://blog.ekini.net/2010/01/19/excel-like-javascript-grid-editors/</link>
		<comments>http://blog.ekini.net/2010/01/19/excel-like-javascript-grid-editors/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 10:44:40 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=683</guid>
		<description><![CDATA[Here is quick quote: A short list of my favorite JavaScript grid components. How many times did you hear users asking you: “something simple, a grid like excel”? When I was a VB programmer, oh yes, I have this dark spot on my career, and it is not the only one… this request threw me [...]]]></description>
			<content:encoded><![CDATA[<p>Here is quick quote:</p>
<blockquote><p> A short list of my favorite JavaScript grid components.<br />
How many times did you hear users asking you: “something simple, a grid like excel”?</p>
<p>When I was a VB programmer, oh yes, I have this dark spot on my career, and it is not the only one… this request threw me in panic. Usually what your “killer” is asking you is not what you, programmer, are thinking of (namely the power of cell functions, programmability, graph etc., that probably your “killer” does not even imagine): what they are thinking about is the editor flexibility, the ability to add columns, rows, move cells blocks, copy and paste from different sources.</p>
<p>After the ritual pointing-out that your application is NOT Excel, the VB solution was to adopt the standard flexGrid or the mythical TrueDbGrid that made happy both the killer-user and the victim-programmer.
</p></blockquote>
<p>The source here: <a href="http://roberto.open-lab.com/2010/01/18/javascript-grid-editor-i-want-to-be-excel/">roberto.open-lab.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2010/01/19/excel-like-javascript-grid-editors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework: Accessing configuration data in application.ini</title>
		<link>http://blog.ekini.net/2009/12/29/zend-framework-accessing-configuration-data-in-application-ini/</link>
		<comments>http://blog.ekini.net/2009/12/29/zend-framework-accessing-configuration-data-in-application-ini/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 05:13:31 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=680</guid>
		<description><![CDATA[Lately, I haven&#8217;t been doing any Zend Framework related things. Although currently tied up with other stuff, I check the community from time to time. Today, I found this quick and useful tip from Akrabat. Akra talks about how you can access your configuration that you have set in your application.ini file &#8211; your configuration [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I haven&#8217;t been doing any Zend Framework related things. Although currently tied up with other stuff, I check the community from time to time. Today, I found this quick and useful tip from <a href="http://akrabat.com/">Akrabat</a>.</p>
<p>Akra talks about how you can access your configuration that you have set in your application.ini file &#8211; your configuration file.</p>
<p>Since it is a short post, I will copy-paste everything here.</p>
<p>Zend_Application will read the data in your application.ini and make it available from your bootstrap&#8217;s getOptions() method. It then sets the bootstrap as a parameter in the front controller. Note that the top level keys are all normalised to lowercase too.</p>
<p>You can then retrieve the options in a number of ways.</p>
<p>In the controller you can do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> someAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$bootstrap</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInvokeArg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bootstrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bootstrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Outside of the controller you can do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$bootstrap</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParam</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bootstrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bootstrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>One downside is that $options is a nested array, and not a Zend_Config object. If you prefer to work with a Zend_Config object you need to create it yourself as Zend_Application discards the one it creates. The easiest way to do this is to create a new method in your bootstrap to create the Zend_Config object and store to the registry.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    protected <span style="color: #000000; font-weight: bold;">function</span> _initConfig<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'config'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$config</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can then get at your config data wherever you need it. Try not to depend too much on Zend_Registry keys though, as it can make testing harder.</p>
<p>Of course, the source is <a href="http://akrabat.com/zend-framework/accessing-your-configuration-data-in-application-ini/">found here</a> with all the comments from Akrabat&#8217;s readers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2009/12/29/zend-framework-accessing-configuration-data-in-application-ini/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My free WordPress Theme: Warmth</title>
		<link>http://blog.ekini.net/2009/12/16/my-free-wordpress-theme-warmth/</link>
		<comments>http://blog.ekini.net/2009/12/16/my-free-wordpress-theme-warmth/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 08:18:11 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[freebies]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress theme]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=671</guid>
		<description><![CDATA[I got bored and spent a few days creating a theme in WordPress. This is a quick release of the theme and I tested this in Firefox and Chrome. You can download it here. Nothing special except that I spent about 4 hours creating the header image for it. LOL :P Also, I have not [...]]]></description>
			<content:encoded><![CDATA[<p>I got bored and spent a few days creating a theme in WordPress. This is a quick release of the theme and I tested this in Firefox and Chrome. <img src="http://blog.ekini.net/wp-content/uploads/2009/12/screenshot.png" alt="screenshot" title="screenshot" width="300" height="225" class="alignleft size-full wp-image-672" align="left"/></p>
<p><strong>You can download it <a href="http://www.ekini.net/warmth.zip">here</a>.</strong></p>
<p>Nothing special except that I spent about 4 hours creating the header image for it. LOL :P</p>
<p>Also, I have not validated the HTML and CSS for this theme. I got tired and I need to do something else &#8211; um like play CounterStrike: Source (?). But seriously, I am starting to get busy and thought that I should finish and release this now.</p>
<p>And oh, by the way, Eddie Vedder is in the theme. Just wanted to share. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2009/12/16/my-free-wordpress-theme-warmth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m giving away 20 Google Wave invites!</title>
		<link>http://blog.ekini.net/2009/12/01/im-giving-away-20-google-wave-invites/</link>
		<comments>http://blog.ekini.net/2009/12/01/im-giving-away-20-google-wave-invites/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 05:54:27 +0000</pubDate>
		<dc:creator>Wenbert</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[google wave]]></category>

		<guid isPermaLink="false">http://blog.ekini.net/?p=667</guid>
		<description><![CDATA[I have 20 available Google Invites. Leave your email below. Format it to something like youremail[AT]gmail.com or something to avoid getting spammed. Just leave your email in the Email textbox when commenting :P First 20 legit emails will get the invites. UPDATE: I still have around 10 or so invites left.]]></description>
			<content:encoded><![CDATA[<p>I have 20 available Google Invites. Leave your email below.<del datetime="2009-12-01T05:55:25+00:00"> Format it to something like <strong>youremail[AT]gmail.com</strong> or something to avoid getting spammed.</del> Just leave your email in the Email textbox when commenting :P</p>
<p>First 20 legit emails will get the invites.</p>
<p><strong>UPDATE:</strong><br />
I still have around 10 or so invites left.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ekini.net/2009/12/01/im-giving-away-20-google-wave-invites/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
