dojo icon

Dojo - dojo.addOnLoad vs. body onload and window.onload

Posted in , Fri, 14 Jul 2006 04:57:00 GMT

When using Dojo Toolkit, you should avoid using <body onload="..."> or window.onload (make sure to check external scripts you use as well). This is because Dojo does it's own window.onload and doing it yourself can interfere with Dojo's initialization routines (including DOM rewriting). Dojo has provided dojo.addOnLoad for this which allows you to load functions after Dojo has finished its own initilization.

To use dojo.addOnLoad you need to pass a function which can be in either of the following formats:

dojo.addOnLoad( myinit );
dojo.addOnLoad( function() { myinit(); });

You cannot, however, use a function call like the following since Dojo is expecting an object, not a function call.

dojo.addOnLoad( myinit() );

I discussed using dojo.addOnLoad in a previous entry about setting Dojo's combobox default value but thought it worthwhile to have a separate entry since this issue continues to come up.

del.icio.us:Dojo - dojo.addOnLoad vs. body onload and window.onload digg:Dojo - dojo.addOnLoad vs. body onload and window.onload reddit:Dojo - dojo.addOnLoad vs. body onload and window.onload spurl:Dojo - dojo.addOnLoad vs. body onload and window.onload wists:Dojo - dojo.addOnLoad vs. body onload and window.onload simpy:Dojo - dojo.addOnLoad vs. body onload and window.onload newsvine:Dojo - dojo.addOnLoad vs. body onload and window.onload blinklist:Dojo - dojo.addOnLoad vs. body onload and window.onload furl:Dojo - dojo.addOnLoad vs. body onload and window.onload fark:Dojo - dojo.addOnLoad vs. body onload and window.onload blogmarks:Dojo - dojo.addOnLoad vs. body onload and window.onload Y!:Dojo - dojo.addOnLoad vs. body onload and window.onload smarking:Dojo - dojo.addOnLoad vs. body onload and window.onload magnolia:Dojo - dojo.addOnLoad vs. body onload and window.onload segnalo:Dojo - dojo.addOnLoad vs. body onload and window.onload

3 comments

typo icon

Adding a popular pages list to Typo using Mint

Posted in Thu, 13 Jul 2006 03:10:00 GMT

Geoffrey Grosenbach of Topfunky has a neat Typo plugin for Mint, a commerical PHP stats package, to display a popular articles list on his Nuby on Rails blog. It currently appears on his blog as the following (screen shot cut off at 5 results of 20):

nubyonrails popular pages screen shot

It works by using data from Mint's mint_visit table which can be populated by Mint or using an included script to import data from server logs logs. To address performance issues from reading the table, the plugin has the ability to create a mint_caches table using an included rake task:

rake mint:create_cache_table

The table can be populated by the following which can be run periodically via cron:

rake mint:rebuild

See the following for additional details:

I haven't tried this yet but it's on the list.

del.icio.us:Adding a popular pages list to Typo using Mint digg:Adding a popular pages list to Typo using Mint reddit:Adding a popular pages list to Typo using Mint spurl:Adding a popular pages list to Typo using Mint wists:Adding a popular pages list to Typo using Mint simpy:Adding a popular pages list to Typo using Mint newsvine:Adding a popular pages list to Typo using Mint blinklist:Adding a popular pages list to Typo using Mint furl:Adding a popular pages list to Typo using Mint fark:Adding a popular pages list to Typo using Mint blogmarks:Adding a popular pages list to Typo using Mint Y!:Adding a popular pages list to Typo using Mint smarking:Adding a popular pages list to Typo using Mint magnolia:Adding a popular pages list to Typo using Mint segnalo:Adding a popular pages list to Typo using Mint

no comments

typo iconscriptaculous icon

Scriptaculous article slider for Typo themes

Posted in , , , Wed, 12 Jul 2006 06:48:00 GMT

