postgresql iconcatalyst iconperl iconmysql icontypo iconphp icon

Database Abstraction - code vs infrastructure

Posted in , , , , , , Wed, 05 Sep 2007 04:38:00 GMT

I've worked on a number of database-driven projects and no matter how much people want database abstraction, it was always difficult to code and maintain. I was recently reminded of this when I read this Drupal article on dropping PostgreSQL support. Not only can it be difficult to maintain support for multiple databases, but it may be difficult to find developers.

One solution of modern programming is to move database abstraction from the code to the infrastructure using a ORM (Object-Relational Mapper) or Data Mapper. A ORM and Data Mapper abstracts the database for you so you no longer have to do tie db abstraction to each app. Not only does it let you code once for multiple databases it lets your users migrate their data from one database to another. This blog runs Typo which is based on Ruby on Rails and ActiveRecord. I've been contemplating migrating Typo from MySQL to PostgreSQL and I've been told that it would be as simple as exporting the data with YAML, updating the database.yml file and importing the data. I haven't gotten around to doing it yet but it is a powerful idea. ActiveRecord is a data mapper and isn't as flexible as a full blown ORM but it gets the job done for the most part. For a full-blown ORM, I think of Perl's DBIx::Class which provides a full OO interface to the RDBMS allowing you to code just once for multiple DBs without limiting you when you want to use some esoteric database-specific SQL. DBIx::Class is often used with the Catalyst Framework but is also used by itself.

There are PHP frameworks out there like Symfony and Cake but do any of them have stand-alone ORMs? If so, could Drupal move to something like that and solve their maintainership problems once and for all? Drupal is part of the Go PHP5 effort so there should be no issue using PHP 5 OO. Something to think about for the Drupal folks if a PHP ORM is available. Abstraction - code vs infrastructure digg:Database Abstraction - code vs infrastructure reddit:Database Abstraction - code vs infrastructure spurl:Database Abstraction - code vs infrastructure wists:Database Abstraction - code vs infrastructure simpy:Database Abstraction - code vs infrastructure newsvine:Database Abstraction - code vs infrastructure blinklist:Database Abstraction - code vs infrastructure furl:Database Abstraction - code vs infrastructure fark:Database Abstraction - code vs infrastructure blogmarks:Database Abstraction - code vs infrastructure Y!:Database Abstraction - code vs infrastructure smarking:Database Abstraction - code vs infrastructure magnolia:Database Abstraction - code vs infrastructure segnalo:Database Abstraction - code vs infrastructure


typo iconrails icon

Typo - Upgrading to 4.1.1

Posted in , Sat, 16 Jun 2007 22:36:00 GMT

I finally got around to upgrading from Typo 4.0.0 r1188 to Typo 4.1.1 and it was pretty smooth. I had held off for a while because Typo was changing a lot under the covers with some much needed refactoring and I have a few hacks I didn't feel like modifying with every minor update.

Read more... - Upgrading to 4.1.1 digg:Typo - Upgrading to 4.1.1 reddit:Typo - Upgrading to 4.1.1 spurl:Typo - Upgrading to 4.1.1 wists:Typo - Upgrading to 4.1.1 simpy:Typo - Upgrading to 4.1.1 newsvine:Typo - Upgrading to 4.1.1 blinklist:Typo - Upgrading to 4.1.1 furl:Typo - Upgrading to 4.1.1 fark:Typo - Upgrading to 4.1.1 blogmarks:Typo - Upgrading to 4.1.1 Y!:Typo - Upgrading to 4.1.1 smarking:Typo - Upgrading to 4.1.1 magnolia:Typo - Upgrading to 4.1.1 segnalo:Typo - Upgrading to 4.1.1

no comments

typo icon

Displaying Dates and Times Using JavaScript

Posted in , , , , Tue, 06 Feb 2007 00:28:00 GMT

Some considerations when displaying dates and times on a website include showing delta times, customized timezones and caching. Often it's nice to show a delta time like "10 minutes ago" or "5 days ago" to give readers a frame of reference instead of an absolute date. When the date is far enough in the past and an absolute date becomes desired, customizing the date to the user's timezone is useful. And if your site grows large enough that caching becomes useful, finding a way to display customized deltas and timezone information in a cacheable static page becomes an ideal solution.

