<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Django and Flex</title>
      <link>http://www.djangoandflex.org.uk/</link>
      <description>Trials and Joys of working with Django and Flex</description>
      <language>en</language>
      <copyright>Copyright 2007</copyright>
      <lastBuildDate>Sat, 21 Jul 2007 01:59:09 +0000</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=3.2</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>Object Oriented Databases with Django</title>
         <description><![CDATA[<p>Three times over my Django-programming career I've had this same problem. I have a highly polymorphic domain that I'm trying to represent to Django. As is well known in the world of RDBMSes, this leads to very large and complex sets of database tables with correspondingly slow lookup and heavy validation requirements.</p>

<p>Lets, for a simple example, imagine building an ecommerce solution for selling antiques. The antiques we have in stock all belong to one or more categories of antiques. So far so simple: an Antique model with a many to many relationship with a Category model. For each antique we need to store various bits of information: information on its quality, provenance, and damage. But, crucially, the information we need to store for each antique depends on its categories. So for a piece of furniture our shop browsers will expect certain information, while collectors of miniature paintings will expect others.</p>

<p>We could solve this problem by allowing each antique to have any number of properties, and then enter all the relevant information ourselves each time we put a new antique in the system. This would work, but be very error prone: we might forget a salient piece of data. It is also laborious, in most cases there are sensible defaults for propoerties that we'd do well to use. And it begs the question what data type do we store data in? Some properties might be dates, others quality levels, yet others names.</p>

<p>So we could create a fiendishly complex model where categories define certain required parameters, defining their default value and data type, and some flexible parameter table holds the paramaters that are non-default for a particular antique, in such a way that any data can be input (or maybe different parameter tables for different data types). It works but it is very inelegant and laborious to code.</p>

<p>There's got to be a better way.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/object_oriented_databases_with_django.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/object_oriented_databases_with_django.html</guid>
         <category>Django</category>
         <pubDate>Sat, 21 Jul 2007 01:59:09 +0000</pubDate>
      </item>
            <item>
         <title>My Last Post on HTML (Honest)</title>
         <description><![CDATA[<p>I promise I really will blog about Django and Flex again soon!</p>

<p>There are some major faults with my column-HTML posts below: "If I have seen further it is by standing on the shoulders of giants." -- Newton</p>

<p>Of course, the key part of the quote is that it is a wise move to find some giants and stand on their shoulders. In my case I stood around on tiptoe trying to see as far as possible because I couldn't immediately find a friendly giant to stand on. Thanks for everyone who commented and pointed out where the giants hang out.</p>

<p>So, in summary:</p>

<p>To put columns in any order, don't do the complex nesting stuff I recommended in <a href='http://www.djangoandflex.org.uk/2007/07/div_column_layouts_in_any_orde.html'>this post</a>, instead, use negative margins, as described <a href='http://alistapart.com/articles/negativemargins/'>here</a>.</p>

<p>And secondly, don't use a zero pixel div with clear:both that I blogged <a href='http://www.djangoandflex.org.uk/2007/07/wrapping_a_div_around_floats_i_1.html'>here</a>, use overlap:hidden in the outer div instead.</p>

<p>So basically, do it differently to the way I said :D</p>

<p>Thanks again everyone for the help.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/my_last_post_on_html_honest.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/my_last_post_on_html_honest.html</guid>
         <category></category>
         <pubDate>Fri, 13 Jul 2007 00:56:41 +0000</pubDate>
      </item>
            <item>
         <title>Welcome Djangoistae</title>
         <description><![CDATA[<p>It seems the site is listed on the Django main weblog (thanks Clint)!</p>

<p>If you're joining from there and are interested in RIAs, please leave a comment or subscribe. I think it would be great to get together and discuss issues particular to RIAs and django!</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/welcome_djangoistae_1.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/welcome_djangoistae_1.html</guid>
         <category>Meta</category>
         <pubDate>Tue, 10 Jul 2007 00:28:42 +0000</pubDate>
      </item>
            <item>
         <title>A 3 Step Plan for SEO-friendly Rich Internet Applications</title>
         <description><![CDATA[<p>Search engines are optimised for a non-RIA model of the web: a web made up of pages. SEO tuned web applications expose content in pages for search engines, even if the user will interact with the application through AJAX and page-rewriting (which is completely opaque to a search engine spider). </p>

<p>RIAs make this even harder, and most developers don't seem to bother at all. That's fine if your RIA is going to be used by employees or partners (i.e. people who know where to find it), but not if it will be public facing.</p>

<p>Fortunately, there's an easy way make your RIA search engine friendly. </p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/a_3_step_plan_for_seofriendly.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/a_3_step_plan_for_seofriendly.html</guid>
         <category></category>
         <pubDate>Sun, 08 Jul 2007 22:43:52 +0000</pubDate>
      </item>
            <item>
         <title>Wrapping a Div around Floats in HTML</title>
         <description><![CDATA[<p>The second of my digressions onto HTML looks at how to make sure that a DIV is at least as high as the floating DIVs it contains.</p>

<p>If you do something like:</p>

<pre>
&lt;div id='outer'&gt;
   &lt;div style='float:left'&gt;Content One&lt;/div&gt;
   &lt;div style='float:left'&gt;Content Two&lt;/div&gt;
   &lt;div style='float:left'&gt;Content Three&lt;/div&gt;
&lt;/div&gt;
</pre>

<p>and want <var>div#outer</var> to encompass the three content divs, you find a browser incompatibility. IE7 does that I want - the enclosing div encloses its children. Other browsers do what the CSS standard says is the right thing: div#outer is one pixel high and the rest of the divs descend below it.</p>

<img alt="enclosing-div-blog.png" src="http://www.djangoandflex.org.uk/enclosing-div-blog.png" width="509" height="221" />

<p>I want it to work on all browsers, however. After various playing around I discovered that:</p>

<pre>
&lt;div id='outer'&gt;
   &lt;div style='float:left'&gt;Content One&lt;/div&gt;
   &lt;div style='float:left'&gt;Content Two&lt;/div&gt;
   &lt;div style='float:left'&gt;Content Three&lt;/div&gt;
   &lt;div style='clear: both; height: 0'&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>

<p>seems to work. [Interestingly, although I'm working exclusively in XHTML, using <var>&lt;div/&gt;</var> doesn't work - the XHTML spec recommends that you don't have empty tags like div (anything that normally contains content), but this isn't a normative part of the spec, so browsers should really support full XML syntax in this regard.]</p>

<p>The application of all this is that I can now apply a vertically tiled 1px high background image to div#outer, with column shading on it, and have the different height columns all <em>appear</em> to be full-height - something that is very difficult to do by making the floating divs actually the same height. It is a solution that avoids many of the accessibility and fragility problems of the "one true layout" approach.</p>

<p>Combining this with the previous blog post I can now get full-height columns in any order, which is what I needed.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/wrapping_a_div_around_floats_i_1.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/wrapping_a_div_around_floats_i_1.html</guid>
         <category>HTML</category>
         <pubDate>Fri, 06 Jul 2007 16:31:55 +0000</pubDate>
      </item>
            <item>
         <title>DIV Column Layouts in Any Order (Almost)</title>
         <description><![CDATA[<p>This is a complete digression for a blog on Django and Flex, I want to talk about some HTML I've been working on. My project is some technology to automatically generate and design web-pages, through my <a href='http://www.therndguy.com'>R&amp;D</a> company. There are two things I've discovered, so look out for a further post on the other.</p>

<p>This post is about how to create DIV column layouts where the columns are given in the HTML in any order, but are displayed correctly when rendered, allowing you to have SEO-friendly content first in the HTML page, even if it appears in the middle of your column layout.</p>

]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/div_column_layouts_in_any_orde.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/div_column_layouts_in_any_orde.html</guid>
         <category>HTML</category>
         <pubDate>Thu, 05 Jul 2007 15:02:28 +0000</pubDate>
      </item>
            <item>
         <title>In with the New</title>
         <description><![CDATA[<p>A quick note to say that I've moved the blog to this new site. Not that there were many folks who'd found it in the five days of its existence, but still.</p>

]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/in_with_the_new.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/in_with_the_new.html</guid>
         <category>Meta</category>
         <pubDate>Wed, 04 Jul 2007 14:32:32 +0000</pubDate>
      </item>
            <item>
         <title>Z-Order of Components in a Flex Canvas</title>
         <description><![CDATA[<p>This isn't a blog about Flex bugs - honest. But I found another yesterday.</p>

<p>If you have a bunch of components in a Flex Canvas, and show/hide/animate them with states and transitions, the components can change z-order on you without warning. I had a pernicious problem today with something like:</p>

<pre>
&lt;mx:Canvas&gt; 
 &lt;mx:Panel id='content'/&gt; 
 &lt;mx:Panel id='tool_palette'/&gt; 
&lt;/mx:Canvas&gt;</pre>
<p>Where <tt>content</tt> started out behind <tt>tool_palette</tt>, but when the latter got hidden (using a RemoveChild node in a state), and reappeared (by transitioning back) it was shown behind the content panel. Clearly a problem.</p>

<p>The solution I found was to separate the objects into two canvases:</p>
<pre>
&lt;mx:Canvas&gt; 
 &lt;mx:Canvas height="100%" width="100%"&gt; 
  &lt;mx:Panel id='content'/&gt; 
 &lt;/mx:Canvas&gt; 
 &lt;mx:Canvas height="100%" width="100%"&gt; 
  &lt;mx:Panel id='tool_palette'/&gt; 
 &lt;/mx:Canvas&gt; 
&lt;/mx:Canvas&gt;</pre>
<p>which is a bit of a hack, but works. This is the first time I've missed old-flash's z-depth model.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/zorder_of_components_in_a_flex.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/zorder_of_components_in_a_flex.html</guid>
         <category>Flex</category>
         <pubDate>Tue, 03 Jul 2007 13:53:49 +0000</pubDate>
      </item>
            <item>
         <title>Binding Selected Items in a Flex List</title>
         <description><![CDATA[<p>Just a quickie.</p>

<p>Discovered today that if you try to programatically deselect the currently selected item in a ListBase subclass with <tt>selectedItem=null</tt> the change doesn't propagate to anything bound to <tt>{my_list.selectedItem}</tt>. In fact in my application it seems to permanently break the data binding.</p>

<p>Instead, to deselect a list item, do <tt>selectedIndex=-1</tt>, that seems to work.</p>

<p>So I've got something like:</p>

<pre>
 &lt;mx:Button label="Clear" click="entries.selectedIndex=-1"/&gt; 
 &lt;mx:List id="entries" dataProvider="{my_data}"/&gt; 
 &lt;components:MyEntryDisplay entry="{entries.selectedItem}"/&gt;</pre>

<p>which is fine for me.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/07/binding_selected_items_in_a_fl_1.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/07/binding_selected_items_in_a_fl_1.html</guid>
         <category></category>
         <pubDate>Sun, 01 Jul 2007 13:56:51 +0000</pubDate>
      </item>
            <item>
         <title>Sending Images From Flex to a Server</title>
         <description><![CDATA[<p>Today's challenge has been to allow a Flex app to create images, and have the new images uploaded back to the server as a bitmap. The application is for a simple buddy-icon editing application: users can upload their photos, drag in bits of clip art, resize and so on, then use their generated buddy icon on the site. The same could be useful for doing basic image editing, uploading for print.</p>

<p>There are two issues. First is getting uploaded images into Flex. That's a topic for a future post (but basically you have to upload them to the server, then download them again).</p>

<p>The second is uploading a final image generated by Flex. And it turns out this is surprisingly easy.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/06/sending_images_from_flex_to_a_1.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/06/sending_images_from_flex_to_a_1.html</guid>
         <category></category>
         <pubDate>Sat, 30 Jun 2007 13:00:00 +0000</pubDate>
      </item>
            <item>
         <title>Xml Generation Module</title>
         <description><![CDATA[<p>In all my apps I communicate client to server in XML. Flex has very nice XML processing capabilities through e4x. I typically generate only simple XML to send back to the server, where python's processing is fairly easy too.</p>

<p>The last link in the chain is getting Django to generate XML easily. I wrote a very simple xml generating module that might proove useful.</p>
]]></description>
         <link>http://www.djangoandflex.org.uk/2007/06/xml_generation_module_1.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/06/xml_generation_module_1.html</guid>
         <category></category>
         <pubDate>Fri, 29 Jun 2007 13:59:05 +0000</pubDate>
      </item>
            <item>
         <title>Welcome</title>
         <description><![CDATA[<p>Welcome to Django'n'Flex. This site is about working with these two great new technologies, because that's what I'm doing a lot at the moment.</p>

<p>I thought I'd start this blog to note down things I've found out, numskull moments and the rare bit of insight.</p>]]></description>
         <link>http://www.djangoandflex.org.uk/2007/06/welcome.html</link>
         <guid>http://www.djangoandflex.org.uk/2007/06/welcome.html</guid>
         <category>Meta</category>
         <pubDate>Thu, 28 Jun 2007 13:59:33 +0000</pubDate>
      </item>
      
   </channel>
</rss>
