Loose Ends

Posted by Steve Longdo Fri, 25 Aug 2006 04:07:00 GMT

Some loose ends will be tied up here soon. Here is a quick list of things that I intend to post more about soon. Suggestions/requests will be taken from comments as well :-)
  • AJAX-ed OpenRico Accordion widget
  • $LOAD_PATH and Revealing some Rails Magic Tricks
  • Edge Typo's New Pluggable Sidebars
  • Installing RubyGems on TextDrive Done!
  • Further Exploring the Limits on TextDrive:
    • [rhesus@davie ~]$ ulimit -a
      core file size (blocks, -c) 0
      data seg size (kbytes, -d) 40960
      file size (blocks, -f) unlimited
      max locked memory (kbytes, -l) 32768
      max memory size (kbytes, -m) 49152
      open files (-n) 240
      pipe size (512 bytes, -p) 1
      stack size (kbytes, -s) 16384
      cpu time (seconds, -t) 1200
      max user processes (-u) 20
      virtual memory (kbytes, -v) 81920

Adobe Flex2 is out...

Posted by Steve Longdo Wed, 28 Jun 2006 15:58:00 GMT

Apparently Adobe Flex2 is available for download today.
When Adobe first announced Flex 2 last fall, it said that it would make the core software development kit (SDK), which provides the core programmer tooling without the bells and whistles of a visual IDE, available for free. The SDK just released includes the framework itself, compiler, documentation, and a command line debugger.
It would be great to be able to use the free SDK compiler to make a simple AJAX driven 3D pie-chart not unlike the ones in Google Analytics. Adobe even provides an open source Flash-Ajax bridge project for linking AJAX activity to a swf file.

Has someone already done this or am I ahead of the curve?

Typo Administration: article tagging III...

Posted by Steve Longdo Wed, 15 Mar 2006 03:47:00 GMT

Last time I alluded to using an AJAX-less solution for the tagging auto completion feature. In fact in the controls.js JavaScript file distributed with Typo there is a "class", Autocompleter.Local, that does what we are after. As the name implies it does completion from a local JavaScript array.

We need to coerce the @tags attribute we set up in the content_controller last time, into a JavaScript array. Then hook up the Autocompleter.Local to the Keywords field on the Article form and pass it the JavaScript array of tags. The Autocompleter.Local needs a <DIV> element to update with matches for what we type into the Keywords field. Also for everything to work properly, turn off the browser's native "autocomplete" feature by setting it to "off" in the text_field method's options hash for the Keywords field. Now that we know what the next steps are lets code:
app/views/admin/content/_form.rhtml
...
<p>
  <label for="article_keywords">Keywords:</label><br />
  <%= text_field 'article', 'keywords', :autocomplete => 'off'  %><br />
  <div id="completer" style="max-width: 75px; display: none; overflow: auto; border: 1px solid black; background-color: white;"></div>
<script type="text/javascript" language="javascript" charset="utf-8">
  opts = new Array(<%= @tags.sort_by{|t| t.display_name}.collect!{|t1| '"' + t1.display_name + '",'} -%>'');
// <![CDATA[  
  new Autocompleter.Local('article_keywords','completer', opts
  , { tokens: new Array(' ',',','\n'), partialChars: 1, choices: 20, partialSearch: false});
// ]]>
</script>
</p>
...
This code reads well, it is Ruby after all, but the line right after the <script> element may deserve some special explanation. That dense little line of Ruby code sorts our @tags by their display_name and then collects them together into a String that will look like this: ("tag1","tag2",...,''). This String will in turn be evaluated into a JavaScript Array. The options being passed to the Autocompleter {tokens,choices,etc.} are documented in the controls.js JavaScript file distributed with Typo.
Let's create a new article and check out the fruits of our labor thus far by seeing what happens when we enter the letter 'a':
The CSS styling provided is pulled from the admin panel's CSS stylesheet, hence the redness. Also you can see that my guess at making the completer <DIV> element's max-width: 75px, didn't work out too well. Using Chris Pedrick's WebDeveloper Extension to view the generated source of our completer <DIV> element, the HTML markup provided by the Autocompleter is pretty basic. We'll work on augmenting it and making the CSS styling better looking next time.


Sorry, for the extra long delay in finishing this up. I ran into some issues with the theme I was using and some other distractions... I will attempt to get the next update out before the weekend.
Read more...

Older posts: 1 2 3 4