<?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>blogu&#039; lu&#039; mrm</title>
	<atom:link href="http://blogu.lu/mrm/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogu.lu/mrm</link>
	<description>ain't I a hypocrite?</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:28:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Gotcha: using shorthand notation with boolean operators</title>
		<link>http://blogu.lu/mrm/2010/03/gotcha-using-shorthand-notation-with-boolean-operators/</link>
		<comments>http://blogu.lu/mrm/2010/03/gotcha-using-shorthand-notation-with-boolean-operators/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 16:17:54 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=119</guid>
		<description><![CDATA[In ActionScript (as well as JavaScript), the boolean AND and OR operators have a special meaning. That is, they don’t necessary return true or false, but return one of the operands. var op1:Boolean = true; var op2:int = 2; var op3:Object = null; var result_1or2:Object = op1 &#124;&#124; op2; trace(result12); // output: true var result_1and2:Object = op1 &#38;&#38; op2; trace(result); // output: 2 var result_3or2:Object = op3 &#124;&#124; op2; trace(result); // output: 2 var result_3and2:Object [...] <a href="http://blogu.lu/mrm/2010/03/gotcha-using-shorthand-notation-with-boolean-operators/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>In ActionScript (as well as JavaScript), the boolean AND and OR operators have a special meaning. That is, they don’t necessary return <code>true</code> or <code>false</code>, but return one of the operands.</p>
<pre>var op1:Boolean = true;
var op2:int = 2;
var op3:Object = null;

var result_1or2:Object = op1 || op2;
trace(result12); // output: true
var result_1and2:Object = op1 &amp;&amp; op2;
trace(result); // output: 2
var result_3or2:Object = op3 || op2;
trace(result); // output: 2
var result_3and2:Object = op3 &amp;&amp; op2;
trace(result); // output: null</pre>
<p>So, if you decide to execute write something really terse, like</p>
<pre>var result:Boolean = validateSomething() &amp;&amp; validateSomethingElse();</pre>
<p>and expect both functions to run, then you might be in for a surprise. If the first operand evaluates to <code>false</code> (<code>false</code>, <code>null</code>, <code>0</code> or <code>""</code>) then the second part is not executed.</p>
<p>The same caveat applies to the shorthand operator a <code>&amp;&amp;= b()</code>, which basically expands to <code>a = a &amp;&amp; b()</code>. So if <code>a</code> is “falsy”,<code> </code><span>b()</span> is not executed. So be careful with logical operators and don’t abuse them or they’ll bite back!</p>
<p>You have been warned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2010/03/gotcha-using-shorthand-notation-with-boolean-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uninstalling Flash Player (like, really uninstalling)</title>
		<link>http://blogu.lu/mrm/2010/03/uninstalling-flash-player-like-really-uninstalling/</link>
		<comments>http://blogu.lu/mrm/2010/03/uninstalling-flash-player-like-really-uninstalling/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 12:18:29 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Experimenting with potions]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/2010/03/uninstalling-flash-player-like-really-uninstalling/</guid>
		<description><![CDATA[If you’ve ever installed Flash Professional on your computer you know it has that nasty habit of overwriting your debug Flash Player (ActiveX) with its own mutant half-debug version. I don’t normally mind, because the plugin version is not affected and I use Opera (which is awesome, by the way). But I started noticing Flash Builder errors whenever I would open a project and try to debug it. Once you close and reopen Flash Builder, [...] <a href="http://blogu.lu/mrm/2010/03/uninstalling-flash-player-like-really-uninstalling/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>If you’ve ever installed Flash Professional on your computer you know it has that nasty habit of overwriting your debug Flash Player (ActiveX) with its own mutant half-debug version. I don’t normally mind, because the plugin version is not affected and I use <a href="http://www.opera.com/browser/" target="_blank">Opera</a> (which is awesome, by the way). But I started noticing Flash Builder errors whenever I would open a project and try to debug it. Once you close and reopen Flash Builder, you can freely debug that project. The error is caused by the failure to write into the FlashPlayerTrust file and it gets annoying after a while.</p>
<p>Because I am constantly installing/uninstalling/reinstalling prerelease versions of Flash Professional CS5, I frequently run into this problem. So I have to install the “real deal” debug version of Flash Player after each Flash Pro reinstall, which I know is not the recommended approach but it’s the fastest one. Today I wanted to try <a href="http://labs.adobe.com/downloads/flashplayer10.html" target="_blank">Flash Player 10.1 beta 3</a> and I got an error that said:</p>
<blockquote><p>The version of Adobe Flash Player ActiveX that you are trying to install is not the most current version.</p></blockquote>
<p>LOL, WUT?</p>
<p>After countless tries and retries and googling and hair pulling I found the solution and it lies within TechNotes <a href="http://kb2.adobe.com/cps/402/kb402435.html" target="_blank">kb402435</a> and <a href="http://kb2.adobe.com/cps/141/tn_14157.html" target="_blank">tn_14157</a>. What you have to do is download the <a href="http://download.macromedia.com/pub/flashplayer/current/uninstall_flash_player.exe" target="_blank">Adobe Flash Player uninstaller</a> and run</p>
<pre>uninstall_flash_player.exe /clean</pre>
<p>from the command line.</p>
<p>Then all you have to do is install the desired version of Flash Player and you’re good to go!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2010/03/uninstalling-flash-player-like-really-uninstalling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orange RO APNs for Android</title>
		<link>http://blogu.lu/mrm/2010/03/orange-ro-apns-for-android/</link>
		<comments>http://blogu.lu/mrm/2010/03/orange-ro-apns-for-android/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 20:53:00 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Experimenting with potions]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=108</guid>
		<description><![CDATA[Internet Name: Orange Internet APN: internet APN type: default MMS Name: Orange MMS APN: mms MMSC: http://wap.mms.orange.ro:8002 MMS proxy: 62.217.247.252 MMS port: 8799 APN type: mms]]></description>
			<content:encoded><![CDATA[<p></p>
<h4>Internet</h4>
<p>Name: Orange Internet<br />
APN: internet<br />
APN type: default</p>
<h4>MMS</h4>
<p>Name: Orange MMS<br />
APN: mms<br />
MMSC: <a href="http://wap.mms.orange.ro:8002">http://wap.mms.orange.ro:8002</a><br />
MMS proxy: 62.217.247.252<br />
MMS port: 8799<br />
APN type: mms</p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2010/03/orange-ro-apns-for-android/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Data binding and ActionScript 3</title>
		<link>http://blogu.lu/mrm/2009/01/data-binding-and-actionscript-3/</link>
		<comments>http://blogu.lu/mrm/2009/01/data-binding-and-actionscript-3/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 00:11:14 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Experimenting with potions]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=72</guid>
		<description><![CDATA[Data binding is really easy to do in MXML. But what do you do if you need to bind some dynamic objects at runtime using ActionScript? Here&#8217;s how I solved this particular problem in the following localization example. Assume you want to add localization to a MenuBar component and the data provider is an Object. Let&#8217;s assume, for the sake of this example, that the Object that will act as dataProvider for the MenuBar component [...] <a href="http://blogu.lu/mrm/2009/01/data-binding-and-actionscript-3/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Data binding is really easy to do in MXML. But what do you do if you need to bind some dynamic objects at runtime using ActionScript? Here&#8217;s how I solved this particular problem in the following localization example.</p>
<p>Assume you want to add localization to a <code>MenuBar</code> component and the data provider is an Object. Let&#8217;s assume, for the sake of this example, that the Object that will act as <code>dataProvider</code> for the <code>MenuBar</code> component looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> menu<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span>
    <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;FILE&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;NEW&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;OPEN&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;IMPORT&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
            <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;PROJECT&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
            <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;OTHER&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> <span style="color: #004993;">type</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;separator&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;EXIT&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
    <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;EDIT&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;UNDO&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;REDO&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> <span style="color: #004993;">type</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;separator&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;CUT&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;COPY&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;PASTE&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
    <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;PROJECT&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;BUILD&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;CLEAN&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> <span style="color: #004993;">type</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;separator&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;EXPORT&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
    <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;LANGUAGE&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;ENGLISH&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">children</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>
            <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;AMERICAN&quot;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
            <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;BRITISH&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
        <span style="color: #000000;">&#123;</span> label<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;ROMANIAN&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p><span id="more-72"></span><br />
For this object, the labels are actually resource names in the resource bundle. When the application is initialized, the <code>init()</code> function kicks in (defined below) and the <code>MenuBar</code>&#8216;s <code>dataProvider</code> is set to the return value of the <code>translateItems()</code> function:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    mainMenu<span style="color: #000066; font-weight: bold;">.</span>dataProvider = translateItems<span style="color: #000000;">&#40;</span>menu<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> translateItems<span style="color: #000000;">&#40;</span>menuItems<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> p<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #0033ff; font-weight: bold;">in</span> menuItems<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #6699cc; font-weight: bold;">var</span> menuItem<span style="color: #000066; font-weight: bold;">:</span>ObjectProxy = menuItems<span style="color: #000000;">&#91;</span>p<span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> ObjectProxy<span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>p<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        menuItem<span style="color: #000066; font-weight: bold;">.</span>labelLocale = menuItem<span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span>item<span style="color: #000066; font-weight: bold;">:</span>ObjectProxy<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            BindingUtils<span style="color: #000066; font-weight: bold;">.</span>bindSetter<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
                item<span style="color: #000066; font-weight: bold;">.</span>label = <span style="color: #004993;">value</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> ResourceManager<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;getString&quot;</span><span style="color: #000066; font-weight: bold;">,</span>
                getter<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span>resMan<span style="color: #000066; font-weight: bold;">:</span>IResourceManager<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span> resMan<span style="color: #000066; font-weight: bold;">.</span>getString<span style="color: #000000;">&#40;</span>BUNDLE_NAME<span style="color: #000066; font-weight: bold;">,</span> item<span style="color: #000066; font-weight: bold;">.</span>labelLocale<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>menuItem<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span> = translateItems<span style="color: #000000;">&#40;</span>menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0033ff; font-weight: bold;">return</span> menuItems<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Now let&#8217;s see what the magic behind the <code>translateItems()</code> function is.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>7
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">        <span style="color: #6699cc; font-weight: bold;">var</span> menuItem<span style="color: #000066; font-weight: bold;">:</span>ObjectProxy = menuItems<span style="color: #000000;">&#91;</span>p<span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> ObjectProxy<span style="color: #000000;">&#40;</span>menuItems<span style="color: #000000;">&#91;</span>p<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>First of all, each Object in the <code>menu</code> Array must be converted to an <code>ObjectProxy</code>. This is necessary because for the localization to work (that is, for the menu labels to change), we need to be able to track changes made to each Object in the data provider. When a change is made to an object managed by a proxy, the dataProvider is notified and the label is updated.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">        menuItem<span style="color: #000066; font-weight: bold;">.</span>labelLocale = menuItem<span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>After we set the <code>ObjectProxy</code>, we save the current <em>label</em> property for later use in the <em>labelLocale</em> property. We&#8217;ll need the <em>labelLocale</em> property to fetch the resource name when the locale changes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">        <span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span>item<span style="color: #000066; font-weight: bold;">:</span>ObjectProxy<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            BindingUtils<span style="color: #000066; font-weight: bold;">.</span>bindSetter<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
                item<span style="color: #000066; font-weight: bold;">.</span>label = <span style="color: #004993;">value</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span> ResourceManager<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #990000;">&quot;getString&quot;</span><span style="color: #000066; font-weight: bold;">,</span>
                getter<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span>resMan<span style="color: #000066; font-weight: bold;">:</span>IResourceManager<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span> resMan<span style="color: #000066; font-weight: bold;">.</span>getString<span style="color: #000000;">&#40;</span>BUNDLE_NAME<span style="color: #000066; font-weight: bold;">,</span> item<span style="color: #000066; font-weight: bold;">.</span>labelLocale<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>menuItem<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>The next part is a little tricky. This section of code is wrapped inside an anonymous function that is executed immediately, with the current <code>menuItem</code> passed as its parameter. This is important because we need to keep a local reference to this <code>menuItem</code> for use in the binding functions.<br />
Next up, is the <code>BindingUtils</code> utility class which provides two static methods for performing data binding from ActionScript. Here, I used the <code>bindSetter</code> method, which has these parameters:</p>
<ul>
<li><code><strong>setter</strong></code>:<code>Function</code> — Setter method to invoke with an argument of the current value of <code>chain</code> when that value changes.</li>
<li><code><strong>host</strong></code>:Object — The host of the property. See the <a href="http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtils.html#bindProperty()" target="_blank"><code>bindProperty()</code></a> method for more information.</li>
<li><code><strong>chain</strong></code>:Object — The name of the property, or property chain. See the <a href="http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtils.html#bindProperty()" target="_blank"><code>bindProperty()</code></a> method for more information.</li>
<li><code><strong>commitOnly</strong></code><strong></strong>:<code>Boolean</code> (default = <em>false</em>) — Set to true if the handler should be called only on committing change events. See the bindProperty() method for more information.</li>
</ul>
<p>I won&#8217;t go into much detail about each of these parameters, as I think the docs do a pretty good job explaining what each of them does. You can <a href="http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtils.html#bindSetter()" target="_blank">find more information here</a>. What is important in this brief example is the <code>chain</code> parameter, to which I have passed an Object in the form: <code>{ name: <em>property name</em>, getter: function(host) { return <em>something</em>; } }</code>. This Object must contain the name of, and a getter function for, a public bindable property of the host object. In our case, the host is the <code>ResourceManager</code> instance and the bindable property is the <code>getString()</code> function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>19
20
21
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">        <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span> = translateItems<span style="color: #000000;">&#40;</span>menuItem<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">children</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The last bit is self explanatory – if the current menu item has any child submenus, we apply the <code>translateItems()</code> function recursively.</p>
<p>Enough talk! Now let&#8217;s see this code in action!<br />
[kml_flashembed movie="http://blogu.lu/mrm/files/2009/01/bindingdemo.swf" width="400" height="180" /]<br />
And the <a href="http://blogu.lu/mrm/files/2009/01/bindingdemo_many.zip">Flex Builder Project source code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2009/01/data-binding-and-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Progress</title>
		<link>http://blogu.lu/mrm/2009/01/progress/</link>
		<comments>http://blogu.lu/mrm/2009/01/progress/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 02:53:22 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Experimenting with potions]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=43</guid>
		<description><![CDATA[For mrm&#8217;s TV Guide I needed a visual representation for displaying progress (i.e., saving data to the local database), so I used the built-in ProgressBar component. What&#8217;s nice about this component is that you can use three different methods to update the progress bar. You choose one of the methods by setting the mode property in MXML to one of the following values: event The control specified by the source property must dispatch progress and [...] <a href="http://blogu.lu/mrm/2009/01/progress/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>For <a title="mrm's TV Guide" href="http://blogu.lu/mrm/2009/01/mrms-tv-guide/">mrm&#8217;s TV Guide</a> I needed a visual representation for displaying progress (i.e., saving data to the local database), so I used the built-in ProgressBar component. What&#8217;s nice about this component is that you can use three different methods to update the progress bar. You choose one of the methods by setting the <code>mode</code> property in MXML to one of the following values:</p>
<ul>
<li><em>event</em> The control specified by the <code>source</code> property must dispatch progress and completed events. The ProgressBar control uses these events to update its status. The ProgressBar control only updates if the value of the <code>source</code> property extends the EventDispatcher class</li>
<li><em>polled</em> The <code>source</code> property must specify an object that exposes <code>bytesLoaded</code> and <code>bytesTotal</code> properties. The ProgressBar control calls these methods to update its status.</li>
<li><em>manual</em> You manually update the ProgressBar status. In this mode you specify the <code>maximum</code> and <code>minimum</code> properties and use the <code>setProgress()</code> property method to specify the status. This mode is often used when the <code>indeterminate</code> property is <em>true</em></li>
</ul>
<p><span id="more-43"></span><br />
In ActionScript, you can use use the following constants to set this property:  <code>ProgressBarMode.EVENT</code>, <code>ProgressBarMode.POLLED</code>, and  <code>ProgressBarMode.MANUAL</code>.</p>
<p>At first I used the <em>manual</em> mode, but I soon abandoned it because It didn&#8217;t feel right. I quickly dismissed the <em>polled</em> method because basically I had to do the same thing as <em>manual</em> mode, only I had to update an object with <code>bytesLoaded</code> and <code>bytesTotal</code> properties and I also felt that it wasn&#8217;t responsive enough.</p>
<p>But it did give me an idea: Hey, why don&#8217;t I build my own data provider type for the ProgressBar component! And this is what I came up with – The <code>Progress</code> class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> mrm
<span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">EventDispatcher</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ProgressEvent</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Progress <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">EventDispatcher</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _bytesLoaded<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _bytesTotal<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Progress<span style="color: #000000;">&#40;</span><span style="color: #004993;">bytesLoaded</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">bytesTotal</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            setValues<span style="color: #000000;">&#40;</span><span style="color: #004993;">bytesLoaded</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">bytesTotal</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">bytesLoaded</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            _bytesLoaded = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span>
            dispatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">bytesLoaded</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> _bytesLoaded<span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">bytesTotal</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            _bytesTotal = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span>
            dispatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">bytesTotal</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">return</span> _bytesTotal<span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setValues<span style="color: #000000;">&#40;</span><span style="color: #004993;">bytesLoaded</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">bytesTotal</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            _bytesLoaded = <span style="color: #004993;">bytesLoaded</span><span style="color: #000066; font-weight: bold;">;</span>
            _bytesTotal = <span style="color: #004993;">bytesTotal</span><span style="color: #000066; font-weight: bold;">;</span>
            dispatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> dispatch<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">ProgressEvent</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">ProgressEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> _bytesLoaded<span style="color: #000066; font-weight: bold;">,</span> _bytesTotal<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            setValues<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>I&#8217;d say the class methods are pretty easy to comprehend, so I won&#8217;t go into much detail about them. Because the class extends <code>EventDispatcher</code>, it can dispatch events so it can be used as source for a <code>ProgressBar</code> component using the default <em>event</em> mode. Basically, whenever you change one of its properties (<code>bytesLoaded</code> or <code>bytesTotal</code>), it fires a <code>ProgressEvent</code>.</p>
<p>This way, you can have one <code>Progress</code> object used as source for multiple <code>ProgressBar</code>s and not even care about them! You just set the <code>source</code> property and update the progress on the object and Flex does the rest for you. Neat, huh?</p>
<p>Here&#8217;s a demo:</p>
<p>[kml_flashembed movie="http://blogu.lu/mrm/files/2009/01/progressdemo.swf" width="230" height="70" /]</p>
<p>And the <a href="http://blogu.lu/mrm/files/2009/01/progressdemo.zip">Flex Builder Project source code</a></p>
<p>Now here&#8217;s the same project, but this time using <a title="Flex 4 SDK (Gumbo)" href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo" target="_blank">Flex 4 SDK</a> (codename &#8220;Gumbo&#8221;):</p>
<p>[kml_flashembed movie="http://blogu.lu/mrm/files/2009/01/progressdemogumbo.swf" width="230" height="70" /]</p>
<p>And the <a href="http://blogu.lu/mrm/files/2009/01/progressdemogumbo.zip">Flex Builder Project source code</a></p>
<p>It works with Gumbo too!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2009/01/progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mrm&#8217;s TV Guide</title>
		<link>http://blogu.lu/mrm/2009/01/mrms-tv-guide/</link>
		<comments>http://blogu.lu/mrm/2009/01/mrms-tv-guide/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 21:28:22 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=10</guid>
		<description><![CDATA[Like any respectable person in this world, I don&#8217;t watch TV. But I do like some TV shows, so I watch them online or download them from various sources and watch them offline. Lately the number of shows I had to keep track of has grown substantially so I had a hard time doing it. (Actually, I&#8217;m just really lame and remembering 8 shows&#8217; air dates is too big an effort for me) So I [...] <a href="http://blogu.lu/mrm/2009/01/mrms-tv-guide/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: line-through">Like any respectable person in this world,</span> I don&#8217;t watch TV. But I do like some TV shows, so I watch them online or download them from various sources and watch them offline. Lately the number of shows I had to keep track of has grown substantially so I had a hard time doing it. (Actually, I&#8217;m just really lame and remembering 8 shows&#8217; air dates is too big an effort for me)</p>
<p>So I had a few days off and I decided to build myself a little <a title="Adobe AIR" href="http://www.adobe.com/products/air/" target="_blank">Adobe AIR</a> app to help me out with my little problem. So without further ado, here&#8217;s the awesomeness of an application which I&#8217;ve dubbed &#8220;mrm&#8217;s TV Guide&#8221;:</p>
<div id="attachment_104" class="wp-caption aligncenter" style="width: 505px"><a title="Download mrm's TV Guide from the Adobe Marketplace" href="http://www.adobe.com/cfusion/marketplace/index.cfm?event=marketplace.offering&amp;offeringid=10130&amp;marketplaceid=1"><img class="size-full wp-image-104" src="http://blogu.lu/mrm/files/2009/11/mrmtvg-screen-large.jpg" alt="mrm's TV Guide in Action" width="495" height="250" /></a><p class="wp-caption-text">mrm&#39;s TV Guide in Action</p></div>
<p>Pretty Cool™, ain&#8217;t it? Yeah, I know. <strong>Now awarded with Softpedia&#8217;s &#8220;100% Clean&#8221; award!</strong></p>
<p><img class="alignnone" src="http://www.softpedia.com/base_img/softpedia_clean_award_f.gif" alt="" width="170" height="116" /></p>
<p>So here&#8217;s how it works.<span id="more-10"></span></p>
<p>The application gets its data from <a title="TV Calendar" href="http://www.pogdesign.co.uk/cat/" target="_blank">TV Calendar</a>, a really neat site that&#8217;s been around for a few years now. If I&#8217;d only find out about it sooner! TV Calendar also gets its data from <a href="http://epguides.com/" target="_blank">epguides.com</a> and <a href="http://www.tvrage.com/" target="_blank">TVRage.Com</a>, so it&#8217;s not 100% accurate or up-to-date.</p>
<p>But my application doesn&#8217;t actually download anything from TV Calendar. Using the power of <a title="YQL" href="http://developer.yahoo.com/yql/" target="_blank">YQL (Yahoo Query Language)</a> and <a href="http://www.w3.org/TR/xpath" target="_blank">XPath</a>, web scraping has never beed easier. My application gets its data from Yahoo&#8217;s cache with an easy to use SQL-like SELECT syntax and a bit of XPath to filter just the relevant HTML tags. The result is return in JSON format, which is decoded to ActionScript objects using Mike Chambers&#8217; <a href="http://code.google.com/p/as3corelib/" target="_blank">as3corelib</a>.</p>
<p style="text-align: center">
<div id="attachment_15" class="wp-caption aligncenter" style="width: 310px"><a href="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-01.jpg"><img class="size-medium wp-image-15" src="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-01-300x186.jpg" alt="Introduction - Picture 1" width="300" height="186" /></a><p class="wp-caption-text">Image 1 - Update button</p></div>
<p>When you press the &#8220;Update&#8221; button, it&#8217;ll fetch all the shows airing this month, the shows that have aired in the past 4 months and the shows that will be airing in the upcoming 2 months (currently these numbers are hardcoded, but you will be able to change them in a future version). Then, for each day in those 7 months, it will load the corresponding TV Calendar page and extract the episode title, episode description etc for each episode it has found. The progress is reported using a simple progress bar as you can see in the image below.</p>
<p>As the information is loaded, the calendar is updated with the episodes from the shows chosen based on my filters. We&#8217;ll get to filters in a bit. When you first run the application there won&#8217;t be any filters, so all the episode dates will be highlighted in the calendar. The episodes for the current selected date will be displayed in on the right. If you hover your mouse over an episode, the summary will be displayed in a tooltip. Handy!</p>
<div id="attachment_27" class="wp-caption aligncenter" style="width: 310px"><a href="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-02__.jpg"><img class="size-medium wp-image-27" src="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-02__-300x186.jpg" alt="Image 2 - Progress bar and information panel" width="300" height="186" /></a><p class="wp-caption-text">Image 2 - Progress bar and information panel</p></div>
<p>After all the data has been retrieved, the information is saved locally in an SQLite database so you can check your favourite shows offline.</p>
<p>Now, I was saying something about those filters&#8230; At this point, if you have no filters set up (that is, no show is checked in the &#8220;Filters&#8221; window), the &#8220;Filters&#8221; window will pop up where you can select the shows you would like to be displayed in the calendar. The &#8220;Select All&#8221; and &#8220;Deselect All&#8221; buttons are conveniently located at the top of the window for easy access. This window also accepts keyboard input, so for example if you press &#8220;H&#8221; the list will scroll to the first show matching the first letter. In this case, &#8220;Heroes&#8221;.</p>
<div id="attachment_29" class="wp-caption aligncenter" style="width: 310px"><a href="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-03_.jpg"><img class="size-medium wp-image-29" src="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-03_-300x186.jpg" alt="Image 3 - Filters window" width="300" height="186" /></a><p class="wp-caption-text">Image 3 - Filters window</p></div>
<p>After you select your preferred shows, the calendar will be updated to reflect your choices. Here&#8217;s what I&#8217;ll be watching on the 20th of January 2009.</p>
<div id="attachment_28" class="wp-caption aligncenter" style="width: 310px"><a href="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-04.jpg"><img class="size-medium wp-image-28" src="http://blogu.lu/mrm/files/2009/01/mrmtvg-intro-04-300x186.jpg" alt="Image 4 - Finally" width="300" height="186" /></a><p class="wp-caption-text">Image 4 - Finally</p></div>
<p>&#8230; And that&#8217;s a wrap.</p>
<p><em>PS: Don&#8217;t click the &#8220;Clear&#8221; button, unless of course you want to remove all shows and episodes data from the database <img src='http://blogu.lu/mrm/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</em></p>
<p><strong>UPDATE: You can now grab it from the <a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;loc=en_us&amp;extid=1718022" target="_blank">Adobe Marketplace</a>. SWEET!!</strong></p>
<p><strong>UPDATE 2: <a href="http://www.softpedia.com/progClean/mrm-s-TV-Guide-Clean-119290.html">&#8220;100% CLEAN&#8221; award granted by Softpedia</a></strong><strong>. SWEET!!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2009/01/mrms-tv-guide/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://blogu.lu/mrm/2008/11/hello-world-2/</link>
		<comments>http://blogu.lu/mrm/2008/11/hello-world-2/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 19:30:49 +0000</pubDate>
		<dc:creator>mrm</dc:creator>
				<category><![CDATA[Mission Statement]]></category>

		<guid isPermaLink="false">http://blogu.lu/mrm/?p=7</guid>
		<description><![CDATA[Why am I a hypocrite? Well, because I always said blogs are a waste of time. But not all of them, just those &#8220;online diary&#8221; type of blogs. You know what I&#8217;m talking about, those &#8220;here&#8217;s what I did this morning&#8221;, &#8220;this is a picture of the sandwich I just ate; it was delicious&#8221;, &#8220;I&#8217;m so sad, please comfort me&#8221; etc etc. This is not going to be one of those blogs. This is going [...] <a href="http://blogu.lu/mrm/2008/11/hello-world-2/">Citeşte mai mult &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Why am I a hypocrite?</p>
<p>Well, because I always said blogs are a waste of time. But not all of them, just those &#8220;online diary&#8221; type of blogs. You know what I&#8217;m talking about, those &#8220;here&#8217;s what I did this morning&#8221;, &#8220;this is a picture of the sandwich I just ate; it was delicious&#8221;, &#8220;I&#8217;m so sad, please comfort me&#8221; etc etc.</p>
<p>This is not going to be one of those blogs. This is going to be one of them <em>tecknical</em> blogs. I&#8217;ll mostly be writing about Flex, ActionScript, JavaScript, web technologies and the sorts. It&#8217;s all so exciting and I&#8217;m really looking forward to it!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogu.lu/mrm/2008/11/hello-world-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
