RSS ? Recent Blog Posts

Blogs » Archive for November, 2007

Design the Cover of SitePoint’s Next Book!

by Matthew Magain

In case you missed it, last week SitePoint’s co-founder Mark Harbottle let slip some big news about the new series of reference books that SitePoint will be publishing in 2008.

Guess what? You have the opportunity to design the first book’s cover!

That’s right, we’re eating our own dog food, and running a design contest for the book cover to be used not only for the first book, but across all titles in The Ultimate Reference series. From the brief:

The desired outcome is simple, elegant, well balanced design that will make our books stand out in a bookstore … On top of the prize, if your design is successful then you’ll receive acknowledgment in the book, as well as copies of the final product.

There are some great designs that have been submitted already. You only have a few days left to get your submission in though.

Good luck to all contestants. I can’t wait to see the final result!

 

The Great Specificity Swindle!

by Andrew Tetlaw

Recently I’ve been working on a SitePoint project: The Ultimate CSS Reference (Coming soon! If you’re into CSS it’s going to rock your world). While researching the shadowy corners of the web for traces of arcane CSS lore, I’ve realized that a lot of information about CSS on the web is in dire need of an update.

Between 2001 and the present we’ve had an explosion in knowledge and general understanding of CSS, the web is full of tutorials, articles and blog posts written during this era of enlightenment. But, time moves on and browsers improve. The level of CSS support in modern browsers is pretty darn good and just as an intimate knowledge of CSS hacks is fast becoming redundant so is a lot of that material. In fact, some of it is down right misleading and your search results are bound to be chock full of well intentioned, but out-of-date information.

Among the pages of arcane CSS lore you’ll find something called the CSS cascade; the thing that ultimately decides what each element’s style will eventually be. It has a reputation for being difficult to understand and is often the cause of those frustrating, obscure CSS problems when what happens …

 

Living on the Edge

by Myles Eftos

As I hinted at in a comment to my last blog post, release candidate 1 for Rails 2.0 has just been released with a number of improvements and bug fixes and in preparation for the final release it is recommended that anyone that is using the pre-release upgrades there applications - but how can you do that? Well it is much easier than you think, and you can be selective about which applications get the makeover.

Although you can reference the Rails libraries in a common path via gems, you can also install specific versions on an per-site basis. Rails will automatically look for a rails folder in the vendor directory - if it finds it, it will use that.

Freezing Rails

Probably the easiest way is to use the freeze rake task. Running the following in the root directory of you application should do the trick:

rake rails:freeze:edge TAG=rel_2-0-0_RC1

Piston

If you are more adventurous and want to play with the bleeding edge, you can use Piston to help you manage all of your rails plugins (including the core!). Now if you are a good little developer you should be using some sort of version control repository, my personal choice is subversion (SVN). This just …

 

The Business of Building Web Sites

by Miles Burke

Hello everyone, my name is Miles Burke. Five years ago this month, I was crazy enough to start a web site design and development company by leaving my previous employer, with only two weeks pay, mortgage payments to make, a 23 month old child and pregnant wife.

As you can imagine the latter was not overly impressed by my act of bravery, however I managed to quickly turn this around, and employed my first staff member less than three months later. I’d freelanced a few years earlier, but this time I believe I learnt from my earlier mistakes.

We now have fifteen staff in the web team and are part of a larger company, which I am a shareholder and director of, with a total staff of just over forty. I recently was awarded ‘one of Western Australia’s most pre-eminent business leaders under the age of 40′, an award which I am proud to have received.

Over the coming months, I hope to discuss with you my thoughts and observations, the mistakes I made and the lessons that I have learnt on this journey of small business ownership and management. I say discuss, because I really hope I can count on …

 

Missing in Action: Java 6 for Mac

by Kevin Yank

Java developers are up in arms over the recent release of Mac OS X Leopard, and the sudden silence from Apple regarding the future of Java 6 on the Mac. Not only did Leopard not ship with Java 6, but Apple has quietly taken down the developer preview of Java 6, and is reportedly deleting threads in the Apple developer forums asking why.

As anyone who has attended a developer conference in the past few years can attest, developers as a group are some of Apple’s best customers. If only Apple treated its developers with as much reverence.

In a post on The Java Lobby entitled So Long Apple. The Party’s Over, Michael Urban summed up the situation nicely:

Not only did Leopard not ship with Java 6, but Apple, in typical fashion, apparently thinks it has no obligation to its customers to inform them about why the plans changed, and when (or even if at this point?) Apple will ever have a working copy of Java 6.

Now, it’s obvious that Apple hasn’t dropped Java completely. As many developers have pointed out, Apple did do plenty of work on its version of Java 5 for the Leopard release. Ben Galbraith recently gave a …

 

Firefox Bug: Status Bar Zaniness

by Alex Walker

Since this issue took me a little while to figure out, I think it’s worth documenting here for future Googlers. Apparently it’s a known bug but as far as I can tell, there seems to be little general awareness of it amongst web developers.

Last week I was working on a some floated buttons and needed them to wrap from a flat, horizontal layout to a vertically stacked layout whenever the window narrowed beyond a certain width. After finding they consistently preferred to prop my window open rather than wrap, I decided to break them out into a simplified test case.

