<?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"
	>

<channel>
	<title>Antun's Blog</title>
	<atom:link href="http://www.antunkarlovac.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.antunkarlovac.com/blog</link>
	<description>Notes on OpenLaszlo, LZX and Rich Internet Application Development</description>
	<pubDate>Tue, 30 Dec 2008 01:10:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>OpenLaszlo 4.2 adds SWF9 Support</title>
		<link>http://www.antunkarlovac.com/blog/2008/12/29/openlaszlo-42-adds-swf9-support/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/12/29/openlaszlo-42-adds-swf9-support/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 01:10:01 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[OpenLaszlo]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=191</guid>
		<description><![CDATA[In case you missed it among the holiday cheer, OpenLaszlo 4.2 was officially released last week. Personally, I&#8217;ve been looking forward to this release for a while, since it adds support for SWF9. SWF9 is bytecode that&#8217;s optimized for the Flash Player 9 runtime. Flash developers may know it as ActionScript 3 (AS3). The exciting [...]]]></description>
			<content:encoded><![CDATA[<p>In case you missed it among the holiday cheer, OpenLaszlo 4.2 was <a href="http://weblog.openlaszlo.org/archives/2008/12/openlaszlo-42-is-now-available/" target="_blank">officially released</a> last week. Personally, I&#8217;ve been looking forward to this release for a while, since it adds support for SWF9. SWF9 is bytecode that&#8217;s optimized for the Flash Player 9 runtime. Flash developers may know it as ActionScript 3 (AS3). The exciting thing for OpenLaszlo developers is that SWF9 is <em>vastly faster</em> than SWF8. And since Flash Player 9 is widely-deployed, you can start using it as the default runtime for new applications.</p>
<p>SWF9 support may not sound like a huge deal to many people - it&#8217;s just a matter of keeping up-to date with the newer version of Flash, isn&#8217;t it? Well, not exactly. The difference between SWF8 bytecode and SWF9 bytecode was significant. So big, in fact, that Adobe included two completely separate runtimes in Flash Player 9: one for running the new SWF9 bytecode, and a separate one for running SWF8-and-below bytecode. In other words, the SWF9 capability is a pretty big deal.</p>
<p>Just how much of a performance gain does the new runtime offer? A few months ago, while writing a post about optimizing data for Lzx (<a href="/blog/2008/07/18/openlaszlo-performance-tip-attributes-not-nodes/">OpenLaszlo Performance Tip: Attributes, not Nodes</a>), I found that the then-beta SWF9 runtime in OpenLaszlo was as much as 3.7 times faster than the SWF8 one, at loading and parsing XML data. At the time, much of the functionality was still missing from the 4.2 branch, so data loading was the only behavior I could test.</p>
<p>With 4.2 available, I wrote a simple test that measured how long it took to instantiate 100 windows:</p>
<pre name="code" class="xml">

&lt;canvas&gt;

    &lt;text id=&quot;output&quot; fontsize=&quot;36&quot; /&gt;

    &lt;class name=&quot;mywindow&quot; extends=&quot;window&quot; width=&quot;300&quot; height=&quot;200&quot;&gt;
    &lt;/class&gt;

    &lt;handler name=&quot;oninit&quot;&gt;&lt;![CDATA[
        var dStart = new Date();
        var j:Number = 0;
        var xpos:Number;
        var ypos:Number;

        for (j=0; j&lt;100; j++) {
            xpos = Math.max(150, Math.random() * canvas.width);
            ypos = Math.max(50, Math.random() * canvas.height);
            new lz.mywindow(canvas, {x: xpos, y: ypos});
        }
        var dEnd = new Date();
        var timeTaken = dEnd.getTime() - dStart.getTime();
        output.setAttribute(&quot;text&quot;, timeTaken);
        ]]&gt;
    &lt;/handler&gt;

&lt;/canvas&gt;
</pre>
<p>The results for creating 100 windows in OpenLaszlo 4.2.0 are:</p>
<ul>
<li>SWF8: 6,042ms</li>
<li>SWF9: 1,073ms</li>
</ul>
<p>That&#8217;s 5.6 times faster - even more dramatic than the results from the data loading test!</p>
<p>Surely all OpenLaszlo developers will now rush to recompile their applications to SWF9; all it takes is appending ?lzt=swf9 to the request, doesn&#8217;t it? Unfortunately, it&#8217;s not that simple. Moving from OpenLaszlo 4.0 to 4.1 involved a lot of language changes, specifically in anticipation of SWF9. I <a href="/blog/2008/07/02/migrating-lzx-code-to-openlaszlo-41/">wrote about this</a> a while back. Then, moving from OpenLaszlo 4.1 to 4.2, there were a few more changes, mainly because icompatibilities were found after 4.1 had been released, and in-depth development had started on supporting the new runtime. As an example, the &lt;script&gt; tag shouldn&#8217;t be used in SWF9. It actually partly works, but causes confusing errors. Better replace it with &lt;handler name=&#8221;oninit&#8221;&gt;.</p>
<p>Happily there are some resources and tools for developers needing to migrate their applications. There&#8217;s an OpenLaszlo wiki page on <a href="http://wiki.openlaszlo.org/Runtime_Differences#Upgrading_to_OpenLaszlo_4.2" target="_blank">Runtime Differences</a>, which should be your first stop. It describes how to use the Perl migration script that (in theory) updates your code for you. Remember that it may not catch everything. It&#8217;s hard to anticipate every manner in which developers will use a platform, so please be patient and provide any feedback on issues you hit on the <a href="http://forum.openlaszlo.org/">forums</a> or <a href="http://www.openlaszlo.org/lists" target="_blank">mailing lists</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/12/29/openlaszlo-42-adds-swf9-support/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Changes at Google Maps</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/26/changes-at-google-maps/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/26/changes-at-google-maps/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 13:30:02 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=187</guid>
		<description><![CDATA[The good folks at Google Maps appear to have been busy. The UI for the zoom/pan control (GLargeMapControl) has been refreshed with a new skin. The process for selecting the position from which to view the neigborhood using the Street View feature is simplified - the draggable &#8220;person&#8221; is always present in the zoom control.
The [...]]]></description>
			<content:encoded><![CDATA[<p>The good folks at <a href="http://maps.google.com/" target="_blank">Google Maps</a> appear to have been busy. The UI for the zoom/pan control (GLargeMapControl) has been refreshed with a new skin. The process for selecting the position from which to view the neigborhood using the <a href="http://maps.google.com/help/maps/streetview/" target="_blank">Street View</a> feature is simplified - the draggable &#8220;person&#8221; is always present in the zoom control.</p>
<div id="attachment_188" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.antunkarlovac.com/blog/wp-content/uploads/2008/11/newgm.jpg"><img class="size-full wp-image-188" title="New Google Maps Interface" src="http://www.antunkarlovac.com/blog/wp-content/uploads/2008/11/newgm.jpg" alt="New Google Maps Interface" width="500" height="290" /></a><p class="wp-caption-text">New Google Maps Interface</p></div>
<p>The entire Street View feature is now a Flash-based application, that takes over the map screen. Previously, the street panorama would be displayed in a Google Maps info window, and was implemented in DHTML.</p>
<p>The satellite imagery has also been replaced with higher-resolution pictures from the <a href="http://launch.geoeye.com/LaunchSite/" target="_blank">GeoEye Satellite</a>, which was launched a couple of months ago. At least that&#8217;s the case in my neigborhood, and a couple of other spots I searched in California.</p>
<p>Even the Street View images have been updated - again, at least in my neigborhood.</p>
<p>Although the new zoom/pan control does not appear to be available to developers using the <a href="http://code.google.com/apis/maps/" target="_blank">Google Maps API</a>, the new satellite images are present by default. Hopefully this means that we&#8217;ll finally have a globally-consistent maximum zoom level!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/26/changes-at-google-maps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The id Attribute in 4.1</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/25/the-id-attribute-in-41/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/25/the-id-attribute-in-41/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 07:41:32 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[LZX Tips]]></category>

		<category><![CDATA[OpenLaszlo]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=183</guid>
		<description><![CDATA[One subtle thing that has changed in OpenLaszlo 4.1 is that you can no longer specify the id attribute when instantiating objects from script.
When instantiating a class from script, you can specify a dictionary of initial properties as the second argument to the constructor:
var v = new lz.view(canvas, {width: 300, height: 300, bgcolor: 0xff0000}); // [...]]]></description>
			<content:encoded><![CDATA[<p>One subtle thing that has changed in OpenLaszlo 4.1 is that you can no longer specify the id attribute when instantiating objects from script.</p>
<p>When instantiating a class from script, you can specify a dictionary of initial properties as the second argument to the constructor:</p>
<p><code>var v = new lz.view(canvas, {width: 300, height: 300, bgcolor: 0xff0000}); // 4.1</code></p>
<p>Prior to OpenLaszlo 4.1, the constructor shown above would have been LzView() instead of lz.view(). Also, prior to 4.1, you could have specified the id attribute in addition to the width, height, and bgcolor attributes, and then referenced your newly-created view by that id later in the application. e.g.</p>
<p><code>var v = new LzView(canvas, {id: "myNewView", width: 300, height: 300, bgcolor: 0xff0000}); // 4.0.12</code></p>
<p>Since the SWF9 does not allow global variables to be created on-the-fly, OpenLaszlo 4.1 will no longer allow you to do this either. For better or for worse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/25/the-id-attribute-in-41/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tab Completion in the Debugger</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/18/tab-completion-in-the-debugger/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/18/tab-completion-in-the-debugger/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 03:00:49 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[LZX Tips]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=181</guid>
		<description><![CDATA[There&#8217;s a handy tab completion feature in the OpenLaszlo debugger now. It&#8217;s been around for a few months, but I&#8217;ve avoided using it mainly because the keyboard focus was a little flaky on my old Windows laptop.
It works just like a typical Unix (say bash) shell:

Recompile your application with the debugger. e.g. browse to the [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a handy tab completion feature in the OpenLaszlo debugger now. It&#8217;s been around for a few months, but I&#8217;ve avoided using it mainly because the keyboard focus was a little flaky on my old Windows laptop.</p>
<p>It works just like a typical Unix (say bash) shell:</p>
<ol>
<li>Recompile your application with the debugger. e.g. browse to the <a href="http://labs.openlaszlo.org/trunk-nightly/my-apps/copy-of-hello.lzx?debug=true" target="_blank">Hello, World!</a> example with ?debug=true.</li>
<li>Click on the Debugger text input field, and begin typing. e.g. <strong>can</strong></li>
<li>Hit tab. The Debugger should complete the word &#8220;canvas&#8221;.</li>
<li>Now add a dot, and hit tab once. e.g. <strong>canvas.</strong></li>
<li>If there are too many possible matches, you&#8217;ll see output like the following in the Debugger:<br />
<span style="color: #0000ff;">INFO: 456 possibilities: press &#8216;\t&#8217; again to see them all</span></li>
<li>Hit tab again, and you should see a long list of possible properties on canvas:<br />
<span style="color: #0000ff;">INFO: Possible completions: $cfn $isstate $lzc$bind_id $lzc$bind_name &#8230;</span></li>
<li>Now add &#8220;sub&#8221; to the text input field. It should read <strong>canvas.sub</strong></li>
<li>Hit tab. You should see two possible matches for canvas.sub:<br />
<span style="color: #0000ff;">Possible completions: subnodes subviews </span></li>
<li>Add a &#8220;v&#8221;, so your text input field now says <strong>canvas.subv</strong></li>
<li>Hit tab. The debugger should complete that to canvas.subviews, since its the only possible match. Now hit the enter key, and the Debugger will inspect canvas.subviews.</li>
</ol>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/18/tab-completion-in-the-debugger/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Maps in OpenLaszlo</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/17/google-maps-in-openlaszlo/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/17/google-maps-in-openlaszlo/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 02:34:20 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[Google Maps]]></category>

		<category><![CDATA[OpenLaszlo]]></category>

		<category><![CDATA[RIAs]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=172</guid>
		<description><![CDATA[Recently, I wrote about Rmenuz, a site that embedded Google&#8217;s Flash maps in OpenLaszlo. The Google Flash Maps are written in ActionScript 3 (AS3), which requires Flash Player 9 or above. That means you wouldn&#8217;t be able to use them in OpenLaszlo 4.1 or below. I figured that with OpenLaszlo 4.2b3, which supports compiling to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I wrote about <a href="/blog/2008/11/04/rmenuz-openlaszlo-and-google-maps/">Rmenuz</a>, a site that embedded Google&#8217;s Flash maps in OpenLaszlo. The <a href="http://code.google.com/apis/maps/documentation/flash/" target="_blank">Google Flash Maps</a> are written in ActionScript 3 (AS3), which requires Flash Player 9 or above. That means you wouldn&#8217;t be able to use them in OpenLaszlo 4.1 or below. I figured that with OpenLaszlo 4.2b3, which supports compiling to SWF9, it should be possible to embed an AS3 component. With some much-appreciated help from <a href="http://www.beartronics.com/" target="_blank">Henry</a>, I got the following application working:</p>
<p>[kml_flashembed movie="/blog/wp-content/uploads/2008/11/openlaszlo_google_maps.swf" height="530" width="468" /]</p>
<p>I wanted an example that:</p>
<ul>
<li>Embedded Google maps in a clean, developer-friendly way.</li>
<li>Was full-featured (allowed a user to search for an address, and add a marker there).</li>
<li>Passed information (such as where to add a marker) from the OpenLaszlo application to the map component.</li>
<li>Passed information (such as the address of the marker that a user clicked) from the map to an object in the OpenLaszlo namespace.</li>
</ul>
<p>Note that the Google Maps geocoding service is Flash-specific. Even though it passes XML back to the client, you need to use Google&#8217;s Flash-based APIs to call it. I didn&#8217;t want to do this; I wanted my example to perform the search in OpenLaszlo, and pass instructions to the map component. So I used Yahoo Maps&#8217; excellent <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html" target="_blank">geocoding service</a>.</p>
<p>Here are the instructions on how to do this:</p>
<ol>
<li><a href="http://www.openlaszlo.org/download/" target="_blank">Download OpenLaszlo</a> 4.2b3 or later, and install.</li>
<li>Get a <a href="http://code.google.com/apis/maps/signup.html" target="_blank">Google Maps API key</a> (free).</li>
<li>Download the <a href="http://code.google.com/apis/maps/documentation/flash/" target="_blank">Google Maps API for Flash SDK</a>, from Google&#8217;s web site. I used version 1.7.</li>
<li>Find the WEB-INF directory in your OpenLaszlo install, and create a directory called flexlib inside that. i.e. WEB-INF/flexlib/</li>
<li>Unzip the Google Maps SDK, and locate the two SWC files in the lib directory. Take the Flash one (mine was called map_1_7a.swc) and copy it into WEB-INF/flexlib/.</li>
<li>In your OpenLaszlo my-apps folder, create your lzx file (e.g. main.lzx), and write your application.</li>
<li>When you compile the app via the browser, make sure that you remember to compile to SWF9. When you request the LZX file, append ?lzr=swf9 to the request. (e.g. main.lzx?lzr=swf9).</li>
</ol>
<p>Here&#8217;s my complete source:</p>
<pre name="code" class="xml">

&lt;canvas proxied=&quot;false&quot; width=&quot;468&quot; height=&quot;530&quot;&gt;

    &lt;!-- antunkarlovac.com key --&gt;
    &lt;attribute name=&quot;gmapsKey&quot;
               value=&quot;ABQIAAAAN0JyO4tW04-1OKNW7bg9gxSPySWqAfkZkuZG2U8jr6yyIuV3XBSrEn410_O9d9QPJh3dbWV85Qad8w&quot; type=&quot;string&quot; /&gt;

    &lt;alert name=&quot;errorDialog&quot; width=&quot;400&quot; /&gt;

    &lt;method name=&quot;handleMarkerClick&quot; args=&quot;address&quot;&gt;
        addressWin.writeAddress(address);
    &lt;/method&gt;

    &lt;script when=&quot;immediate&quot;&gt;&lt;![CDATA[
        class FlashMapOL {
            #passthrough (toplevel: true) {
                import com.google.maps.*;
                import com.google.maps.controls.*;
                import com.google.maps.overlays.*;

                import flash.geom.*;
            }#

            var map:Map;

            function createMap() {
                map = new Map();
                map.addEventListener(MapEvent.MAP_READY, onMapReady);
                map.key = canvas.gmapsKey;
                map.setSize(new Point(450, 300));
                return map;
            }

            function onMapReady(event:MapEvent):void {
                map.addControl(new ZoomControl());
                map.addControl(new PositionControl());
                map.addControl(new MapTypeControl());
            }

            function addMarker(lat:Number, lon:Number, address:String):void {
                map.clearOverlays();
                var latLon:LatLng = new LatLng(lat, lon);
                var marker:Marker = new Marker(latLon);
                marker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void {
                    canvas.handleMarkerClick(address);
                    map.openInfoWindow(latLon, new InfoWindowOptions({titleHTML: &quot;&lt;b&gt;Search Result&lt;/b&gt;&quot;, contentHTML: address}));
                });
                map.addOverlay(marker);
            }

            function centerAndZoom(lat:Number, lon:Number):void {
                var latLon:LatLng = new LatLng(lat, lon);
                this.map.setCenter(latLon, 14, MapType.NORMAL_MAP_TYPE);
            }

        }

        lz.mapFactory = new FlashMapOL();

        lz.map = lz.mapFactory.createMap();
    ]]&gt;
    &lt;/script&gt;

    &lt;dataset name=&quot;geoCode_ds&quot;
             src=&quot;http://local.yahooapis.com/MapsService/V1/geocode?&quot; type=&quot;http&quot; request=&quot;false&quot;/&gt;

    &lt;datapointer name=&quot;result_dp&quot;
                 xpath=&quot;geoCode_ds:/ResultSet/Result[1]&quot; /&gt;

    &lt;handler name=&quot;ondata&quot; reference=&quot;geoCode_ds&quot;&gt;&lt;![CDATA[
        var lat;
        var lon;
        var root_dp = geoCode_ds.getPointer();
        root_dp.selectChild();
        if (root_dp.getNodeName() != &quot;Error&quot;) {
            lat = result_dp.xpathQuery(&quot;Latitude/text()&quot;) * 1;
            lon = result_dp.xpathQuery(&quot;Longitude/text()&quot;) * 1;
            var warn = result_dp.getNodeAttribute(&quot;warning&quot;);
            if (warn != undefined) {
                // Pass along any warnings (e.g. couldn&#039;t find address,
                // centering on city.
                errorDialog.setAttribute(&quot;text&quot;, warn);
                errorDialog.open();
            }
            // Get full address as a string
            var address = result_dp.xpathQuery(&quot;Address/text()&quot;)
                        + &quot;,&lt;br /&gt;&quot; + result_dp.xpathQuery(&quot;City/text()&quot;)
                        + &quot;, &quot; + result_dp.xpathQuery(&quot;State/text()&quot;)
                        + &quot; &quot; + result_dp.xpathQuery(&quot;Zip/text()&quot;)
                        + &quot;&lt;br /&gt;&quot; + result_dp.xpathQuery(&quot;Country/text()&quot;);
            lz.mapFactory.centerAndZoom(lat,lon);
            lz.mapFactory.addMarker(lat, lon, address);
        } else {
            // Failed to find address
            var msg = root_dp.xpathQuery(&quot;Message/text()&quot;);
            errorDialog.setAttribute(&quot;text&quot;, msg);
            errorDialog.open();
        }
    ]]&gt;
    &lt;/handler&gt;

    &lt;window name=&quot;mapWin&quot; title=&quot;Map&quot; width=&quot;468&quot; height=&quot;369&quot;
            allowdrag=&quot;false&quot;&gt;
        &lt;passthrough&gt;
            import flash.display.*;
        &lt;/passthrough&gt;
        &lt;handler name=&quot;oninit&quot;&gt;
            var sprite:Sprite = this.content.sprite;
            sprite.addChildAt(lz.map, sprite.numChildren);
        &lt;/handler&gt;

        &lt;view name=&quot;buttons&quot; bgcolor=&quot;0xeaeaea&quot; width=&quot;100%&quot;
              valign=&quot;bottom&quot;&gt;
            &lt;simplelayout axis=&quot;x&quot; spacing=&quot;10&quot; /&gt;
            &lt;text valign=&quot;middle&quot;&gt;Address Search:&lt;/text&gt;
            &lt;edittext name=&quot;addressInput&quot; width=&quot;260&quot;
                      text=&quot;1221 Mariposa Street, San Francisco, CA&quot; /&gt;
            &lt;button&gt;Search
                &lt;handler name=&quot;onclick&quot;&gt;&lt;![CDATA[
                    var qs = &quot;appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&quot;
                           + &quot;&amp;amp;amp;location=&quot; + parent.addressInput.text
                    geoCode_ds.setQueryString(qs);
                    geoCode_ds.doRequest();
                ]]&gt;
                &lt;/handler&gt;
            &lt;/button&gt;
        &lt;/view&gt;

    &lt;/window&gt;

    &lt;window name=&quot;addressWin&quot; title=&quot;Address&quot; width=&quot;468&quot; height=&quot;150&quot;
            y=&quot;379&quot; allowdrag=&quot;false&quot;&gt;
        &lt;method name=&quot;writeAddress&quot; args=&quot;address&quot;&gt;
            this.txt.setAttribute(&quot;text&quot;, address);
        &lt;/method&gt;

        &lt;simplelayout axis=&quot;y&quot; spacing=&quot;10&quot; /&gt;

        &lt;text width=&quot;100%&quot; multiline=&quot;true&quot; fontstyle=&quot;italic&quot;&gt;
            Click the search button to search for an address. When you click
            one of the markers, the full address will be displayed in the
            OpenLaszlo text field below:
        &lt;/text&gt;

        &lt;!-- Address display area --&gt;
        &lt;text name=&quot;txt&quot; width=&quot;100%&quot; multiline=&quot;true&quot; fontsize=&quot;14&quot;&gt;
        &lt;/text&gt;
    &lt;/window&gt;

&lt;/canvas&gt;
</pre>
<p>Note a few important points in the code:</p>
<ul>
<li>There&#8217;s AS3 code directly inside the script block in the canvas. You need to use the when=&#8221;immediate&#8221; option in the script tag for this.</li>
<li>There&#8217;s an OpenLaszlo compiler instruction that allows you to include libraries from the WEB-INF/flexlib/ directory:<br />
#passthrough (toplevel: true) {<br />
&#8230;<br />
}#</li>
<li>There&#8217;s another OpenLaszlo compiler instruction in the view where you want to instantiate the map (there&#8217;s a new passthrough tag, and the map must be added procedurally - sprite.addChildAt().</li>
</ul>
<p>Here&#8217;s the <a href="/blog/wp-content/uploads/2008/11/openlaszlo_google_mapslzx.zip">complete source</a> to my app, as a zip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/17/google-maps-in-openlaszlo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rmenuz - OpenLaszlo and Google Maps</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/04/rmenuz-openlaszlo-and-google-maps/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/04/rmenuz-openlaszlo-and-google-maps/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 15:36:13 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[Google Maps]]></category>

		<category><![CDATA[OpenLaszlo]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=165</guid>
		<description><![CDATA[I looked at Google Map&#8217;s Flash API a while ago, trying to determine a way to integrate it into OpenLaszlo, but never had time to finish it. Today, I discovered Rmenuz, which is an OpenLaszlo application that lets you search for restaurants, and displays them using the Flash-based Google Maps.
I&#8217;m not sure what the status [...]]]></description>
			<content:encoded><![CDATA[<p>I looked at <a href="http://code.google.com/apis/maps/documentation/flash/">Google Map&#8217;s Flash API</a> a while ago, trying to determine a way to integrate it into OpenLaszlo, but never had time to finish it. Today, I discovered Rmenuz, which is an OpenLaszlo application that lets you search for restaurants, and displays them using the Flash-based Google Maps.</p>
<div id="attachment_166" class="wp-caption aligncenter" style="width: 470px"><a href="https://my.rmenuz.com/default.aspx" target="_blank"><img class="size-full wp-image-166" title="rmenuz" src="http://www.antunkarlovac.com/blog/wp-content/uploads/2008/11/rmenuz.gif" alt="Rmenuz Screenshot" width="460" height="331" /></a><p class="wp-caption-text">Rmenuz Screenshot</p></div>
<p>I&#8217;m not sure what the status is of the site; it may still be under development. There&#8217;s a problem with its security certificate and I found a number of glitches with the application. You can try it at:</p>
<p><a href="https://my.rmenuz.com/default.aspx" target="_blank">https://my.rmenuz.com/default.aspx</a></p>
<p>It can be hard to get to the map, since it&#8217;s only displayed if your search returns valid search results. To see the map, follow these steps:</p>
<ol>
<li>Click on the &#8220;Search by: CUISINE&#8221; window.</li>
<li>Check &#8220;American Restaurants&#8221;.</li>
<li>Select &#8220;Distance&#8221; 2.</li>
<li>Enter the zip: 94107.</li>
<li>Click go.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/04/rmenuz-openlaszlo-and-google-maps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS in OpenLaszlo</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/03/css-in-openlaszlo/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/03/css-in-openlaszlo/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 20:45:16 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[OpenLaszlo]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=159</guid>
		<description><![CDATA[It&#8217;s been over a month since my last (proper) post. I&#8217;ve been heads-down on a Webtop project. One feature that I had to become familiar with for this was CSS. Yes, OpenLaszlo has included support for CSS for some time, although it wasn&#8217;t documented. CSS was added to OpenLaszlo specifically to support the Webtop product. [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been over a month since my last (proper) post. I&#8217;ve been heads-down on a <a href="http://www.laszlosystems.com/products/webtop/overview" target="_blank">Webtop</a> project. One feature that I had to become familiar with for this was CSS. Yes, OpenLaszlo has included support for CSS for some time, although it wasn&#8217;t documented. CSS was added to OpenLaszlo specifically to support the Webtop product. Webtop is customizable, but the client (i.e. OpenLaszlo) libraries are precompiled into .lzo files, so developers cannot modify them directly when they want to skin the product.</p>
<p>CSS works in OpenLaszlo 4.1.1 and 4.0.13. I haven&#8217;t tried it in the 4.2 branch.</p>
<p>You can use CSS to control colors, resources, text labels, coordinates and dimensions. Since the standard OpenLaszlo components don&#8217;t support any CSS properties yet, here&#8217;s how to define your own. This post is supposed to be a quick introduction to CSS in OpenLaszlo; I&#8217;ll post some more specific posts over the coming days.</p>
<p>When you define your class, specify its default styles in a stylesheet tag, and use the new style binding to constrain individual view properties to CSS properties:</p>
<p><strong>styleablebox.lzx</strong></p>
<pre name="code" class="xml">

&lt;library&gt;

    &lt;stylesheet&gt;
        styleablebox {
            borderColor: #0000ff;
            backgroundColor: #00ffff;
            buttonText: &quot;Move the box!&quot;;
            buttonX: 30;
            buttonY: 30;
        }
    &lt;/stylesheet&gt;

    &lt;class name=&quot;styleablebox&quot; width=&quot;200&quot; height=&quot;100&quot;&gt;
        &lt;view name=&quot;bg&quot; width=&quot;100%&quot; height=&quot;100%&quot;
              bgcolor=&quot;$style{&#039;borderColor&#039;}&quot;&gt;
            &lt;view name=&quot;inner&quot; width=&quot;90%&quot; height=&quot;80%&quot;
                  align=&quot;center&quot; valign=&quot;middle&quot;
                  bgcolor=&quot;$style{&#039;backgroundColor&#039;}&quot;&gt;
                &lt;text fontsize=&quot;24&quot;&gt;Stylable Box&lt;/text&gt;
                &lt;button text=&quot;$style{&#039;buttonText&#039;}&quot;
                        x=&quot;$style{&#039;buttonX&#039;}&quot; y=&quot;$style{&#039;buttonY&#039;}&quot;&gt;
                    &lt;handler name=&quot;onclick&quot;&gt;
                        classroot.animate(&quot;x&quot;, 25, 500, true);
                    &lt;/handler&gt;
                &lt;/button&gt;
            &lt;/view&gt;
        &lt;/view&gt;
    &lt;/class&gt;

&lt;/library&gt;
</pre>
<p>The default styles will apply to that class when you instantiate it, unless you override them later. To override them, simply define a new stylesheet tag later in the code:</p>
<p><strong>test-styleablebox.lzx</strong></p>
<pre name="code" class="xml">

&lt;canvas proxied=&quot;false&quot;&gt;
    &lt;include href=&quot;styleablebox.lzx&quot; /&gt;

    &lt;stylesheet&gt;
        styleablebox {
            borderColor: #ff0000;
            backgroundColor: #ffff00;
            buttonText: &quot;Slide away!&quot;;
            buttonX: 80;
            buttonY: 50;
        }
    &lt;/stylesheet&gt;

    &lt;styleablebox /&gt;

&lt;/canvas&gt;
</pre>
<p>There are a variety of supported CSS selectors that will allow you to specify which objects particular styles apply to; I&#8217;ll discuss those in a future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/03/css-in-openlaszlo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Advertising Temporarily Suspended</title>
		<link>http://www.antunkarlovac.com/blog/2008/11/03/advertising-temporarily-suspended/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/11/03/advertising-temporarily-suspended/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 19:51:25 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=156</guid>
		<description><![CDATA[My blog has always been purely about geeky computer stuff: RIAs, Rails, Linux, etc. So I was quite surprised to browse to it today and find a political ad regarding one of California&#8217;s propositions in the left-hand sidebar. (Note to non-Californians: proposition == referendum). Google serves these ads directly, through their AdSense program. I have [...]]]></description>
			<content:encoded><![CDATA[<p>My blog has always been purely about geeky computer stuff: RIAs, Rails, Linux, etc. So I was quite surprised to browse to it today and find a political ad regarding one of California&#8217;s propositions in the left-hand sidebar. (Note to non-Californians: proposition == referendum). Google serves these ads directly, through their <a href="http://www.google.com/adsense" target="_blank">AdSense</a> program. I have no control over what ads gets served. Until now, they have usually been relevant, since Google parses my blog and matches ads based on keywords it finds.</p>
<p>I apologize to my readers for this intrusion.</p>
<p>Since one doesn&#8217;t talk about politics in polite company, I&#8217;ve decided to remove <em>all </em>ads from my blog until after tomorrow - election day - when no doubt Google will revert to serving discreet text ads packed with warm acronyms.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/11/03/advertising-temporarily-suspended/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Restoring a Broken Linux RAID Array</title>
		<link>http://www.antunkarlovac.com/blog/2008/09/30/restoring-a-broken-linux-raid-array/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/09/30/restoring-a-broken-linux-raid-array/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 06:13:10 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=151</guid>
		<description><![CDATA[About 18 months ago I set up a Linux media server for my home. It was made from an old Dell desktop that my neighbor was (literally) discarding, and a pair of new, identical Seagate hard disks. Since I was going to be spending a lot of time copying my CDs to this server, I [...]]]></description>
			<content:encoded><![CDATA[<p>About 18 months ago I set up a Linux media server for my home. It was made from an old Dell desktop that my neighbor was (literally) discarding, and a pair of new, identical Seagate hard disks. Since I was going to be spending a lot of time copying my CDs to this server, I configured a RAID-1 array that mirrored the hard disks; that way, there would always be a current backup. The OS was Ubuntu Linux 6.06 Server, and it used software RAID.</p>
<p>One of the drives started failing last week, so happy though I was to have a handy backup, I was a bit daunted about the prospect of restoring a broken RAID array. You see, there&#8217;s plenty of tutorials on how to set up software RAID, but not that many resources on what to do after a drive breaks. It actually turned out to be really easy, thanks in large part to my friends <a href="http://www.ultimatebootcd.com/" target="_blank">Yossie&#8217;s</a> and Eric&#8217;s guidance, so I decided to document the process here.</p>
<p><strong>Determining if Your RAID Array is Broken</strong></p>
<p>This part is really easy. Log in as root, and run:</p>
<p>cat /proc/mdstat</p>
<p>You should see something like this if there is a problem:</p>
<blockquote><p>Personalities : [raid1]<br />
md1 : active raid1 hda2[0]<br />
1927680 blocks [2/1] [U_]</p>
<p>md0 : active raid1 hda1[0]<br />
310640768 blocks [2/1] [U_]</p>
<p>unused devices: &lt;none&gt;</p></blockquote>
<p>Note the underscore in the <strong>[U_]</strong>. A healthy RAID array will not have the underscore. Instead, it would say [UU]. Also note that hda is active (it&#8217;s listed in the md0/md1 lines), but hdb is conspicuously absent. So hdb is in trouble.</p>
<p><strong>Finding the Broken Drive</strong></p>
<p>If you know which drive hdb is, then remove it, but it&#8217;s probably best to run a test to be sure it actually has errors. For this, I found a very versatile free tool called <a href="http://www.ultimatebootcd.com/" target="_blank">Ultimate Boot CD</a>. You download the ISO and burn it onto a CD. You can use the CD to boot your PC. It&#8217;s packed with diagnostic tools, such as hard disk testers, memory testers, etc. Run the appropriate one for your brand of hard disk, on each disk in the array. The Seagate tester I used lists the hard disks serial numbers, so there&#8217;s no confusion once you open the case to remove the bad drive.</p>
<p><strong>Ensure You Can Boot From the Good Drive</strong></p>
<p>Depending on which drive is bad, and how you originally configured them, you may not be able to boot properly from the good drive. Best to test that you can. Remove the bad drive, and try to boot. You may need to modify jumper settings and/or move the good drive to the master plug on the IDE cable. If you can boot, great. If not, the Grub loader may be missing from the the good drive. To reinstall it, put the drives back where they were so that you can boot, log in as root, and run:</p>
<p>grub-install /dev/hda</p>
<p>(Assuming you need to install it on hda).</p>
<p>Retest that you can now boot off the remaining drive with the bad one removed.</p>
<p><strong>Replace the Broken Drive</strong></p>
<p>Obtain a matching drive, and install it in the case.</p>
<p>I only discovered (happily) after this happened that Seagate drives come with a 5-year warranty. If a drive goes bad, you can check if it&#8217;s covered using Seagate&#8217;s <a href="http://support.seagate.com/customer/warranty_validation.jsp" target="_blank">Warranty Checker</a>. You don&#8217;t even need your original receipt to process the return, just the serial and model numbers. The whole process couldn&#8217;t be easier. I opted for their $20 premium service, where they send you a refurbished drive that matches yours <em>immediately</em>, via 2-day air shipping. The replacement drive comes with a box and a prepaid label to return the broken one to Seagate. The return shipping alone would have cost me $10, so that service seems like a bargain.</p>
<p><strong>Rebuild the RAID Array</strong></p>
<p>This is the bit I was daunted by, but it really turned out to be fairly simple. After the new drive is installed, boot up and log in as root.</p>
<p>Verify which drive is now part of the array. Run:</p>
<p>cat /proc/mdstat</p>
<p>You should see something like:</p>
<blockquote><p>md1 : active raid1 hda2[1]<br />
1927680 blocks [2/1] [_U]</p>
<p>md0 : active raid1 hda1[1]<br />
310640768 blocks [2/1] [_U]</p></blockquote>
<p>In this case, hda is the working drive.</p>
<p>Look at the current partition table of the working drive (hda in my case). Run:</p>
<p>fdisk /dev/hda<br />
p (for print)<br />
q (to exit)</p>
<p>Output should be something like:</p>
<blockquote><p>Disk /dev/hda: 320.0 GB, 320072933376 bytes<br />
255 heads, 63 sectors/track, 38913 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/hda1   *           1       38673   310640841   fd  Linux raid autodetect<br />
/dev/hda2           38674       38913     1927800   fd  Linux raid autodetect</p></blockquote>
<p>Now configure the partitions of the new drive (hdb) to match the working one (hda). Run:</p>
<p>fdisk /dev/hda</p>
<ol>
<li>Enter n (for new partition).</li>
<li>Enter p (for primary partition).</li>
<li>Make it the first partition (i.e. 1).</li>
<li>Start at cylinder 1 (the default).</li>
<li>Use the End value for the last cylinder of partition 1 on hda (i.e. 38673).</li>
<li>Change the new partition&#8217;s type to match the Id value of your first<br />
partition (i.e. &#8220;fd&#8221;). This is important for the RAID controller to understand that this is part of the RAID array.<br />
Enter t (for &#8220;change a partition&#8217;s system id&#8221;).<br />
Enter fd.</li>
<li>That would have configured the first partition hdb1. Repeat steps 1-6 for all the partitions on hda. In my case, there was only one additional one. Remember to use the copy Start and End blocks.</li>
<li>when you&#8217;re finished, enter w (for &#8220;write table to disk and exit&#8221;).</li>
</ol>
<p>Now you&#8217;re ready to hot-add the new drive to your RAID array. You&#8217;ll need to run mdadm for each partition you need to restore (two in my case). Use the output of /proc/mdstat as a guide. e.g.</p>
<blockquote><p><strong>md1 </strong>: active raid1 <strong>hda2</strong>[1]<br />
1927680 blocks [2/1] [_U]</p>
<p><strong>md0 </strong>: active raid1 <strong>hda1</strong>[1]<br />
310640768 blocks [2/1] [_U]</p></blockquote>
<p>Here md1 currently maps to hda2 only. We need to add hdb2 to md1. md0 currently maps to hda1 only. We need to add hdb1 to md0. So in this case, you would run the following commands:</p>
<p>mdadm /dev/md0 -a /dev/hdb1<br />
mdadm /dev/md1 -a /dev/hdb2</p>
<p>That&#8217;s it! The RAID array should be doing its magic.</p>
<p><strong>Verify That It&#8217;s Updating</strong></p>
<p>Examine the output from /proc/mdstat now, and you should see something like:</p>
<blockquote><p>Personalities : [raid1]<br />
md1 : active raid1 hdb2[2] hda2[1]<br />
1927680 blocks [2/1] [_U]<br />
resync=DELAYED</p>
<p>md0 : active raid1 hdb1[2] hda1[1]<br />
310640768 blocks [2/1] [_U]<br />
[&gt;....................]  recovery =  1.0% (3196864/310640768) finish=158.8min speed=32257K/sec</p>
<p>unused devices: &lt;none&gt;</p></blockquote>
<p>Since it&#8217;ll take several hours, you can log out of the shell, and let it synchronize the two disks.</p>
<p><strong>Install the Grub Loader on Your New Drive</strong></p>
<p>Since you just added hdb, you should install the Grub loader, in case hda ever fails or is removed. Run:</p>
<p>grub-install /dev/hdb</p>
<p>&#8230; and you should be good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/09/30/restoring-a-broken-linux-raid-array/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finding the OpenLaszlo Version of a Compiled SWF</title>
		<link>http://www.antunkarlovac.com/blog/2008/09/29/finding-the-openlaszlo-version-of-a-compiled-swf/</link>
		<comments>http://www.antunkarlovac.com/blog/2008/09/29/finding-the-openlaszlo-version-of-a-compiled-swf/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 18:37:06 +0000</pubDate>
		<dc:creator>antun</dc:creator>
		
		<category><![CDATA[OpenLaszlo]]></category>

		<guid isPermaLink="false">http://www.antunkarlovac.com/blog/?p=149</guid>
		<description><![CDATA[When you need to additional work on a previously-built OpenLaszlo application, you need to make sure that you use the same version of OpenLaszlo as was originally used to build it. If you use a different version of OpenLaszlo, you may run into incompatibilities in the existing application&#8217;s LZX source code. Unless the original application [...]]]></description>
			<content:encoded><![CDATA[<p>When you need to additional work on a previously-built OpenLaszlo application, you need to make sure that you use the same version of OpenLaszlo as was originally used to build it. If you use a different version of OpenLaszlo, you may run into incompatibilities in the existing application&#8217;s LZX source code. Unless the original application developer documented what version of OpenLaszlo they used, it won&#8217;t be immediately obvious.</p>
<p>I&#8217;m assuming that at this point, you have the source code, and a compiled SWF (possibly from the live deployment server). If you don&#8217;t have the application as a compiled SWF, then this approach won&#8217;t work.</p>
<p>First, download and extract <a href="http://flasm.sourceforge.net/#download" target="_blank">Flasm</a>. Flasm is an open-source SWF disassembler. It won&#8217;t translate a SWF into LZX code, but it will convert it into readable bytecode, and that is all you really need to find the OpenLaszlo canvas attributes. You run Flasm from the command line.</p>
<p>Second, download the compiled application SWF (the one whose OpenLaszlo version you want to determine) onto your development machine. If its on a production server, you can use a *NIX command-line tool like wget or curl. If you&#8217;re on Windows, install <a href="http://http://www.cygwin.com/" target="_blank">Cygwin</a>, and you&#8217;ll have all the *NIX goodies you need. (The Windows Flasm executable works well in a Cygwin shell). e.g.</p>
<p>wget http://www.antunkarlovac.com/blog/wp-content/uploads/2008/09/selectionmanager.swf</p>
<p>That should download the SWF to your current directory.</p>
<p>Finally, run Flasm, with the disassemble argument, and search for the term <strong>lpsversion</strong>. Either save the output to a file, or pipe it through grep. There&#8217;s a bunch of output, but I find the last line of output tends to be the relevant one:</p>
<p style="padding-left: 30px;">&#8230;<br />
push &#8216;canvas&#8217;, &#8216;__LZproxied&#8217;, &#8216;true&#8217;, &#8216;bgcolor&#8217;, 16777215, &#8216;embedfonts&#8217;, TRUE, &#8216;fontname&#8217;, &#8216;Verdana,Vera,sans-serif&#8217;, &#8216;fontsize&#8217;, 11, &#8216;fontstyle&#8217;, &#8216;plain&#8217;, &#8216;height&#8217;, 260, &#8216;<strong>lpsbuild</strong>&#8216;, &#8216;<strong>10323-openlaszlo-branches-4.1</strong>&#8216;, &#8216;lpsbuilddate&#8217;, &#8216;2008-07-11T15:05:43-0700&#8242;, &#8216;lpsrelease&#8217;, &#8216;Production&#8217;, &#8216;<strong>lpsversion</strong>&#8216;, &#8216;<strong>4.1.1</strong>&#8216;, &#8216;proxied&#8217;, FALSE, &#8216;<strong>runtime</strong>&#8216;, &#8216;<strong>swf8</strong>&#8216;, &#8216;width&#8217;, 300, 14</p>
<p>Note the relevant terms I&#8217;ve highlighted in bold:</p>
<ul>
<li>lpsbuild: The exact build number of OpenLaszlo that was used to compile this SWF.</li>
<li>lpsversion: The version number that was used to compile this SWF.</li>
<li>runtime: The version of SWF that this was compiled to.</li>
</ul>
<p>There you have it. It&#8217;s also a good tip to put a comment in your main application file, to tell other developers (and yourself, six months from now) what version of OpenLaszlo you were using.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antunkarlovac.com/blog/2008/09/29/finding-the-openlaszlo-version-of-a-compiled-swf/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
