Bug of the Day: Safari / Webkit trying to load gradients as images/URLs

Why is webkit trying to load my -webkit-linear-gradient’s as URLs?

I’ve got the following perfectly acceptable CSS3:

	background-image: -webkit-gradient(linear, left top, left bottom, from(#648087), to(#38484c));
	background-image: -webkit-linear-gradient(top, #648087, #38484c);
	background-image: -moz-linear-gradient(top, #648087, #38484c);
	background-image: -o-linear-gradient(top, #648087, #38484c);
	background-image: -ms-linear-gradient(top, #648087, #38484c);
	background-image: linear-gradient(top, #648087, #38484c);
	filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, StartColorStr='#648087', EndColorStr='#38484c');

I’ve spent a good 60 minutes this morning trying to find out why it was producing the following output in my ruby server console:

Started GET "/admin/-webkit-linear-gradient(top,%20rgb(100,%20128,%20135),%20rgb(56,%2072,%2076))" for 127.0.0.1 at 2012-01-10 11:43:41 +0000

ActionController::RoutingError (No route matches [GET] "/admin/-webkit-linear-gradient(top,%20rgb(100,%20128,%20135),%20rgb(56,%2072,%2076))"):

Well. It’s a bug, and it’s present in the latest released build of Safari. Safari still renders this fine, but it also tries to load it as an image, which’ll result in weird output in your ruby console, or error log.

It’s fixed in the latest webkit nighties, which should mean its fixed in the next safari build too.

Redirect an entire site with .htaccess but exclude one or more directories

We recently wanted to move a website to a new domain and automatically send visitors and Googlebot to the new content, but certain resources had to remain on the current domain.  This meant we needed to redirect all requests to the site, except for the contents of a couple of directories, to a new domain.  After some head scratching we decided the simplest answer was a RewriteRule in our .htaccess file.

Continue reading

Storm news roundup 06-01-12

Our favourite web(ish) stories from the week…

Adam:

“Windows 8 is going to have a very sexy new feature called Storage Spaces. This is effectively RAID for the masses – hiding all the gnarly details while still offering a wide range of powerful features. They are offering mirroring and parity redundancy as well as the ability to bolt together heterogeneous disks to form a storage pool. That basically means you can take you internal hard drives, external USB drives or SAS drives, all of different speeds and capacity and have them act as one big hard drive. If they pull this off then it’ll be awesome. You’d no longer need a £500 Drobo to provide a convenient, reliable way to handle multimedia, just a bunch of USB external drives!”

Paul:

“In probably one of the most extreme examples of why you should be careful of using Paypal when selling, they instructed an unsatisfied buyer to destroy an antique violin worth thousands of dollars before they would issue a refund”

Dave:

“My news for this week is about the much-anticipated ‘http://hasliamgladdywatchedstarwarsyet.info‘. It may come as a shock to many of you, but our very own Liam Gladdy has not watched any of the Star Wars films.

We learnt recently that Liam was motivated most by earning achievements and unlocking badges. As such, the http://hasliamgladdywatchedstarwarsyet.info website comes with a progress saber where you can keep up to date with Liam’s progress. We hear that v2 is in the pipeline, and comes with unlockable badges and achievements.”

Mike:

” ‘…the action figure comes with a pair of black socks, some glasses, a leather belt, two apples (one with a bite taken out of it), a bar stool and a ‘one more thing’ backdrop’.

Yes, it’s a Steve Jobs action doll, and Apple aren’t too happy about it – apparently claiming that they own the rights to the likeness of the late Apple founder.  And no – this isn’t in The Onion, it’s in The Telegraph.”

Liam:

“It’s CES time again! Yup, the biggest week of the year for consumer electronics starts next week, and we’re bound to have a bumper crop of news and gadgets to be tweeting about. You can follow all of the latest news from CES at http://www.theverge.com/ces or read their preview of the event here.”

Andrew:

“SOPA is becoming more and more of a toxic entity to be associated with, as Sony become the latest target this week, with Anonymous announcing that they plan to target the company for their continued support of the Stop Online Piracy Act. In the light of the mass Go Daddy exodus, who will be next to distance themselves from the controversial proposed legislation?”

 

Introducing “Maintenance Mondays”

We have two kinds of work, “new” development (including major changes to existing sites) and “maintenance” for projects which have been delivered but require ongoing work, such as keeping software up-to-date or making small changes from time to time.

Managing the balance between new projects and maintenance work so that new work gets delivered on time while maintenance gets carried out in a professional and organised fashion can be difficult once you have a significant number of maintenance clients. Maintenance work can quickly come to dominate your week.

To make things run smoother, from next week we will be trying out a new idea – “Maintenance Mondays”. This breaks our work week down like this:

Maintenance Monday – Non-urgent or regular tasks involving system administration, small updates to sites. Nothing that should take more than a day, and most will only take a few hours.

Tuesday to Thursday – Main project time, for uninterrupted development of new client sites, or significant changes to an existing site.

Friday – This is normally a short day here at Storm and is kept free for internal tool development, training and learning, but it also serves as an “overflow” for when things get hectic or work is delayed for some reason.

Of course if there is an urgent maintenance task, such as rescuing a failed system, then this will be dealt with as soon as possible. If we find that we don’t have enough to do to fill a Monday then we can just move straight on to project work.

Development work requires a high degree of focus and concentration to do well. Constantly switching between projects to deal with small issues breaks up the day, reduces the productivity of the team, and increases stress. Maintenance Mondays will hopefully reduce these distractions by giving us three largely uninterrupted days to concentrate, resulting in a more productive and happier team throughout the week.

This approach will make maintenance work more predictable. Instead of trying to fit it in between other work we can give a definite day when it will be carried out, providing greater certainty to our clients.

Maintenance work is often a one person job, so having these tasks spread around the week means we are constantly breaking up the team. Scheduling all these for the same day will make it easier to work together on new projects in the mid-week.

Projects can easily be delayed by maintenance work from other clients, but this approach provides a clear three day week for new project work. We feel that three days is an honest reflection of the amount of time in a week that we can spend on new project work without neglecting maintenance clients and all the other things you have to do to keep a company running. By clearly acknowledging and dealing with the effect of maintenance work on our schedules we believe we can more accurately estimate work in the future. Estimating software development projects is notoriously difficult, so anything we can do to improve it is worth a try.

This is all a bit experimental so we’ll be keeping an eye on how well it works over the next few months, and tweaking it based on experience.

So how do you balance out the demands of your existing and new clients? We split our time, other companies split their people into “greenfield” and “maintenance” teams. What have you done that works, and what have you tried that didn’t?

Custom roles in wordpress not appearing in author lists

A quick little post from me today to explain a bug that stumped me for a couple of hours this morning in wordpress.

WordPress supports custom roles, either defined by a plugin or custom code in your plugin or theme, such as:

//Base the new role on the existing "editor" role
$editor = get_role('editor');
//This function only ever does something once - the first time its run.
//Once the 'staff member' role exists, it returns NULL each time.
$staff_member = add_role('staffmember','Staff Member',$editor->capabilities);

The problem is, your nice shiny new user won’t appear in the author list on a post or page, so you can’t ever set them as the post/page author.

This is a known bug in wordpress that was reported 10 months ago (http://core.trac.wordpress.org/ticket/16841) and is the result of complications from changes wordpress have made to the user role system over the last few years.

The fix is actually relatively simple, but a touch backwards – You need to add a capability to the user of ‘level_1′, a deprecated role which shouldn’t be required, and actually does nothing but fix this bug.

//Get the role again - need to do this incase the role already exists, and add_role returned null.
$staff_member = get_role('staffmember');
$staff_member->add_cap('level_1');

Any new users with the role of “Staff Member” will now appear in the list. Another issue applies to existing users, though. While they’ll have the new level_1 capability, wordpress won’t update them in its database to have the old style user_level option (which is now deprecated, anyway).

The fix for existing users is a bit lame: You need to change them to be another type of role, and then back to Staff Members – I think this is a bug in itself, and have submitted the issue to the wordpress developers (http://core.trac.wordpress.org/ticket/19747).

I hope this helps some of you out!

Things Storm bookmarked this week 04/01/12

Liam:

Happy New Year! My bookmark to start 2012 is batman.js – It’s a nice little CoffeeScript or Javascript framework for building web apps. You can find more info at http://batmanjs.org/ – or have a look at some pretty examples

Adam:

A couple of libraries that devs might like.

Chosen is a jQuery plugin to make super sexy drop-down lists with auto-complete. It should be very useful for making long drop-downs far more user friendly.

Thinking Sphinx is a Ruby library to bring Sphinx full text search into ActiveRecord and looks really easy to get started with. Full text search is needed when you want decent search results on strings and Sphinx is one of the leading open-source solutions, so this plugin should come in very handy!

Andrew:

This week a link that i have actually bookmarked- http://www.codecademy.com.  Just released, it is a user-friendly introduction to programming for those of us not gifted in the art of development. it uses pretty badges and you can track your progress and compare it with friends. Having only just been released, its library of classes is quite small, but hopefully as time passes and the site’s profile grows, so will the tutorials.

Paul:

At the Storm Christmas do I was surprised that my colleagues had never heard of The Mother of All Demos. Back in 1968 Doug Englebert demoed a system his team at SRI had been working on since 1963 and featured the first computer mouse, hypertext, collaborative editing, video conferencing and many other ideas that would take decades to become commonplace. It’s a great reminder of how so many of the things we think of as new have been kicking around for years, it just takes time for technology to catch up. The entire demo is available on Stanford’s website as bite-sized pieces, or as one 100 minute video

Mike:

My bookmark this week is very much based on the fact we’re probably all looking for something that isn’t work to remind us of the holidays just gone. Little Alchemy is a beautifully simple game where you combine two elements to create a new one. Then you do it again and again. Then you realise you’ve only got about 18 out of a possible 220, and go slowly bonkers trying to work out the others. Exactly what is required when there aren’t enough mince pies around”

Dave:

A really slick work-orientated recommendation engine that uses your twitter network to find opportunities that are well suited to you. WorkFu  is brought to you by, amongst others, one of our Bath friends Mike Kus.

Scott:

Real life Wipeout!

Are you backing up your IIS 7 configuration?

We all now how important is to have backups of our websites and data, but less people remember to backup their web server configuration.  However, it’s equally as important!  If your hard drive dies, your config goes with it.  Bye bye performance optmisations.  Bye bye fix to obscure bug you resolved 2 years ago.  And bye bye to user and access permissions that have been added gradually since your server went live.

What are you going to be doing tomorrow if that lot disappears tonight?  Hopefully, the answer is restoring from a backup and not desperately trying to remember everything you’d changed and configured!

If you don’t have backups of this stuff, make it your New Years’s resolution to change that!  With IIS 7 it’s trivially easy to backup your application pools, websites and server settings.   All you need to do is add the following directory to your backup process and your done!

C:\windows\system32\inetsrv\config

What are you waiting for?  Go do it now!

Error messages seen at Storm in 2011

We work with a wide range of technologies, frameworks and tools at Storm and that means we’re working with new things and learning all the time.  As any developer will tell you, there are two critical requirements that make learning a new tool easier: good documentation and good error messages for when you inevitably get it wrong.

2011 has been a year of many new things and we’ve seen our fair share of error messages.  Some of which were just a little bit more…. special…than others.  We’d like to share these with you, so that when you’re writing your next library, toolkit, plugin or whatever, you take time to think about the error messages the mere mortals using your code will see!

Continue reading