<?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>DevPatch &#187; Blog</title>
	<atom:link href="http://www.devpatch.com/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devpatch.com</link>
	<description>Web Applications, Information Architecture, Project Management</description>
	<lastBuildDate>Thu, 03 Jun 2010 18:28:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Should You Extend or Wrap jQuery UI 1.8 Widgets</title>
		<link>http://www.devpatch.com/2010/05/should-you-extend-or-wrap-jquery-ui-1-8-widgets/</link>
		<comments>http://www.devpatch.com/2010/05/should-you-extend-or-wrap-jquery-ui-1-8-widgets/#comments</comments>
		<pubDate>Fri, 21 May 2010 18:08:37 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQueryUI]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=807</guid>
		<description><![CDATA[As part of a recent project I was tasked with creating a set of custom jQuery UI widgets. When specing my widgets I discovered almost all would use some existing widget features, like sortable. I found myself trying to decide if I should extend existing widgets or somehow wrap the existing widgets with my custom [...]]]></description>
			<content:encoded><![CDATA[<p>As part of a recent project I was tasked with creating a set of custom jQuery UI widgets. When specing my  widgets I discovered almost all would use some existing widget features, like sortable.<strong> I found myself trying to decide if I should extend existing widgets or somehow wrap the existing widgets with my custom code?</strong> I think this is a common question.</p>
<p>The <a href="http://jqueryui.com/docs/Developer_Guide">jQuery UI widget factory</a> provides a method to inherit one and only one widget. For example If you look at some of the jquery ui widget source code (draggable, droppable, sortable) you will notice that most inherit <strong>mouse</strong>. However when writing my own widgets I found that I never needed to do any of the things inheritance was intended for, such as overriding methods.</p>
<p>For me, I just needed some of the default widget behaviors (like sortable) applied to my own custom code.<strong> I decided to wrap the existing widget behavior rather than extend.</strong></p>
<p>So how does this work? Let&#8217;s take the example of a page selector.</p>
<p><span id="more-807"></span></p>
<p>My hypothetical page selector widget needs to do the following:</p>
<ul class="disc">
<li>User can click to select a page</li>
<li>User can reorder pages</li>
<li>Selecting or Reordering triggers an ajax save</li>
<li>I want to append the draggabe handle in the JS</li>
</ul>
<p>As you can see there is a mix of behavior, the reordering is boiler plate sortable, but appending the draggable handle and other features are all custom.</p>
<p>A quick visual:<br />
<a class="lb" href="/wp-content/uploads/2010/05/page-selector.png"><img src="/wp-content/uploads/2010/05/page-selector.png" alt="" title="page-selector" width="455" height="95" class="alignnone size-full wp-image-808" /></a></p>
<p>So for this widget I want to use sortable to handle the sorting, but everything else will be custom code.</p>
<p>Here is the base/empty code for our widget:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.pageSelector&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
        _create <span style="color: #339933;">:</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>
&nbsp;
       <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
        _destroy <span style="color: #339933;">:</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>
&nbsp;
       <span style="color: #009900;">&#125;</span>
&nbsp;
     <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;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>Options</h4>
<p>Our first challenge are the options. We have two sets of options, the options for sortable and the options for pageSelector (our custom widget). You can handle options as either one object or two.</p>
<p><strong>One Object</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    $.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.pageSelector&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
            customName <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;customValue&quot;</span><span style="color: #339933;">,</span>
            items<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.sort-item'</span><span style="color: #339933;">,</span>   
            handle<span style="color: #339933;">:</span><span style="color: #3366CC;">'.sort-handle'</span><span style="color: #339933;">,</span>
            containment<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.page-slider-container'</span><span style="color: #339933;">,</span>
            placeholder<span style="color: #339933;">:</span> <span style="color: #3366CC;">'sort-item-placeholder ui-state-highlight'</span><span style="color: #339933;">,</span>
            forcePlaceholderSize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            opacity<span style="color: #339933;">:</span><span style="color: #3366CC;">'0.6'</span><span style="color: #339933;">,</span>
            revert<span style="color: #339933;">:</span><span style="color: #3366CC;">'100'</span><span style="color: #339933;">,</span>
            delay<span style="color: #339933;">:</span><span style="color: #3366CC;">'100'</span> 
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>In the above example options for the wrapped widget and the custom widget are all together (<strong>customName</strong> is for the pageSelector widget). I think there are significant problems with this approach, for example when we instantiate sortable we pass it options it does not need, and I can imagine name conflicts (if you are not careful).</p>
<p><strong>Two Objects</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    $.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.pageSelector&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
            customName <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;customValue&quot;</span><span style="color: #339933;">,</span>
            sortableOptions<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                items<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.sort-item'</span><span style="color: #339933;">,</span>   
                handle<span style="color: #339933;">:</span><span style="color: #3366CC;">'.sort-handle'</span><span style="color: #339933;">,</span>
                containment<span style="color: #339933;">:</span> <span style="color: #3366CC;">'.page-slider-container'</span><span style="color: #339933;">,</span>
                placeholder<span style="color: #339933;">:</span> <span style="color: #3366CC;">'sort-item-placeholder ui-state-highlight'</span><span style="color: #339933;">,</span>
                forcePlaceholderSize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
                opacity<span style="color: #339933;">:</span><span style="color: #3366CC;">'0.6'</span><span style="color: #339933;">,</span>
                revert<span style="color: #339933;">:</span><span style="color: #3366CC;">'100'</span><span style="color: #339933;">,</span>
                delay<span style="color: #339933;">:</span><span style="color: #3366CC;">'100'</span> 
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>I like the second approach better as we can handle the sortable options separately. Later when we invoke sortable we can pass just the options it needs.</p>
<h4>Instantiating The Wrapped Widget</h4>
<p>In the <strong>_create</strong> method we can now instantiate the sortable, passing in the sortableOptions object:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">        _create <span style="color: #339933;">:</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: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> o <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span><span style="color: #339933;">,</span> e <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">element</span><span style="color: #339933;">;</span>
&nbsp;
            e.<span style="color: #660066;">sortable</span><span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">sortableOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>Hooking Into The Wrapped Widget</h4>
<p>Now that our widget is instantiated we can start adding the widget specific behavior. In this example we want to trigger a save on the wrapped sortable&#8217;s event <strong>sortupdate</strong>. To do this we can bind that event in our <strong>_create</strong> method:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">        _create <span style="color: #339933;">:</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: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> o <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span><span style="color: #339933;">,</span> e <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">element</span><span style="color: #339933;">;</span>
&nbsp;
            e.<span style="color: #660066;">sortable</span><span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">sortableOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            e.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;sortupdate&quot;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span>ui<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                self._saveSortOrder<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;">&#41;</span></pre></td></tr></table></div>

<p>You can also invoke methods on your sortable using this syntax:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">e.<span style="color: #660066;">sortable</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'serialize'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The above approach has worked really well for me and I was able to create custom widgets that encapsulated the behavior I needed.</p>
<h4>Option Based Function Callbacks</h4>
<p>Semi-related: I discovered that some &#8220;widgets&#8221; that you might want to wrap (say non jQuery UI like tinyMCE) allow callback functions to be defined as an option. This can cause problems if you want to invoke a function from within your widget.</p>
<p>For example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    $.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.pageSelector&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
            customName <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;customValue&quot;</span><span style="color: #339933;">,</span>
            someFooOptions<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                save_callback <span style="color: #339933;">:</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: #006600; font-style: italic;">//I want to do something here!                     </span>
                <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>                
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>In the above example I want the save behavior to be handled by my custom widget, but the code I am wrapping only provides a callback method. You can&#8217;t invoke widget methods from the options since there is no scope.</p>
<p>My solution was to use a trigger bound to this widgets instance:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    $.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.pageSelector&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
            customName <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;customValue&quot;</span><span style="color: #339933;">,</span>
            someFooOptions<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                save_callback <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #006600; font-style: italic;">// Trigger Custom Event</span>
                    $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my:customSaveEvent&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                                       
                <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>                
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
&nbsp;
 . . .
       _create <span style="color: #339933;">:</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: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> o <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span><span style="color: #339933;">,</span> e <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">element</span><span style="color: #339933;">;</span>
&nbsp;
            $<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my:customSaveEvent&quot;</span><span style="color: #339933;">,</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: #006600; font-style: italic;">//do stuff           </span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>In this example I trigger the &#8220;my:customSaveEvent&#8221; in the callback. This event is bound to behavior in my widget. For this to work you just need to somehow get the id of the widget passed in (or some other identifier). You want to be careful not to trigger the event on the entire document as you may have multiple widgets instantiated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/05/should-you-extend-or-wrap-jquery-ui-1-8-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Communication Between jQuery UI Widgets</title>
		<link>http://www.devpatch.com/2010/03/communication-between-jquery-ui-widgets/</link>
		<comments>http://www.devpatch.com/2010/03/communication-between-jquery-ui-widgets/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 20:57:12 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQueryUI]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=748</guid>
		<description><![CDATA[When writing user interfaces using jQuery I often need widgets to interact with each other. For example, an ajax status widget that displays a spinner when an ajax call starts, and displays a status message when the ajax call completes. This widget should be accessible by whatever other widgets are on the page. In the [...]]]></description>
			<content:encoded><![CDATA[<p>When writing user interfaces using jQuery I often need widgets to interact with each other. For example, an ajax status widget that displays a spinner when an ajax call starts, and displays a status message when the ajax call completes. This widget should be accessible by whatever other widgets are on the page.</p>
<p>In the past I directly called methods from each widget, but this creates a lot of &#8220;glue code&#8221; and dependencies.  I had recently watched this <a href="http://developer.yahoo.com/yui/theater/video.php?v=zakas-architecture">YUI Theatre video on Scalable Javascript Application Architecture</a> and wanted to apply the following to my jQuery UI Widgets:</p>
<ul class="disc">
<li>Widgets should be able to live on their own</li>
<li>Keep everything loosely coupled</li>
</ul>
<h4>Approach</h4>
<p>Given the above I decided to use jQuery&#8217;s custom events to enable publish/speak and subscribe/listen into my widgets. Each widget would publish certain events and subscribe to others. This approach effectively decouples the widgets and allows them to function independently.<br />
<span id="more-748"></span></p>
<p>The two key jQuery methods:  </p>
<ul>
<li><strong><a href="http://api.jquery.com/bind/">bind</a></strong> &#8211; Bind will perform the &#8220;listen&#8221; or &#8220;subscribe&#8221;</li>
<li><strong><a href="http://api.jquery.com/trigger/">trigger</a></strong> &#8211; Trigger will perform the &#8220;speak&#8221; or &#8220;publish&#8221;</li>
</ul>
<h4>Example Code Subscribe/Listen</h4>
<p>Note I am using <strong>jQuery 1.4.2</strong> &#038; <strong>jQuery UI 1.8rc3</strong>.</p>
<p>The following is a bare bones widget and has most of the code removed so it can serve as an example. This widget has two bound custom events <strong>dpui:ajaxStart</strong> &#038; <strong>dpui:ajaxEnd</strong> (DPUI is just my namespace for events &#8220;DevPatch UI&#8221;). Whenever the custom events are triggered the widget will output text to a firebug console.</p>
<p><strong>UPDATED March 22, 2010</strong><br />
I updated my custom event format to <em>namespace:eventName</em>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.ajaxStatus&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
        _create <span style="color: #339933;">:</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: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>                     
&nbsp;
            self.<span style="color: #660066;">element</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dpui-widget&quot;</span><span style="color: #009900;">&#41;</span>
&nbsp;
            $<span style="color: #009900;">&#40;</span>self.<span style="color: #660066;">element</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dpui:ajaxStart&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<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;ajax start&quot;</span><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>
&nbsp;
            $<span style="color: #009900;">&#40;</span>self.<span style="color: #660066;">element</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dpui:ajaxEnd&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<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;ajax end&quot;</span><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: #009900;">&#125;</span><span style="color: #339933;">,</span>
        destroy<span style="color: #339933;">:</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: #660066;">Widget</span>.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">destroy</span>.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> arguments<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h4>Example Code Speak/Publish</h4>
<p>Below is the code that would be in another widget.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.dpui-widget&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dpui:ajaxStart&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The class .dpui-widget is my namespace class that is applied to every UI widget with speak/listen. If you wanted to do this globally you could use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td 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;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;dpui:ajaxStart&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Important to note here that I am not calling <strong>dpui:ajaxStart</strong> on the ajax widget, instead I am triggering this event on a sub-set of document objects. Any document objects that are subscribed to this custom event will have their action triggered.</p>
<h4>Conclusion</h4>
<p>I think the above approach solves many of my problems, but I can imagine some issues, especially on larger projects.</p>
<p>If you have additional thoughts or suggestions for a different approach please leave a comment.</p>
<p>The following two blog posts were very helpful and are a good intro to jQuery widgets and event pooling.</p>
<p><a href="http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/">http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/</a></p>
<p><a href="http://www.michaelhamrah.com/blog/2009/12/organizing-javascript-for-event-pooling-with-jquery/">http://www.michaelhamrah.com/blog/2009/12/organizing-javascript-for-event-pooling-with-jquery/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/03/communication-between-jquery-ui-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying Zend Framework With Apache ANT</title>
		<link>http://www.devpatch.com/2010/03/deploying-zend-framework-with-apache-ant/</link>
		<comments>http://www.devpatch.com/2010/03/deploying-zend-framework-with-apache-ant/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 23:39:55 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Application]]></category>
		<category><![CDATA[ZF 1.0]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=653</guid>
		<description><![CDATA[I recently wrote a quick ANT script to deploy a personal Zend Framework project and thought I would share the code. If you are just getting started with Agile development, ANT builds/deployments are a great first step with immediate benefits. The following example is bare-bones, it does not run tests or do anything complicated but [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote a quick ANT script to deploy a personal Zend Framework project and thought I would share the code. If you are just getting started with Agile development, ANT builds/deployments are a great first step with immediate benefits. The following example is bare-bones, it does not run tests or do anything complicated but it should give you something that works and can be built upon.</p>
<p>For more ANT goodness check out my other posts: <a href="http://blog.sternthal.org/2008/12/19/using-ant-to-deploy-drupal/">Deploying Drupal with ANT</a>, <a href="http://blog.sternthal.org/2008/12/23/css-cache-busting-and-drupal/">CSS Cache Busting &amp; Drupal</a>, <a href="http://blog.sternthal.org/2009/05/18/integrating-yuicompressor-into-ant-builds/"> Using YUI Compressor with ANT</a>.</p>
<h4>Methodology</h4>
<p>For my project I need ANT to do the following:</p>
<ul class="disc">
<li>Checkout From Subversion HEAD Or A Specific Revision Of The Project</li>
<li>Remove Files That Should Not Go To Production (Documentation)</li>
<li>Configure Zend For The Correct Environment</li>
<li>Securely Transfer Code To Production Server</li>
</ul>
<p>I think this is a very common use-case so&#8230; onto the code!<br />
<span id="more-653"></span></p>
<h4>Pre-Reqs</h4>
<ul class="disc">
<li><a href="http://ant.apache.org/">Apache ANT</a></li>
<li><a href="http://subclipse.tigris.org/svnant.html">SnvAnt</a> &#8211; Provides Subversion Interface To ANT</li>
<li><a href="http://ant.apache.org/">JSCH Jars</a> &#8211; Provides SCP To ANT</li>
</ul>
<p>I am using Zend 1.10. In this example the only Zend dependency is using Zend_Application with production/development sections in your application.ini file. </p>
<h4>Setup Zend</h4>
<p>Setting up Zend is the easy part. We need a folder within our project to hold two files:</p>
<ul class="disc">
<li>build.xml &#8211; the file that contains all the ant tasks</li>
<li>build.properties.prod &#8211; the file that contains the properities required by build.xml</li>
</ul>
<p>We also need a .htaccess file that will be used in production.  The important part of this file is APPLICATION_ENV, this value is used by Zend to determine what environment it is in and what settings to use from your application.ini file.</p>
<p>Simply copy the .htaccess file that is already there, and rename to htaccess.prod. Edit the file and change<br />
<b>SetEnv APPLICATION_ENV development</b> to <b>SetEnv APPLICATION_ENV production</b>.</p>
<p>The below screenshot shows how I have set things up. Orange arrows are the important parts.</p>
<p><a class="lb" href="/wp-content/uploads/2010/03/zend-ant.gif"><img src="/wp-content/uploads/2010/03/zend-ant.gif" alt="" title="zend-ant" width="327" height="356" class="alignnone size-full wp-image-663" /></a></p>
<h4>build.properties.prod</h4>
<p>Below is my example properties file. Included are settings for:</p>
<ul class="disc">
<li>Locations of Subversion Jar Files</li>
<li>Subversion Login Information</li>
<li>Temp File Locations</li>
<li>Path To Comment File</li>
<li>Production Server Information (user/pwd are entered a runtime)</li>
</ul>
<p>The path to the comment file is where we will instruct ANT to insert the version information and timestamp. This allows us to &#8220;view source&#8221; on the production site and see the revision information and date/time of last build.</p>
<p>You need to customize all values for your own environment, the comments within the file should help explain what you need to do.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
</pre></td><td class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># build.properties</span>
<span style="color: #808080; font-style: italic;"># This file is referenced by the  build.xml file.</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># External jars needed for Subversion</span>
<span style="color: #808080; font-style: italic;"># Example:</span>
<span style="color: #808080; font-style: italic;"># lib.dir=/usr/local/ant/lib</span>
<span style="color: #808080; font-style: italic;"># svnant.jar=${lib.dir}/svnant.jar</span>
<span style="color: #808080; font-style: italic;"># svnClientAdapter.jar=${lib.dir}/svnClientAdapter.jar</span>
<span style="color: #808080; font-style: italic;"># svnjavahl.jar=${lib.dir}/svnjavahl.jar</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">lib.dir</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/usr/share/ant/lib</span>
<span style="color: #000080; font-weight:bold;">svnant.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">$<span style="">&#123;</span>lib.dir<span style="">&#125;</span>/svnant.jar</span>
<span style="color: #000080; font-weight:bold;">svnClientAdapter.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">$<span style="">&#123;</span>lib.dir<span style="">&#125;</span>/svnClientAdapter.jar</span>
<span style="color: #000080; font-weight:bold;">svnjavahl.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">$<span style="">&#123;</span>lib.dir<span style="">&#125;</span>/svnjavahl.jar</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># Subversion Login and URL</span>
<span style="color: #808080; font-style: italic;"># Example:</span>
<span style="color: #808080; font-style: italic;"># svnant.repository.user=username</span>
<span style="color: #808080; font-style: italic;"># svnant.repository.passwd=password</span>
<span style="color: #808080; font-style: italic;"># svnant.project.url=svn://XXX.XXX.XX.XX/path/to/project</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">svnant.repository.user</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">username</span>
<span style="color: #000080; font-weight:bold;">svnant.repository.passwd</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">password</span>
<span style="color: #000080; font-weight:bold;">svnant.project.url</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">svn://path.to.your.repo.project/trunk</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># Build Folder Locations</span>
<span style="color: #808080; font-style: italic;"># Example:</span>
<span style="color: #808080; font-style: italic;"># temp.dir=temp</span>
<span style="color: #808080; font-style: italic;"># build.dir=release</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">temp.dir</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/temp/scratch</span>
<span style="color: #000080; font-weight:bold;">build.dir</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/temp/release</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># Comment File Location, Where we output revision information requires tokens</span>
<span style="color: #808080; font-style: italic;"># in file: @build-revision@</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">comment.file.path</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/your-app/views/scripts/common/footer.phtml</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
<span style="color: #808080; font-style: italic;"># Deploy Location and Login</span>
<span style="color: #808080; font-style: italic;"># Example:</span>
<span style="color: #808080; font-style: italic;"># deploy.server=sugababes.com</span>
<span style="color: #808080; font-style: italic;"># deploy.path=/path/to/directory</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># -----------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">deploy.server</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">productionserver.com</span>
<span style="color: #000080; font-weight:bold;">deploy.path</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/full/path</span></pre></td></tr></table></div>

<h4>build.xml</h4>
<p> Contained within the build XML file are all the tasks used by ANT. First the tasks we will actually run:</p>
<ul class="disc">
<li>build-release : checksout and builds release (good for testing without sending to production)</li>
<li>deploy-release : deploys release and expands on target server</li>
<li>build-deploy : a short cut that builds and releases to production in one step (most commonly used)</li>
</ul>
<p>The above relies on the following ANT tasks to do the actual work:</p>
<ul class="disc">
<li>clean : clean up from any previous builds</li>
<li>checkout : checkout project from subversion</li>
<li>cleanRelease : removes folders that should not be deployed (documentation, the build folder)</li>
<li>populate : copy and rename the correct htaccess file, remove old one</li>
<li>revision : find token in file, replace with revision number and date/time stamp</li>
<li>zip release : compress file </li>
<li>deploy : use scp to transfer zip file</li>
<li>extractConfigure : delete existing files on target server, extract zip file on target server.</li>
</ul>
<p><em>* Apologies for the weird indentation below, the wordpress plugin for syntax coloring is mangling tabs</em>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DevPatch Client App&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;usage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    Build File For DevPatch Client Zend Deployment - checkout from subversion,
    cleans release, creates zip file and scp file to the correct environment.
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 	
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;build.properties.${env}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Subversion                                            --&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 	
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;project.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${svnjavahl.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${svnant.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${svnClientAdapter.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;typedef</span> <span style="color: #000066;">resource</span>=<span style="color: #ff0000;">&quot;org/tigris/subversion/svnant/svnantlib.xml&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;project.classpath&quot;</span>  <span style="color: #000000; font-weight: bold;">/&gt;</span></span>  
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;checkout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svn</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${svnant.repository.user}&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${svnant.repository.passwd}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;checkout</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;${svnant.project.url}&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">revision</span>=<span style="color: #ff0000;">&quot;${revision}&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">destPath</span>=<span style="color: #ff0000;">&quot;${temp.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/svn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Utility &amp; Clean Up                                    --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 		
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${temp.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
&nbsp;
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;cleanRelease&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${temp.dir}/build&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${temp.dir}/db&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>	
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${temp.dir}/docs&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>		 
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Replace Token In Footer With Revision Number          --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 	
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;revision&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;status</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${temp.dir}&quot;</span> <span style="color: #000066;">revisionProperty</span>=<span style="color: #ff0000;">&quot;Revision&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/svn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tstamp</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;replace</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${temp.dir}${comment.file.path}&quot;</span> </span>
<span style="color: #009900;">               <span style="color: #000066;">token</span>=<span style="color: #ff0000;">&quot;@build-revision@&quot;</span> </span>
<span style="color: #009900;">               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Revision: ${Revision}, Built On: ${DSTAMP} : ${TSTAMP}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Copy/rename correct htaccess file. Remove existing    --&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- file                                                  --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 	
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;populate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${temp.dir}/public/clients-admin/.htaccess&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>    
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${temp.dir}/public/clients-admin/htaccess.${env}&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${temp.dir}/public/clients-admin/.htaccess&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>	
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${temp.dir}/public/clients-admin/htaccess.${env}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>    
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>                  
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- zip release                                           --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 		
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;zipRelease&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${build.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zip</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${build.dir}/YOUR-FILE-NAME_${revision}.zip&quot;</span> </span>
<span style="color: #009900;">		     <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${temp.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- deploy to target server                                  --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 	
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scp</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${build.dir}/YOUR-FILE-NAME_${revision}.zip&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${user}@${deploy.server}:${deploy.path}&quot;</span> </span>
<span style="color: #009900;">			<span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${pass}&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">trust</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Extract and configure on target server, delete        --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- manually everything, create data folder        --&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- set correct dir permissions                           --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 	
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;extractConfigure&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sshexec</span> <span style="color: #000066;">host</span>=<span style="color: #ff0000;">&quot;${deploy.server}&quot;</span></span>
<span style="color: #009900;">        			  <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${user}&quot;</span></span>
<span style="color: #009900;">	              <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${pass}&quot;</span></span>
<span style="color: #009900;">	              <span style="color: #000066;">trust</span>=<span style="color: #ff0000;">&quot;yes&quot;</span></span>
<span style="color: #009900;">	              <span style="color: #000066;">command</span>=<span style="color: #ff0000;">&quot;cd ${deploy.path}; </span>
<span style="color: #009900;">	                      rm -R app-clients-admin;</span>
<span style="color: #009900;">	                      rm -R library;</span>
<span style="color: #009900;">	                      rm -R public;	</span>
<span style="color: #009900;">	                      rm -R data;	   </span>
<span style="color: #009900;">	                      mkdir data;</span>
<span style="color: #009900;">	                      mkdir data/cache;</span>
<span style="color: #009900;">	                      mkdir data/session;	                                           </span>
<span style="color: #009900;">	                      chmod 775 data/cache;</span>
<span style="color: #009900;">	                      chmod 775 data/session;</span>
<span style="color: #009900;">                          unzip -o YOUR-FILE-NAME_${revision}.zip;</span>
<span style="color: #009900;">                          rm YOUR-FILE-NAME_${revision}.zip;   </span>
<span style="color: #009900;">                         &quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- Targets               				--&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- ===================================================== --&gt;</span> 			
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build-release&quot;</span> </span>
<span style="color: #009900;">			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Checksout and Build Release, Specify revision and environment (prod) </span>
<span style="color: #009900;">			             Example: ant build-release -Drevision=HEAD -Denv=prod&quot;</span> </span>
<span style="color: #009900;">			<span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean,checkout,cleanRelease,populate,revision,zipRelease&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy-release&quot;</span> </span>
<span style="color: #009900;">  			<span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Deploys Release and Expands on Target Server </span>
<span style="color: #009900;">  			             Example: ant deploy-release -Drevision=value -Denv=prod -Duser=value -Dpass=value&quot;</span></span>
<span style="color: #009900;">  			<span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;deploy,extractConfigure&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build-deploy&quot;</span> </span>
<span style="color: #009900;">  	      <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Checksout,Build, Deploys in One Step</span>
<span style="color: #009900;">  	                   Example: ant build-deploy -Drevision=value -Denv=prod -Duser=value -Dpass=value&quot;</span></span>
<span style="color: #009900;">  			<span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean,checkout,cleanRelease,populate,revision,zipRelease,deploy,extractConfigure&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>  			
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;usage&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;  Execute 'ant -projecthelp' for build file help.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;  Execute 'ant -help' for Ant help.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>   	
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>cleanRelease and extractConfigure is where you will likely need to do the most customizing. For example during extractConfigure I remove my data directory where I store cache/session data then re-create. This is something specific to my application.</p>
<p>When running the ANT targets you supply the revision (or HEAD) the target environment (just prod in the example), and the username/password for your production environment:</p>
<p>Example: ant build-deploy -Drevision=HEAD -Denv=prod -Duser=foo -Dpass=foobar</p>
<p>The env variable is used to specify which properties file to use and which htaccess file to copy. If you supplied <strong>qa,</strong> ANT would look for <strong>build.properties.qa</strong> and <strong>htaccess.qa</strong>.</p>
<p>Running <strong>ant -projecthelp</strong> will show you the 3 main targets and examples of their usage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/03/deploying-zend-framework-with-apache-ant/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Debugging Front End Code, New Tools</title>
		<link>http://www.devpatch.com/2010/03/debugging-front-end-code-new-tools/</link>
		<comments>http://www.devpatch.com/2010/03/debugging-front-end-code-new-tools/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 18:00:00 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=623</guid>
		<description><![CDATA[Front End debugging tools have come a long way. Below are some of the tools I am using on a daily basis to debug and fine-tune my front end code. Firebug &#8211; Firefox Plugin Firebug is my workhorse for general debugging. It has the standard set of CSS inspectors and a robust net monitor. The [...]]]></description>
			<content:encoded><![CDATA[<p>Front End debugging tools have come a long way. Below are some of the tools I am using on a daily basis to debug and fine-tune my front end code.</p>
<h4>Firebug &#8211; Firefox Plugin</h4>
<p><a class="lb" href="http://www.devpatch.com/wp-content/uploads/2010/03/firebug.png"><img src="http://www.devpatch.com/wp-content/uploads/2010/03/firebug-300x96.png" alt="" title="firebug" width="300" height="96" class="alignnone size-medium wp-image-624" /></a></p>
<p><a href="http://getfirebug.com/">Firebug</a> is my workhorse for general debugging. It has the standard set of CSS inspectors and a robust net monitor. The net monitor is essential for debugging XHR requests. I could not develop Ajax applications without it.</p>
<p><span id="more-623"></span></p>
<h4>Chrome &#8211; Developer Tools</h4>
<p><a class="lb" href="http://www.devpatch.com/wp-content/uploads/2010/03/chrome.png"><img src="http://www.devpatch.com/wp-content/uploads/2010/03/chrome-300x138.png" alt="" title="chrome" width="300" height="138" class="alignnone size-medium wp-image-627" /></a></p>
<p>Google&#8217;s chrome browser comes with an amazing set of developer tools and is quickly replacing firebug in my toolkit. It has all the standard CSS inspectors and JS debuggers but goes a bit further than firebug. I was blown away when I discovered CPU profiling. This is a great way to sniff out memory leaks, really important if you are adding/removing DOM elements like a madman.</p>
<p>Also important to point out are the JS timeline tools, showing you a breakdown of loading, scripting, rendering while you are interacting with the web page. Another great tool for optimizing speed.</p>
<p><a class="lb" href="http://www.devpatch.com/wp-content/uploads/2010/03/timeline.png"><img src="http://www.devpatch.com/wp-content/uploads/2010/03/timeline-300x146.png" alt="" title="timeline" width="300" height="146" class="alignnone size-medium wp-image-633" /></a></p>
<h4>Pixel Perfect &#8211; Firefox Plugin</h4>
<p><a class="lb" href="http://www.devpatch.com/wp-content/uploads/2010/03/pixelperfect.png"><img src="http://www.devpatch.com/wp-content/uploads/2010/03/pixelperfect-300x111.png" alt="" title="pixelperfect" width="300" height="111" class="alignnone size-medium wp-image-629" /></a></p>
<p>The ultimate tool for making sure you have translated a design to HTML with pixel perfect accuracy. <a href="http://www.pixelperfectplugin.com/">Pixel Perfect</a> allows you to overlay an image onto a web page and manipulate it&#8217;s opacity. This makes it incredibly simple to compare a design mockup and your HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/03/debugging-front-end-code-new-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lectures on JavaScript History &amp; Future</title>
		<link>http://www.devpatch.com/2010/02/lectures-on-javascript-history-future/</link>
		<comments>http://www.devpatch.com/2010/02/lectures-on-javascript-history-future/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 01:10:05 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=616</guid>
		<description><![CDATA[Douglas Crockford is currently giving a series of lectures on JavaScript. So far there are 2 and they are fascinating: http://developer.yahoo.com/yui/theater/]]></description>
			<content:encoded><![CDATA[<p>Douglas Crockford is currently giving a series of lectures on JavaScript. So far there are 2 and they are fascinating:</p>
<p><a href="http://developer.yahoo.com/yui/theater/">http://developer.yahoo.com/yui/theater/</a></p>
<p><a class="lb" href="http://www.devpatch.com/wp-content/uploads/2010/02/crockonjs.png"><img src="http://www.devpatch.com/wp-content/uploads/2010/02/crockonjs-300x168.png" alt="" title="crockonjs" width="300" height="168" class="alignnone size-medium wp-image-618" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/lectures-on-javascript-history-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load Routes From Routes.ini Config File In Zend Application Bootstrap</title>
		<link>http://www.devpatch.com/2010/02/load-routes-from-routes-ini-config-file-in-zend-application-bootstrap/</link>
		<comments>http://www.devpatch.com/2010/02/load-routes-from-routes-ini-config-file-in-zend-application-bootstrap/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:15:54 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Application]]></category>
		<category><![CDATA[ZF 1.0]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=592</guid>
		<description><![CDATA[I spent waaaay to many hours trying to load routes via a config file in Zend Framework 1.10 and I think this might be a problem with the documentation I was following on the Zend Framework site. More on that later, let&#8217;s get to my solution first. Here is the use case I am addressing: [...]]]></description>
			<content:encoded><![CDATA[<p>I spent waaaay to many hours trying to load routes via a config file in Zend Framework 1.10 and I think this might be a problem with the documentation I was following on the Zend Framework site. More on that later, let&#8217;s get to my solution first.</p>
<p>Here is the use case I am addressing: <strong><em>I want to store routes in a .ini file and have this file loaded via the Application Bootstrap. Zend Application allows me to store these in the application.ini file but I have a large number and want to store them separately.</em></strong></p>
<p><span id="more-592"></span><br />
First create your routes.ini file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">configs/routes.ini</pre></div></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>production<span style="">&#93;</span></span>
routes.linkA.route <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;linkA&quot;</span>
routes.linkA.defaults.controller <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;linkB&quot;</span>
routes.linkA.defaults.action <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;linkBAction&quot;</span></pre></td></tr></table></div>

<p>Where <strong>linkA</strong> is the incoming route and <strong>linkB</strong> is the outgoing route</p>
<p>New let&#8217;s add the function to load this file in the Bootstrap. Add the following to your boostrap.php:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">protected <span style="color: #000000; font-weight: bold;">function</span> _initRewrite<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$front</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;">;</span>
    <span style="color: #000088;">$router</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$front</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config_Ini<span style="color: #009900;">&#40;</span>APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/configs/routes.ini'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'production'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      
    <span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addConfig</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'routes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>That&#8217;s it, everything should be working <img src='http://www.devpatch.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The above use case is addressed in the Zend Framework Documentation but I could not get their example to work:</p>
<p><a href="http://framework.zend.com/manual/en/zend.controller.router.html">http://framework.zend.com/manual/en/zend.controller.router.html</a></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Using Zend_Config with the RewriteRouter
Sometimes it is more convenient to update a configuration file with 
new routes than to change the code. This is possible via
the addConfig() method. 
&nbsp;
 . . .
&nbsp;
$config = new Zend_Config_Ini('/path/to/config.ini', 'production');
$router = new Zend_Controller_Router_Rewrite();
$router-&gt;addConfig($config, 'routes');</pre></div></div>

<p>No matter how hard I tried I could not get the above to work. It is very simple code but there are no instructions on where this can/should be run. Maybe this can&#8217;t be run from the bootstrap? I even wrote a plugin and but no matter what I tried I could not get this to work using <strong> Zend_Controller_Router_Rewrite()</strong>.</p>
<p>It is also possible that I completely mis-understood the documentation and got all mixed up, I struggle with Zend Documentation sometimes.</p>
<p>If you figure out how to do this using <strong> Zend_Controller_Router_Rewrite()</strong> please leave a comment it was driving me nuts!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/load-routes-from-routes-ini-config-file-in-zend-application-bootstrap/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing Node.Js On OS X 10.6</title>
		<link>http://www.devpatch.com/2010/02/installing-node-js-on-os-x-10-6/</link>
		<comments>http://www.devpatch.com/2010/02/installing-node-js-on-os-x-10-6/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 14:00:50 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Node.js]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=545</guid>
		<description><![CDATA[Updated May 7 2010, With Version 0.1.94 From GitHub Node.js is evented i/o for Google&#8217;s V8 Server Side JavaScript engine. For me . . . node.js means I can write apps that can handle tons of requests without having to learn/think about threads &#038; locks (all I know about threads is that they are scary [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Updated May 7 2010, With Version 0.1.94 From GitHub</strong></p>
<p>Node.js is evented i/o for <a href="http://code.google.com/p/v8/">Google&#8217;s V8 Server Side JavaScript engine</a>. For me . . . node.js means I can write apps that can handle tons of requests without having to learn/think about threads &#038; locks (all I know about threads is that they are scary and involve big books from O&#8217;reilly). </p>
<p>As a front-end developer the node.js approach is fantastic because I already think in terms of events and I love writing code in JavaScript. </p>
<p>Installing node.js on OS X is super-easy and the documentation on the <a href="http://nodejs.org/">node.js</a> site is great, but I figured I would write a step-by-step for OS X since I had just installed it for the first time. The node.js install includes Google&#8217;s V8 JS engine so no need to worry about installing that. </p>
<p><span id="more-545"></span> </p>
<h4>Download and Install Node.JS</h4>
<p>Get node.js from either github or download from the node.js site. If you need GIT for OS X you can grab the code from google <a href="http://code.google.com/p/git-osx-installer/">http://code.google.com/p/git-osx-installer/</a> and follow <a href="http://help.github.com/mac-git-installation/">GitHub&#8217;s install instructions</a>.</p>
<p><a href="http://github.com/ry/node">http://github.com/ry/node</a></p>
<p><a href="http://nodejs.org/#download">http://nodejs.org/#download</a></p>
<h4>Build &#038; Install</h4>
<p>Build node.js by following the instructions in the readme or just run:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>configure
 <span style="color: #c20cb9; font-weight: bold;">make</span> 
 <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>At this stage you may get an error about a missing compiler (I did). This can be caused by outdated developer tools or completely missing developer tools. In my case I did not run the Xcode install from my Snow Leopard Disc when I upgraded. So if you get this error grab your Snow Leopard DVD, put the kettle on, and run the Xcode installer. </p>
<p>You may also get a permissions error running make install, in this case just <strong>sudo make install</strong>.</p>
<h4>Test Server With Hello World</h4>
<p>Copy the test server code from below (taken directly from<a href=" http://nodejs.org"> http://nodejs.org</a>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> sys <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'sys'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    http <span style="color: #339933;">=</span> require<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    http.<span style="color: #660066;">createServer</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>req<span style="color: #339933;">,</span> res<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        setTimeout<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>
            res.<span style="color: #660066;">writeHead</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">200</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'Content-Type'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'text/plain'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            res.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Hello World<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2000</span><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: #660066;">listen</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">8000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
sys.<span style="color: #660066;">puts</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Server running at http://127.0.0.1:8000/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Run it with:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">node example.js</pre></div></div>

<p>And go the the following url in a browser:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://127.0.0.1:8000/</pre></div></div>

<p>You should see the text &#8220;hello world&#8221;. If you do congrats, node.js is installed!</p>
<p><img src="http://www.devpatch.com/wp-content/uploads/2010/02/Screen-shot-2010-02-07-at-11.41.06-AM.png" alt="" title="Screen shot 2010-02-07 at 11.41.06 AM" width="449" height="129" class="alignnone size-full wp-image-562" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/installing-node-js-on-os-x-10-6/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Managing CSS and JavaScript files within a Zend Framework App &#8211; A Different Approach: View Plugin</title>
		<link>http://www.devpatch.com/2010/02/view-plugin/</link>
		<comments>http://www.devpatch.com/2010/02/view-plugin/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 18:50:24 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Application]]></category>
		<category><![CDATA[ZF 1.0]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=455</guid>
		<description><![CDATA[Reading this article on the Zend Framework Blog Managing CSS and JavaScript files within a Zend Framework App, speaking personally as a front-end developer I would use a different system. In my approach loading up different CSS/JS files per controller is the exception not the rule. We load additional CSS/JS when we need to do [...]]]></description>
			<content:encoded><![CDATA[<p>Reading this article on the Zend Framework Blog <a href="http://devzone.zend.com/article/11760-Managing-CSS-and-JavaScript-files-within-a-Zend-Framework-App">Managing CSS and JavaScript files within a Zend Framework App</a>, speaking personally as a front-end developer I would use a different system.</p>
<p>In my approach loading up different CSS/JS files per controller is the exception not the rule. We load additional CSS/JS when we need to do something very special, for example a page with a flash file uploader. </p>
<p>I also think loading dependent files outside of the controller  can make it difficult for other developers to work on your code.  You can&#8217;t just look at the controller to see what other CSS/JS dependencies are being used, you need to check the file system.</p>
<p><strong>My approach is a View Plugin that manages a standard set of CSS/JS for every layout. Additional CSS/JS if needed are added in the controllers.</strong></p>
<p>Onto the code!<br />
<span id="more-455"></span></p>
<h4>View Plugin Example</h4>
<p>Here is my example view plugin from a recent project:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/app/plugins/View.php</pre></div></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td 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;">class</span> Plugin_View <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Plugin_Abstract <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> routeStartup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$view</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_View<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctype</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'XHTML1_STRICT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSeparator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' - '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FooBar.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'text/html; charset=utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/style.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addHelperPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ZendX/JQuery/View/Helper/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ZendX_JQuery_View_Helper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uiEnable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocalPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/jquery/jquery-1.3.2.min.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setUiLocalPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/jquery/jquery-ui-1.7.2.custom.min.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/css/smoothness/jquery-ui-1.7.2.custom.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">jQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJavascriptFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/js/interface-utils.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$viewRenderer</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Controller_Action_Helper_ViewRenderer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$viewRenderer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setView</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$view</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
        Zend_Controller_Action_HelperBroker<span style="color: #339933;">::</span><span style="color: #004000;">addHelper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$viewRenderer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The code in an example layout file:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/app/views/layout/login.php</pre></div></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>doctype() ?&gt;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;en&quot;</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>  
  <span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>headMeta() ?&gt;
  <span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>headLink() ?&gt;
  <span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>jQuery() ?&gt;        
  <span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>headScript() ?&gt; 
  <span style="color: #009900;">&lt;?<span style="color: #66cc66;">=</span> $this-&gt;</span>headTitle()?&gt; 
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span></pre></td></tr></table></div>

<p>As you can see from the above code, the Plugin handles everything needed for the HEAD area of the page, and it is all in one place.</p>
<h4>Adding Additional CSS/JS From A Controller</h4>
<p>If you need to add additional CSS/JS files, you can now do this in the controller &#8211; when needed. In the following example I need to add the dependencies for &#8220;Uploadify&#8221; a flash based multifile uploader.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/app/controllers/UploadController.php</pre></div></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> UploadController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
&nbsp;
    <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> indexAction<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;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/uploadify/uploadify.css'</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;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headScript</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/uploadify/swfobject.js'</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;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headScript</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/uploadify/jquery.uploadify.v2.1.0.min.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>          
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The above inserts the dependencies into the layout for this controller action only. Sweet!!</p>
<p>From my perspective this approach works better and I think from a code organization structure it is cleaner. Any special CSS/JS can be added on a per-controller or  per-controller-action basis and it will be very clear to other developers what is being loaded and where.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/view-plugin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Painless EOT Font Generation With FontSquirrel</title>
		<link>http://www.devpatch.com/2010/02/painless-eot-font-generation-with-fontsquirrel/</link>
		<comments>http://www.devpatch.com/2010/02/painless-eot-font-generation-with-fontsquirrel/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 01:02:10 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.devpatch.com/?p=480</guid>
		<description><![CDATA[So you want to use @font-face to add some fancy fonts to your site. Well there is that pesky problem of IE needing a specific font type. Until recently you had to use Microsoft&#8217;s WEFT tool to generate the right files. Personally I&#8217;d rather stick needles into my eyeballs than use this awful program, luckily [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to use @font-face to add some fancy fonts to your site. Well there is that pesky problem of IE needing a specific font type. Until recently you had to use Microsoft&#8217;s WEFT tool to generate the right files. Personally I&#8217;d rather stick needles into my eyeballs than use this awful program, luckily some online tools have sprung up to ease the pain.<br />
<span id="more-480"></span></p>
<p><a href="http://www.fontsquirrel.com">Font Squirrel</a> has a great online conversion tool that handles generating the fonts/CSS and everything for you. All you need is the TrueType or OpenType version of the font.</p>
<p><a href="http://www.fontsquirrel.com/fontface/generator">http://www.fontsquirrel.com/fontface/generator</a></p>
<p>It will even base64 encode the font, allowing you embed the entire font into your CSS (rather than having a file) to avoid the &#8220;text flashing/switching&#8221; that can occur.</p>
<p>Be aware that you will need to encode all variants of the font you want to use, including bold/italic so keep an eye on your file size.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/painless-eot-font-generation-with-fontsquirrel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DevPatch.com Launched</title>
		<link>http://www.devpatch.com/2010/02/devpatch-launch/</link>
		<comments>http://www.devpatch.com/2010/02/devpatch-launch/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 23:47:06 +0000</pubDate>
		<dc:creator>Benjamin</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://devpatch-blog.local.com:8888/?p=39</guid>
		<description><![CDATA[Announcing the launch of DevPatch.com! I will be using the blog section to share technical tips &#038; tricks focusing on: XHTML &#038; HTML 5 jQuery Server Side JavaScript Zend Framework Technical Project Management Special thanks to Lesley Marker @ Marker Design for developing the DevPatch logo/branding.]]></description>
			<content:encoded><![CDATA[<p>Announcing the launch of DevPatch.com!</p>
<p>I will be using the blog section to share technical tips &#038; tricks focusing on:</p>
<ul class="disc">
<li>XHTML &#038; HTML 5</li>
<li>jQuery</li>
<li>Server Side JavaScript</li>
<li>Zend Framework</li>
<li>Technical Project Management</li>
</ul>
<p>Special thanks to Lesley Marker @ <a href="http://www.markerdesign.com">Marker Design</a> for developing the DevPatch logo/branding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devpatch.com/2010/02/devpatch-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
