<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Cambiatablog</title>
	<atom:link href="http://cambiatablog.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cambiatablog.wordpress.com</link>
	<description>Programming and music</description>
	<lastBuildDate>Tue, 03 Nov 2009 05:47:55 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='cambiatablog.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/281cc497000bbec52ff7f5e09c8a2a68?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Cambiatablog</title>
		<link>http://cambiatablog.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cambiatablog.wordpress.com/osd.xml" title="Cambiatablog" />
		<item>
		<title>MySql: The power of Views (or Better late than never)</title>
		<link>http://cambiatablog.wordpress.com/2009/10/24/mysql-the-power-of-views-or-better-late-than-never/</link>
		<comments>http://cambiatablog.wordpress.com/2009/10/24/mysql-the-power-of-views-or-better-late-than-never/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 08:12:16 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=188</guid>
		<description><![CDATA[I sometimes get the sour feeling of &#8220;there&#8217;s something fundamentally wrong with this! It works, but nevertheless&#8230;&#8221; It happens in all aspects of life, including programming. Some of (not always!) the times this feeling causes curiosity and energy to strive for a new perspective, new knowledge, new ways of facing the problem. Aspects of inutition [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=188&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I sometimes get the sour feeling of &#8220;there&#8217;s something fundamentally wrong with this! It works, but nevertheless&#8230;&#8221; It happens in all aspects of life, including programming. Some of (not always!) the times this feeling causes curiosity and energy to strive for a new perspective, new knowledge, new ways of facing the problem. Aspects of inutition and creativity, I guess&#8230;</p>
<p>In my current project there&#8217;s an awful lot of SQL going on. Lots of connected tables, nestled selects etc. In the preparation for the next level of full text searchability, I stumbled upon the concept of Views in MySql. I can&#8217;t believe that I didn&#8217;t know this beauty before!</p>
<p>In short, a View is a virtual database table where the content is a result of a underlying sql statement. It can be accessed by normal queries just like any table &#8211; a view can build its content depending on tables as well as other views.</p>
<p>For a good introduction of MySql Views, <a href="http://www.techotopia.com/index.php/An_Introduction_to_MySQL_Views" target="_blank">check this Techtopia blogpost out</a>.</p>
<p>Creating a View in PhpMyAdmin is a breeze, there&#8217;s a Create View link in the right bottom of any table view:</p>
<p><img class="alignnone size-medium wp-image-190" title="pma-create-view" src="http://cambiatablog.files.wordpress.com/2009/10/pma-create-view.png?w=300&#038;h=126" alt="pma-create-view" width="300" height="126" /></p>
<p>I haven&#8217;t found any button to retrieving the underlaying View sql though. However, it can be done by using a normal &#8220;SHOW CREATE VIEW tablename&#8221; sql statement.</p>
<p>The concept of views will ease my further development a lot! I&#8217;m glad I did listen to that feeling&#8230; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=188&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/10/24/mysql-the-power-of-views-or-better-late-than-never/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>

		<media:content url="http://cambiatablog.files.wordpress.com/2009/10/pma-create-view.png?w=300" medium="image">
			<media:title type="html">pma-create-view</media:title>
		</media:content>
	</item>
		<item>
		<title>Red5 on Ubuntu 9.04 &#8211; Thanks to BigBlueButton!</title>
		<link>http://cambiatablog.wordpress.com/2009/10/20/red5-on-ubuntu-9-04-thanks-to-bigbluebutton/</link>
		<comments>http://cambiatablog.wordpress.com/2009/10/20/red5-on-ubuntu-9-04-thanks-to-bigbluebutton/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 09:53:24 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Red5]]></category>
		<category><![CDATA[BigBlueButton]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=182</guid>
		<description><![CDATA[Found the BigBlueButton project (http://bigbluebutton.org/) the other day &#8211; very interesting!
Not at least that they have solved the tricky red5 installation very in a way that hopefully will find it&#8217;s way back to red5.org very soon&#8230; Their full installation uses nginx web server (http://nginx.net) instead of Apache, but here&#8217;s a way to pick the red5 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=182&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Found the BigBlueButton project (<a href="http://bigbluebutton.org/" target="_blank">http://bigbluebutton.org/</a>) the other day &#8211; very interesting!</p>
<p>Not at least that they have solved the tricky red5 installation very in a way that hopefully will find it&#8217;s way back to red5.org very soon&#8230; Their full installation uses nginx web server (<a href="http://nginx.net/" target="_blank">http://nginx.net)</a> instead of Apache, but here&#8217;s a way to pick the red5 raisin out of the big blue cookie:</p>
<ol>
<li>wget http://archive.bigbluebutton.org/bigbluebutton.asc</li>
<li> sudo apt-key add bigbluebutton.asc</li>
<li> echo &#8220;deb http://archive.bigbluebutton.org/ bigbluebutton main&#8221; | sudo tee /etc/apt/sources.list.d/bigbluebutton.list</li>
<li> sudo apt-get update</li>
<li>sudo apt-get install red5</li>
</ol>
<p>Thank you, Fred and others at BigBlueButton!<br />
Now, let&#8217;s find out if this works on a Debian Lenny too&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=182&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/10/20/red5-on-ubuntu-9-04-thanks-to-bigbluebutton/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>
	</item>
		<item>
		<title>The quest for client-side search query language</title>
		<link>http://cambiatablog.wordpress.com/2009/09/25/the-quest-for-client-side-search-query-language/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/25/the-quest-for-client-side-search-query-language/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 05:40:59 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=175</guid>
		<description><![CDATA[&#8230;just led me to CQL (Contextual Query Language). Thanks StackOverflow and njk for showing the way!
(Please note that since version 1.2, &#8220;Contextual Query Language&#8221; is changed from former &#8220;Common Query Language&#8221;)
This lets the user write advanced searches using logical operators, indexes, even proximities&#8230; So, let&#8217;s create a search for all the cql-to-php-to-sql libraries laying around [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=175&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#8230;just led me to <a href="http://www.loc.gov/standards/sru/specs/cql.html" target="_blank">CQL (Contextual Query Language)</a>. Thanks <a href="http://stackoverflow.com/questions/1473813/standards-for-client-side-definition-of-advanced-search">StackOverflow and njk</a> for showing the way!</p>
<p>(Please note that since version 1.2, &#8220;Contextual Query Language&#8221; is changed from former &#8220;Common Query Language&#8221;)</p>
<p>This lets the user write advanced searches using logical operators, indexes, even proximities&#8230; So, let&#8217;s create a search for all the cql-to-php-to-sql libraries laying around waiting for to be implemented&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=175&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/25/the-quest-for-client-side-search-query-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>
	</item>
		<item>
		<title>Imagemagick: Pdf to bitmap density quirk</title>
		<link>http://cambiatablog.wordpress.com/2009/09/24/imagemagick-pdf-to-bitmap-density-quirk/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/24/imagemagick-pdf-to-bitmap-density-quirk/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 12:32:44 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=173</guid>
		<description><![CDATA[When converting bitmapcontained pdfs to bitmaps using the imagemagick convert method, beware the parameter order! The density parameter sets the resolution of the bitmap conversion before resizing &#8211; therefore, the higher density value, the better resulting quality.
So, the followning should work, but doesnt:
convert source.pdf -resize 630&#215;891 -density 300 result%04d.png
By some reason the -density parameter has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=173&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When converting bitmapcontained pdfs to bitmaps using the imagemagick convert method, beware the parameter order! The density parameter sets the resolution of the bitmap conversion before resizing &#8211; therefore, the higher density value, the better resulting quality.<br />
So, the followning should work, but doesnt:</p>
<p style="padding-left:30px;">convert source.pdf -resize 630&#215;891 -density 300 result%04d.png</p>
<p>By some reason the -density parameter has to be set before the source file name. This works:</p>
<p style="padding-left:30px;">convert -resize 630&#215;891 -density 300 <strong>source.pdf</strong> result%04d.png</p>
<p>By the way, the &#8220;%04d&#8221; tag in the resulting file name gives an autonumbering with leading zeros, in this case 4 digits in total. Thus:</p>
<p style="padding-left:30px;">page0000.png<br />
page0001.png<br />
page0002.png</p>
<p>etc.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=173&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/24/imagemagick-pdf-to-bitmap-density-quirk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>
	</item>
		<item>
		<title>Kohana 2.x code completion in Eclipse PDT</title>
		<link>http://cambiatablog.wordpress.com/2009/09/18/kohana-2-x-code-completion-in-eclipse-pdt/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/18/kohana-2-x-code-completion-in-eclipse-pdt/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 19:44:39 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Kohana PHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PDT]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=160</guid>
		<description><![CDATA[Things are about to change with Kohana 3 just released&#8230;
Meanwhile, the Eclipse PDT editor can&#8217;t really cope with Kohanas class namings and folder structure. But of course there is a solution: Peter Bowyer&#8217;s zend_autocomplete (works in all Eclipse PDT implementations including my boosted FlexBuilder 3, not just Zend Studio!). Put it in your controller directory, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=160&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Things are about to change with Kohana 3 just released&#8230;</p>
<p>Meanwhile, the Eclipse PDT editor can&#8217;t really cope with Kohanas class namings and folder structure. But of course there is a solution: Peter Bowyer&#8217;s <a href="http://www.mapledesign.co.uk/code/kohana-zend-autocomplete/" target="_blank">zend_autocomplete</a> (works in all Eclipse PDT implementations including my boosted FlexBuilder 3, not just Zend Studio!). Put it in your controller directory, run it &#8211; and it creates a file in the cache containing all Kohana system classes as well as your own application classes! This is what Eclipse needs to give you well-working code completion! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-161" title="CodeCompletion" src="http://cambiatablog.files.wordpress.com/2009/09/codecompletion.png?w=480&#038;h=241" alt="CodeCompletion" width="480" height="241" /></p>
<p>Thank you, Peter!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=160&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/18/kohana-2-x-code-completion-in-eclipse-pdt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>

		<media:content url="http://cambiatablog.files.wordpress.com/2009/09/codecompletion.png" medium="image">
			<media:title type="html">CodeCompletion</media:title>
		</media:content>
	</item>
		<item>
		<title>Kohana, Formo and many-to-many relations (&#8220;habtm&#8221;)</title>
		<link>http://cambiatablog.wordpress.com/2009/09/18/kohana-formo-and-many-to-many-relations-habtm/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/18/kohana-formo-and-many-to-many-relations-habtm/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:22:30 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Kohana PHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Formo]]></category>
		<category><![CDATA[Kohana]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=151</guid>
		<description><![CDATA[Just got the solution for how to handle many-to-many relations in Formo. Thank you, Ben!
Three tables, groups (id, name), users (id, name) and the pivot table groups_users(group_id, user_id).

class User_Model extends ORM {
protected $has_and_belongs_to_many = array('groups');
}
class Group_Model extends ORM {
protected $has_and_belongs_to_many = array('users');
}

And here&#8217;s how to in the controller handle display of an user form, complete [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=151&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Just got the solution for how to handle many-to-many relations in Formo. Thank you, Ben!</p>
<p>Three tables, groups (id, name), users (id, name) and the pivot table groups_users(group_id, user_id).</p>
<pre class="brush: php;">
class User_Model extends ORM {
protected $has_and_belongs_to_many = array('groups');
}
class Group_Model extends ORM {
protected $has_and_belongs_to_many = array('users');
}
</pre>
<p>And here&#8217;s how to in the controller handle display of an user form, complete with checkbuttons for toggling connections to groups:</p>
<pre class="brush: php;">
public function user($id = false) {
$user = new User_Model($id);
$form = Formo::factory()
-&gt;orm($user)
-&gt;habtm('user', 'group')
-&gt;add('Submit');
if ($form-&gt;validate()) $form-&gt;save();
echo $form;
}
</pre>
<p>This gives the following form. The magic lies in the habtm plugin (has to be active either by Formo config or by Formo::factory()-&gt;plugin(&#8216;habtm&#8217;). Not one single sql line, not one line of deadly tedious form populating and deriving&#8230;</p>
<p><img title="habtm" src="http://cambiatablog.files.wordpress.com/2009/09/habtm1.png?w=362&#038;h=146" alt="habtm" width="362" height="146" /></p>
<p>Ok, not pretty, but that&#8217;s another story.</p>
<p>Soo proud. Just struck me what &#8220;habtm&#8221; stands for.<br />
Na na, won&#8217;t tell ya! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=151&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/18/kohana-formo-and-many-to-many-relations-habtm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>

		<media:content url="http://cambiatablog.files.wordpress.com/2009/09/habtm1.png" medium="image">
			<media:title type="html">habtm</media:title>
		</media:content>
	</item>
		<item>
		<title>Kohana PHP with ORM and Formo &#8211; db made easy!</title>
		<link>http://cambiatablog.wordpress.com/2009/09/17/kohana-php-with-orm-and-formo-db-made-easy/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/17/kohana-php-with-orm-and-formo-db-made-easy/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 20:19:53 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Kohana PHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Formo]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=142</guid>
		<description><![CDATA[After some days prototyping with Kohana, I start to realize the strength and beauty!
One of the every-day needs in my world is to coordinate different database tables to get things to work. Most of the time this is done by hand, using PhpMyAdmin. For basic stuff, this works fine, but very often there&#8217;s the bad [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=142&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After some days prototyping with <a href="http://kohanaphp.com" target="_blank">Kohana</a>, I start to realize the strength and beauty!</p>
<p>One of the every-day needs in my world is to coordinate different database tables to get things to work. Most of the time this is done by hand, using PhpMyAdmin. For basic stuff, this works fine, but very often there&#8217;s the bad feeling of should-have-a-real-admin-interface-for-this&#8230;</p>
<p>No bad feelings no more! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  The combination of Kohana&#8217;s Object Relational Mapping library (ORM) and the <a href="http://dev.kohanaphp.com/projects/formo" target="_blank">Formo module </a>makes it super-easy to create a table-admin-interface, including related tables. No SQL at all, no defining form layouts at all! (Ok, there can be a need for some validation information, some styling etc.)</p>
<p>Here&#8217;s an example, based on two tables, schools and students:</p>
<pre class="brush: php;">
schools: &lt;- Note: Table name in plural
id:int autoincrement
name:varchar

students:  &lt;- Note: Table name in plural
id:int autoincrement
school_id:int   &lt;- Note! Referred table as singular + &quot;_id&quot;
name:varchar
</pre>
<p>Two models for those tables:</p>
<pre class="brush: php;">
// models/student.php
class Student_Model extends ORM {
protected $belongs_to = array(&quot;school&quot;);
// Defines the connection to school - &quot;each student belonst to a school&quot;
}
// models/school.php
class School_Model extends ORM {
protected $has_many = array(&quot;students&quot;);
// Defines the connection to students - &quot;each school has many students&quot;
}
</pre>
<p>So for the controller. Here&#8217;s the real beauty: In the listAll action below the schools are fetched, and ORM handles automatically the relationship and fetches all connected students as well!</p>
<pre class="brush: php;">
// controllers/controllername.php
public function listAll() {
$schoolModel = new School_Model();
$schools = $schoolModel-&gt;find_all();
foreach ($schools as $school) {
echo &quot;&lt;br/&gt;&lt;b&gt;$school-&gt;name - &quot;.html::anchor(&quot;controllername/school/{$school-&gt;id}&quot;, &quot;edit&quot;).&quot;&lt;/b&gt;&quot;;
foreach ($school-&gt;students as $student) {
echo &quot;&lt;br/&gt;- $student-&gt;name - &quot;.html::anchor(&quot;controllername/student/{$student-&gt;id}&quot;, &quot;edit&quot;);
}
}
}
</pre>
<p>The actions below handle both creation and editing of posts. The super-handy Formo library maps out a complete form &#8211; including dropselect for selecting a school for the students! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Kind of magic!</p>
<pre class="brush: php;">
// controllers/ormtest.php
public function school($id = false) {
$school = new School_Model($id);
$form = Formo::factory()-&gt;orm($school)-&gt;add(&quot;Submit&quot;);
echo $form;
if ($form-&gt;validate()) {
$form-&gt;save();
}
}

public function student($id = false) {
$student = new Student_Model($id);
$form = Formo::factory()
  		-&gt;orm($student)
  		-&gt;add(&quot;Submit&quot;);
if ($form-&gt;validate()) $form-&gt;save();
echo $form;
}
</pre>
<p>The only &#8220;tricky&#8221; part is that you have to get the table names and references to them right according to the <a href="http://docs.kohanaphp.com/libraries/orm/starting" target="_blank">ORM naming conventions</a>. Here&#8217;s a short summary:</p>
<ul>
<li>Table names should be plural<br />
(&#8220;schools&#8221;, &#8220;students&#8221; &#8211; this makes sense because the table is a list with many items)</li>
<li>Referring field names should be singular plus &#8220;_id&#8221;<br />
(&#8220;school_id&#8221; &#8211; logically because a single student belongs to one single school)</li>
<li>Model names should be singular.<br />
(The model file for a student is named &#8220;student.php&#8221;, and the class is named &#8220;class Student_Model extends ORM&#8221;. A model most of the time represent one single item: one student or one school. The exception is when we want a listing of all items in the table. Have a look at the listAll code above.)</li>
</ul>
<p>The models need to include information about the relations.</p>
<ul>
<li>The student belongs to one of many schools, therefore we use<br />
<em>protected $belongs_to = array(&#8217;schools&#8217;); </em><br />
with plural in &#8220;schools&#8221;</li>
<li>The school has one or many students, thus<br />
<em>protected $has_many = array(&#8217;students&#8217;);</em></li>
</ul>
<p>Note that this relates to a one-to-many relationship. <em><br />
</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=142&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/17/kohana-php-with-orm-and-formo-db-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy crudding with Kohana</title>
		<link>http://cambiatablog.wordpress.com/2009/09/16/crudding-with-kohana/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/16/crudding-with-kohana/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 09:34:43 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Kohana PHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[crud]]></category>
		<category><![CDATA[Kohana]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=134</guid>
		<description><![CDATA[Another superb Kohana solution: CRUD Scaffold (projects.nathanbentley.com/projects/show/crudscaffold) by Nathan Bentley. Just install, write some controller and model lines, and you have a nice JQuery-driven table editor &#8211; just the way it should be!:

Thank you, Nathan!
Now, there&#8217;s just left to sort out how to handle related tables&#8230;
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=134&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Another superb Kohana solution: CRUD Scaffold (projects.nathanbentley.com/projects/show/crudscaffold) by Nathan Bentley. Just install, write some controller and model lines, and you have a nice JQuery-driven table editor &#8211; just the way it should be!:</p>
<p><img class="alignnone size-medium wp-image-139" title="crud_artists_listing2-641x498" src="http://cambiatablog.files.wordpress.com/2009/09/crud_artists_listing2-641x4981.png?w=300&#038;h=233" alt="crud_artists_listing2-641x498" width="300" height="233" /></p>
<p>Thank you, Nathan!</p>
<p>Now, there&#8217;s just left to sort out how to handle related tables&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=134&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/16/crudding-with-kohana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>

		<media:content url="http://cambiatablog.files.wordpress.com/2009/09/crud_artists_listing2-641x4981.png?w=300" medium="image">
			<media:title type="html">crud_artists_listing2-641x498</media:title>
		</media:content>
	</item>
		<item>
		<title>Php: Getting it together with Kohana?</title>
		<link>http://cambiatablog.wordpress.com/2009/09/16/php-getting-it-together-with-kohana/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/16/php-getting-it-together-with-kohana/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 09:20:39 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Kohana PHP]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[s7n]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=129</guid>
		<description><![CDATA[Somewhere deep inside you carry a vision, a longing, a vague picture of &#8220;getting it all together&#8221;&#8230; At least I do &#8211; in every aspect of life..!  
Since I started php coding some years ago, I&#8217;ve always had a bad taste in my mouth. It&#8217;s so ugly, so diversitive, so sprawling, so poly-cultural (in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=129&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Somewhere deep inside you carry a vision, a longing, a vague picture of &#8220;getting it all together&#8221;&#8230; At least I do &#8211; in every aspect of life..! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Since I started php coding some years ago, I&#8217;ve always had a bad taste in my mouth. It&#8217;s so ugly, so diversitive, so sprawling, so poly-cultural (in a bad sense), so non-coherent&#8230;  This feeling has been accentuated since I started using Flex and Actionscript 3 with its java-like package concept combined with the superb Eclipse based editor&#8230; At last an environment that helped me to good and professional-like thinking, structure and habits!</p>
<p>Since some months, I&#8217;ve been able to get my php-solutions together in a low-level kind-of-framework-like structure, where I (at last!) quickly and easily can reach what I need: GD-processing, File handling stuff, SQL processing, debugging, ZendAmf stuff etc&#8230;</p>
<p>Connecting to my initial philosophies, I would like to weave this basic every-day utility stuff into something that has full limit-less production capabilities, including crudding, cms-ing, caching etc&#8230;  And maybe I&#8217;ve found what I&#8217;ve been looking for &#8211; Kohana (konanaphp.com)! With its CodeIgniter roots, it&#8217;s the far most elegant and simple php framework that I&#8217;ve been able to understand this far..! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>It&#8217;s layered concistent structure of system-modules-application makes it so quick and easy! Just one example: Yesterday, I downloaded and tried the s7n cms system (http://code.google.com/p/s7ncms/) created in Kohana by Eduard Baun. The complete cms core as one module! Extensions of the cms also as modules! The fundamental Kohana layout virtually untouched! Some months ago I investigated some Zend cms solutions, and they were a complicated mess compared to this one&#8230;</p>
<div id="attachment_131" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-131" title="s7ncms_admin_pages" src="http://cambiatablog.files.wordpress.com/2009/09/s7ncms_admin_pages.png?w=300&#038;h=255" alt="S7N admin interface, created with Kohana PHP" width="300" height="255" /><p class="wp-caption-text">S7N admin interface, created with Kohana PHP</p></div>
<p>And it looks good too&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=129&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/16/php-getting-it-together-with-kohana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>

		<media:content url="http://cambiatablog.files.wordpress.com/2009/09/s7ncms_admin_pages.png?w=300" medium="image">
			<media:title type="html">s7ncms_admin_pages</media:title>
		</media:content>
	</item>
		<item>
		<title>AS3 BitmapData AMF solution using IExternalizable</title>
		<link>http://cambiatablog.wordpress.com/2009/09/12/as3-bitmapdata-amf-solution-using-iexternalizable/</link>
		<comments>http://cambiatablog.wordpress.com/2009/09/12/as3-bitmapdata-amf-solution-using-iexternalizable/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 19:02:28 +0000</pubDate>
		<dc:creator>cambiatablog</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[AMF]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[bytearray]]></category>

		<guid isPermaLink="false">http://cambiatablog.wordpress.com/?p=125</guid>
		<description><![CDATA[Using bitmaps in an AS3 remoting environment isn&#8217;t that easy. If I&#8217;m getting it right, the problem is that the BitmapData object needs constructor parameters, wich isn&#8217;t combinable with the handy [RemoteClass(alias= ] method of invoking the objects when streaming data into a ByteArray.
A walkaround is to wrap the BitmapData into a custom class implementing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=125&subd=cambiatablog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Using bitmaps in an AS3 remoting environment isn&#8217;t that easy. If I&#8217;m getting it right, the problem is that the BitmapData object needs constructor parameters, wich isn&#8217;t combinable with the handy [RemoteClass(alias= ] method of invoking the objects when streaming data into a ByteArray.</p>
<p>A walkaround is to wrap the BitmapData into a custom class implementing the IExternalizable interface. This interface forces the writing and reading of data through methods where the serialization can be taken care of.<br />
In the example below (a renamed copy of <a href="http://www.behindtheui.com/2009/06/caching-images-to-disk.html">this class</a>, thank you Greg! &#8211; unfortunately I couldn&#8217;t find your lastname&#8230;), the bitmap data storage is done through encoding/decoding as png data. Loading is then performed via a Loader object.</p>
<pre class="brush: java;">
package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.utils.ByteArray;
    import flash.utils.IDataInput;
    import flash.utils.IDataOutput;
    import flash.utils.IExternalizable;
    import mx.graphics.codec.PNGEncoder;

    [RemoteClass(name=&quot;ExtBitmap&quot;)]
    public class ExtBitmap implements IExternalizable
    {
        public var imageData:BitmapData;

        protected var loader:Loader;

        public function ExtBitmap(){
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(
                   Event.COMPLETE, handleBytesLoaded);
        }

        public function handleBytesLoaded(event:Event):void{
            trace('handleBytesLoaded');
            imageData = Bitmap(loader.content).bitmapData;
        }

        public function writeExternal(out:IDataOutput):void{
            trace('writeExternal');
            var encoder:PNGEncoder = new PNGEncoder();
            var bytes:ByteArray = encoder.encode(imageData);
            bytes.position = 0; // may not be necessary
            out.writeDouble(bytes.length);
            out.writeBytes(bytes);
        }

        public function readExternal(input:IDataInput):void{
            trace('readExternal');
            var length:Number = input.readDouble();
            var pngData:ByteArray = new ByteArray();
            input.readBytes(pngData,0,length);
            loader.loadBytes(pngData);
        }
    }
}
</pre>
<p>Let&#8217;s hope that this kind of wierdness can be forgotten in AS4&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cambiatablog.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cambiatablog.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cambiatablog.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cambiatablog.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cambiatablog.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cambiatablog.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cambiatablog.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cambiatablog.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cambiatablog.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cambiatablog.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cambiatablog.wordpress.com&blog=8456041&post=125&subd=cambiatablog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cambiatablog.wordpress.com/2009/09/12/as3-bitmapdata-amf-solution-using-iexternalizable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/23a67691db07dbe225862f246fd125f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cambiatablog</media:title>
		</media:content>
	</item>
	</channel>
</rss>