
On this page
Posted in postgresql, catalyst, activerecord, perl, mysql, typo, php
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.
6 comments
Posted in typo, rails
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...
no comments
Posted in scalability, typo, javascript, dhtml, datetime
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...
2 comments
Posted in typo, hacks
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...
6 comments
Posted in typo
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...
3 comments
Posted in blogger, typo
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...
3 comments
Posted in typo
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...
4 comments
Posted in security, typo, rails
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...
no comments
Posted in typo
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:- http://www.dev411.com/blog/xml/feed/feed.xml?type=feed&format=atom
- http://www.dev411.com/blog/xml/feed/feed.xml?type=feed&format=rss20
For comparison, the 2.6.0 style is:- http://www.dev411.com/blog/xml/rss/feed.xml
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 -%>
to
<% for category in @categories.sort {|a,b| a.name <=> b.name} -%>
- config no longer used in ArticlesController: If you used config, the code needs to be changed like this example:
config[:blog_name]
to
this_blog.blog_name
2 comments
Posted in typo, rails
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 0.3.13.4 pre-release.
2 comments