Listing 1

<canvas debug="true" height="200" width="400">
  <script>
  <![CDATA[
    // Add a find method to Array
    Array.prototype.find = function (what ) {
      for (i in this ) {
        if (this[i] === what) {
          return i;
        }
      }
    }
 
    sneaky = {example: 'sneaky'};
    tryit = ['foo', 42, sneaky, Math.PI, false];

    Debug.write("42 is at: " + tryit.find(42));
    Debug.write("false is at: " + tryit.find(false));
    Debug.write("'bar' is at: " + tryit.find('bar'));        
    Debug.write("{example: 'sneaky'} is at: " + tryit.find({example: 'sneaky'}));
    Debug.write("sneaky is at: " + tryit.find(sneaky));
  ]]>
  </script>
</canvas>
                                                                                     Source: Laszlo Systems



Listing 2 A simple rss feed application

<xal xmlns="http://www.openxal.org/xal">
    <data:documentDataSource id="yahoo"
        source="http://rss.news.yahoo.com/rss/topstories"
        xmlns:data="http://www.openxal.org/data" />
    <rootPane>
            <borderLayout/>
            <label img="yahoo_news.gif" borderPosition="north"/>
            <table borderPosition="center">
                <column>
                    <header text="Title"/>
                </column>
                <column>
                    <header text="URL"/>
                </column>
                <column>
                    <header text="pub Date"/>
                </column>
                <data:iterator xmlns:data="http://www.openxal.org/data"
				dataSource="yahoo" type="ONE_WAY" name="newsIterator" select="//item">
                    <row>
                       <textView>{*('title')}</textView>
                       <link text="{*('link')}"  alignHorizontal="left"/>
                       <cell text="{*('pubDate')}"/>
                    </row>
                </data:iterator>
            </table>
    </rootPane>
</xal>
                                                                                                  Source: Nexaweb