<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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" version="2.0">

<channel>
	<title>blog.zuerchtech.com</title>
	
	<link>http://blog.zuerchtech.com</link>
	<description>zuercher technologies blog</description>
	<pubDate>Mon, 31 Aug 2009 20:21:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/zuerchtech" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>DATA pt. 4 - Running from Command Line and Logging</title>
		<link>http://blog.zuerchtech.com/2009/08/31/data-pt-4-running-from-command-line-and-logging/</link>
		<comments>http://blog.zuerchtech.com/2009/08/31/data-pt-4-running-from-command-line-and-logging/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 20:19:14 +0000</pubDate>
		<dc:creator>Ali Faiz</dc:creator>
		
		<category><![CDATA[Titanium]]></category>

		<category><![CDATA[DATA series]]></category>

		<category><![CDATA[logging]]></category>

		<category><![CDATA[PushToTest]]></category>

		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=135</guid>
		<description><![CDATA[This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)
Running Titanium Apps from the Command Line
To run a Titanium app using a command line script as opposed to starting it up through the Titanium Developer App, we placed the following in a file named run.sh inside our app&#8217;s directory.

export PATH=$PATH:/Library/Application\ [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)</p>
<h3>Running Titanium Apps from the Command Line</h3>
<p>To run a Titanium app using a command line script as opposed to starting it up through the Titanium Developer App, we placed the following in a file named run.sh inside our app&#8217;s directory.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">export PATH=$PATH:/Library/Application\ Support/Titanium/sdk/osx/0.6.0/
tibuild.py -d . -s /Library/Application\ Support/Titanium -r -a /Library/Application\ Support/Titanium/sdk/osx/0.6.0 ./</pre></div></div>

<p>The tibuild.py does our work for us and running ./run.sh from the command line starts our app up without having to open the Titanium Developer App.</p>
<h3>Logging</h3>
<p>This is a short blurb on the difference between Titanium logging and Firebug&#8217;s logging. At the top of our Javascript file we have the following try/catch statement  to setup our log var.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">try {
    var log = Titanium.App.stdout; // Titanium's logging to the command line
} catch (squash) {
    var log = console.log; // console logging for Webkit/Firebug
}</pre></div></div>

<p>The try/catch is an easy way to ensure we have the right logging for the right environment. We want TItanium logging when running Titanium and console.log as the default.<br />
Calling logging is simple from this point:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> log('HELLO!');</pre></div></div>