Read more... Dates and Times Using JavaScript digg:Displaying Dates and Times Using JavaScript reddit:Displaying Dates and Times Using JavaScript spurl:Displaying Dates and Times Using JavaScript wists:Displaying Dates and Times Using JavaScript simpy:Displaying Dates and Times Using JavaScript newsvine:Displaying Dates and Times Using JavaScript blinklist:Displaying Dates and Times Using JavaScript furl:Displaying Dates and Times Using JavaScript fark:Displaying Dates and Times Using JavaScript blogmarks:Displaying Dates and Times Using JavaScript Y!:Displaying Dates and Times Using JavaScript smarking:Displaying Dates and Times Using JavaScript magnolia:Displaying Dates and Times Using JavaScript segnalo:Displaying Dates and Times Using JavaScript


typo icon

Notable social bookmarking/networking for Typo

Posted in , Sat, 02 Sep 2006 17:20:00 GMT

Benjamin Gorlick asked for WP-Notable-style social bookmarking/networking links on the #typo IRC channel so I put one together in the form of a single view (template file). WP-Notable, by Cal Evans, displays a row of icons with links to social bookmarking/networking sites under your blog article allowing for easy posting tovarious social bookmarking sites.

Read more... social bookmarking/networking for Typo digg:Notable social bookmarking/networking for Typo reddit:Notable social bookmarking/networking for Typo spurl:Notable social bookmarking/networking for Typo wists:Notable social bookmarking/networking for Typo simpy:Notable social bookmarking/networking for Typo newsvine:Notable social bookmarking/networking for Typo blinklist:Notable social bookmarking/networking for Typo furl:Notable social bookmarking/networking for Typo fark:Notable social bookmarking/networking for Typo blogmarks:Notable social bookmarking/networking for Typo Y!:Notable social bookmarking/networking for Typo smarking:Notable social bookmarking/networking for Typo magnolia:Notable social bookmarking/networking for Typo segnalo:Notable social bookmarking/networking for Typo


typo icon

Typo - License for TypoGarden Themes

Posted in Sun, 27 Aug 2006 01:48:00 GMT

There has been some confusion about the license that covers the themes submitted to the 2005 TypoGarden Theme Contest. Many themes do not mention a specific license and the contest page simply says:

All themes submitted will be made available for download. Don’t submit it unless you want it to be used by tens of thousands of Typo users.

Geoffrey Grosenbach, of TypoGarden, mentioned on the #typo IRC channel that all the themes submitted are under the MIT License. This makes sense since Typo itself is under the MIT License.

Read more... - License for TypoGarden Themes digg:Typo - License for TypoGarden Themes reddit:Typo - License for TypoGarden Themes spurl:Typo - License for TypoGarden Themes wists:Typo - License for TypoGarden Themes simpy:Typo - License for TypoGarden Themes newsvine:Typo - License for TypoGarden Themes blinklist:Typo - License for TypoGarden Themes furl:Typo - License for TypoGarden Themes fark:Typo - License for TypoGarden Themes blogmarks:Typo - License for TypoGarden Themes Y!:Typo - License for TypoGarden Themes smarking:Typo - License for TypoGarden Themes magnolia:Typo - License for TypoGarden Themes segnalo:Typo - License for TypoGarden Themes


blogger icontypo icon

Categories vs. Tags

Posted in , Wed, 16 Aug 2006 06:18:00 GMT

Today, Google announced the next version of Blogger, Blogger Beta. As part of this upgrade, Blogger will finally get categorization. Like Gmail, Blogger will only give you 'labels' which other blog engines such as Typo and MovableType give you both categories and tags. When both categories and tags are available, there's often a question as how to use them, either together or one or the other. This can be seen in some blogs where there doesn't seem to be rhyme or reason to what is a category and what is a tag. For Typo, this is somewhat complicated by that fact that tags came along after categories, so some blogs used them for the same thing but never got rid of the old categories after switching to tags so there appears to be some overlap.

