RSS ? Recent Blog Posts

Blogs » Archive for October, 2007

Preparing for Rails 2.0

by Myles Eftos

Anyone that has used Rails 1.2.3, 1.2.4 or 1.2.5 may have noticed a number of deprecation notices in their development logs. Whilst these deprecated methods still work as expected in 1.2.x versions, you will come-a-cropper when you try to upgrade to Rails 2.0. So what do you need to do and what tools are out there to help you with the move? Glad you asked.

The first thing you can do it run your code through a code checker — Geoffrey Grosenbach has released a great rake task which digs through your code looking for the old methods. It will give you hints of how to fix the issues, but lets look at them a little more closely.

@params, @session, @flash, @env

As of Rails 2.0, you won’t be able to directly access the above instance variables. They have been replaced with methods, which makes customising their actions much easier. It also allows the internals of Rails to change without breaking the API. This is very easy to fix - just remove the @ in front of those variables - they will work exactly the same.

find_all, find_first, render_partial

In earlier version of Rails there were a number of grouped methods, that do very similar …

 

Events Past and Future: Adobe Max North America and CFCAMP Australia

by Kay Smoljak

Most ColdFusion programmers have heard of Ben Forta -the leading CF “guru” since the Allaire days. The author of no less than six editions of the definitive “ColdFusion Web Application Programming Kit” books, affectionately known as CFWACK or “the bible” around many a CF shop’s office, Ben travels the world as Adobe’s Senior Technical Evangelist speaking and writing about ColdFusion. Having just got back from the Adobe MAX Europe conference (held in Spain), he’s next headed to Adobe Max Japan, then to Australia for a series of events on ColdFusion 8, Flex and AIR in late November. Called CFCAMP, the Australian events will be part formal presentation and part unconference, barcamp-style, so if you’re down under they should be worth getting along to - registration is now open.

Before Europe, MAX kicked off in Chicago at the end of October. Kai Koenig, New Zealand-based developer, blogger, trainer and director of Ventego Creative, was there and was kind enough to answer some of my questions about the event.

Kay: Attending Adobe MAX 2007 must have been pretty exciting. Have you been to MAX in previous years, and if so was it any different under the Adobe banner?

