<?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>麟 - Alan Cheung</title>
	<atom:link href="http://hkalan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hkalan.com</link>
	<description>Alan Cheung</description>
	<lastBuildDate>Wed, 28 Dec 2011 04:12:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Amazon AWS errors and solutions</title>
		<link>http://hkalan.com/2011/12/20/amazon-aws-errors-and-solutions/</link>
		<comments>http://hkalan.com/2011/12/20/amazon-aws-errors-and-solutions/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 03:06:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=461</guid>
		<description><![CDATA[FTP: 500 OOPS: cannot change directory:/home/developer &#62; setsebool allow_ftpd_full_access=1 &#62; setsebool sftpd_enable_homedirs on Sendmail: NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied &#62; setsebool httpd_can_sendmail on &#62; service sendmail restart]]></description>
			<content:encoded><![CDATA[<p><strong>FTP: 500 OOPS: cannot change directory:/home/developer</strong></p>
<p>&gt; setsebool allow_ftpd_full_access=1<br />
&gt; setsebool sftpd_enable_homedirs on</p>
<p><strong>Sendmail: NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied</strong><br />
&gt; setsebool httpd_can_sendmail on<br />
&gt; service sendmail restart</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/12/20/amazon-aws-errors-and-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RemoveChild, exists check</title>
		<link>http://hkalan.com/2011/11/08/removechild-exists-check/</link>
		<comments>http://hkalan.com/2011/11/08/removechild-exists-check/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 06:51:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=458</guid>
		<description><![CDATA[Removing child always need to be checked against if it exists. Use .contains() : var main:MovieClip = new MovieClip; var childMovie:MovieClip = new MovieClip main.addChild(childMovie); if (obj.contains(childMovie) main.remove(childMovie); This will advoid the non-exists problem.]]></description>
			<content:encoded><![CDATA[<p>Removing child always need to be checked against if it exists.</p>
<p>Use .contains() :</p>
<pre>
var main:MovieClip = new MovieClip;
var childMovie:MovieClip = new MovieClip
main.addChild(childMovie);

if (obj.contains(childMovie)
  main.remove(childMovie);
</pre>
<p>This will advoid the non-exists problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/11/08/removechild-exists-check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221;</title>
		<link>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/</link>
		<comments>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 01:41:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=455</guid>
		<description><![CDATA[Spent like a day to find out why flex would come up a java error, with a message like this: Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221; However, compiling the source and run it off simulator would work fine. Things won&#8217;t work on the iPad / iPhone devices. Searching on google didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Spent like a day to find out why flex would come up a java error, with a message like this:</p>
<p>Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221;</p>
<p>However, compiling the source and run it off simulator would work fine. Things won&#8217;t work on the iPad / iPhone devices.</p>
<p>Searching on google didn&#8217;t really help. Finally, found it is because the number of files included in the package is too much. In my case I have included 1200+ mp3 files from previous project. </p>
<p>Hope this will help someone to save time.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ETI Web Design</title>
		<link>http://hkalan.com/2011/03/25/eti-web-design/</link>
		<comments>http://hkalan.com/2011/03/25/eti-web-design/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 06:53:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=446</guid>
		<description><![CDATA[It&#8217;s been a while since I post some design work. Have a look at this energy saving company with a black cool look. Energy Transform Industry]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I post some design work. Have a look at this energy saving company with a black cool look.</p>
<p><a href="http://ukalan.com/eti/" target="_blank">Energy Transform Industry</a></p>
<p><a href="http://hkalan.com/wp-content/uploads/2011/03/Screen-shot-2011-03-25-at-25-3-2.48.21-pm1.png"><img class="aligncenter size-full wp-image-449" title="Screen shot 2011-03-25 at 25-3, 2.48.21 pm" src="http://hkalan.com/wp-content/uploads/2011/03/Screen-shot-2011-03-25-at-25-3-2.48.21-pm1.png" alt="" width="494" height="244" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/03/25/eti-web-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resolved Many_Many relationship with CAdvancedArBehavior and application.components.Relation Widget</title>
		<link>http://hkalan.com/2011/01/05/resolved-many_many-relationship-with-cadvancedarbehavior-and-application-components-relation-widget/</link>
		<comments>http://hkalan.com/2011/01/05/resolved-many_many-relationship-with-cadvancedarbehavior-and-application-components-relation-widget/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 17:44:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[CAdvancedArBehavior]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yii]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=443</guid>
		<description><![CDATA[I spent so much time to accomplish little thing &#8211; MANY to MANY relationship to work with a Widget in Yii. (I wish to write as least code as possible). Here is my solution: Use this component, it depends on GHelper. You will also want the views files too. Once you got them setup, the [...]]]></description>
			<content:encoded><![CDATA[<p>I spent so much time to accomplish little thing &#8211; MANY to MANY relationship to work with a Widget in Yii. (I wish to write as least code as possible).</p>
<p>Here is my solution:</p>
<p>Use <a href="http://code.google.com/p/gii-template-collection/source/browse/trunk/gtc/components/Relation.php?r=155">this component</a>, it depends on <a href="http://code.google.com/p/gii-template-collection/source/browse/trunk/gtc/components/GHelper.php?r=155">GHelper</a>. You will also want the <a href="http://code.google.com/p/gii-template-collection/source/browse/trunk/gtc/components/views/dropdownlist.php?r=155">views files</a> too.</p>
<p>Once you got them setup, the easiest way to get the MANY to MANY update (and create), do the followings:</p>
<p>1. You will need <a href="http://code.google.com/p/gii-template-collection/source/browse/trunk/gtc/components/CAdvancedArBehavior.php?r=155">CAdvancedArBehavior</a>.<br />
2. Use the same relation name as the table name e.g.:<br />
<code>'Location' =&gt; array(self::MANY_MANY, 'Location', 'client_location(client_id, location_id)')</code><br />
3. Simply use the widget in your view, e.g.:<br />
<code><br />
$this-&gt;widget('application.components.Relation', array(<br />
'model' =&gt; $model,<br />
'style' =&gt; 'listbox',<br />
'relation' =&gt; 'Location',<br />
'fields' =&gt; 'name',<br />
'showAddButton'=&gt;false,<br />
'htmlOptions' =&gt; array('style' =&gt; 'width: 100px;')<br />
));<br />
</code><br />
4. Don&#8217;t forget you need to give &#8220;safe&#8221; in the rules in your model of the attribute (&#8216;Location&#8217; in my case)</p>
<p>5. You may want to alter the $sycndb at around line 82 of CAdvancedArBehavior.php so that it will actually do things with your DB.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/01/05/resolved-many_many-relationship-with-cadvancedarbehavior-and-application-components-relation-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bavarian Alps, Germany, Oct 2006</title>
		<link>http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/</link>
		<comments>http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 13:05:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=415</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://hkalan.com/wp-content/uploads/2010/07/IMG_9778.jpg"><img src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9778.jpg" alt="" title="IMG_9778" width="427" height="640" class="aligncenter size-full wp-image-439" /></a><br />

<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9330/' title='IMG_9330'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9330-120x120.jpg" class="attachment-thumbnail" alt="IMG_9330" title="IMG_9330" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9370/' title='IMG_9370'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9370-120x120.jpg" class="attachment-thumbnail" alt="IMG_9370" title="IMG_9370" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9385/' title='IMG_9385'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9385-120x120.jpg" class="attachment-thumbnail" alt="IMG_9385" title="IMG_9385" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9406/' title='IMG_9406'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9406-120x120.jpg" class="attachment-thumbnail" alt="IMG_9406" title="IMG_9406" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9561/' title='IMG_9561'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9561-120x120.jpg" class="attachment-thumbnail" alt="IMG_9561" title="IMG_9561" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9599/' title='IMG_9599'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9599-120x120.jpg" class="attachment-thumbnail" alt="IMG_9599" title="IMG_9599" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9719/' title='IMG_9719'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9719-120x120.jpg" class="attachment-thumbnail" alt="IMG_9719" title="IMG_9719" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9720/' title='IMG_9720'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9720-120x120.jpg" class="attachment-thumbnail" alt="IMG_9720" title="IMG_9720" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9746/' title='IMG_9746'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9746-120x120.jpg" class="attachment-thumbnail" alt="IMG_9746" title="IMG_9746" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9748/' title='IMG_9748'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9748-120x120.jpg" class="attachment-thumbnail" alt="IMG_9748" title="IMG_9748" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9759/' title='IMG_9759'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9759-120x120.jpg" class="attachment-thumbnail" alt="IMG_9759" title="IMG_9759" /></a>
<a href='http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/img_9778/' title='IMG_9778'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/07/IMG_9778-120x120.jpg" class="attachment-thumbnail" alt="IMG_9778" title="IMG_9778" /></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/07/21/bavarian-alps-germany-oct-2006/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>North Wales &amp; Snowdonia , May 2005</title>
		<link>http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/</link>
		<comments>http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/#comments</comments>
		<pubDate>Wed, 05 May 2010 06:12:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=372</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://hkalan.com/wp-content/uploads/2010/05/IMG_5728.jpg"><img class="aligncenter size-full wp-image-397" title="IMG_5728" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5728.jpg" alt="" width="640" height="215" /></a><br />

<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5546/' title='IMG_5546'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5546-120x120.jpg" class="attachment-thumbnail" alt="IMG_5546" title="IMG_5546" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5626/' title='IMG_5626'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5626-120x120.jpg" class="attachment-thumbnail" alt="IMG_5626" title="IMG_5626" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5629/' title='IMG_5629'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5629-120x120.jpg" class="attachment-thumbnail" alt="IMG_5629" title="IMG_5629" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5688/' title='IMG_5688'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5688-120x120.jpg" class="attachment-thumbnail" alt="IMG_5688" title="IMG_5688" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5722/' title='IMG_5722'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5722-120x120.jpg" class="attachment-thumbnail" alt="IMG_5722" title="IMG_5722" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5728/' title='IMG_5728'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5728-120x120.jpg" class="attachment-thumbnail" alt="IMG_5728" title="IMG_5728" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5744/' title='IMG_5744'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5744-120x120.jpg" class="attachment-thumbnail" alt="IMG_5744" title="IMG_5744" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5745/' title='IMG_5745'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5745-120x120.jpg" class="attachment-thumbnail" alt="IMG_5745" title="IMG_5745" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5756/' title='IMG_5756'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5756-120x120.jpg" class="attachment-thumbnail" alt="IMG_5756" title="IMG_5756" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5781/' title='IMG_5781'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5781-120x120.jpg" class="attachment-thumbnail" alt="IMG_5781" title="IMG_5781" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5799/' title='IMG_5799'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5799-120x120.jpg" class="attachment-thumbnail" alt="IMG_5799" title="IMG_5799" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5844/' title='IMG_5844'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5844-120x120.jpg" class="attachment-thumbnail" alt="IMG_5844" title="IMG_5844" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5851/' title='IMG_5851'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5851-120x120.jpg" class="attachment-thumbnail" alt="IMG_5851" title="IMG_5851" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5858/' title='IMG_5858'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5858-120x120.jpg" class="attachment-thumbnail" alt="IMG_5858" title="IMG_5858" /></a>
<a href='http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/img_5866/' title='IMG_5866'><img width="120" height="120" src="http://hkalan.com/wp-content/uploads/2010/05/IMG_5866-120x120.jpg" class="attachment-thumbnail" alt="IMG_5866" title="IMG_5866" /></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/05/05/north-wales-snowdonia-may-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Click Login, new look!</title>
		<link>http://hkalan.com/2010/05/03/click-login-new-look/</link>
		<comments>http://hkalan.com/2010/05/03/click-login-new-look/#comments</comments>
		<pubDate>Mon, 03 May 2010 03:28:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=369</guid>
		<description><![CDATA[It&#8217;s now having another look. I spent quite a lot of time to create those images &#8211; hopefully it looks like a decent marketing advert. Have a look : ClickLogin Web Design]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s now having another look. I spent quite a lot of time to create those images &#8211; hopefully it looks like a decent marketing advert.</p>
<p>Have a look : <a href="http://clicklogin.com">ClickLogin</a> <a href="http://clicklogin.com">Web Design</a></p>
<p><a href="http://hkalan.com/wp-content/uploads/2010/05/clicklogin.png"><img class="aligncenter size-full wp-image-413" title="clicklogin" src="http://hkalan.com/wp-content/uploads/2010/05/clicklogin.png" alt="" width="494" height="244" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/05/03/click-login-new-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stem Cell International &#8211; New Design</title>
		<link>http://hkalan.com/2010/05/01/stem-cell-international-new-design/</link>
		<comments>http://hkalan.com/2010/05/01/stem-cell-international-new-design/#comments</comments>
		<pubDate>Sat, 01 May 2010 17:28:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=362</guid>
		<description><![CDATA[That&#8217;s life. Been there, done it, got the t-shirt &#8211; but, hey, let&#8217;s do it again. It&#8217;s not very easy to go though the site and do it again with different design but I&#8217;m the person to please my lovely client(s). Feel free to check out the new design, my client seems finally very happy [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s life. Been there, done it, got the t-shirt &#8211; but, hey, let&#8217;s do it again.</p>
<p>It&#8217;s not very easy to go though the site and do it again with different design but I&#8217;m the person to please my lovely client(s). </p>
<p>Feel free to check out the new design, my client seems finally very happy with it.</p>
<p><a href="http://stemcell-intl.com">Stem Cell International</a></p>
<p><img alt="" src="http://hkalan.com/portfolioImages/stemcell-intl-new.png" class="aligncenter" width="494" height="244" /></p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/05/01/stem-cell-international-new-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex FileReference Download error: #2167</title>
		<link>http://hkalan.com/2010/04/22/flex-filereference-download-error-2167/</link>
		<comments>http://hkalan.com/2010/04/22/flex-filereference-download-error-2167/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 19:53:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=353</guid>
		<description><![CDATA[Its quite hard to believe that such a simple thing &#8211; download a file from server in flex is such a pain! The code was very simple, from the manual and example: var fileRef:FileReference = new FileReference&#40;&#41;; fileRef.download&#40;new URLRequest&#40;&#34;myFile.txt&#34;&#41;, &#34;myFile.txt&#34;&#41;; But in real world, there are things that they didn&#8217;t tell unless you hit it! [...]]]></description>
			<content:encoded><![CDATA[<p>Its quite hard to believe that such a simple thing &#8211; download a file from server in flex is such a pain!</p>
<p>The code was very simple, from the manual and example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
fileRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;myFile.txt&quot;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">&quot;myFile.txt&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>But in real world, there are things that they didn&#8217;t tell unless you hit it!<br />
From flash player 10, all uploads/downloads in fileRef won&#8217;t allowed seamlessly. It require user to click a button or hotkey to invoke upload/download action. Otherwise it will give you an error #2167. This isn&#8217;t difficult to resolve if it&#8217;s not too much of a pain for your user to click a button one more time.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Click OK to download.&quot;</span>,<span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #000000; font-weight: bold;">null</span>,startDownload<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> startDownload<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference;
		fileRef = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		const FILE_URL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;myTextFile.txt&quot;</span>;
		urlReq = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>FILE_URL<span style="color: #66cc66;">&#41;</span>;
		urlReq.<span style="color: #006600;">method</span> = URLRequestMethod.<span style="color: #0066CC;">GET</span>;
		<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				fileRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span>urlReq<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>.<span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>I thought this could work, not until I found that my <a href="http://hkalan.com/2010/04/05/232/">previous post</a>&#8230; you need to define the fileReference outside of the function&#8230; otherwise it won&#8217;t!<br />
Finally&#8230; this would work:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference;
fileRef = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Click OK to download.&quot;</span>,<span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #000000; font-weight: bold;">null</span>,startDownload<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> startDownload<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
		const FILE_URL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;myTextFile.txt&quot;</span>;
		urlReq = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>FILE_URL<span style="color: #66cc66;">&#41;</span>;
		urlReq.<span style="color: #006600;">method</span> = URLRequestMethod.<span style="color: #0066CC;">GET</span>;
		<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				fileRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span>urlReq<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">error</span>.<span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/04/22/flex-filereference-download-error-2167/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