Read more... vs. Tags digg:Categories vs. Tags reddit:Categories vs. Tags spurl:Categories vs. Tags wists:Categories vs. Tags simpy:Categories vs. Tags newsvine:Categories vs. Tags blinklist:Categories vs. Tags furl:Categories vs. Tags fark:Categories vs. Tags blogmarks:Categories vs. Tags Y!:Categories vs. Tags smarking:Categories vs. Tags magnolia:Categories vs. Tags segnalo:Categories vs. Tags


typo icon

MediaWiki and Typo - Pros and Cons for Personal Use

Posted in Fri, 11 Aug 2006 18:37:00 GMT

Now that this site runs both MediaWiki and Typo, I need to decide what to post where. Unfortunately I want to continue running both because they each have their advantages but ideally I could just run one, at least externally facing. These are some of the features I like of both MediaWiki and Typo which makes it hard to choose one over the other for all my posts. As a disclaimer, this is a personal wiki so I won't be discussing multiple users. The below lists the pros for each, If it's listed it means the other one doesn't have it ;)

Read more... and Typo - Pros and Cons for Personal Use digg:MediaWiki and Typo - Pros and Cons for Personal Use reddit:MediaWiki and Typo - Pros and Cons for Personal Use spurl:MediaWiki and Typo - Pros and Cons for Personal Use wists:MediaWiki and Typo - Pros and Cons for Personal Use simpy:MediaWiki and Typo - Pros and Cons for Personal Use newsvine:MediaWiki and Typo - Pros and Cons for Personal Use blinklist:MediaWiki and Typo - Pros and Cons for Personal Use furl:MediaWiki and Typo - Pros and Cons for Personal Use fark:MediaWiki and Typo - Pros and Cons for Personal Use blogmarks:MediaWiki and Typo - Pros and Cons for Personal Use Y!:MediaWiki and Typo - Pros and Cons for Personal Use smarking:MediaWiki and Typo - Pros and Cons for Personal Use magnolia:MediaWiki and Typo - Pros and Cons for Personal Use segnalo:MediaWiki and Typo - Pros and Cons for Personal Use


typo iconrails icon

Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6

Posted in , , Thu, 10 Aug 2006 06:14:00 GMT

It was recently announced that Rails 1.1.0, 1.1.1, 1.1.2, and 1.1.4. have a very serious security hole. Although the RoR blog hasn't discussed exactly what the hole is, it has been rumored to involve uploading of .rb files to execute arbitrary code on the server (UPDATE: now confirmed). Typo only allows file uploads by administrators so certain applications may be somewhat safer. (UPDATE: Running arbitrary code was fixed in 1.1.5 however you could still crash it. 1.1.6 has been released to fix these lingering bugs. Just change 1.1.5 to 1.1.6 below).

Read more... Typo 4.0.0 to Rails 1.1.5/1.1.6 digg:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 reddit:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 spurl:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 wists:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 simpy:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 newsvine:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 blinklist:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 furl:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 fark:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 blogmarks:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 Y!:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 smarking:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 magnolia:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6 segnalo:Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6

no comments

typo icon

Typo Upgrade: 2.6.0 to 4.0.0 r1188

Posted in Wed, 02 Aug 2006 23:32:00 GMT

I finally got around to upgrading Typo here to the latest trunk. At first I was waiting to upgrade to 4.0.0 (officially r1161) but decided to move to SVN after hearing about some post-r1161 bugfixes and it seems like a fairly common practice to run off SVN, at least for Typo. I've hacked a few changes onto 2.6.0 and had to manually merge the mods to r1181. Merging one's own mods to the trunk was discussed today on the Typo mailing list under the heading "Version Controling Modifications" and most of the respondents have their own mods and use Chia-Liang Kao's SVK to keep their mods synced with the trunk. Scott Laird has a number of articles on using SVK with Typo's repo. Seems like running off of the trunk with SVK may be a best practice for Typo installations.

Hopefully I'll be on SVK for my next upgrade since I had to manually update the following files this time around:

  • app/controllers/articles_controller.rb
  • app/helpers/application_helper.rb
  • app/helpers/articles_helper.rb
  • app/views/articles/_article.rhtml
  • app/views/articles/_articles_toc.rhtml
  • app/views/articles/index.rhtml
  • app/views/articles/read.rhtml
  • components/plugins/sidebars/category/content.rhtml
  • components/plugins/sidebars/xml/content.rhtml
  • config/routes.rb
  • themes/azure/layouts/default.rhtml

