<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Gerton's Corner</title>
	<atom:link href="http://gertonscorner.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gertonscorner.wordpress.com</link>
	<description>Just some thoughts, nothing else…</description>
	<lastBuildDate>Thu, 06 Oct 2011 19:24:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gertonscorner.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Gerton's Corner</title>
		<link>http://gertonscorner.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gertonscorner.wordpress.com/osd.xml" title="Gerton&#039;s Corner" />
	<atom:link rel='hub' href='http://gertonscorner.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Zend Framework: MongoDB session saveHandler</title>
		<link>http://gertonscorner.wordpress.com/2011/05/31/zend-framework-mongodb-session-savehandler/</link>
		<comments>http://gertonscorner.wordpress.com/2011/05/31/zend-framework-mongodb-session-savehandler/#comments</comments>
		<pubDate>Tue, 31 May 2011 20:11:43 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[noSQL]]></category>
		<category><![CDATA[session save handler]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=150</guid>
		<description><![CDATA[In this third part about the Zend Framework i am diving into the world of Zends implementation for sessions. Sessions are used to provide a way to save data between different page requests. The Zend Framework has an easy way of managing sessions by creating a new instance of the Zend_Session_Namespace class. This class provides [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=150&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this third part about the <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> i am diving into the world of <a title="Zend_Session" href="http://framework.zend.com/manual/en/learning.multiuser.sessions.html" target="_blank">Zends implementation</a> for sessions. Sessions are used to provide a way to save data between different page requests.</p>
<p>The Zend Framework has an easy way of managing sessions by creating a new instance of the Zend_Session_Namespace class. This class provides an easy to use API on the Zend_Session managed superglobal $_SESSION. By default the session data is saved to the filesystem which works perfect for simple applications using a single webserver but will be more problematic when multiple webservers are used all with their own filesystem.</p>
<p>A solution for this problem is saving the session data to a central database which is available to all webservers. The Zend Framework provides a class which can be used for this: <a title="Zend session advanced usage" href="http://framework.zend.com/manual/en/learning.multiuser.sessions.html#learning.multiuser.sessions.advanced-usage" target="_blank">Zend_Session_SaveHandler_DbTable</a> which can be configured completely as a resource within the application.ini file.</p>
<p>Using the database as a central source for session data gives some other worries though:</p>
<ul>
<li>You have to make sure the database will be available at all time</li>
<li>Clustering databases for high availability is something not all persons have knowledge on</li>
<li>Managing the session tables within these databases poses some headaches when changes to the existing table are needed.</li>
</ul>
<p>Another approach is using a memory based store like <a title="Session store in memcache" href="http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/" target="_blank">memcache</a>, but in this post i would like to use the &#8220;new&#8221; kid in town called <a title="MongoDB" href="http://www.mongodb.org/" target="_blank">MongoDB</a>, a scalable, high-performance, open source, document-oriented database. For this we are going to write a new session save handler for Zend Framework called GcLib_Zend_Session_SaveHandler_MongoDb. The source of this class can be downloaded <a title="Implementation of a session savehandler for MongoDB" href="http://gertonscorner.googlecode.com/svn/trunk/phplib/GcLib/Zend/Session/SaveHandler/MongoDb.php" target="_blank">here</a>.</p>
<p><span id="more-150"></span>We start by creating the class <em>GcLib_Zend_Session_SaveHandler_MongoDb</em> implementing the interface <em>Zend_Session_SaveHandler_Interface</em>. This interface contains six methods we need to implement:</p>
<ol>
<li><strong>open($save_path, $session_name)</strong>: This method should open a connection to MongDB and return a boolean indicating its success. In our case we do not really need the parameters for save path and session so we ignore the values passed into the method.</li>
<li><strong>close()</strong>: This method should normally close the connection you opened in the open() method, but for convenience we just return true.</li>
<li><strong>read($id)</strong>: This method has a parameter containing the session id. With this id we will find the session data in MongoDB. Beware, this function should alway return a literal, so never return NULL or false when no session data is returned from the database!</li>
<li><strong>write($id, $data)</strong>: This method actually stores the session data in MongoDB. The id parameter contains the session id (which is the same as the value kept in the session cookie). The data parameter contains the serialized session data. These values are both stored in a MongoDB document together with a lifetime property containing the acces time. The method returns a boolean indicating its success.</li>
<li><strong>destroy($id)</strong>: This method removes the session data and returns also a boolean indicating its success.</li>
<li><strong>gc($maxlifetime)</strong>: This methods behaves as the garbage collector and removes sessions which are stale.</li>
</ol>
<div>Last method i will discuss is the constructor for the save handler class. The constructor has one parameter which expects a Zend_Config instance or an array containing the options for connecting to MongoDB. One of the options is &#8220;servers&#8221;, which holds the MongoDB server(s) to connect to. The other options provided by the parameter will be used as optional connect options which are more explained <a title="PHP MongoDB connect options" href="http://www.php.net/manual/en/mongo.connecting.php" target="_blank">here</a>.</div>
<blockquote>
<div>Note: For now the database and collection are hardcoded: db=&#8221;php&#8221;, collection=&#8221;sessions&#8221;</div>
</blockquote>
<p><strong>Zend configuration of the MongoDB save handler</strong></p>
<div>To use the MongoDB save handler we add the following line to the application.ini file:</div>
<p><code>resources.session.saveHandler.class = "GcLib_Zend_Session_SaveHandler_MongoDb"</code></p>
<div>With this single resource line Zend_Session will now use our save handler class. Add the following resource line to connect to a single MongoDB instance:</div>
<p><code>resources.session.saveHandler.options.servers = "localhost:27017"</code></p>
<div>The &#8220;servers&#8221; resource  option will hold the MongoDB connect string, which is localhost using the default port 27017. It is possible to connect to multiple servers by adding more host:port entries separated by commas. When the MongoDB is started as a standalone server it is advisable to add the &#8220;persist&#8221; option line like below to use a persistent connection (using the name &#8220;x&#8221;):</div>
<p><code>resources.session.saveHandler.options.persist = "x"</code></p>
<div>It is also possible to connect to a set of MongoDB servers started in a replication set. Read the MongoDB documentation for a <a title="MongoDB replication setup" href="http://www.mongodb.org/display/DOCS/Replica+Set+Tutorial" target="_blank">tutorial</a> on howto setup this configuration. For connecting to the primary, remove the persist option and add the following option line to application.ini:</div>
<p><code>resources.session.saveHandler.options.replicaSet = "true"</code></p>
<div>Just play around by creating a new php session and terminating one of the servers within the replicated set: failover at your fingertips.</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=150&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2011/05/31/zend-framework-mongodb-session-savehandler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
		<item>
		<title>JQuery Inline-Field-Label plugin: a better approach</title>
		<link>http://gertonscorner.wordpress.com/2010/08/30/jquery-inline-field-label-plugin-a-better-approach-2/</link>
		<comments>http://gertonscorner.wordpress.com/2010/08/30/jquery-inline-field-label-plugin-a-better-approach-2/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 13:56:35 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[inline field labels]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=140</guid>
		<description><![CDATA[There are several  solutions available on the internet for implementing labels inside a text field as shown in the example screenshot below. Most of these implementations use the .focus() and .blur() functions to add/empty the input value with the label. This approach has some drawbacks though: Submitting the form will submit the label when no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=140&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are several  solutions available on the internet for implementing labels inside a text field as shown in the example screenshot below.</p>
<div id="attachment_141" class="wp-caption aligncenter" style="width: 339px"><a href="http://gertonscorner.files.wordpress.com/2010/08/inline-form-labels.png"><img class="size-full wp-image-141" title="inline-form-labels" src="http://gertonscorner.files.wordpress.com/2010/08/inline-form-labels.png?w=329&#038;h=85" alt="Example of inline form labels" width="329" height="85" /></a><p class="wp-caption-text">Example of inline form labels</p></div>
<p>Most of these implementations use the .focus() and .blur() functions to add/empty the input value with the label. This approach has some drawbacks though:</p>
<ul>
<li>Submitting the form will submit the label when no custom data is entered.</li>
<li>When a input field needs focus on page loading then the label is never shown.</li>
</ul>
<p>To overcome these problems i created a JQuery plugin called inFieldLabel which adds an extra span element containing the label value and with some css this span element is projected over the input text field.<br />
<code>/* Inline Label class*/<br />
span.inline-label {<br />
position: absolute;<br />
display: none;<br />
}<br />
</code></p>
<p>When you start typing the span element is hided.</p>
<p>Usage:</p>
<p>1) Using default label text<br />
<code>$("#test1").inFieldLabel();</code></p>
<p>2) Using custom label text<br />
<code>$("#test1").inFieldLabel({labelText:"Type your text here..."});</code></p>
<p>3) Using an attribute value of the input text field as label text (eg. &#8220;title&#8221;)<br />
<code>$("#test1").inFieldLabel({useAttribute:"title"});</code></p>
<p>The full source code for this plugin can be downloaded <a title="inFieldLabel JQuery plugin" href="http://gertonscorner.googlecode.com/svn/trunk/jquery/plugins/inFieldLabel/jquery.inFieldLabel.js">here</a> (updated). An example of its usage can be seen <a title="Demo jQuery plugins" href="http://gertonscorner.googlecode.com/svn/trunk/jquery/demo.html" target="_blank">here</a> (updated) or can be downloaded <a title="inFieldLabel example" href="http://gertonscorner.googlecode.com/files/inFieldLabelExample.zip">here</a> as a packaged zip file (not updated).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=140&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2010/08/30/jquery-inline-field-label-plugin-a-better-approach-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>

		<media:content url="http://gertonscorner.files.wordpress.com/2010/08/inline-form-labels.png" medium="image">
			<media:title type="html">inline-form-labels</media:title>
		</media:content>
	</item>
		<item>
		<title>CKEditor On Air: Part 2</title>
		<link>http://gertonscorner.wordpress.com/2010/08/02/ckeditor-on-air-part-2/</link>
		<comments>http://gertonscorner.wordpress.com/2010/08/02/ckeditor-on-air-part-2/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 18:24:48 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CKEditor]]></category>
		<category><![CDATA[ckeditor plugin]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=133</guid>
		<description><![CDATA[In the first part of this serie i explained the steps needed to run the CKEditor in the Adobe Air runtime and how to load data from actionscript to the CKEditor instance running in Air. This part explains how to send the data from the CKEditor instance back to the Air application, using a new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=133&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a title="CKEditor On Air" href="http://gertonscorner.wordpress.com/2010/07/15/ckeditor-on-air/" target="_self">first part</a> of this serie i explained the steps needed to run the <a title="CKEditor" href="http://ckeditor.com/" target="_blank">CKEditor</a> in the Adobe Air runtime and how to load data from actionscript to the CKEditor instance running in Air.</p>
<p>This part explains how to send the data from the CKEditor instance back to the Air application, using a new CKEditor plugin called airsave. The sources for this part are available as an <a title="CKEditorOnAir_Update.zip download" href="http://gertonscorner.googlecode.com/files/CKEditorOnAir_Update.zip" target="_self">update</a> to the sources of <a title="CKEditor On Air" href="http://gertonscorner.wordpress.com/2010/07/15/ckeditor-on-air/" target="_self">part 1</a>.</p>
<p><span id="more-133"></span>It all starts with a new CKEditor plugin, &#8220;airsave&#8221;. For this a new directory airsave is created within the ckeditor\_source\plugins directory. In this directory a new file plugin.js is created where i copied the content from the standard save plugin with the following change to the execute function:<br />
<code>exec : function( editor ) {<br />
// When executing "fire" event "airSave" containing the editor data<br />
editor.fire( 'airSave', editor.getData() );<br />
}</code></p>
<p>After all changes are applied, the plugin is registered to the CKEditor by adding the following line to the \ckeditor\config.js file:</p>
<p><code>config.extraPlugins = 'airsave';</code></p>
<p>In the same file the newly created AirSave button is added to the toolbar.</p>
<p>When the AirSave button is pressed an event called &#8220;airSave&#8221; containing the html content of the editor is fired and this event can be catched by registering an event listener with a callback function to the CKEditor instance:</p>
<p><code>var aireditor = CKEDITOR.replace( 'editor' );<br />
// Add Listener for the "airSave" event...<br />
aireditor.on( 'airSave', function( evt )	{<br />
window.parentSandboxBridge.saveContent( evt.data );<br />
} );</code></p>
<p>(see src\assets\ckeditor\aireditor.html for the complete code).</p>
<p>The event listener is registered in the non-sandboxed part of the Air application, so i need to call the saveContent function in the sandboxed src\assets\ckeditor\index.html file using the parentSandboxBridge.</p>
<p>This &#8220;sandboxed&#8221; saveContent function is calling another javascript function sendContentToAS3 which is linked to an actionscript function in the onApplicationCompleteHandler function during application start up.</p>
<p>Download the <a title="CKEditorOnAir_Update.zip download" href="http://gertonscorner.googlecode.com/files/CKEditorOnAir_Update.zip" target="_self">CKEditorOnAir_Update.zip</a> file for full example code.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=133&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2010/08/02/ckeditor-on-air-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
		<item>
		<title>CKEditor On Air</title>
		<link>http://gertonscorner.wordpress.com/2010/07/15/ckeditor-on-air/</link>
		<comments>http://gertonscorner.wordpress.com/2010/07/15/ckeditor-on-air/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:45:42 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CKEditor]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=123</guid>
		<description><![CDATA[Although Adobe has provided a new (opensource) Text Layout Framework with the release of Flashplayer 10 and Adobe AIR 1.5, i am more curious whether it was possible to use a javascript editor like the CKEditor within for example Adobe AIR. After some searching on the web, i found out that it should be possible [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=123&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Although <a title="Adobe" href="http://www.adobe.com" target="_blank">Adobe</a> has provided a new (opensource) <a title="Adobe Text Layout Framework" href="http://opensource.adobe.com/wiki/display/tlf/Text+Layout+Framework" target="_blank">Text Layout Framework</a> with the release of Flashplayer 10 and Adobe AIR 1.5, i am more curious whether it was possible to use a javascript editor like the <a title="CKEditor" href="http://ckeditor.com" target="_blank">CKEditor</a> within for example Adobe AIR.</p>
<p>After some searching on the web, i found out that it should be possible to use javascript/html editors like CKEditor within Adobe AIR, but little info was available on how to do that.</p>
<p>So this blog post describes the steps i have made to successfully integrate the CKEditor with Adobe AIR, called CKEditorOnAir. Download <a title="CKEditorOnAir.zip download" href="http://gertonscorner.googlecode.com/files/CKEditorOnAir.zip" target="_self">CKEditorOnAir.zip</a> for full example code.</p>
<p><span id="more-123"></span>Although the code samples should work within Adobe AIR 1.5 i am using Adobe AIR 2.0 for this example. Furthermore i have used a <a title="CKEditor adobeair branche" href="http://dev.ckeditor.com/browser/CKEditor/branches/features/adobeair" target="_blank">branche</a> of the CKEditor due to the fact that the current release of CKEditor 3.3.x has some difficulties with the Adobe AIR security constraints. CKEditor developers are working on these issues, and there efforts so far can be found <a title="CKEditor adobeair branche" href="http://dev.ckeditor.com/browser/CKEditor/branches/features/adobeair" target="_blank">here</a>.</p>
<p>Below is a screenshot of the application, which contains a textarea field for editing raw html content, a button for loading the content from the textarea to the CKEditor instance.</p>
<p style="text-align:left;">
<div id="attachment_124" class="wp-caption aligncenter" style="width: 310px"><a href="http://gertonscorner.files.wordpress.com/2010/07/ckeditoronair_large.png"><img class="size-medium wp-image-124" title="CKEditorOnAir" src="http://gertonscorner.files.wordpress.com/2010/07/ckeditoronair.png?w=300&#038;h=215" alt="CKEditorOnAir screenshot" width="300" height="215" /></a><p class="wp-caption-text">CKEditorOnAir application screenshot</p></div>
<p style="text-align:left;">I will not go into detail here about the configuration settings (toolbar, color etc.) used for the CKEditor instance, but you can find them in the &#8220;src/assets/ckeditor/config.js&#8221; file within the <a title="CKEditorOnAir.zip download" href="http://gertonscorner.googlecode.com/files/CKEditorOnAir.zip" target="_self">CKEditorOnAir.zip</a>.</p>
<p style="text-align:left;">So now you know what the result will be, lets dive into the wonder world of application sandboxes, non-application sandboxes and the bridges which connects them.</p>
<p style="text-align:left;">Because the CKEditor sources are doing all kind of wonderfull javascript things which are prohibited by Adobe AIR it is not possible to load a html file with a CKEditor instance directly with the actionscript HTMLLoader class into the AIR runtime. If you want to know more about these Adobe AIR security constraints, i suggest to read some Adobe documents about this <a title="Cross-scripting content in different security sandboxes" href="http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f08.html" target="_blank">topic</a>.</p>
<p style="text-align:left;">Two files are necessary to load a CKEditor into Adobe AIR and communicate with the CKEditor API from the AIR API and vice versa:</p>
<ol>
<li>index.html (running in the application sandbox)</li>
<li>aireditor.html (running in the non-application sandbox)</li>
</ol>
<p>The index.html file is loaded by the actionscript class HTMLLoader and from within this file you have access to the complete Adobe AIR API. You can also call javascript functions within this file directly from actionscript.</p>
<p>The aireditor.html file is loaded from the (sandboxed) index.html file using an iframe and has access to all kind of features which is needed by the CKEditor including the CKEditor API.</p>
<p>Two separate worlds, so how do we communicate between those worlds? Fortunately Adobe AIR creates two interfaces on every loaded html window: parentSandboxBridge and the childSandboxBridge.</p>
<p>This way we can expose javascript functions from the index.html to the loaded contentWindow of the iframe, but also call javascript functions which are exposed by the aireditor.html file in the same way.</p>
<p>aireditor.html example:<br />
<code>var childBridgeInterface = {};<br />
childBridgeInterface.setContent = function(content) {<br />
aireditor.setData(content);<br />
}<br />
window.childSandboxBridge = childBridgeInterface;</code></p>
<p>The above &#8220;setContent&#8221; function can now be called from index.html file by using the childSandboxBridge of the iframe contentWindow:<br />
<code>document.getElementById("sandbox").contentWindow.childSandboxBridge.setContent(content);</code></p>
<p>Check the complete sources of index.html and aireditor.html in the <a title="CKEditorOnAir.zip download" href="http://gertonscorner.googlecode.com/files/CKEditorOnAir.zip">CKEditorOnAir.zip</a>. Both files can be found in the &#8220;src/assets/ckeditor&#8221; location.</p>
<p>In another post i will explain howto send the content from the CKEditor instance to actionscript using a CKEditor save plugin. Have fun!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=123&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2010/07/15/ckeditor-on-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>

		<media:content url="http://gertonscorner.files.wordpress.com/2010/07/ckeditoronair.png?w=300" medium="image">
			<media:title type="html">CKEditorOnAir</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP OCI extension for Oracle: Execution Mode</title>
		<link>http://gertonscorner.wordpress.com/2010/05/11/php-oci-extension-for-oracle-execution-mode/</link>
		<comments>http://gertonscorner.wordpress.com/2010/05/11/php-oci-extension-for-oracle-execution-mode/#comments</comments>
		<pubDate>Tue, 11 May 2010 19:43:22 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[auto-commit]]></category>
		<category><![CDATA[execution mode]]></category>
		<category><![CDATA[OCI extension]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=111</guid>
		<description><![CDATA[In the PHP world it is common to use an open source database like MySQL for persisting data. But this post is about a less common used database &#8211; Oracle &#8211; and especially the execution mode found in the PHP OCI extension for Oracle. The PHP OCI extension for Oracle provides two execution modes: OCI_DEFAULT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=111&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a title="PHP" href="http://www.php.net/">PHP</a> world it is common to use an open source database like <a title="MySQL" href="http://www.mysql.com/">MySQL</a> for persisting data. But this post is about a less common used database &#8211; <a href="http://www.oracle.com/">Oracle</a> &#8211; and especially the execution mode found in the PHP OCI extension for Oracle.</p>
<p>The PHP OCI extension for Oracle provides two execution modes: OCI_DEFAULT and OCI_COMMIT_ON_SUCCESS. The default execution mode is OCI_COMMIT_ON_SUCCESS and this mode will automatically commit <em>any</em> (successful) SQL statement. The OCI_DEFAULT mode is mostly used when multiple statements are executed in one batch and should be committed (or rolled back) as one transaction.</p>
<p>Although most PHP developers (and PHP frameworks like <a href="http://framework.zend.com/">Zend Framework</a>) are using the OCI_COMMIT_ON_SUCCESS execution mode as their default mode, I personally think that you should not use this mode: <em>Using the OCI_COMMIT_ON_SUCCESS mode will auto-commit any successful SQL statement, even when a SELECT statement is executed!</em></p>
<p><span id="more-111"></span><br />
When selecting data in Oracle the results will probably come from the Shared Global Area (SGA memory). Only when the requested data does not reside in the SGA some file I/O is needed to fetch the missing data from disk to the SGA.</p>
<p>Now I don&#8217;t know why anybody would want to commit a SELECT statement (no data modifications are made), using the auto-commit will probably have an effect on the total performance of the system.</p>
<p>Below is an example proofing that a select statement in auto-commit execution mode is issuing a transactional commit. For the example explained below the following software is used:</p>
<ul>
<li><a href="http://www.oracle.com/technology/software/products/database/xe/index.html">Oracle Express Edition</a></li>
<li>PHP&#8217;s <a href="http://www.php.net/OCI8">OCI</a> extension</li>
<li>PHP 5+</li>
</ul>
<p>The following query describes the table definition used:</p>
<p><code>create table execution_mode<br />
( mydate    date<br />
, some_text varchar2(200)<br />
);<br />
</code></p>
<p>And here is the PHP script (Example.php):<br />
<code>&lt;?php<br />
$conn = oci_connect('username', 'password', '//localhost/XE') or die;<br />
$data = 'Hello world';<br />
// Insert a record<br />
$sql = "INSERT INTO execution_mode<br />
(mydate, some_text)<br />
VALUES<br />
(SYSDATE, :text)";<br />
$stmt = oci_parse($conn, $sql);<br />
oci_bind_by_name($stmt, ':text', $data, 200);<br />
// Use OCI_DEFAULT execution mode,<br />
// when failure occurs rollback any changes<br />
if ( !oci_execute($stmt, OCI_DEFAULT) ) {<br />
oci_rollback($conn);<br />
echo "Transaction failed\n";<br />
exit(1);<br />
}<br />
// Determine total records by select count(*)<br />
$sql   = "SELECT COUNT(*) AS num_entries FROM execution_mode";<br />
$stmt = oci_parse($conn,$sql);<br />
// Bind count to $num_entries variable<br />
oci_define_by_name($stmt, "NUM_ENTRIES", $num_entries);<br />
// Whoops forgot OCI_DEFAULT, so OCI_COMMIT_ON_SUCCES is used!<br />
oci_execute($stmt);<br />
// Fetch data<br />
oci_fetch($stmt);<br />
// Issue a rollback<br />
oci_rollback($conn);<br />
// Too bad data has already been commited by the select count(*) statement!<br />
?&gt;<br />
</code><br />
Checking the data in table execution_mode with SQL*Plus reveals that the record is inserted and commited:</p>
<p><a href="http://gertonscorner.files.wordpress.com/2010/05/output.jpg"><img class="aligncenter size-medium wp-image-112" title="output" src="http://gertonscorner.files.wordpress.com/2010/05/output.jpg?w=300&#038;h=179" alt="" width="300" height="179" /></a><br />
Conclusion: always use OCI_DEFAULT as your default execution mode. Commit (or rollback) your transactions manually when and where appropriate.</p>
<p><a href="http://framework.zend.com/issues/browse/ZF-8227">Vote</a> for my proposed solution to enable to set the default execution mode within the Zend Framework Oracle database adapter!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=111&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2010/05/11/php-oci-extension-for-oracle-execution-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>

		<media:content url="http://gertonscorner.files.wordpress.com/2010/05/output.jpg?w=300" medium="image">
			<media:title type="html">output</media:title>
		</media:content>
	</item>
		<item>
		<title>Zend Framework: Application resources</title>
		<link>http://gertonscorner.wordpress.com/2009/10/27/zend-framework-application-resources/</link>
		<comments>http://gertonscorner.wordpress.com/2009/10/27/zend-framework-application-resources/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 19:32:51 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend logging]]></category>
		<category><![CDATA[zend MVC]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=94</guid>
		<description><![CDATA[In this second part of my Zend Framework quest, i will dive in the wonderfull world of application resource plugins. Zend_Application provide several standard resource plugins for database access, session management, routing etc. You can find more info about these standard Resource Plugins here. The fun part of these Resource Plugins is that they can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=94&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this second part of my Zend Framework quest, i will dive in the wonderfull world of application resource plugins. Zend_Application provide several standard resource plugins for database access, session management, routing etc. You can find more info about these standard Resource Plugins <a title="Zend Framework standard Resource Plugins" href="http://framework.zend.com/manual/en/zend.application.available-resources.html" target="_blank">here</a>.</p>
<p>The fun part of these Resource Plugins is that they can be configurated completely within the application.ini (or application.xml) configuration file and are loaded automatically by the Application Bootstrapper.  For example you can define a new Route resource &#8220;myroute&#8221; referencing the module/controller/action without writing any code like this:</p>
<p><code>; Router resources<br />
resources.router.routes.myroute.route = "hello/:myname"<br />
resources.router.routes.myroute.defaults.module = "mymodule"<br />
resources.router.routes.myroute.defaults.controller = "index"<br />
resources.router.routes.myroute.defaults.action = "index"</code></p>
<p>Which will route the following url &#8220;http://localhost/hello/world&#8221; to the standard controller action from the &#8220;mymodule&#8221; module, with the request parameter &#8220;myname&#8221;  filled with &#8220;world&#8221;.</p>
<p>While Zend Framework ships with a number of standard resource plugins, the intention is that developers should write their own to encapsulate their own initialization needs. So lets begin with our own custom resource plugin for initializing application logging using Zend_Log.</p>
<p><span id="more-94"></span>The first step is to define a plugin-path and prefix path for the new custom resource in the application.ini configuration file (preferably somewhere in the beginning), like this:</p>
<p><code>pluginPaths.Custom_Resource = APPLICATION_PATH "/resources"</code></p>
<p>When the new resource class starts with &#8220;Custom_Resource&#8221;, it will be automatically loaded by the Bootstrapper.</p>
<p>Create a new file Logger.php in the APPLICATION_PATH/resources location containing the following code:</p>
<p><code>class Custom_Resource_Logger<br />
extends Zend_Application_Resource_ResourceAbstract {<br />
}</code></p>
<p>The new resource plugin should now accept options to the constructor, have mechanisms for setting and retrieving options, have mechanisms for setting and retrieving the bootstrap object, and an initialization method.</p>
<p>Now the basics are set, it is time to think about what the new logger resource can do, or better, define the configuration options. Here are the options:</p>
<ol>
<li>&#8220;registry&#8221;</li>
<li>&#8220;output&#8221;</li>
<li>&#8220;priority&#8221;</li>
<li>&#8220;file&#8221;</li>
</ol>
<p>Although Resource Plugins are put in a bootstrap container (which is basically an instance of Zend_Registry) they are not globally available. This means you need access to the bootstrap in your code to load the resource. To overcome this &#8220;problem&#8221; the Zend_Log instance is registered with the name provided in the &#8220;registry&#8221; option. This way you can get your Zend_Log instance like this:</p>
<p><code>Zend_Registry::get('[registry-option]')</code></p>
<p>The &#8220;output&#8221; option let you configure where the log messages are send: The available values are &#8220;file&#8221; or &#8220;firebug&#8221;.</p>
<p>The &#8220;priority&#8221; option will filter the log messages to the default Zend_Log priorities levels 0-7.</p>
<p>The &#8220;file&#8221; option finally defines the file location when you choose &#8220;file&#8221; as the output. It is possible to use a date within the filename, using the replace needle &#8220;%d&#8221;.</p>
<p>The full implementation (source) of the Logger.php file can be found <a title="Full source code Logger.php" href="https://gertonscorner.googlecode.com/svn/trunk/ZendFramework/application/resources/Logger.php" target="_blank">here</a>.</p>
<p>Just the final step to completion, registration off the new Resource Plugin to your bootstrap. Again this can be accomplished by adding the following line to your application.ini configuration file:</p>
<p><code>resources.logger[] = ""</code></p>
<p>The application.ini configuration should now look like this:</p>
<p><code>; Custom resource plugins<br />
pluginPaths.Custom_Resource = APPLICATION_PATH "/resources"<br />
; Logger resources<br />
resources.logger[] = ""<br />
; Option used for Global Registry location<br />
resources.logger.registry = "Zend_Log"<br />
; Use for output option: firebug or file<br />
resources.logger.output = "file"<br />
; Priorities available: 0=[EMERG]/1=ALERT/2=CRIT/3=ERR/4=WARN/5=NOTICE/6=INFO/7=[DEBUG]<br />
resources.logger.priority = 3<br />
resources.logger.file = APPLICATION_PATH "/../tmp/app-prod-%d.log"</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=94&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2009/10/27/zend-framework-application-resources/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
		<item>
		<title>Zend Framework: Project setup</title>
		<link>http://gertonscorner.wordpress.com/2009/10/07/zend-framework-setup/</link>
		<comments>http://gertonscorner.wordpress.com/2009/10/07/zend-framework-setup/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 19:39:07 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend MVC]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=83</guid>
		<description><![CDATA[It has been a while since i last wrote a post about working with the Zend Framework and the, then rather new, package Zend_Amf. The project structure was an attempt to integrate the Zend MVC with Zend Amf (and of course try out some new features in the Flash player 10). Since that post, Zend [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=83&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It has been a while since i last wrote a <a title="Fileupload using Zend AMF, RemoteObject and Flash 10" href="http://gertonscorner.wordpress.com/2009/04/19/fileupload-using-zend-amf-remoteobject-and-flash-10/" target="_self">post</a> about working with the <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> and the, then rather new, package Zend_Amf. The project structure was an attempt to integrate the Zend MVC with Zend Amf (and of course try out some new features in the Flash player 10).<br />
Since that post, Zend has released some major releases with some rather big changes, like the Zend_Application package combined with the Bootstrap class.</p>
<p>Because i am not a real PHP programmer (consider myself as a junior in that area), it is rather difficult to learn all the ins-and-outs of the framework and i rely heavily on what other people write on the internet about the several topics considering the Zend Framework.</p>
<p>So i decided to bundle all my findings into one project setup and publish the sources on <a title="ZendFramework project on Google code" href="http://gertonscorner.googlecode.com/svn/trunk/ZendFramework/" target="_blank">Google code</a>. This way i always have access to these sources and i can refer to them within coming blog posts.</p>
<p><span id="more-83"></span>The first thing i did was setting up a project structure like the one shown in picture 1:</p>
<div id="attachment_84" class="wp-caption alignleft" style="width: 310px"><img class="size-medium wp-image-84" title="project-outline" src="http://gertonscorner.files.wordpress.com/2009/10/project-outline.jpg?w=300&#038;h=245" alt="project outline zend framework" width="300" height="245" /><p class="wp-caption-text">figure 1: project outline zend framework</p></div>
<p>The root of the project contains besides the standard application, library and public folders, also folders for future unit tests and temporary files (caching, logfiles).</p>
<p>The library folder needs some explanation. Normally this folder contains a Zend folder with the Zend Framework classes. I decided not to hold a complete copy of the framework in my own Google code subversion repository, but instead a have set a subversion property svn:external, linking to the Zend Framework subversion repository.</p>
<p>When checking out the code from Google code, the Zend Framework classes will also be checked out (and automatically updated, when the svn:external property is updated) in the library folder.</p>
<p>So let start with the application folder structure. As shown the folder contains  a configs, default, modules and resources folder. When you follow the project setup explained in the <a title="Zend Framework Quick Start" href="http://framework.zend.com/docs/quickstart" target="_blank">Zend Framework Quick Start</a>, you will find some differences with the setup i use. For example all contents of the default folder are found in de Quick Start directly under the application folder and the Quick Start setup is missing the modules and resources folders.</p>
<p>I shall try to explain the rest of the project contents in some later posts, so in the meanwhile check out the sources and let me know what you think of it.</p>
<p>Here is a screenshot of what will be shown when the sources are succesfully installed within your local webserver.</p>
<div id="attachment_89" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-89" title="screenshot" src="http://gertonscorner.files.wordpress.com/2009/10/screenshot.jpg?w=300&#038;h=187" alt="Frontpage zend framework demoground" width="300" height="187" /><p class="wp-caption-text">Frontpage zend framework demoground</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=83&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2009/10/07/zend-framework-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>

		<media:content url="http://gertonscorner.files.wordpress.com/2009/10/project-outline.jpg?w=300" medium="image">
			<media:title type="html">project-outline</media:title>
		</media:content>

		<media:content url="http://gertonscorner.files.wordpress.com/2009/10/screenshot.jpg?w=300" medium="image">
			<media:title type="html">screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>Fileupload using Zend AMF, RemoteObject and Flash 10</title>
		<link>http://gertonscorner.wordpress.com/2009/04/19/fileupload-using-zend-amf-remoteobject-and-flash-10/</link>
		<comments>http://gertonscorner.wordpress.com/2009/04/19/fileupload-using-zend-amf-remoteobject-and-flash-10/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 20:12:21 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[remoting]]></category>
		<category><![CDATA[zend amf]]></category>
		<category><![CDATA[zend MVC]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=54</guid>
		<description><![CDATA[In one of my earlier posts i described a method for uploading files using the RemoteObject class found in the Flex SDK. For the &#8220;back end&#8221; i used the still very popular amfphp implementation of the AMF protocol. Wade Arnold the maintainer of amfphp is also involved in another implementation of the AMF protocol which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=54&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In one of my <a title="Fileupload using AMFPHP, RemoteObject and Flash 10" href="http://gertonscorner.wordpress.com/2009/03/15/fileupload-using-amfphp-remoteobject-and-flash-10/">earlier posts</a> i described a method for uploading files using the RemoteObject class found in the Flex SDK. For the &#8220;back end&#8221; i used the still very popular <a title="AMFPHP remoting" href="http://www.amfphp.org/docs2/index.html" target="_blank">amfphp</a> implementation of the AMF protocol.</p>
<p><a title="Wade Arnold blog" href="http://wadearnold.com/blog/" target="_blank">Wade Arnold</a> the maintainer of amfphp is also involved in another implementation of the AMF protocol which is shipped with the <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a>. After reading some blog posts about this &#8220;new&#8221; package called Zend_Amf, i decided to give it a try.</p>
<p>Download <a title="Full example code" href="http://gertonscorner.googlecode.com/files/ZendAMFUpload.zip">ZendAMFUpload.zip</a> for full example code.<br />
<span id="more-54"></span><br />
I started my quest with downloading of the latest <a title="Zend Framework library" href="http://www.zendframework.com/releases/ZendFramework-1.7.8/ZendFramework-1.7.8.zip">Zend Framework library</a>, which is now at version 1.7.8 and followed the instructions of the Quickstart guide, which can be found <a title="Zend Framework Quickstart guide" href="http://framework.zend.com/docs/quickstart" target="_blank">here</a>.</p>
<p>I also found a <a title="Zend_Amf with full Zend Framework" href="http://www.riaspace.net/2009/01/zend_amf-with-full-zend-framework/" target="_blank">great post</a> from Piotr Walczyszyn about how to merge the Zend_Amf package within the Zend Framework MVC structure and i used this approach as a starting point for my own example, but made the following changes compared to the tutorial of Piotr:</p>
<p>1)<br />
Because i don&#8217;t use a database within my example i removed all code related to the config, database and registry from my bootstrap.php file.</p>
<p>2)<br />
Somehow the disableLayout call in the MessageBrokerController init function Piotr provided resulted in an error, so i removed this line.</p>
<p>3)<br />
Instead of putting my data objects into a dto folder i used a folder named vo. It is the same, but i am used to call my remote data objects Value Objects.</p>
<p>4)<br />
During my quest i stumbled to some strange behaviour when sending Typed Objects (FileVO) from my flex client to the service layer. According to the Zend_Amf documentation you could use $_explicitType within a ValueObject for mapping serverside PHP classes with AS3 classes, but this only worked for retrieving typed objects, not for sending typed objects. Finally i found these issues related to class mapping of typed objects: <a href="http://www.zendframework.com/issues/browse/ZF-5755" target="_blank">ZF-5755</a>, <a href="http://www.zendframework.com/issues/browse/ZF-5885">ZF-5885</a> and <a href="http://www.zendframework.com/issues/browse/ZF-6130">ZF-6130</a>, and decided to use the $server-&gt;setClassMap call in my MessagebrokerController.</p>
<p>Here is the code i ended up with:</p>
<p><em>MessagebrokerController.php</em><br />
<code><br />
class MessagebrokerController extends Zend_Controller_Action {<br />
// Initialise controller with no view renderer<br />
public function init()	{<br />
$this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(true);<br />
}<br />
// amf action<br />
public function amfAction()	{<br />
$server = new Zend_Amf_Server();<br />
$server-&gt;addDirectory(APPLICATION_PATH . '/services/');<br />
// Mapping of PHP FileVO class and AS3 FileVO class<br />
$server-&gt;setClassMap("FileVO", "FileVO");<br />
echo($server-&gt;handle());<br />
}<br />
}<br />
</code></p>
<p><em>FileVO.php</em></p>
<p><code><br />
class FileVO {<br />
public $filename;<br />
public $filedata;<br />
}<br />
</code></p>
<p><em>RemoteFile.php</em></p>
<p><code><br />
class RemoteFile {<br />
/**<br />
* Upload files!<br />
*<br />
* @param  $file as a FileVO Object<br />
* @return string<br />
**/<br />
public function upload($file) {<br />
$data = $file-&gt;filedata;<br />
file_put_contents( APPLICATION_PATH . '/uploads/' . $file-&gt;filename, $data);<br />
return 'File: ' . $file-&gt;filename .' Uploaded ';<br />
}<br />
}<br />
</code></p>
<p>I kept the flex code the same as in my earlier post except for the remote service endpoint url, which should be now something like</p>
<p>http://[some-host]/messagebroker/amf</p>
<p>Download <a title="Full example code" href="http://gertonscorner.googlecode.com/files/ZendAMFUpload.zip">ZendAMFUpload.zip</a> for full example code.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=54&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2009/04/19/fileupload-using-zend-amf-remoteobject-and-flash-10/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
		<item>
		<title>Fileupload using AMFPHP, RemoteObject and Flash 10</title>
		<link>http://gertonscorner.wordpress.com/2009/03/15/fileupload-using-amfphp-remoteobject-and-flash-10/</link>
		<comments>http://gertonscorner.wordpress.com/2009/03/15/fileupload-using-amfphp-remoteobject-and-flash-10/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 14:02:27 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[remoting]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=38</guid>
		<description><![CDATA[File upload with Adobe Flex is a common asked feature for lots of applications. There are several posts on the internet to be found which explain, in detail, how to do this. Most of these examples however uses the http protocol to transport the binary data. With the arrival of the Adobe Flash 10 player [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=38&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>File upload  with Adobe Flex is a common asked feature for lots of applications. There are several posts on the internet to be found which explain, in detail, how to do this.</p>
<p>Most of these examples however uses the http protocol to transport the binary data. With the arrival of the Adobe Flash 10 player and the new FileReference features that comes with it, it is now also possible to upload a file via a RemoteObject service call.</p>
<p><span id="more-38"></span></p>
<p>For the coming example it is assumed that <a title="AMFPHP remoting" href="http://www.amfphp.org/docs2/index.html" target="_blank">amfphp 1.9</a> and Flash player 10 (Flex 3.2 SDK) is installed and running. Furthermore i am using a setup as described in one of my earlier posts about <a title="RemoteObject using AMFPHP and Actionscript 3" href="http://gertonscorner.wordpress.com/2008/09/06/remoteobject-using-amfphp-and-actionscript-3/">RemoteObject and AMFPHP</a>. Download <a title="Full example code" href="http://gertonscorner.googlecode.com/files/PHPUpload.zip">PHPUpload.zip</a> for full example code.</p>
<p>Copy the services contents found in the zip to your amfphp services location (and check the amfphp/globals.php if your &#8220;vo&#8221; location is configurated to &#8220;services/vo/&#8221;).</p>
<p>Within your services directory a RemoteFile.php can be found with a public function upload, which require a parameter of type FileVO:</p>
<p><code><br />
require_once ('./vo/FileVO.php');<br />
class RemoteFile {<br />
/**<br />
* Upload files!<br />
*<br />
* @param  FileVO $file<br />
* @return string<br />
**/<br />
public function upload(FileVO $file) {<br />
$data = $file-&gt;filedata-&gt;data;<br />
file_put_contents( 'uploads/' . $file-&gt;filename, $data);<br />
return 'File: ' . $file-&gt;filename .' Uploaded ';<br />
}<br />
}<br />
</code></p>
<p>The FileVO php class has a Flex counterpart also called FileVO which is used as a so called RemoteClass. This RemoteClass has an attribute for the filename and filedata (ByteArray).</p>
<p>No we are ready to create the service class for the upload example, this class will be named RemoteFileService and extends the RemoteService super class.<code>public class RemoteFileService extends RemoteService {<br />
private static var phpServiceClass:String = "RemoteFile";<br />
//constructor<br />
public function RemoteFileService(amfChannelId:String, amfChannelEndpoint:String) {<br />
super("remotefileService","amfphp", amfChannelId, amfChannelEndpoint);<br />
}<br />
// Upload function<br />
public function upload(file:FileVO):void {<br />
remoteObject.source = phpServiceClass;<br />
remoteObject.upload.addEventListener(<br />
ResultEvent.RESULT,handleRemoteMethod);<br />
remoteObject.upload(file);<br />
}<br />
// Remote result handler<br />
protected function handleRemoteMethod(event:ResultEvent):void {<br />
var uploadStatus:String;<br />
uploadStatus = event.result.toString();<br />
Application.application.dispatchEvent(<br />
new RemoteResultEvent(RemoteResultEvent.UPLOAD_STATUS, uploadStatus));<br />
}<br />
}</code></p>
<p>The Flex application file contains a text component (which will be filled with the selected filename), a button for selecting a file and a button to start the upload. Download <a title="Full example code" href="http://gertonscorner.googlecode.com/files/PHPUpload.zip">PHPUpload.zip</a> for full example code.</p>
<p>After a succesfull upload the selected file will be placed in the amfphp/services/uploads directory (needs write privileges!) and an Alert shows a message from the server.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=38&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2009/03/15/fileupload-using-amfphp-remoteobject-and-flash-10/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
		<item>
		<title>Localized flex login using the Swiz framework</title>
		<link>http://gertonscorner.wordpress.com/2009/03/07/localized-flex-login-using-the-swiz-framework/</link>
		<comments>http://gertonscorner.wordpress.com/2009/03/07/localized-flex-login-using-the-swiz-framework/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 15:36:30 +0000</pubDate>
		<dc:creator>Gerton</dc:creator>
				<category><![CDATA[Adobe Flex/AIR]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[runtime localization]]></category>
		<category><![CDATA[swiz framework]]></category>

		<guid isPermaLink="false">http://gertonscorner.wordpress.com/?p=27</guid>
		<description><![CDATA[After reading some blogs about a relative new Flex framework called swiz, i decided to try it out some time. Swiz is a framework. started by Chris Scott, that aims to bring complete simplicity to RIA development. To get some feeling with the framework i started to work out a login example i found on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=27&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After reading some blogs about a relative new Flex framework called <a title="Swiz framework" href="http://code.google.com/p/swizframework/" target="_blank">swiz</a>, i decided to try it out some time. Swiz is a framework. started by <a title="Blog of Chris Scott" href="http://cdscott.blogspot.com/" target="_blank">Chris Scott</a>, that aims to bring complete simplicity to RIA development.</p>
<p>To get some feeling with the framework i started to work out a login example i found on the blog from <a title="Blog of Sönke Rohde" href="http://soenkerohde.com/2008/11/mock-business-delegates-with-swiz/" target="_blank">Sönke Rohde</a>, which uses a utility for mocking service calls, which also can be found in the swiz framework. For my own example i used the following snapshot <a href="http://swizframework.googlecode.com/files/swiz-0.0.5-010609.swc">swiz-0.0.5-010609.swc</a> with mediator and event type checking support, but decided to extend the login sample with some runtime localization features.</p>
<p>These localization features consist of some xml-files which can be loaded during runtime and are used for translating labels and fault messages (bad credentials).</p>
<p>During development of the new example i found out that the mockutility in the framework only returned a result. In a real-life application faults will occur so i copied the sources of the swiz framework TestUtil class into a new class called MockUtil and added my own mockFault and mockFaultEvent methods.</p>
<p>The sources of my extended login example can be downloaded <a href="http://gertonscorner.googlecode.com/files/SwizControl.zip">here</a> (swiz library not included!). The assets/data/users.xml file contains the mock data for the login and can be modified with your own user credentials. The assets/locale directory contains sub-directories with the localization files used.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gertonscorner.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gertonscorner.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gertonscorner.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gertonscorner.wordpress.com&amp;blog=1218571&amp;post=27&amp;subd=gertonscorner&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gertonscorner.wordpress.com/2009/03/07/localized-flex-login-using-the-swiz-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6f94a1f04b4abb17c51bdf7fc46ee0f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agee</media:title>
		</media:content>
	</item>
	</channel>
</rss>
