<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mobile and gis dev notes &#187; javascript</title>
	<atom:link href="http:///wordpress/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>/wordpress</link>
	<description>by rupert</description>
	<lastBuildDate>Wed, 08 Feb 2012 22:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ExtJS: Window Snippet</title>
		<link>/wordpress/2008/03/extjs-window-snippet/</link>
		<comments>/wordpress/2008/03/extjs-window-snippet/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 23:03:19 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.gisnotes.com/wordpress/index.php/2008/03/27/extjs-window-snippet/</guid>
		<description><![CDATA[Just a quick example on creating floatable windows Note that renderTo: &#8216;document.body&#8217; would result in an error, use renderTo: document.body instead var config = { id: 'win', title:'Detail', width:600, height:300, shim:false, animCollapse:false, border:false, layout: 'fit', minimizable: true, maximizable: true, closable: false, renderTo: document.body, left: 620, top: 420, constrain: true }; window1 = new Ext.Window(config); window1.setPosition(0, [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick example on creating floatable windows</p>
<p>Note that <em>renderTo: &#8216;document.body&#8217;</em> would result in an error, use renderTo: document.body instead</p>
<p><script language="javascript">
		var config = {
		    id: 'win',
		    title:'Detail',
		    width:600,
		    height:300,
		    shim:false,
		    animCollapse:false,
		    border:false,
		    layout: 'fit',
		    minimizable: true,
		    maximizable: true,
		    closable: false,
		    renderTo: document.body,
		    left: 620,
		    top: 420,
		    constrain: true
		};
		window1 = new Ext.Window(config);
		window1.setPosition(0, 0);
		window1.show();
</script></p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/03/extjs-window-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test Driven Development using Test.AnotherWay and mxUnit</title>
		<link>/wordpress/2008/03/test-driven-development-using-testanotherway-and-mxunit/</link>
		<comments>/wordpress/2008/03/test-driven-development-using-testanotherway-and-mxunit/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 18:09:13 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.gisnotes.com/wordpress/index.php/2008/03/20/test-driven-development-using-testanotherway-and-mxunit/</guid>
		<description><![CDATA[Time and time again, I have debugging bugs and redeveloping code which some I wrote but mostly done by others as well. Experience is still my best teacher in web development and I believe it would be a heavier burden later on if we continuously pursue rapid development without any testing at all. You may [...]]]></description>
			<content:encoded><![CDATA[<p>Time and time again, I have debugging bugs and redeveloping code which some I wrote but mostly done by others as well. Experience is still my best teacher in web development and I believe it would be a heavier burden later on if we continuously pursue rapid development without any testing at all.</p>
<p>You may have heard of writing test cases before diving into code which is well known as Test Driven Development.  This methodology has been widely adapted in programming (Java thru JUnit, etc).  Following Kent Beck&#8217;s Test Driven Development (TDD) we will follow this simple method:</p>
<ol>
<li>Write the test <em>first</em></li>
<li>Watch the test fail</li>
<li>Write the component</li>
<li>Watch the test pass</li>
</ol>
<p><span id="more-155"></span><br />
A. <a href="http://straytree.com/TestAnotherWay/doc/index.html">Test.AnotherWay.</a> With the emerging trend in web development including javascript, I need a similar aproach which makes development consistent and debugging easier for the client/front-end.  Since I&#8217;ve been doing mostly web mapping, I have adapted a testing methodology from OpenLayers which is practical but effective.</p>
<p>1. Read <a href="http://straytree.com/TestAnotherWay/doc/index.html">Test.AnotherWay Documentation</a></p>
<p>2. Download <a href="http://straytree.com/TestAnotherWay/download/Test.AnotherWay-0.51.tar.gz">Test.AnotherWay-0.51.tar.gz</a></p>
<p>3. Let&#8217;s say my application is called <strong>myproject</strong>. Create a <em>test</em> folder under <strong>myproject</strong>.</p>
<p>4. Copy run-tests.html, list-tests.html into <strong>myproject</strong>/<em>test</em>. Don&#8217;t be surprised if you can&#8217;t find list-tests.html in Test.AnotherWay.</p>
<p>5. Writing the tests. To add a test, you should add it on <strong>list-tests.html</strong>. Test files should be named beginning with test_. For example, <em>test_index.html<br />
</em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #003366; font-weight: bold;">function</span> test_Map<span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        t.<span style="color: #660066;">plan</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">//this should go to the Application\\'s Global Settings</span>
    	<span style="color: #003366; font-weight: bold;">var</span> baselayer <span style="color: #339933;">=</span> CS.<span style="color: #660066;">globals</span>.<span style="color: #660066;">baselayer</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">//this should go to the Application\\'s Global Settings</span>
		<span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> CS.<span style="color: #660066;">globals</span>.<span style="color: #660066;">options</span><span style="color: #339933;">;</span>		
&nbsp;
		map <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> CS.<span style="color: #660066;">Map</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div-map&quot;</span><span style="color: #339933;">,</span> baselayer<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #006600; font-style: italic;">// default options was set</span>
		t.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>map.<span style="color: #660066;">getMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">CLASS_NAME</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;OpenLayers.Map&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;map object created successful&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		layerPlaces <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> CS.<span style="color: #660066;">VectorLayer</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Places Layer&quot;</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		t.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>layerPlaces.<span style="color: #660066;">getLayer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">CLASS_NAME</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;OpenLayers.Layer.Vector&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;vector layer created successfully&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		map.<span style="color: #660066;">addVectorLayer</span><span style="color: #009900;">&#40;</span>layerPlaces<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		selectControl <span style="color: #339933;">=</span> layerPlaces.<span style="color: #660066;">getSelectControl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		t.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span>selectControl.<span style="color: #660066;">CLASS_NAME</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;OpenLayers.Control.SelectFeature&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;selectFeatureControl added successfully&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>B. For the server side, particularly ColdFusion, I have been using <a href="http://mxunit.org/doc/index.cfm">mxunit.org</a> upon following <a href="http://corfield.org/blog/index.cfm/do/blog.entry/entry/MXUnit">Sean Corfield&#8217;s blog post regarding ColdFusion Unit Testing.</a></p>
<p>1. Download from <a href="mxunit.org">mxunit.org</a></p>
<p>2. Extract to your webroot</p>
<p>3. Write your testcase as a cfc.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> metaName <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;gao li wu&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> search <span style="color: #339933;">=</span> createObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;component&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;platform.svc.search.GeoSearch&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
search.<span style="color: #660066;">setDSN</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'beijing_app'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
search.<span style="color: #660066;">setMetaName</span><span style="color: #009900;">&#40;</span>metaName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
actual <span style="color: #339933;">=</span> search.<span style="color: #660066;">getMetaName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
assertEquals<span style="color: #009900;">&#40;</span>actual<span style="color: #339933;">,</span>metaName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Notes:<br />
1. You can <strong>show the cfdump on the test case iff the test-case passed</strong>. If your test-case <em>fails</em>, then you need to <strong>comment</strong> the assertion first so you could see the cfdump. Inserting cfdump (commented or not) is a convenient way to debug your CFM.</p>
<p>2. You can chain test cases by calling the related functions. This is very useful when you are doing a short-circuit test.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/03/test-driven-development-using-testanotherway-and-mxunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aptana Impressions</title>
		<link>/wordpress/2008/03/aptana-impressions/</link>
		<comments>/wordpress/2008/03/aptana-impressions/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 17:25:01 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[aptana]]></category>

		<guid isPermaLink="false">http://www.gisnotes.com/wordpress/index.php/2008/03/16/aptana-impressions/</guid>
		<description><![CDATA[I recently downloaded Aptana Studio 1.1 Community Edition and have been using it mostly for my Javascript/ColdFusion development. Intellisense for ExtJS by using com.extjs.ext.2.0_1.0.0.00000.jar from the ExtJS blog. Umm, I am hoping someday OpenLayers can provide a similar jar file to provide code assist. I like the fact that it could clearly display an outline [...]]]></description>
			<content:encoded><![CDATA[<p>I recently downloaded Aptana Studio 1.1 Community Edition and have been using it mostly for my Javascript/ColdFusion development.</p>
<ul>
<li>Intellisense for ExtJS by using <a href="http://orsox.mocis.at/download.php?view.1">com.extjs.ext.2.0_1.0.0.00000.jar</a> from the <a href="http://extjs.com/blog/2008/02/01/ides-plugins-and-tools-for-ext-js-20/">ExtJS blog.</a> Umm, I am hoping someday OpenLayers can provide a similar jar file to <a href="http://www.aptana.com/docs/index.php/Displaying_Code_Assist">provide code assist.</a></li>
<li>I like the fact that it could clearly display an outline of my javascript objects but <em>sometimes</em> not for all.</li>
</ul>
<p>But one of the major problems I encountered was the startup. Sometimes, for some unknown reason, Aptana cannot start using the executable it provided during the install. However, I was able to weed that problem out by instead launching it from startup.jar. All of these is documented from <a href="http://support.aptana.com/asap/browse/STU-1303">Aptana&#8217;s JIRA ticket</a>.</p>
<p>1. Downloaded and install <a href="http://www.aptana.com/">Aptana</a></p>
<p>2. Watched <a href="http://www.aptana.tv/movies/aptana_overview/Overview.html">Aptana TV Overview</a></p>
<p>3. Installed cfeclipse <a href="http://www.cfeclipse.org/update">http://www.cfeclipse.org/update</a></p>
<p>4. Installed viPlugin <a href="http://satokar.com/">http://satokar.com/</a> (Note that the viPlugin would not work with files = *.html)</p>
<p>5. Added the extjs2.0 code assist</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/03/aptana-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSEclipse</title>
		<link>/wordpress/2007/11/jseclipse/</link>
		<comments>/wordpress/2007/11/jseclipse/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 13:38:16 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">/wordpress/?p=117</guid>
		<description><![CDATA[I have an ongoing project which utilises Yahoo UI&#8217;s Javascript Libraries. There are also plans of even extending the application to use ExtJS for a more powerful window/container/layout lib. In regards to these Javascript pursuits, I need a Javascript editor for Eclipse besides my almighty vim. JSEclipse from Adobe Labs JSEclipse Installation Eclipse Update Site: [...]]]></description>
			<content:encoded><![CDATA[<p>I have an ongoing project which utilises <a href="http://developer.yahoo.com/yui">Yahoo UI&#8217;s Javascript Libraries</a>. There are also plans of even extending the application to use <a href="http://www.extjs.com/">ExtJS</a> for a more powerful window/container/layout lib. In regards to these Javascript pursuits, I need a <em>Javascript</em> editor for Eclipse besides my almighty <em>vim</em>.</p>
<p><a href="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/11/jseclipse.png" title="jseclipse.png"><img src="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/11/jseclipse.png" alt="jseclipse.png" /></a></p>
<p><a href="http://labs.adobe.com/technologies/jseclipse/">JSEclipse from Adobe Labs</a></p>
<p><a href="http://www.interaktonline.com/Documentation/JSEclipse/jseclipse.htm#2000_installing.htm">JSEclipse Installation</a></p>
<p>Eclipse Update Site:<br />
Help -&gt; Software Updates -&gt; Find and Install -&gt; New</p>
<p>http://download.macromedia.com/pub/labs/jseclipse/autoinstall</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/11/jseclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

