Blogs

Grails vs Rails vs Django -- Grails wins?

The web is built on three layers:

  1. Programming Languages (PHP, Java, Ruby, Python)
  2. Web Frameworks (Cake PHP, Grails, Ruby on Rails, Django)
  3. Content Management Systems(Drupal, Alfresco, Radiant CMS, Django-CMS)

Each layer has its time and place.  Let's start with #1.  Used to be that every site was built on JSP, ASP, and PHP.  Now with web frameworks and CMS, using this layer to build a site is simply reinventing the wheel.  As a result, this layer has been relegated to (1) non-web people trying to get started via a For Dummies book (aka, don't do it!), and (2) to-the-metal, scalability-intensive sites like Google and Yahoo, built on C or Java for per-line performance tweaking.

On the other side we have Content Management Systems.  CMSs shine for sites that are common-place -- blogs, photo-galleries, shopping carts, google maps, etc.  The reason for this is that a CMS is only as good as its extensibility framework, and the more common a feature the more likely a plugin has been built for the CMS.  A CMS will get you an out-of-the-box, feature-rich, functional website in hours.  99% of websites should be built using a CMS, because its only 1% of the time you get something completely brand new -- like Yelp or Twitter in their time.  When you do need something completely fresh, a CMS is limiting because of the restrictions its framework imposes.  You end up using a lot of code, time, and xdebug to tweak a one-liner.

Tomcat 6 on Dreamhost

A short while ago, it was impossible to run Tomcat on Dreamhost PS. It was a bummer, since I needed to deploy my FillPDF servlet (which uses Grails and iText) and I would have preferred to use my favorite hosting service. (A note to people trying every which way to deploy iText on Dreamhost -- don't bother with RJB or PHP/Java bridge on the shared plans -- it just doesn't work).

Need to test your mobile Web site?

Here's a pretty good Web site to test your site in for mobile development. The application emulates different cell phone browsers and allows you to view how it would look. It will also test your site to see how mobile ready your site is.

The site is called mobiReady

Determine if current page is a panel (Drupal themes)

Snippet that adds "panels" to the body classes of a page if the currently-viewed page is a panel:

function zen_preprocess_page(&$vars, $hook) {
  $vars['body_classes_array'][] = (module_exists('page_manager') && (page_manager_get_current_page())) ? 'panels' : ''; // Page is Panels page
//  $vars['sample_variable'] = t('Lorem ipsum.');
}

svn checkout: "No such file or directory" on Mac OSX

On svn update/checkout, I was getting the following error:
svn: In directory 'goingon6/drupal/sites/all/modules/contrib/ctools/ctools_plugin_example/help'
svn: Can't open file 'goingon6/drupal/sites/all/modules/contrib/ctools/ctools_plugin_example/help/.svn/tmp/text-base/Chaos-Tools--Ctools--Plugin-Examples.html.svn-base': No such file or directory

Show "Book Navigation" block only on Book pages

Quickie: Only show Drupal's "Book Navigation" block on Book pages:

1) Go to admin/build/block/configure/book/0
2) "Page specific visibility settings" -> "Show if the following PHP code returns TRUE (PHP-mode, experts only)."
3) Insert the following:

<?php
$is_book
=db_result(db_query('select 1 from {book} where nid=%d',arg(1)));
return
$is_book;
?>

Misc Drush commands

I've finally gotten around to using Drush (mostly because I got a Mac -- Drush+Cygwin made me procrastinate). There are a few day-to-day tasks I perform that aren't in Drush core, but which are easy to add to Drush via .drush.inc files. I'll upload my ocdevel.drush.inc file here and update this blog post any time I add new commands (see the "Commands" section of Drush's README for how to install this file for your own sites).

Views 1 API - Adding Relationships in PHP

Views 2 has a great feature called Relationships, allowing your view to aggregate fields from various content types which are related some how. For example, say you have a Person content type and a Dependent content type. Within your view, you might want the Person's first/last name, age, etc.. as well as that person's Dependent's first name. With Views 2, you connect these content types in a view via Relationships and all is dandy. In Views 1 (Drupal 5) however, this is impossible without custom code.

Views Bulk Operations & Actions (plus configurable secondary page) in Drupal 5

Here's a quick example of writing an Action (5.x-2.x, which is a backport of 6.x's API style) for Views Bulk Operations. It allows you to assign selected users from a view (Usernode) and assign them to selected Organic Groups from a secondary page.


<?php
/**
* Implementation of hook_action_info().
*/
function go_views_bulk_ops_action_info() {
return array(
'go_views_bulk_ops_action' => array(

Getting started in the web business

This is a recent email correspondence I think some newbies might find useful:

Hi, I just recently decided I wanted to try and get into web development and I discovered and listened to your podcast. It was wonderful and I was disappointed to discover that it appears to be discontinued. Do you plan on picking up where you left off? Also, would you recommend any good podcasts that start from the ground up? I really like the linux reality one you recommended so far.

I read online about colleges/universities that offer certification programs in different areas of web development; do employers hire these people? Or is it a waste of time and better to get a 4 year degree? Mostly I just want to learn for my own growth, but maybe someday in the future I would like to make a career of this.

Syndicate content