Spaces, not Tabs

The holy war about spaces or tabs continues and you can see all sorts of arguments for each side raging around the internet.

I prefer spaces because it’s a consistent format that remains the same no matter what you are using.  With tabs things appear differently depending on how your editor or other program is configured.  Plus the worst thing is when spaces and tabs get intermixed.

Arguments for tabs such as they take up less room or it’s easier to move around are in my mind weak.  In this day of terabyte disk drives, file size differences between tabs and spaces are trivial and most of your disk space is taken up by images and binary files anyway.  And being able to move around and format quickly is not an issue either with modern editors.

The two editors I use most are XEmacs and Eclipse.  Below I describe how to use spaces for indents for each program.

In Emacs:

(setq-default indent-tabs-mode nil)  ; Use spaces for indents except
                                     ; in buffers that already have
                                     ; their own local values for the
                                     ; variable.

In Eclipse:

Google App Engine

Recently I learned about Google’s App Engine and I must admit I am extremely impressed.  I am already have heard of at least two start ups that are deploying on it.

What it promises in terms of scalability and the amount it gives for free in terms of storage and bandwidth is impressive.  It is too bad it has not announced yet the terms when you begin to go over these limits.

I watched this tutorial on developing and deploying an application on Google App Engine.

My initial impressions were:

  • Python, hmmm…
  • Django, interesting…
  • this is not nearly as easy as Ruby on Rails

Still once has to believe this is going to help Python and its web framework, Django, in terms of momentum.

Mysterious dspel:include problem with flush=true

When I use dspel:include within a custom tag like below things work fine.

<betweengo:link href="/click.do?id=foo"><dspel:include
page="/include/bar.jsp"/></betweengo:link>

However when I add flush=”true” it fails silently.

<betweengo:link href="/click.do?id=foo"><dspel:include
page="/include/bar.jsp" flush="true"/></betweengo:link>

The JSP page no longer renders after it gets to this line of code.  What puzzles me even more is that the documentation says that if you do not explicitly set flush, flush happens automatically.  Therefore theoretically adding flush=”true” should not have an effect though I do it because the documentation recommends doing it.

The above code is happening within a TargetingForEach droplet.  It is running on an ATG 2006.3 Patch 2 app server with JBoss 4.0.4.GA.

I contacted ATG support about this issue and they responded very quickly.  Basically they said don’t use flush=”true” on third party application servers and just rely on the automatic flush.

Entered on 07/29/2008 at 13:12:19 by Nicholas Glover:
Hi Frank,

You should note that JBoss 4.0.4 GA is not supported with any version of ATG and you should not be using it. Please stick with JBoss 4.0.3 SP1.

Also, it is imperative that you upgrade from your ATG version to the latest 2006.3 patch, patch 6. The latest patch has many bugfixes include a fix for one relating to flushing behavior, PR #134387.

Due to various bugs and issues encountered, use of the “flush” attribute with a 3rd party app server, is not really recommended. We are removing all docs for this feature in later versions of our documentation. In this case, flush=true is forcing an explicit flush on the current page; but if this is not set, a more “intelligent” auto flush is done that flushes top-level pages first and then progresses down the tree. This prevents problems with 3rd party app servers such as content getting rendered out of order. I recommend not messing with the “flush” setting.

Is there something you are trying to do that is not working that leads you to want to use the “flush” attribute?

Thanks.


Nick Glover
ATG Support

Entered on 07/29/2008 at 15:02:57 by Nicholas Glover:
Hi Frank,

I had already entered the documentation bug about this previously, but I polished and published it for our site with what I learned when looking into this for a prior customer and when looking into it for you.

It is PR #146637. Here’s the link:
http://www.atg.com/esupport/bugs/index.jsp?FullViewBug=ViewBug&bugId=146637

I’ll close this case now.

Thanks.


Nick Glover
ATG Support

Twitter and Rails

Twitter has become the poster child of why not to use Ruby on Rails.  Recently a friend of mine started a company and when I noticed he used PHP I asked why he didn’t use Rails.  He responded “Twitter uses Rails and they keep going down.  Facebook uses PHP.  We’ll use PHP.”

There is an interesting interview w/ Twitter developer Alex Payne about the issues Twitter has had with Ruby on Rails.

The common wisdom in the Rails community at this time is that scaling Rails is a matter of cost: just throw more CPUs at it. The problem is that more instances of Rails (running as part of a Mongrel cluster, in our case) means more requests to your database. At this point in time there’s no facility in Rails to talk to more than one database at a time. The solutions to this are caching the hell out of everything and setting up multiple read-only slave databases..

