Ebuyer & ParcelForce – a story in how not to treat your customer

5-6 weeks ago ago I ordered two 24″ widescreen monitors from EBuyer – when the ParcelForce guy delivered them I told him I expected 2, and there was only one delivered. He walked off. I presumed that the other would arrive the next day or something… but it didn’t.

while(true) {
     David.ContactsEBuyerViaStupidENoteSystem(‘rah rah rah where is my missing monitor?’);
     EBuyer.stallForAFewDays();
     EBuyer.replies(‘We’re checking ‘ + excuse.random([‘Warehouse’, ‘Parcel Force’]) + ‘ and apologise … blah blah blah’);
}
5-6 weeks later, there is no sight of the monitor….
Not impressed.

Upgrading iPhone – the iphone could not be restored an unknown error occurred 1013

On seeing JailBreakMe has released a new version – which allows me to upgrade to the 4.3.3 firmware – I thought I’d update my iPhone4 – but annoyingly kept getting the following error message (whether doing an update or a full restore) :

“The iphone could not be restored an unknown error occurred 1013”

In my case, the fix was to edit /etc/hosts (OSX) and comment out / remove an entry for :

74.208.10.249 gs.apple.com

I have a feeling this was put there by TinyUmbrella or something, but nevermind. It works now.

 

Delaying external javascript/content loading on a website…

One customer of ours, has a considerable amount of content which is loaded from third parties (generally adverts and tracking code). To the extent that it takes some time for page(s) to load on their website. On the website itself, there’s normally just a call to a single external JS file – which once included includes a lot of additional stuff (flash players, videos, adverts, tracking code etc etc).

On Tuesday night, I was playing catchup with the PHPClasses podcast, and heard about their ‘unusual’ optimisations – which involved using a loader class to pull in JS etc after the page had loaded. So, off I went to phpclasses.org, and found contentLoader.js (See it’s page – here).

Implementation is relatively easy, to the extent of adding the loader into the top of the document and “rewriting” any existing script tags/content so they’re loaded through the contentLoader.

<script src="/wp-content/themes/xxxx/scripts/contentLoader.js" type="text/javascript"></script>
<script type="text/javascript">
var cl = new ML.content.contentLoader();
// uncomment, debug does nothing for me, but the delayedContent one does.
//cl.debug = true;
//cl.delayedContent = '<div><img src="/wp-content/themes/images/loading-image.gif" alt="" width="24" height="24" /></div>';
</script>

And then adding something like the following at the bottom of the page :

<script type="text/javascript">
cl.loadContent();
</script>

And, then around any Javascript you want to delay loading until after the page is ready, use :

<script>
cl.addContent({
		    content: '' +'' + '<' + 'script type="text/javascript"' + ' src="http://remote.js/blah/blah.js" />' ,
		    inline: true,
		    priority: 50
		});
</script>

You can control the priority of the loading – lower numbers seem to be loaded first. You can also specify a height:/width: within the addContent – but I’m not sure these work.

For all I know there may be many other similar/better mechanisms to achieve the same – I’m pretty ignorant/clueless when it comes to Javascript. It’s a bit difficult for me to test it – as I have a fairly quick net connection – however it seems to move content around when looking at the net connections from FireBug, so I think it’s working as expected.

Running along….

I think I’m back into my running ‘habit’ again, after finally overcoming an achilles tendon and so on.

I randomly installed RunKeeper on my iPhone, and I seem to be running at about 4minutes 30seconds per kilometer (I did 9.6km at this pace). The furthest I’ve been recently is about 13-14 miles, I think…

So, upcoming events:

I had intended to do the Sherwood Marathon last year, but then I injured myself… so hopefully this year will work out better.

Magento not finding product images (solution)

I migrated a Magento instance from one host to another, and in the process earnt myself some free beer; everything went well, apart from some of the thumbnail images not appearing. The image URLs would look like :

/media/catalog/product/cache/1/image/5e06319eda06f020e43594a9c230972d/images/catalog/product/placeholder/image.jpg