I've moved all my Azure theme changes to a custom theme so the changes are easier to keep track of and don't interfere with the base Azure theme.

I've updated my Installing Typo article to cover SVN checkout, Feedburner customization and rake migrate. The Typo TOC How-to has also been updated for 4.0.0.

While code diving, I was happy to see lots of refactoring though the code is still pretty easy to follow and modify. Hopefully soon I'll be back to hacking more enhancements. I'm particularly interested in extending the sidebar functionality so groups of plugins can be positioned in multiple locations on the page, e.g. a 3-col layout.

Upgrade Gotchas

  • UPDATE: this section on Feed URIs seems to be inaccurate because I chose to use my old 2.6.0 routes.rb file. I didn't think the feed URIs would change. New approach: don't assume anything has stayed the same and move to svk.
    Feed URIs: Typo 4.0.0 changes the feed URIs from 2.6.0 so if you have these URIs registered somewhere, e.g. Feedburner or LiveJournal, you'll need to upgrade your URIs. The new URI styles are:
    For comparison, the 2.6.0 style is:
    Everytime this URI changes I need to file a support ticket at LiveJournal whereas on Feedburner I can change the URI myself. I've been wondering if I should just have LiveJournal use the Feedburner URI ;)
  • Categories sidebar no longer alphabetized: My categories list was no longer alphabetized so I edited the components/plugins/sidebars/category/content.rhtml page from:
    <% for category in @categories -%>
    <% for category in @categories.sort {|a,b| <=>} -%>
  • config no longer used in ArticlesController: If you used config, the code needs to be changed like this example:
    this_blog.blog_name Upgrade: 2.6.0 to 4.0.0 r1188 digg:Typo Upgrade: 2.6.0 to 4.0.0 r1188 reddit:Typo Upgrade: 2.6.0 to 4.0.0 r1188 spurl:Typo Upgrade: 2.6.0 to 4.0.0 r1188 wists:Typo Upgrade: 2.6.0 to 4.0.0 r1188 simpy:Typo Upgrade: 2.6.0 to 4.0.0 r1188 newsvine:Typo Upgrade: 2.6.0 to 4.0.0 r1188 blinklist:Typo Upgrade: 2.6.0 to 4.0.0 r1188 furl:Typo Upgrade: 2.6.0 to 4.0.0 r1188 fark:Typo Upgrade: 2.6.0 to 4.0.0 r1188 blogmarks:Typo Upgrade: 2.6.0 to 4.0.0 r1188 Y!:Typo Upgrade: 2.6.0 to 4.0.0 r1188 smarking:Typo Upgrade: 2.6.0 to 4.0.0 r1188 magnolia:Typo Upgrade: 2.6.0 to 4.0.0 r1188 segnalo:Typo Upgrade: 2.6.0 to 4.0.0 r1188


typo iconrails icon

Mongrel and non-root URIs

Posted in , Sun, 23 Jul 2006 17:59:00 GMT

Two weeks ago, Scott Laird posted a Mongrel patch to the Typo list to make it work with non-root URIs. I'm particularly interested in this because Mongrel is getting more mindshare and my blog uses a non-root URI. The patch has been submitted to Zed Shaw for inclusion but, until it's in, here are some links since I don't think this is easy to find:

UPDATE: This is now included in Mongrel pre-release. and non-root URIs digg:Mongrel and non-root URIs reddit:Mongrel and non-root URIs spurl:Mongrel and non-root URIs wists:Mongrel and non-root URIs simpy:Mongrel and non-root URIs newsvine:Mongrel and non-root URIs blinklist:Mongrel and non-root URIs furl:Mongrel and non-root URIs fark:Mongrel and non-root URIs blogmarks:Mongrel and non-root URIs Y!:Mongrel and non-root URIs smarking:Mongrel and non-root URIs magnolia:Mongrel and non-root URIs segnalo:Mongrel and non-root URIs


Older posts: 1 2 3