Several Typo themes have nice DHTML effects and I thought it would be useful to extract some of these for use in other themes. In particular I am interested in adding Modernist's DHTML Scriptaculous ScrollTo article slider to my modded Azure theme. You can see this in action at poocs.net which is currently running Modernist. This article covers the steps necessary to repurpose the DHTML article slider and involves templates, CSS and images. I've shown how Modernist does it and, where applicable, how I prefer to do it. It turns out to be pretty easy.

I've added this feature to my test system, however it's not here yet because I've decided to create a custom Dev411_Azure theme to handle the views (and controller/helper patches) for the growing number of mods I'm using rather than to continue manually hacking files under themes/azure and app. This should be here before long.

Read more...
del.icio.us:Scriptaculous article slider for Typo themes digg:Scriptaculous article slider for Typo themes reddit:Scriptaculous article slider for Typo themes spurl:Scriptaculous article slider for Typo themes wists:Scriptaculous article slider for Typo themes simpy:Scriptaculous article slider for Typo themes newsvine:Scriptaculous article slider for Typo themes blinklist:Scriptaculous article slider for Typo themes furl:Scriptaculous article slider for Typo themes fark:Scriptaculous article slider for Typo themes blogmarks:Scriptaculous article slider for Typo themes Y!:Scriptaculous article slider for Typo themes smarking:Scriptaculous article slider for Typo themes magnolia:Scriptaculous article slider for Typo themes segnalo:Scriptaculous article slider for Typo themes

2 comments

typo icon

Category icons for Typo

Posted in Sun, 09 Jul 2006 14:36:00 GMT

I decided to see how easy it was to add category icons to my Typo install and it turns out to be pretty easy. Only some categories have icons now. They are shown if they exist otherwise they are skipped. The category icon will also appear in the table of contents when the page is a category page. When I migrate to Typo 4.0 these will become tag icons. This is a quick hack for now and should be cleaned up a bit.

Step 1 is to add the icons to the articles. Right now I just code a list of categories I have icons for in the helper method below but I should either put the list in a config setting or make a model for it. The modified files are:

  • app/helpers/articles_helper.rb: add an article_icons method to generate the icons given an article.
  • app/views/articles/_article.rhtml: add call to the new article_icons helper method.
  • app/views/articles/read.rhtml: add call to the new article_icons helper method.

Step 2 is to add it to the TOC if you have one. If you don't have one yet, you can follow the directions here. The modified files are:

  • app/controllers/articles_controller.rb: set @category instance variable in the category action.
  • app/helpers/articles_helper.rb: add a category_icon method to generate the icon given an category.
  • app/views/articles/_articles_toc.rhtml: add call to new category_icon helper method and pass it the @category instance variable if it exists.

I also created a category sidebar that uses icons instead of text names but found that it's really only useful if all your categories/tags have icons. If a reasonable percentage don't, having a bunch of default icons kind of defeats the purpose.

I'll post some code once it's been migrated to Typo 4.0 and has been cleaned up a little. I'm still not sure what's the best way to package mods that require changes to controllers, helpers and templates. My current thoughts are patches for controllers / helpers and either patches for Azure or instructions on how to mod your own templates. Let me know what you think.

del.icio.us:Category icons for Typo digg:Category icons for Typo reddit:Category icons for Typo spurl:Category icons for Typo wists:Category icons for Typo simpy:Category icons for Typo newsvine:Category icons for Typo blinklist:Category icons for Typo furl:Category icons for Typo fark:Category icons for Typo blogmarks:Category icons for Typo Y!:Category icons for Typo smarking:Category icons for Typo magnolia:Category icons for Typo segnalo:Category icons for Typo

no comments

typo icon

Typo themes seen in the wild

Posted in Sun, 09 Jul 2006 13:57:00 GMT

Here are some Typo blogs I've run across with nice custom themes:

The Vivabit one reminds me a bit of the Django framework website but is nicer due to the curves.

If any of these happen to be FOSS templates, let me know. For Typo themes you can use on your own blog, see the Typo Themes Viewer and Tim Freund's Digital Achievement.