Nothing changed. Although the buttons still had ample space to float in, at a certain point some invisible force was propping open the window — it was like a long, invisible pixel-shim GIF (remember them?) had been snuck into the layout. In fact, even when I broke the layout down to lonesome H1, I saw the same behavior. Were the elements inheriting CSS width from some other source? If so, where? I was stumped.

Firefox dynamic window resizing

Out of ideas, I sat there absentmindedly scaling the window in and out, in and out when I noticed the misbehaviour …

 

Preparing for Rails 2.0: Controller-based exception handling

by Myles Eftos

Since Ruby is a pure Object-Oriented Language, exceptions play a big role in the flow of control. Previously, you had the choice of rescuing exceptions at a local level or you could override the rescue_action method in your controller.

The former method gave you really fine-grained control of what to do in the case of an exception:

begin
user.save!
rescue ActiveRecord::RecordInvalid
render :action => ‘new’
end

In this case, if the ActiveRecord::RecordInvalid exception is raised (the save! method will raise this if validation fails) Rails will render the ‘new’ action. It became clear, though that adding begin/rescues around the same methods is pretty time consuming and not very DRY - which is where the rescue_action became helpful:

def rescue_action(exception)
if exception == ActionView::TemplateError
render :template => ‘errors/404′
else
super
end
end

This (rather contrived) example will trap any ActionView::TemplateError and render the 404.erb file in the /app/views/errors directory. You are able to drop that method into any controller (including app_controller), but again, there is a lot of work involved in setting them up, making sure each controller performs the correct action for a given exception, which is why Rails 2.0 introduces rescue_from.

rescue_from is …

 

Friendly URLs

by Eric Jones

So I hope everyone in the US has survived the Daylight Savings Time crisis of 2007! I don’t know about you but i didn’t even feel it :)

I was browsing the forums recently, as i typically do when I’m looking for a topic to blog on, and I came across a post by forumposters entitled “Clean and descriptive url’s”. In this post forumposters asks:

“What have you fellow CF developers done to make your URLs look better? I’d like to see many examples and options if you would all be so kind to share”

I thought this was a good topic for me since I have a good bit of experience both historically and recently with this very issue.

For the longest time search engines would treat URLS with query strings aka dynamic URLs, everything after the question mark (?) in the URL, differently. Mostly pages which had these query strings would be ranked lower than a page which didn’t. So if you had the URL:

http://www.example.com/books/index.cfm?category=coldfusion&author=forta

it would rank lower in search results versus a URL formatted like so:

http://www.example.com/books/coldfusion/forta/

So it’s been a pretty big tasks for developers to try and get their URLs to be “clean”, meaning they wanted to remove …

 

The PHP Anthology: 101 Essential Tips, Tricks & hacks, 2nd Edition

by Andrew Tetlaw

The PHP Anthology: 101 Essential Tips, Tricks & hacks, 2nd Edition is out! This is a big deal for me because it’s my first book as a technical editor. It represents several months’ work and a considerable amount of coffee. I think it’s a great book with heaps of code you can rip out and start using straight away.

One of my favorite parts is chapter 10: “Access Control”. If you read the whole chapter you’ll realize that you have a complete, ready-made user registration and permissions system, with email confirmation, groups, permission levels and session storage. You’ll find this chapter in the free sample PDF too!

And you’ll find even more answers to common problems like how to send HTML email with attachments, how to read or produce an RSS feed, how to make a customized data grid, and how to speed up your site through caching. It’s like codeine for your PHP headaches!

In the spirit of eating my own dog food, I recently used code from the book to create these slightly amusing bar graphs. They are built from the data from the 2007 Web Design Survey and they provide this shocking revelation: 50% of people in the web …

 

Wide Finder in … errr … PHP

by Harry Fuecks

Long time no blog - very busy searching Switzerland these days but popping in first to say congrats to the 2nd edition team and second, for the sheer evil delight in submitting a late PHP implementation for Tim Bray’s fascinating Wide Finder Project.

Tim set a simple, but very much real-world challenge; write an app that determines the top 10 most popular blogs from his Apache access log. It should be fast and readable, with a subtext of illustrating how “language X” copes in terms of parallel processing and utilizing “wider” (many processor) systems.

Now technically, PHP has almost zero ability to execute stuff in parallel, other than pcntl_fork - (don’t try that on your live webserver - CLI only!), unless you’re counting ticks, which I hope you aren’t.

But we’re not going to let little details stop us! Because we’ve got curl_multi_exec() which allows us to talk to multiple URLs and process their responses in parallel. And just think how many requests Apache + mod_php is able to serve at the same time. Perfect for some map and reduce…

So first a mapper;

<?php
if ( isset($argv[1]) ) $_GET[’f'] = $argv[1];

if ( !isset($_GET[’f']) || !is_readable($_GET[’f']) ) {
header(”HTTP/1.0 404 Not Found”);
die(”Cant …

 

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.

The Web Site Revenue Maximizer
The Ultimate HTML Reference

Book: The Ultimate HTML Reference

The most complete and up-to-date HTML Encyclopedia money can buy.

Free eBook! Firefox Revealed