Categories

One of the Reasons for “Not Build Here” Syndome

I have a personal family website that I use to post mostly pictures to. It consists of a blog run by Wordpress and a photo gallery run by Plogger. The other day I updated Wordpress, because it’s one of those platforms that should be kept updated since it’s a pretty good sized target for hackers. After updating, my Plogger gallery was broken because of a shared third party component that both of the platforms use. After a bit of looking around, I found out that it was a know issue that had been fixed in Plogger and that they had a new release candidate available, which I upgraded to. During the upgrade process there was a process that appeared to be changing some images around, but at the time I didn’t realize that it was moving the actual files. When I booted up the upgraded site, I realized that all the images where now in a totally new location, which broke every single statically linked image I had used anywhere.
Previous to the upgrade, my urls would looks something like this: /thumbs/lrg-11761-christmas-_mg_0328-20091225.jpg
After the upgrade all images have been moved to this format: /plog-content/thumbs/122009/122009-christmas/large/11761-christmas-_mg_0328-20091225.jpg
What this means is that I have about 100 posts on my blog that all have broken images that aren’t going to be easy to fix in any sort of automated way. This was done without any warning during the upgrade process that I noticed and is not reflected in the upgrade instructions.
I’ve logged this bug in Ploggers bug tracker and I hope that they will address it. In the bug I suggested that it be addressed in one of the following ways:
  1. Warn users that this is going to happen and allow them to make the choice on whether or not to continue the upgrade (worst choice.)
  2. Don’t delete the old folders during the upgrade, or at least give users the choice of whether to do so or not (slightly better choice.)
  3. Allow users to continue to use the old directory structure for old images and use the new structure for new images (best choice.)

I suppose one other choice would be to create a new url structure that would be easy to update via a SQL statement, but that seems like a very last choice solution.

XML Editor for Giant XML Files

At work we have a client that delivers huge xml files that we have to work with. Although our software usually imports them fine, we sometimes have to edit them to find specific information, which is really hard to track down in a flat 80,000 file file. I’ve tried a couple of different software packages but have been really unimpressed with their speed. This morning, I downloaded XML Marker and was really impressed with the results. It opens my files in seconds and allows me to very easily find the information I’m looking for. It’s free and available at http://symbolclick.com/.

Add A New Products Section to a Magento Store Homepage

Was looking for a way to add a New Products section to the homepage of a Magento store I’m working on a found a great write up on Richard Castera’s blog. All you really have to do is add this code to the homepage code in your CMS section:

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage"template="catalog/product/new.phtml"}}

Check out the full blog post with some great back and forth and troubleshooting tips.

Once you have the new products displaying, this post on the Magento site will show you how to have more than five products displayed and how to add more than one row.

Could It Really Be That Easy?

In a project we are working on we needed a way to extract the number portion of a weight from a string. So we could receive any of the following:

21
21 lbs
21.3
21.3 lbs

We started looking into some regular expressions to do the job, but then ran across a page saying that you can just cast it to a float or int and it will drop the string bit automatically like so:

<?php
$string = “22.8 lbs”;
echo (float)$string;
?>

<?php
$string = “22.8 lbs”;
echo (float)$string;
?>

This should output 22.8. Not perfect for every situation, but pretty handy in the right one.