I'll continue to update this entry as I find more themes.

del.icio.us:Typo themes seen in the wild digg:Typo themes seen in the wild reddit:Typo themes seen in the wild spurl:Typo themes seen in the wild wists:Typo themes seen in the wild simpy:Typo themes seen in the wild newsvine:Typo themes seen in the wild blinklist:Typo themes seen in the wild furl:Typo themes seen in the wild fark:Typo themes seen in the wild blogmarks:Typo themes seen in the wild Y!:Typo themes seen in the wild smarking:Typo themes seen in the wild magnolia:Typo themes seen in the wild segnalo:Typo themes seen in the wild

no comments

hp iconlancearmstrong iconamd icon

The Lance Armstrong Notebook

Posted in , , , Sun, 09 Jul 2006 07:40:00 GMT

Lance Armstring and his notebook

I was recently in the market for a AMD 64 notebook because I wanted a portable system to do x86_64 linux testing. The HP Lance Armstrong L2000 series notebook was one that I came across. The technical features were fairly standard so it didn't stand out for me. From a marketing perspective however, each laptop is branded with the LIVESTRONG logo, has Lance's signature, comes with a yellow wrist band and provided a $50 donation to the Lance Armstrong Foundation. Certainly the yellow LIVESTRONG wrist bands were decent business (counterfeiters were convicted and fined $111,000 for selling fake wrist bands), but I wondered how many people would buy a notebook computer because of Lance Armstrong and the LIVESTRONG program

.