<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/DATA+series' rel='tag' target='_self'>DATA series</a>, <a class='technorati-link' href='http://technorati.com/tag/logging' rel='tag' target='_self'>logging</a>, <a class='technorati-link' href='http://technorati.com/tag/PushToTest' rel='tag' target='_self'>PushToTest</a>, <a class='technorati-link' href='http://technorati.com/tag/titanium' rel='tag' target='_self'>titanium</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2009/08/31/data-pt-4-running-from-command-line-and-logging/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DATA pt. 3 - File I/O with jQuery and Titanium</title>
		<link>http://blog.zuerchtech.com/2009/08/25/data-pt-3-file-io-with-jquery-and-titanium/</link>
		<comments>http://blog.zuerchtech.com/2009/08/25/data-pt-3-file-io-with-jquery-and-titanium/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 16:04:47 +0000</pubDate>
		<dc:creator>Ali Faiz</dc:creator>
		
		<category><![CDATA[Titanium]]></category>

		<category><![CDATA[DATA series]]></category>

		<category><![CDATA[File I/O]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[PushToTest]]></category>

		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=132</guid>
		<description><![CDATA[This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)
Opening an XML file dialog in Titanium
The props variable specifies that only xml files will be highlighted and accepted in the file dialog. In order to highlight and accept all file types, just make props and empty array: var props = [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)</p>
<h3>Opening an XML file dialog in Titanium</h3>
<p>The props variable specifies that only xml files will be highlighted and accepted in the file dialog. In order to highlight and accept all file types, just make props and empty array: var props = {};</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">var props = {multiple:false,types:['xml']};
Titanium.UI.openFileChooserDialog(function(filenames) {
	if (filenames[0]){
		Editor.load_file(filenames[0]);
	}
},props);</pre></div></div>

<h3>Reading an XML file</h3>
<p>Here are the ways to read an xml (or any) file using both jQuery and Titanium. In both examples, lambda represents a function pointer.</p>
<p>jQuery</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">	$.get(filename,lambda);</pre></div></div>

<p>Titanium</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">	var f = Titanium.Filesystem.getFile(filename);
	var xml = &quot;&quot;+f.read();
	lambda(xml);</pre></div></div>

<h3>Writing an XML file</h3>
<p>This of course can only be done with Titanium. Below is how we formatted the xml to pretty print the xml string before writing out to the file. The raw xml string doesn&#8217;t lay out nicely so we have to add some spacing.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">formatXml: function(xml, lambda) {
    var formatted = '';
    var reg = /(&gt;)(&lt;)(\/*)/g;
    xml = xml.replace(reg, '$1\r\n$2$3');
    var pad = 0;
    jQuery.each(xml.split('\r\n'), function(index, node) {
        var indent = 0;
        if (node.match( /.+&lt;\/\w[^&gt;]*&gt;$/ )) {
            indent = 0;
        } else if (node.match( /^&lt;\/\w/ )) {
            if (pad != 0) {
                pad -= 1;
            }
        } else if (node.match( /^&lt;\w[^&gt;]*[^\/]&gt;.*$/ )) {
            indent = 1;
		} else {
            indent = 0;
		}
&nbsp;
        var padding = '';
        for (var i = 0; i &lt; pad; i++) {
            padding += '  ';
		}
&nbsp;
        formatted += padding + node + '\r\n';
        pad += indent;
	});
    lambda(formatted);
},</pre></div></div>

<p>Below is the code that actually writes out to the filesystem. If the file represented by the filename already exists, the write simply overwrites it. If the file doesn&#8217;t exist, a new one with that filename is created. Because of the way we had to parse the xml read in, it was necessary to tack on the the xml header.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">try {
	var TFS = Titanium.Filesystem;
	var file = TFS.getFile(filename);
	Editor.formatXml(Editor.currentopenfile.filexml, function(xml) {
		header = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;';
		file.write(header+xml);
		var contents = file.read();
	});
} catch (squash) {
	alert(&quot;Failed to write to File&quot;);
}</pre></div></div>


<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/DATA+series' rel='tag' target='_self'>DATA series</a>, <a class='technorati-link' href='http://technorati.com/tag/File+I%2FO' rel='tag' target='_self'>File I/O</a>, <a class='technorati-link' href='http://technorati.com/tag/jQuery' rel='tag' target='_self'>jQuery</a>, <a class='technorati-link' href='http://technorati.com/tag/PushToTest' rel='tag' target='_self'>PushToTest</a>, <a class='technorati-link' href='http://technorati.com/tag/titanium' rel='tag' target='_self'>titanium</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2009/08/25/data-pt-3-file-io-with-jquery-and-titanium/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DATA pt. 2 - Accessing the DOM with jQuery</title>
		<link>http://blog.zuerchtech.com/2009/08/20/data-pt-2-accessing-the-dom-with-jquery/</link>
		<comments>http://blog.zuerchtech.com/2009/08/20/data-pt-2-accessing-the-dom-with-jquery/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 20:37:11 +0000</pubDate>
		<dc:creator>Ali Faiz</dc:creator>
		
		<category><![CDATA[Titanium]]></category>

		<category><![CDATA[DATA series]]></category>

		<category><![CDATA[DOM manipulation]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[PushToTest]]></category>

		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=126</guid>
		<description><![CDATA[This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)
The many ways to access the DOM with jQuery
In part 1 of this series, I ended the post with stating that I would follow up with how we accessed the DOM with jQuery and why we weren&#8217;t always using the best [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the continuing series of articles on Developing Appcelerator Titanium Applications (DATA)</p>
<h3>The many ways to access the DOM with jQuery</h3>
<p>In part 1 of this series, I ended the post with stating that I would follow up with how we accessed the DOM with jQuery and why we weren&#8217;t always using the best way to do it. Given more time, we would likely have gone back and changed all methods of accessing the DOM to be consistent.<br />
Below are 3 ways that we used to access the DOM. It is almost a chronological journey through how we figured out the different methods.<br />
For this part, as I did in my last post, I&#8217;ll be using the PushToTest datasource as an example.</p>
<p>Here again is the html used to render a datasource.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;datasources_iterator${id}&quot; class=&quot;datasource_container&quot;&gt;
	&lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;${id}&quot; fieldset=&quot;datasource&quot;/&gt;
	&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt;
		&lt;tr&gt;
			&lt;td&gt;Name&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; value=&quot;${name}&quot; fieldset=&quot;datasource&quot; class=&quot;name&quot;/&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;image&quot; name=&quot;delete&quot; value=&quot;${id}&quot; src=&quot;images/cross.png&quot; fieldset=&quot;datasource&quot;/&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Type&lt;/td&gt;
			&lt;td&gt;
				&lt;select id=&quot;datatypeselect${id}&quot; name=&quot;datatypeselect&quot; fieldset=&quot;datasource&quot;&gt;
				  	&lt;option value=&quot;HashDPL&quot;&gt;HashDPL&lt;/option&gt;
				  	&lt;option value=&quot;CSVDPL&quot;&gt;CSVDPL&lt;/option&gt;
				  	&lt;option value=&quot;RDBMSDPL&quot;&gt;RDBMSDPL&lt;/option&gt;
				  	&lt;option value=&quot;TheLocker&quot;&gt;TheLocker&lt;/option&gt;
				&lt;/select&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Resource Name&lt;/td&gt;
			&lt;td&gt;&lt;select id=&quot;rscname${id}&quot; datasourceid=&quot;${id}&quot; name=&quot;rscname&quot; fieldset=&quot;datasource&quot;&gt;&lt;/select&gt; (From Resources)&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
&lt;/div&gt;</pre></div></div>

<h3>The Unique ID Approach</h3>
<p>The simplest way to manipulate the DOM with jQuery is using the id based method.<br />
In the html we have datatypeselect drop down menus.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;select id=&quot;datatypeselect${id}&quot; name=&quot;datatypeselect&quot; fieldset=&quot;datasource&quot;&gt;
  	&lt;option value=&quot;HashDPL&quot;&gt;HashDPL&lt;/option&gt;
  	&lt;option value=&quot;CSVDPL&quot;&gt;CSVDPL&lt;/option&gt;
  	&lt;option value=&quot;RDBMSDPL&quot;&gt;RDBMSDPL&lt;/option&gt;
  	&lt;option value=&quot;TheLocker&quot;&gt;TheLocker&lt;/option&gt;
&lt;/select&gt;</pre></div></div>

<p>For each individual datasource displayed, there is a datatypeselect drop down with a unique id associated with that element.<br />
Here is the javascript to set the  value of the datatypeselect for a given datasource object. This follows the method for populating the html we covered in part 1 of this series.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$(&quot;#datatypeselect&quot;+datasource.id).val(datasource.datatypeselect);</pre></div></div>

<p>The &#8216;#&#8217; at the beginning of the selector signifies that we&#8217;re selecting based on the id attribute of the html element. The value is being set to the datasource object&#8217;s datatypeselect field.</p>
<h3>The div ID Approach</h3>
<p>This approach is similar to the Unique ID Approach, but instead of using the id for the particular element, we can use the id for a parent of this element. This forces us to only have a unique id at the parent level instead of a unique id for each individual html element.</p>
<p>The parent of the datatypeselect element in the html:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;datasources_iterator${id}&quot; class=&quot;datasource_container&quot;&gt;</pre></div></div>

<p>Here&#8217;s the javascript for this approach to accessing the datatypeselect element:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">var divid = '#datasources_iterator'+datasource.id;
$(divid+ ' select[name=datatypeselect]').val(datasource.datatypeselect);</pre></div></div>

<h3>The Parent Selector Approach</h3>
<p>This approach uses the same divid as the div ID Approach above but we pass the selector as an argument. Here we also use the fieldset attribute to give greater specificity to the jQuery selector.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$('select[name=datatypeselect][fieldset=datasource]', $(divid)).val(datasource.datatypeselect);</pre></div></div>

<p>Ultimately we want to strip our html elements to the bare minimum of what we really need to access and manipulate their values and get away from using unique ids for each element.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/DATA+series' rel='tag' target='_self'>DATA series</a>, <a class='technorati-link' href='http://technorati.com/tag/DOM+manipulation' rel='tag' target='_self'>DOM manipulation</a>, <a class='technorati-link' href='http://technorati.com/tag/jQuery' rel='tag' target='_self'>jQuery</a>, <a class='technorati-link' href='http://technorati.com/tag/PushToTest' rel='tag' target='_self'>PushToTest</a>, <a class='technorati-link' href='http://technorati.com/tag/titanium' rel='tag' target='_self'>titanium</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2009/08/20/data-pt-2-accessing-the-dom-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Developing Appcelerator Titanium Application (DATA) pt. 1 - A series of articles on lessons learned…</title>
		<link>http://blog.zuerchtech.com/2009/08/20/developing-appcelerator-titanium-application-pt-1-a-series-of-articles-on-lessons-learned/</link>
		<comments>http://blog.zuerchtech.com/2009/08/20/developing-appcelerator-titanium-application-pt-1-a-series-of-articles-on-lessons-learned/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 19:10:02 +0000</pubDate>
		<dc:creator>Ali Faiz</dc:creator>
		
		<category><![CDATA[Titanium]]></category>

		<category><![CDATA[DATA series]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[PushToTest]]></category>

		<category><![CDATA[templating]]></category>

		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=120</guid>
		<description><![CDATA[The Application: PushToTest TestMaker
As part of our work on the PushToTest TestMaker open source project, we ran into numerous issues and resolutions that we felt should be shared.
Some background on what we used:
- Appcelerator Titanium Developer
- Javascript
- jQuery 1.3.2
- jQuery template plugin
- jQuery scrollTo plugin
- ExtJS 3.0 rc 3
First Issue To Address
One of the key [...]]]></description>
			<content:encoded><![CDATA[<h3>The Application: PushToTest TestMaker</h3>
<p>As part of our work on the PushToTest TestMaker open source project, we ran into numerous issues and resolutions that we felt should be shared.</p>
<p>Some background on what we used:<br />
- Appcelerator Titanium Developer<br />
- Javascript<br />
- jQuery 1.3.2<br />
- jQuery template plugin<br />
- jQuery scrollTo plugin<br />
- ExtJS 3.0 rc 3</p>
<h3>First Issue To Address</h3>
<p>One of the key first issues we ran into was how to render the html using jQuery on the client side for the Titanium application without doing too much manual DOM manipulation. Also, since most of the information being rendered would be in arrays, it would preferably make displaying arrays easier.</p>
<h3>The Solution</h3>
<p>Our solution came in the form of the <a href="http://plugins.jquery.com/project/jquerytemplate">jQuery template plugin</a>.<br />
For our implementation, we created html code snippets that we placed in individual html files. Each html file would be loaded and be passed into the $.template method which would then be passed into a .append method along with an object whose values would be injected into the html.</p>
<p>The reason why templating and more specifically why breaking the html into snippets was necessary is almost entirely because we wanted to be able to iterate through multiple objects and display them the cleanest and most efficient way possible.</p>
<h3>Example with the PushToTest Datasource</h3>
<p>For an example I&#8217;ve lain out how we rendered the information for datasources. Datasources are objects that have names, types, and resource names.<br />
First we created a datasources.hmtl page that will be a container for all the datasources rendered:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;panelmessage&quot;&gt;
Make this a data-driven test.
&lt;/div&gt;
&nbsp;
&lt;div class=&quot;form&quot;&gt;
	&lt;div class=&quot;title&quot;&gt;
		Data Production Libraries (DPLs) provide operational test data to the tests as they operate. For example, a DPL reads data from a relational database, comma-separated-value (CSV) file, or data generating object and injects it into a test script. &lt;a id=&quot;ShowTutorials&quot; name=&quot;ShowTutorials&quot; class=&quot;link&quot;&gt;Read more about it.&lt;/a&gt;
	&lt;/div&gt;
	&lt;div id=&quot;datasources_iterator&quot; style=&quot;display:none&quot; class=&quot;&quot;&gt;
	&lt;/div&gt;
	&lt;div class=&quot;adddatasource&quot;&gt;
		&lt;a id=&quot;adddatasource&quot; name=&quot;adddatasource&quot; class=&quot;link&quot; dirty=&quot;true&quot;&gt;Add DPL&lt;/a&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>Then, we created a _datasourcestemplate.html file with all the attributes for a datasource specified:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;datasources_iterator${id}&quot; class=&quot;datasource_container&quot;&gt;
	&lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;${id}&quot; fieldset=&quot;datasource&quot;/&gt;
	&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot;&gt;
		&lt;tr&gt;
			&lt;td&gt;Name&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; value=&quot;${name}&quot; fieldset=&quot;datasource&quot; class=&quot;name&quot;/&gt;&lt;/td&gt;
			&lt;td&gt;&lt;input type=&quot;image&quot; name=&quot;delete&quot; value=&quot;${id}&quot; src=&quot;images/cross.png&quot; fieldset=&quot;datasource&quot;/&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Type&lt;/td&gt;
			&lt;td&gt;
				&lt;select id=&quot;datatypeselect${id}&quot; name=&quot;datatypeselect&quot; fieldset=&quot;datasource&quot;&gt;
				  	&lt;option value=&quot;HashDPL&quot;&gt;HashDPL&lt;/option&gt;
				  	&lt;option value=&quot;CSVDPL&quot;&gt;CSVDPL&lt;/option&gt;
				  	&lt;option value=&quot;RDBMSDPL&quot;&gt;RDBMSDPL&lt;/option&gt;
				  	&lt;option value=&quot;TheLocker&quot;&gt;TheLocker&lt;/option&gt;
				&lt;/select&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Resource Name&lt;/td&gt;
			&lt;td&gt;&lt;select id=&quot;rscname${id}&quot; datasourceid=&quot;${id}&quot; name=&quot;rscname&quot; fieldset=&quot;datasource&quot;&gt;&lt;/select&gt; (From Resources)&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
&lt;/div&gt;</pre></div></div>

<p>Then in the javascript we use this code to get that content and template it:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">	$.get('content/_datasourcestemplate.html', function(html) {
        Editor.datasourcesTemplate = $.template(html);
    });
&nbsp;
	for (var i=0;i&lt;Editor.currentopenfile.datasources.length;i++) {
		var datasource = Editor.currentopenfile.datasources[i];
		$('#datasources_iterator').append(Editor.datasourcesTemplate, datasource);
	}</pre></div></div>

<p>Using this method we were able to iterate through the datasource objects and inject them into the template, then append it to the datasources.html page.</p>
<h3>Post implementation lessons</h3>
<p>As you can see in the _datasourcestemplate.html code, we placed the datasource object&#8217;s id all over the place. Originally this was needed because of the way we were using jQuery to get values from the DOM. After doing some more research we found out better ways to gain access to the DOM which is what I will cover in the next post.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/DATA+series' rel='tag' target='_self'>DATA series</a>, <a class='technorati-link' href='http://technorati.com/tag/jQuery' rel='tag' target='_self'>jQuery</a>, <a class='technorati-link' href='http://technorati.com/tag/PushToTest' rel='tag' target='_self'>PushToTest</a>, <a class='technorati-link' href='http://technorati.com/tag/templating' rel='tag' target='_self'>templating</a>, <a class='technorati-link' href='http://technorati.com/tag/titanium' rel='tag' target='_self'>titanium</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2009/08/20/developing-appcelerator-titanium-application-pt-1-a-series-of-articles-on-lessons-learned/feed/</wfw:commentRss>
		</item>
		<item>
		<title>andrewzuercher.com - personal blog site migrated</title>
		<link>http://blog.zuerchtech.com/2009/07/06/andrewzuerchercom-personal-blog-site-migrated/</link>
		<comments>http://blog.zuerchtech.com/2009/07/06/andrewzuerchercom-personal-blog-site-migrated/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 04:57:51 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=114</guid>
		<description><![CDATA[Greetings,

We&#8217;ve migrated off andrew zuercher&#8217;s personal blog site to http://andrewzuercher.com.  Going forward, this site (http://blog.zuerchtech.com) will only include posts that are company specific and not of a personal nature.





]]></description>
			<content:encoded><![CDATA[<p>Greetings,</p>
<div>
We&#8217;ve migrated off andrew zuercher&#8217;s personal blog site to <a href="http://andrewzuercher.com">http://andrewzuercher.com</a>.  Going forward, this site (<a href="http://blog.zuerchtech.com">http://blog.zuerchtech.com</a>) will only include posts that are company specific and not of a personal nature.
</div>

<!-- start wp-tags-to-technorati 1.01 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2009/07/06/andrewzuerchercom-personal-blog-site-migrated/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Barcamp 2008</title>
		<link>http://blog.zuerchtech.com/2008/10/29/barcamp-2008/</link>
		<comments>http://blog.zuerchtech.com/2008/10/29/barcamp-2008/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 01:31:42 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[barcamp]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=86</guid>
		<description><![CDATA[Finally a week after barcamp altanta 2008 I have a second to write about the weekend - its been a crazy past few weeks for me.  Barcamp was great, same as last year, but this time i knew a few more of the attendees (its a small world).  Some of the highlights for [...]]]></description>
			<content:encoded><![CDATA[<p>Finally a week after <a href="http://barcampatlanta.com/">barcamp altanta 2008</a> I have a second to write about the weekend - its been a crazy past few weeks for me.  Barcamp was great, same as last year, but this time i knew a few more of the attendees (its a small world).  Some of the highlights for me</p>
<ul>
<li>jedi mind tricks  - reciprocity, commitment &#038; consistency, social proof, authority, scarcity, reactities, liking, contacts, and co-operation.  Dont you think that those are some very keen tactics?  answer &#8220;those are some very keen tactics.  </li>
<li>an open source talk</li>
<li>a political discussion - i caught the end of it</li>
<li>a preso on fluid</li>
<li>iphone sdk 101</li>
<li>and my favorite poker till 4am - honed up my skills in omaha and texas hold-em</li>
</ul>
<p>While there i presented a session on <a href="http://www.appcelerant.com/introducing-testmonkey.html">Appcelerator and TestMonkey</a>.  It was a great weekend and I really like our atlanta community and glad to see it unite for a weekend.  Looking forward to <a href="http://atlanta2.startupweekend.com/">atlanta startup weekend 2</a> here in a few weeks.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/barcamp' rel='tag' target='_self'>barcamp</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2008/10/29/barcamp-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>No Fluff Just Stuff Atlanta Fall 2008</title>
		<link>http://blog.zuerchtech.com/2008/10/29/no-fluff-just-stuff-atlanta-fall-2008/</link>
		<comments>http://blog.zuerchtech.com/2008/10/29/no-fluff-just-stuff-atlanta-fall-2008/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 01:20:18 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[nfjs]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=79</guid>
		<description><![CDATA[Friday through Sunday this week I attended no fluff just stuff in atlanta.  Some of you may have seen some of my tweets.  Some of the key sessions that I attended and really enjoyed:

Groovy by Scott Davis.  Scott has a tremendous amount of energy and did a very good job of covering [...]]]></description>
			<content:encoded><![CDATA[<p>Friday through Sunday this week I attended <a href="http://www.nofluffjuststuff.com/home.jsp">no fluff just stuff</a> in atlanta.  Some of you may have seen some of my tweets.  Some of the key sessions that I attended and really enjoyed:</p>
<ul>
<li>Groovy by <a href="http://www.nofluffjuststuff.com/conference/speaker/scott_davis.html">Scott Davis</a>.  Scott has a tremendous amount of energy and did a very good job of covering some of the lesser known aspects of groovy as well as grails</li>
<li>GWT by <a href="http://www.nofluffjuststuff.com/speaker_view.jsp?speakerId=4">David Geary</a>.  David is local to Atlanta and provided some humor while explaining the internals of GWT</li>
<li>Agile and Architecture by <a href="http://www.nofluffjuststuff.com/conference/speaker/david_hussman.html">David Hussman</a>.  David is an agile coach and had a very open and interactive session that was very enjoyable</li>
<li>Cloud Computing by <a href="http://www.nofluffjuststuff.com/conference/speaker/michael_nygard.html">Michael Nygard</a> - helped answer a lot of my questions with practical examples.  He knows his stuff and I cant wait to start using AWS on some of my upcoming projects.</li>
</ul>
<p>While at the conference I ended up tweeting with some of the other attendees.  That was pretty cool.  It was a very long weekend and made for a tiring Monday, but I&#8217;m glad that I had the opportunity to attend the sessions.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/nfjs' rel='tag' target='_self'>nfjs</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2008/10/29/no-fluff-just-stuff-atlanta-fall-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zuercher Technologies Re-born</title>
		<link>http://blog.zuerchtech.com/2008/10/29/zuercher-technologies-re-born/</link>
		<comments>http://blog.zuerchtech.com/2008/10/29/zuercher-technologies-re-born/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 01:01:46 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[announcements]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=74</guid>
		<description><![CDATA[Zuercher Technologies is making a comeback.  As many of you probably already know the Appcelerator Atlanta Office closed down.  Some have asked me what is on the horizon and I&#8217;ve held back a little to make a formal announcement.  Over the next couple of weeks I&#8217;ll be putting up a new web [...]]]></description>
			<content:encoded><![CDATA[<p>Zuercher Technologies is making a comeback.  As many of you probably already know the <a href="http://blog.jeffhaynie.us/tough-times-tough-decisions.html">Appcelerator Atlanta Office closed down</a>.  Some have asked me what is on the horizon and I&#8217;ve held back a little to make a formal announcement.  Over the next couple of weeks I&#8217;ll be putting up a new web front for zuerchtech, but the premise is that I will be starting a services delivery company aimed at helping companies create RIA based web solutions as an <a href="http://appcelerator.com">Appcelerator</a> partner.  I&#8217;d like to thank all those who have offered their support over the past couple of weeks and am very excited with the opportunities to come in the near future!</p>

<!-- start wp-tags-to-technorati 1.01 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2008/10/29/zuercher-technologies-re-born/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Appcelerator Interceptors for I18N, L10N, G11N</title>
		<link>http://blog.zuerchtech.com/2008/10/13/using-appcelerator-interceptors-for-i18n-l10n-g11n/</link>
		<comments>http://blog.zuerchtech.com/2008/10/13/using-appcelerator-interceptors-for-i18n-l10n-g11n/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:56:03 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[announcements]]></category>

		<category><![CDATA[appcelerator]]></category>

		<category><![CDATA[i18n]]></category>

		<category><![CDATA[ria]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=20</guid>
		<description><![CDATA[What&#8217;s the problem?
Just implementing resource bundles to localize your application doesn&#8217;t quite cut it.  You need to do things like work with localized dates in the browser (including formatting), numbers, currencies, and who knows what else to munge your data.  It sure would be nice if there were a way to transparently make [...]]]></description>
			<content:encoded><![CDATA[<h3>What&#8217;s the problem?</h3>
<p>Just implementing resource bundles to localize your application doesn&#8217;t quite cut it.  You need to do things like work with localized dates in the browser (including formatting), numbers, currencies, and who knows what else to munge your data.  It sure would be nice if there were a way to transparently make this happen in a message oriented way that does not require server side awareness for services, can you help me with this problem?  sure.</p>
<h3>Built in &#8216;ization&#8217; support in Appcelerator</h3>
<p>Globalization (G11N) and Localization (L10N) both get lumped into Internationalization (I18N) - how to deal with languages, time, data formats and everything else that goes on making it so that people in different places in the world can use your glorious application.  Appcelerator <a href="http://doc.appcelerator.org/reference/localization/index.html">localization</a> helps you out with this on some really simple levels with the langid attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">  &lt;span langid=&quot;account.number.title&quot;&gt;&lt;/span&gt;:&lt;input type=&quot;text&quot;&gt;&lt;/input&gt;</pre></div></div>

<p>This should arm you successfully with an ability to deal with things like simple messages and labeling in your application.  Now if you want to blend in your data payload to render localized text, you can make use of appcelerator javascript functions Appcelerator.Localization.get and the more powerful but less documented Appcelerator.Localization.getWithFormat.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script&gt;
  var en_lang_bundle = {
	&quot;invalidlogin.message&quot;: &quot;Dear sir/madame, the username you provided '#{username}' does not exist:&quot;
  }
  Appcelerator.Localization.addLanguageBundle(&quot;en&quot;,English&quot;,$H(en_lang_bundle));
&lt;/script&gt;
&lt;span on=&quot;l:invalidlogin.response then value[text]&quot;&gt;&lt;/span&gt;
&lt;app:script on=&quot;r:invalidlogin.response then execute&quot;&gt;
  var text = Appcelerator.Localization.getWithFormat('invalidlogin.message',null,null,{username:'azuercher'});
  $MQ('l:invalidlogin.response',{text:text});
&lt;/app:script&gt;</pre></div></div>

<p>This is a nice way to use message indirection for munging messages, but really is quite messy and anything but transparent.  There must be a better way!</p>
<h3>Interceptors</h3>
<p>A lesser known feature of Appcelerator is the concept of interceptors - client side behavior that you can have play in-between the delivery of queued messages to their recipients.  In the case for client-2-server orchestration all server requests and their corresponding response messages are enqueued and subject to perversion by interceptors.  You just have to know how to implement them.  Lets say that whenever I send a CRUD request to the server called &#8216;r:createorder.request&#8217; I want to add a new attribute called last_modified_utc which is a numerical representation of a utc date as a long.  I can add that to the payload to the back end service completely transparently with the Appcelerator.Util.ServiceBroker.addInterceptor method - the method takes a callback to the following:</p>
<ul>
<li>interceptQueue - where requests from client to server are intercepted</li>
<li>interceptSendToListener - where responses from server to client are intercepted</li>
</ul>
<p>In the example below I</p>
<ul>
<li>add &#8216;last_modified_utc&#8217; as a current utc long to r:createorder.request which is consumed by my back end service</li>
<li>transform &#8216;last_modified_utc&#8217; in the r:createorder.response from utc to a localized string in the browser</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;app:script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	var interceptor = {
	    interceptQueue: function(msg, callback, messageType, scope) {
			if (messageType=='remote:createorder.request') {
				msg.data.last_modified_utc = new Date().getTime();
			}
	        return true;
	    },
	    interceptDispatch: function (requestid, type, data, datatype) {
	        return true;
	    },
	    interceptSendToListener: function (listener, messageType, data, datatype) {
			if (messageType=='createorder.response') {
				date = new Date(data.last_modified_utc);
				data.last_modified = date.toString();
			}
	        return true;
	    }
	};
	Appcelerator.Util.ServiceBroker.addInterceptor(interceptor);
	$MQ('r:createorder.request',{hi:'there'});
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/app:script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Obviously, you can take this a step further and then add interceptors that munge your data conditionally based on the current locale defined in Appcelerator.Localization.  The benefit here is that this data transformation happens at a layer outside of my normal pub/sub for messages in Appceleator - the normal pattern is to either replace or add attributes in the payload.  </p>
<h3>wrap up</h3>
<p>Although not a shrink wrapped solution for I18N in all its glory, its not hard to implement interceptors to do so.  Beyond I18N, a lot of other aspects for your messages can be mutated in the browser non-intrusively.  Although the key demonstration here is data transformation, you would potentially add other horizontal services into your application.</p>
<p>
this article cross posted at <a href="http://www.appcelerant.com/using-appcelerator-interceptors-for-i18n-l10n-g11n.html">http://www.appcelerant.com/using-appcelerator-interceptors-for-i18n-l10n-g11n.html</a></p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/appcelerator' rel='tag' target='_self'>appcelerator</a>, <a class='technorati-link' href='http://technorati.com/tag/i18n' rel='tag' target='_self'>i18n</a>, <a class='technorati-link' href='http://technorati.com/tag/ria' rel='tag' target='_self'>ria</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2008/10/13/using-appcelerator-interceptors-for-i18n-l10n-g11n/feed/</wfw:commentRss>
		</item>
		<item>
		<title>wordpress migration</title>
		<link>http://blog.zuerchtech.com/2008/10/06/wordpress-migration/</link>
		<comments>http://blog.zuerchtech.com/2008/10/06/wordpress-migration/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 00:58:28 +0000</pubDate>
		<dc:creator>Andrew Zuercher</dc:creator>
		
		<category><![CDATA[announcements]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[zuerchtech]]></category>

		<guid isPermaLink="false">http://blog.zuerchtech.com/?p=3</guid>
		<description><![CDATA[zuerchtech.com has moved to use the wordpress engine, to view the earlier version and previous posts you can do so at http://oldblog.zuerchtech.com.   more will be updated soon



Technorati Tags: wordpress, zuerchtech


]]></description>
			<content:encoded><![CDATA[<p>zuerchtech.com has moved to use the wordpress engine, to view the earlier version and previous posts you can do so at <a href="http://oldblog.zuerchtech.com">http://oldblog.zuerchtech.com</a>.   more will be updated soon</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/wordpress' rel='tag' target='_self'>wordpress</a>, <a class='technorati-link' href='http://technorati.com/tag/zuerchtech' rel='tag' target='_self'>zuerchtech</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.zuerchtech.com/2008/10/06/wordpress-migration/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
