From the BlogSubscribe Now

Inputs in Firefox storing previous values

Today’s problem came as a result of a Firefox anomaly. It’s one of those problems that comes up after launching because we were too lax in testing. Here’s how it broke down, without going into great detail about the application.

We’re building a CRM that stores asks and closes of our sales reps. The application shows recent asks and closes on the main screen, with the ability for the user to update said activities. The update option are in input fields, named the same, and updated via javascript behind the scenes.

When adding a new activity, the application inserts that entry into the table of current asks and closes. On reload, Firefox was showing old data in those fields, but if the user clicked on a different page and came back to the dashboard, they would see the correct data. Upon inspection, the value of the input was correct. Meaning the browser was replacing the input with what it believed to be good data.

Unfortunately this bug wasn’t caught until production. The answer was simple. We only needed to turn off autocomplete on each of the inputs. This immediately solved the problem.


Add that line to the input and the problem disappeared.

How to Force Javascript File Updates onto Users

Wonka wonka wonka cache busting memeThe question came up when working with a new application that relies heavily on Javascript, How can we force users to renew the javascript file? This is especially important for single page applications that rely heavily on Javascript for everything from authentication to storing data.

In researching this problem, I found there to be a great deal many options at hand. Some suggested using a paramater in the overall application which could be used to version the javascript.

This would work, but it also requires a paramater in the URL, which I didn’t like for our needs.

Instead we opted to use a very similar method but in the file include statement, where it would be updated for future versioning. So where we call the javascript in the template files, we added a parameter to that javascript file, like so…

<script src="/js/custom.js?v=19228" type="text/javascript">

Let me know in the comments how you handle this problem and if there are any issues you find with our way of solving it.


Magento update breaks site

Magento is open-source software for e-commerce

I helped a friend update their Magento site from version 1.9.1 to The software has a few ways to update, one using a command line utility and the other a web based service called Magento Connect. We used the latter to update and ran into a few issues before finally getting the site to update.

The first problem was the update process failed in Magento Connect with a message that there were conflicts between all the packages being updated. The root cause of this was inside the /public_html folder on the server was a folder called pkginfo which had a Latest_Mage_All.txt folder and another file. We needed to manually delete these and the updates ran as expected.

Once we got the updates to run, then the site returned a white screen. This was caused by an error in the Apache configuration on the server. Because Magento overwrites the .htaccess files, we needed to modify the file to suit the local configuration needs of the server. In this case, that meant SymLinksIfOwnerMatch. This resolved the issue and allowed the pages to load.

Once that was complete, we did need to delete the var/cache folder, as the site was having trouble showing a query that was no longer available in the latest version. That fix could have been prevented by turning off caching prior to updating, but was an easy enough fix nonetheless.

The final fix was template specific and cost us a new support fee with the good people at RocketTheme. The site for this nonprofit uses a module call RokMage HomePageGrid. The grid stopped working after the update, but the fix was simple. By adding the block to the allowed blocks permission page, the frontpage again populated with the necessary information.

How to get a larger album cover image from iTunes API

I ran into this issue recently. I wanted a larger version than what’s returned from the basic response API search. The images there are intended for mobile applications and are available at 60 wide and 100 wide. Easy to get those. What are you going to do with it though? Take a look at the size of the largest version returned from the API.

But how do you get a larger version if your web application requires it? It doesn’t mention anything in the API documents.

Hence a bit of search and replace…take a look at this returned url from the basic api search.

Now all you need to do is replace where it says 100×100 with any value. Need an image that’s 400×400 wide? Change the values to equal that and you’re good to go.

A simple php string replace should do the trick. Here’s what I used to get a 200×200 version of the album.

$albumArt = $response->results[0]->artworkUrl100;
$albumArt = str_replace('100x100', '200x200', $albumArt);

I received the response from the iTunes search library made by Vinelab