My question was answered in July's Business 2.0 magazine which says the Lance Armstrong notebook has sold over 40,000 units and is the best selling laptop at CompUSA for 2005Q3. Originally $50 was donated for each laptop sold but now it's been increased to $150 and the laptop has its own website. The laptop is now sold exclusively at CompUSA - I'm not sure if CompUSA had an exclusive before or if this after their great success. Additionally, HP has picked up 2 points in market share against Dell since the program started and AMD's market share has gone from 9% to 11% (of course a lot of AMD's rise is due to price-performance, not Lance's notebook; the HP vs. Dell numbers may also be due to Dell's reluctance to use AMD). Some good insight into the power of brands.

del.icio.us:The Lance Armstrong Notebook digg:The Lance Armstrong Notebook reddit:The Lance Armstrong Notebook spurl:The Lance Armstrong Notebook wists:The Lance Armstrong Notebook simpy:The Lance Armstrong Notebook newsvine:The Lance Armstrong Notebook blinklist:The Lance Armstrong Notebook furl:The Lance Armstrong Notebook fark:The Lance Armstrong Notebook blogmarks:The Lance Armstrong Notebook Y!:The Lance Armstrong Notebook smarking:The Lance Armstrong Notebook magnolia:The Lance Armstrong Notebook segnalo:The Lance Armstrong Notebook

no comments

catalyst icon

Catalyst 5.7000 released

Posted in Sun, 09 Jul 2006 02:36:00 GMT

A new major version of the Catalyst framework has just been released. Read about it on Digg; here are the latest results I've seen:

Catalyst 5.700 Digg status

It actually got to 91 diggs at the top of the Digg homepage before a new article came along (I took screen shots in KDE too but the layout wasn't as nice as XP). From Jezmo's Digg comment, I learned that SomethingAwful (6th largest forum on the Internet) is using Catalyst to build Titan, a schema-compatible vBulletin replacement. Catalyst is also used by Dresdner Bank, IUseThis and EditGrid.

Marcus has an announcement on his blog and the change log is available, but I'll summarize the changes here:

New Features
  • "ActionClass templates" which allow you to make extensible actions. The first of which is Catalyst::Action::RenderView, a more flexible replacement for the DefaultEnd plugin. Read more about this in Catalyst::Manual::Actions.
  • "Chained actions" which allow you to have parent and child actions on a uri. For example in a uri like /page/43/revision/23/edit you could have one action handle /page/43 and another handle revision/23/edit with captures for 43, 23 and edit.
Enhancements
  • Major documentation improvements including the Tutorial and Introduction parts of the Catalyst manual, reference API documentation and the Cookbook.
  • More concise log info and new colors for the debug screen.
  • Switch from Module::Pluggable::Fast to Module::Pluggable for more fine grain control over setup_components.
New Packaging
  • The Catalyst distribution has been split into Catalyst::Runtime and Catalyst::Devel. Runtime contains the minimal parts for deployment while Devel includes helpers and tools. Thankfully install Catalyst in CPAN will install Catalyst::Runtime and there's no need to change the use Catalyst; lines in your App Classes.
Upgrade Gotchas
  • Catalyst::Engine::Apache FIRSTKEY error: I just upgraded from Catalyst 5.6902 and Catalyst::Engine::Apache 1.06. I didn't have a problem running 5.6902 and 1.06 but others had the generic problem below and previously upgraded to 1.07. The problem only appeared with 5.7000 and 1.06 for me. In any event, make sure you're running Catalyst::Engine::Apache 1.07.

    [error] Caught exception in engine "Can't locate
      object method "FIRSTKEY" via package "APR::Table" at
      /path/to/site_perl/5.8.7/Catalyst/Engine/Apache.pm 
      line 65."
del.icio.us:Catalyst 5.7000 released digg:Catalyst 5.7000 released reddit:Catalyst 5.7000 released spurl:Catalyst 5.7000 released wists:Catalyst 5.7000 released simpy:Catalyst 5.7000 released newsvine:Catalyst 5.7000 released blinklist:Catalyst 5.7000 released furl:Catalyst 5.7000 released fark:Catalyst 5.7000 released blogmarks:Catalyst 5.7000 released Y!:Catalyst 5.7000 released smarking:Catalyst 5.7000 released magnolia:Catalyst 5.7000 released segnalo:Catalyst 5.7000 released

1 comment

ubuntu iconapple icon

Ubuntu - Winning with Microsoft's Strategy?

Posted in , , Thu, 06 Jul 2006 05:29:00 GMT

It's interesting to watch the evolution of Canonical Ubuntu. It started off by gaining popularity in the desktop space and now it's finally moving into the server space. Linux on the desktop has been a thorn in Linux's side for a while and Ubuntu seems to be the answer. Just recently a couple of people have moved from OS-X to Ubuntu causing quite a stir on Slashdot and Tim O'Reilly's blog. By winning the desktop, they win users that they can leverage to win the server space. If this strategy sounds familiar, it's the same one that Microsoft used to defeat Novell NetWare. Now that Ubuntu has entered Red Hat and SUSE's turf, it will be interesting to see if they respond with more user friendly desktop editions (I'd be happy for a Linux-version of Textmate). If so, the users will win.
del.icio.us:Ubuntu - Winning with Microsoft's Strategy? digg:Ubuntu - Winning with Microsoft's Strategy? reddit:Ubuntu - Winning with Microsoft's Strategy? spurl:Ubuntu - Winning with Microsoft's Strategy? wists:Ubuntu - Winning with Microsoft's Strategy? simpy:Ubuntu - Winning with Microsoft's Strategy? newsvine:Ubuntu - Winning with Microsoft's Strategy? blinklist:Ubuntu - Winning with Microsoft's Strategy? furl:Ubuntu - Winning with Microsoft's Strategy? fark:Ubuntu - Winning with Microsoft's Strategy? blogmarks:Ubuntu - Winning with Microsoft's Strategy? Y!:Ubuntu - Winning with Microsoft's Strategy? smarking:Ubuntu - Winning with Microsoft's Strategy? magnolia:Ubuntu - Winning with Microsoft's Strategy? segnalo:Ubuntu - Winning with Microsoft's Strategy?

6 comments

typo icon

Typo - Disabling link creation in comments

Posted in Wed, 05 Jul 2006 18:59:00 GMT

Typo will automatically turn something like http://www.dev411.com in a comment into a link, however this is undesirable when you're using a dummy uri such as http://your.domain.com. To get around this, I use the HTML symbol for 'h' in http so I type:

&#104;ttp://your.domain.com

This is just a one-off solution in that it requires some manual checking of whether the uri is a real one or not. I use it when posting on other people's Typo blogs. I suppose this can be automated by checking if the uri returns a valid response but that may be overkill.

BTW, here's a HTML symbol table for reference.

del.icio.us:Typo - Disabling link creation in comments digg:Typo - Disabling link creation in comments reddit:Typo - Disabling link creation in comments spurl:Typo - Disabling link creation in comments wists:Typo - Disabling link creation in comments simpy:Typo - Disabling link creation in comments newsvine:Typo - Disabling link creation in comments blinklist:Typo - Disabling link creation in comments furl:Typo - Disabling link creation in comments fark:Typo - Disabling link creation in comments blogmarks:Typo - Disabling link creation in comments Y!:Typo - Disabling link creation in comments smarking:Typo - Disabling link creation in comments magnolia:Typo - Disabling link creation in comments segnalo:Typo - Disabling link creation in comments

2 comments

blogger icontypo icon

Moving Day - Blogger to Typo

Posted in , , Mon, 03 Jul 2006 02:37:00 GMT

I've been experimenting with Typo at the new Dev411 blog primarily to get around the serious performance problems I (and many others) have experienced on Blogger. I know they are working on this and I hope they get it under control soon, however I didn't want to wait for something that may or may not happen so I've moved everything over to http://www.dev411.com/blog/. Typo has some nice features include categories/tags and Live Search which shows you search results as you type. Of course, I may switch back to Blogger (or to another engine) at some point but I'm hoping I won't have to change again.

I'm running 2.6.0 which is the current stable version according to the website though many people are running code directly from the SVN trunk. I'll probably wait for 4.0 before upgrading which I've heard should be coming out soon. In the mean time I've made some changes from the default configuration:

  • added table of contents to pages with multiple articles (index, category/tag, archives and search) described previously.
  • renamed categories to tags. The trunk supports both categories and tags but 2.6.0 only has categories. I simply renamed categories to tags by editing routes.rb and content.rhtml for the category plugin. When 4.0 comes out, I'll use the separate categories and tags and the tag uris will stay the same.
  • moved categories/tags from bottom of each post to top by editing articles_helper.rb and templates.
  • removed articles from uri by editing routes.rb.
  • added number of comments to Live Search AJAX results by editing views/live/search.rhtml.
  • added blog name to HTML title for individual article pages by editing articles_controller.rb.
  • added Blog Roll sidebar which is just a copy of the static sidebar plugin. It would be nice if you could use the same static plugin multiple times but copy/rename is easy enough.

Features I'd like to add:

  • Navigation breadcrumbs
  • More specific HTML page titles
  • The anchor slider from the Modernist theme
  • A logarithmic tag cloud; the trunk version is linear
  • Ability to categorize tags similar to del.icio.us tag bundles; this is supposed to be doable now with acts_as_taggable
  • A tag list that also has links to tags you use at del.icio.us and possibly other places
del.icio.us:Moving Day - Blogger to Typo digg:Moving Day - Blogger to Typo reddit:Moving Day - Blogger to Typo spurl:Moving Day - Blogger to Typo wists:Moving Day - Blogger to Typo simpy:Moving Day - Blogger to Typo newsvine:Moving Day - Blogger to Typo blinklist:Moving Day - Blogger to Typo furl:Moving Day - Blogger to Typo fark:Moving Day - Blogger to Typo blogmarks:Moving Day - Blogger to Typo Y!:Moving Day - Blogger to Typo smarking:Moving Day - Blogger to Typo magnolia:Moving Day - Blogger to Typo segnalo:Moving Day - Blogger to Typo

1 comment

Older posts: 1 ... 4 5 6 7 8 9