All the convenience methods and syntactical sugar that makes Rails such a pleasure for coders ends up being absolutely punishing, performance-wise. Once you hit a certain threshold of
traffic, either you need to strip out all the costly neat stuff that Rails does for you (RJS, ActiveRecord, ActiveSupport, etc.) or move the slow parts of your application out of Rails, or both.

It’s also worth mentioning that there shouldn’t be doubt in anybody’s mind at this point that Ruby itself is slow. It’s great that people are hard at work on faster implementations of the language, but right now, it’s tough. If you’re looking to deploy a big web application and you’re language-agnostic, realize that the same operation in Ruby will take less time in Python. All of us working on Twitter are big Ruby fans, but I think it’s worth being frank that this isn’t one of those relativistic language issues. Ruby is slow.

In April 2007, former Chief Architect Blaine Cook made a presentation called Scaling Twitter.  It’s a well done presentation, even if everything is black.

In May 2008 there were rumors that Twitter was abandoning Rails.  SitePoints believes it is not a framework issue but rather an architectural issue that is causing Twitter’s problems.

There are many large sites that run Rails well and many smaller ones that do not.  It seems like another case of the “leaky abstraction” where we have such a nice framework that we think we can abstract away issues like scaling but in the end when the site becomes big enough we have to look under the covers.

Ruby has been documented to have I/O issues and general performance issues.  Like PHP before it looks like Ruby needs to mature more and deal better with scaling and I/O issues.  I am confident though this will happen because of the tremendous momentum of Ruby on Rails.  However I am keeping on eye on Django, especially now that Google has thrown its large hat into Django’s ring.

Fixing IllegalArgumentException in ACC

Recently I was unable to create an item using the ACC because of an IllegalArgumentException.

java.lang.IllegalArgumentException:  Attempt to set
property named view (ContentList:800007)  with value =
moduleTemplate:2200004 (class=class atg.adapter.gsa.GSAItem).
This property  failed due to a property type specific test.
Enable loggingDebug for  details.

It turned out to be a simple issue of the wrong case. The repository path for the ContentList view item was:

/Betweengo/repository/Portal

when it should have been

/betweengo/repository/Portal.

This is certainly not obvious from the exception.

TargetingRange ignoring start param

We were using the TargetingRange droplet to display a number of slides, starting with the 2nd slide.  We would never show more than 9 slides so we set howMany to 9.

What we found was that the TargetingRange droplet was always returning all the slides, including the first slide, no matter what we set for start.

Fortunately ATG support identified this problem as Bug #84551.  If the howMany param > number of targets returned then it ignores the start position parameter.

The work around is to make sure to set the howMany parameter to the number of items you expect.

Maintaining your Mac

Macworld has a series of articles that I found helpful on maintaining your mac.

  1. Essential Mac Maintenance: Get set up

    Perhaps the most important component to test is RAM…  Thankfully, it’s not difficult to do so, although a comprehensive test can take a while. Apple Hardware Test, included on the Mac OS X Install disc that comes with all recent Macs, has an Extended Testing option that tests your RAM.

  2. Essential Mac Maintenance: Rev Up Your Routines
  3. Five Maintenance Myths

    Myth #2: “You need to run the Unix maintenance scripts.”
    You may have heard about a collection of magical Unix maintenance scripts that OS X is supposed to run automatically. The story goes that because these scripts are scheduled to run in the middle of the night, putting your Mac to sleep or shutting it down prevents them from running—so you need to do so manually…

    An easy way to run the scripts manually is by using Mike Vande Ven Jr.’s free Maintidget 1.3, a Dashboard widget that shows you the last time each script was run and lets you manually run one or all with a single click. There are also innumerable tweaking utilities that provide similar functionality

Eclipse Ganymede

I was about to write a post about how much I was starting to dislike Eclipse. Two years ago I was singing the praises of Eclipse but Eclipse Europa (version 3.3) in my opinion has been a disaster. It is incredibly slow, crashes often, runs out of memory, etc. I found myself at times using XEmacs instead because it was faster.

But today I installed Eclipse Ganymede (version 3.4) and so far life has been much better.  It is much more responsive, it is not crashing, things are running smoothly.   You can read about what is New and Noteworthy in Ganymede.  The most exciting new feature to me is the Retain case of match when replacing, just like XEmacs.

Also I noticed that in my JBoss project, hot swapping of code is again working.  I am not sure if this is because I upgraded to Ganymede or because I turned on “Build Automatically”.  I suspect it might be the latter.