Things tried which didn’t help :

  1. rebuilding various Magento image caches and so on (login as admin -> System -> Cache management).
  2. Check PHP’s memory limit… (512mb… shouldn’t be a problem!)
  3. Check permissions on the media directory (chown -R www-data media .. didn’t fix it)
  4. Check PHP has gd installed/enabled – yes.
  5. Disable suhosin (no change)
  6. Check PHP logs (nothing relevant)
  7. Check Apache logs (nothing relevant)
  8. Changing the product to use a different thumbnail etc image (didn’t help)

I already knew the original host didn’t have a case sensitive file system, and this was partially fixed this using mod_speling in Apache, but this obviously doesn’t help when e.g. PHP decides to read and resize an image file.

I then tried comparing the contents in media/catalog/product with what’s in the catalog_product_entity_varchar table. So, in my case :

select value from catalog_product_entity_varchar where value like '/F%' limit 1;
returned something like :

/f/i/file_4_1.jpg

And looking in the above mentioned directory, only showed a directory called F. Simple fix… :

mv F f

(Obviously check the table doesn’t make reference to images with /F in them….  in my case it didn’t.)

<<reload web browser; images all appear and everything works.>>

What sort of idiot created case insensitive filesystems… grr.

Still, at least people can now browse online for Kitchens …. and see the appropriate thumbnails.

Getting a kvm serial console with grub2

I’ve a few kvm guest servers, which I’ve been accessing using vnc – but this is a bit of a pain (getting port forwarding setup etc). Host and guests run Debian Squeeze with Grub2 installed/in use.

So, here’s how to do the ‘virsh console ‘ thing …

  1. Edit /etc/default/grub, specify
    GRUB_TERMINAL=console 
    GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
    GRUB_CMDLINE_LINUX_DEFAULT=""
    GRUB_CMDLINE_LINUX="text console=tty0 console=ttyS0,115200n8"
  2. Run update-grub
  3. Edit /etc/inittab and enable ttyS0 for logins.
  4. Reboot
  5. ‘virsh console servername’ on the kvm host.

The libvirt config files I have already have the appropriate bits in them –

<serial type='pty'><target port='0'/></serial>
<console type='pty'><target type='serial' port='0'/></console>

fsck -y (or fsck yes…)

Tip for the day:

Edit /etc/default/rcS on Debian/Ubuntu servers, and set FSCKFIX=yes (default of no) so next time your server runs fsck at startup, and spends hours doing it to only moan when it finds an error, and tells you to waste more time by running fsck with ‘-y’ (to fix it).

Quite why fsck even asks me to say ‘yes’ to it’s “do you want to fix…?” questions is another matter. It really annoys me – it’s not like I have enough information to make any sort of informed choice – it’s not like I know the structure that’s present on the disk, in order to say “No! You’re wrong FSCK, inode xxxxx should be blahblahblah”. I can only say ‘yes’.

If only FSCKFIX=yes was the default setting….. I can’t imagine Windows or OSX ever asking someone to answer such questions.

All in a day’s work…. (magento and putty)

Here’s a random summary of some vaguely interesting techie things today.

Magento Migration

When exporting a Magento website from a third party (e.g 1&1), you’ll need to :

  1. Copy all files across; the ‘var’ directory can probably be omitted as it’s full of cache like stuff. ‘media’ and ‘var’ look like they need to be writeable by the web server.
  2. Edit the app/etc/local.xml file to specify the new database settings
  3. Check the various .htaccess files; the one in the root directory will probably need tweaking.
  4. Dump the database, and ensure that it has the following at the top of the dump file before restoring on the new host:
  • SET NAMES “utf8”
  • SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”

Failure to do the ‘utf8’ one, will lead to £ symbols being slightly wrong.

Failure to do the second will ensure that all the foreign key references fail (so restoration will be hard to start with) and if you disable the foreign key checks (‘SET FOREIGN_KEY_CHECKS=0;’) you’ll find that Magento will b0rk on access – complaining about nulls and so on in parts of the configuration (the error message will likely mention app/code/core/Mage/Core/Model/Mysql4/Config.php ).