Kai: Yes, the first major (at that …

 

Design Great Billboards

by Matthew Magain

A billboard displaying the ambiguous phrase, Arrester Bed
We can learn a lot about designing usable web sites from the offline world.

For instance, when I was in Adelaide a couple of weeks ago visiting family, I took a drive around the Adelaide Hills. Cruising along the freeway at 120 kms/hr, I passed the sign in the picture on the right. The first thing that popped into my head was “What the heck does that mean?”

I’m not sure what it’s like in your part of the world, but when I was last living in Adelaide, South Australia, the term arrester bed definitely wasn’t common language.

(I was half expecting to see an intimidating king-size mattress in full police uniform step out from the bushes and order me to pull over.)

The second thing that popped into my head — and this is possibly an indication that I spend far too much time online — was this:

“Imagine if something similarly obscure was used to describe a tab on a web site. No-one would know what the text linked to!”

Steve Krug wrote about this very concept — that we should think of our users as driving by in a car, and …

 

Adobe CS3 and the Case of the Disappearing Thumbnails - The Sequel

by Alex Walker

So, it’s been almost two years since we first published a little a piece on getting your thumbnails to work again in Adobe Creative Suite 2. The exec summary: Adobe disabled many of thumbnails that used to display in Explorer, presumably to ‘motivate’ CS3 users to use Bridge. After some teeth gritting and a little research, we figured out a workaround and published it there.

Two years later, it’s been one of our more popular posts ever since — approaching 140 comments last time I checked, and generally getting another comment or two most weeks.

However, Adobe still like Bridge and still would like you to use Bridge, so responded by making things just that little bit more difficult in CS3. If allowed, Illustrator CS3 checks that thumbnails are disabled every time it starts — if it finds they aren’t, it makes changes to ensure they are.

If you let it that is..

Thankfully the issue has been solved, and I’m keen to pass on the solution and the credit for it.

William M Park is a talented painter, Photoshop power user and apparently sometime registry tweaker.

Along with the DLLs and REG files mentioned in the original solution, William has put together a detailed …

 

Rails 2.0 features: Multiple views

by Myles Eftos

The seed has been sewn for the next major release of the Ruby on Rails framework. Towards the end of last month, the Preview Release was announced and now that I have had a chance to play with it, I thought it timely to outline some of the new features.

Multiple Views

In version 1.2 of Rails, the respond_to block was introduced, which made serving up differerent data types, like XML or JSON really easy. All you needed to do was something like this:

def index
@stories = Story.find :all
respond to { |format|
format.html {}
format.xml {
render :xml => @stories.to_xml
}
format.json {
render :json => @stories.to_json
}
}
end

Then, on the web browser, if you appended the file extension (eg /stories/index.xml) and you would get the content delivered in the requested format. You could even …

 

Changes to PageRank?

by Lucas Chan

It seems that Google has recently changed their PageRank algorithm. A number of sites have experienced a significant drop in PageRank as a result.

  • Boing Boing: Was 9, now 7.
  • Engadget: Was 7, now 5.
  • Forbes.com: Was 7, now 5.
  • New Scientist: Was 7, now 5.

Early reports suggest that sites which sell or exchange links are most affected. However sites that don’t fall into this category have also experienced a drop in PageRank.

This is a potentially devastating change for sites that rely heavily on search traffic. Post here if this affects you, or if you have any further insight.

 

ColdFusion: worth the cost!

by Kay Smoljak

Judging by many of the comments on my previous post, the licensing cost of ColdFusion is a major issue for many people, given the many free and open source alternatives. This is not a new concern - developers have been asking “is it worth paying for?” for as long as ColdFusion has been around. Fellow SitePoint blogger Eric Jones wrote an article way back in June 2004 and addressed this very issue (among others) in Making the Case for ColdFusion. Fast forward to 2008, and it seems that people are still asking.

But first, just how much does ColdFusion actually cost?

A Standard Edition license - designed for delivering multiple applications or sites on a single server - will cost, on average, US $1,299. Up the other end of the scale, an Enterprise Edition license - for multiple servers or plugging into existing J2EE installations - can be purchased for US $7,499. The Enterprise Edition has some extra features not found in the Standard Edition that are mostly of interest, as the name suggests, to developers working in an enterprise-level environment, as well as an expanded range of supported platforms and databases.

An important item to note is that a …

 

We ASP.NET Geeks Have Lost Nothing

by Wyatt Barnett

Rob Conery—the creator of the very, very slick SubSonic persistence framework—writes that he has forgotten a lot of HTML and javascript. He ain’t lying. I took his little challenge and failed miserably. Then again, I realized how glad I was that I had not had to struggle with, nor implement, manual form handling in quite some time. While I might have lost something by becoming an ASP.NET junkie, at the same time I gained a lot of very, very powerful tools to make complex, interactive web applications without having to worry too much about how to wire up HTML forms.

 

Dynamic global functions in PHP

by Troels Knak-Nielsen

Like many others, I prefer to use procedural PHP as a template language. While PHP’s syntax makes it a practical choice for this, there is a problem with embedding dynamic content. Most PHP applications produce HTML output, so you end up writing <?php echo htmlspecialchars($foo);?> a lot, using this technique. Or you forget it, and make your application prone to all sorts of nasty XSS attacks.

Apart from the annoyance of superfluous typing, there is a danger of getting lazy, seeing that <?php echo $foo;?> is remarkably shorter to type. In some situations, it won’t manifest itself as a problem either, since some content-types never contains HTML special characters (Numbers for example). This is particularly nasty, because errors in the view layer are notoriously hard to track down, and unlike SQL-injections — a similar problem — the consequences tend to hurt the users of a site, rather than the site directly.

KISS
Recently, I had a look at some code, written for CakePHP. My eye caught a function e, which is shorthand for echo. A single letter, regular function is undoubtedly the simplest way to extend PHP’s syntax. Thinking about it, it’s fairly obvious, but it just never occurred to me.
Well, the CakePHP …

 

Dealing with unqualified HREF values (Part 2)

by James Edwards

In my original blog post, Dealing with unqualified HREF values, I put forward a method for converting an href value in any format into a fully-qualified URL, using data from the document location object.

However, as one commentator pointed out, the proposed solution couldn’t cater for changes in location context, such as that caused by a <base> element, or within the context of an included document such as a stylesheet or a page in an <iframe>.

To fix that it was necessary to abandon the use of the location object entirely, and parse URLs as strings. But the upshot of this is a far more flexible and useful method, that automatically caters for <base> elements, and is also able to accept an input location string to use as context.

So from the original code, this:

//get the current document location object
var loc = document.location;

Becomes this:

//get the current document location href
var here = document.location.href;

//look for a base element to use instead
var bases = document.getElementsByTagName(’base’);
if(bases.length > 0)
{
var basehref = bases[0].getAttribute(’href’);
if(basehref && basehref != ”)
{
here = basehref;
}
}

//if the context argument is present and non-empty string, use that instead
if(typeof context == ’string’ && context != ”)
{
here = context;
}

//extract the protocol, host and path
//and create a location object with …

 

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Logo Design, Web page Design and more!

99designs

  • Custom logo designs created ‘just for you’.
  • Pick the design you like best.
  • Only pay if you’re satisfied with the result.