All of the above is ignoring the fact that the Magento instance I migrated was infested with some malware, and I’m not yet sure how it ‘got there’, though I shot an email over to my buddy at Bing (Bing Digital is a leading Magento agency run by my buddy of 15 years). However, when it does next get infected, which it is likely to, I will at least be able to see what’s changed thanks to git.

Putty on OSX

Well, it sort of exists; if you use ‘brew‘ – namely ‘brew install putty’ does something – but doesn’t (yet? can it?) build the GUI. However, all I needed was to convert a putty ssh keyfile (blahblah.putty.key) into an openssh variant, for which puttygen works perfectly :

  • puttygen blahblah.putty.key -O private-openssh -o test.key

Strangely there don’t seem to be any free apps on the app-store for SSH. I’m almost surprised no one hasn’t just compiled putty and put it on there for 50p or free.

The pain of bios updating (M3N78-VM / ASUS)

I’ve hopefully bought a new CPU to stick in the office server. All being well, it’ll be super quick and so on.

Looking at ASUS’s website, I made sure to choose a CPU the motherboard supports. I saw it required a BOS update, so fine… that shouldn’t be hard, right?

Think again.

  1. Downloaded BIOS file (possible from this link)
  2. Downloaded FreeDOS, burnt to CDR so I could boot into a DOS like environment.
  3. Copied BIOS file + AFUDOS update utility to USB stick.
  4. Rebooted, booted off CDR, chose to run LiveCD (No Drivers)
  5. Then tried to use AfuDos.
  6. Be good – take a backup first (afudos.exe /obiosbackup.rom
  7. Try and install a newer one (afudos.exe /iM3N78-~1.ROM) – fails with a message like “invalid bios id in rom”. Quite unhelpful.
  8. I tried various different .rom file names, but no combination of motherboard (M3N78) and bios version name seemed to work.
  9. Eventually, Googled a LOT more, and found that there is an ‘engineering’ version of the AfuDos tool, which allows you to force the update, and ignore any stupid check….
  10. For the sake of it, I tried to restore the backup I’d taken, using the original afudos.exe, but this didn’t work (WTF?)
  11. Downloaded ‘engineering’ afudos tool (try e.g. here)
  12. Ran with ‘afudos.exe /ibiosbackup.rom /n’ (the /n tells it to not do the stupid check) – worked… OK.
  13. Rebooted
  14. Entered back into DOS, and ran: ‘afudos.exe /iBiosIWantToUse.rom /n
  15. Crossed fingers, hoped I wasn’t going to brick the stupid motherboard…
  16. Success.
  17. Reboot. Carry on life.

The ‘onboard’ ez-flash utility ASUS provide seems totally useless.

Oh well, hopefully we’ll soon have 6 cores of goodness powering Jenkins.

Twitter Weekly Updates for 2011-03-13

  • Can't be bothered to give up chocolate for lent. Pancakes on the other hand will not be missed. #lent #fb #
  • Reminders:
    * @PHPWM meeting tomorrow (free beer/pizza phpwm.org);
    * It's Pie Week;
    * Pancake today tomorrow.
    Nom nom nom #Fatties #fb #
  • rah rah rah rah rah rah rah rah rah rah

    I have to walk home today 🙁 #

  • A new week, and my bike chain breaks again. Halfords were sold out of connector links and replacement chains. I feel it's a conspiracy #fb #
  • “@StormySan: Every other sentence today is 'Oh my god that's disgusting'. She's just bleached her desk and keyboard.” #fb #
  • Cw54 dmx – you tailed me on the m6 for 30miles; Learn to: dip headlights (not on full beam) & use left hand lane-it's not lorries only #fb #
  • Hmm. I shouldn't have expected any better. On the ground next to the car is an untwisted coat hanger. Car seems ok #LiverpoolAirport #fb #
  • Hello Liverpool. I'm back. Now to drive home. *yawn* happy flyings! #fb #flylo #