Taking out the trash – unset and wp_cache_flush to free up memory

I’ve been working on a third party API plugin for WordPress that requires a script that auto updates from the API. It consists of pulling a big list of items from the API and checking them against the local site entries, often adding new items or updating existing entries.
The problem was with a number of memory allocation errors with PHP as the script went on, often about half way through the execution. Memory exhausted and Fatal Allowed memory issues popping up. A memory limit change would fix the problem to a point, it would still leave issues though – to work through the full list of items would need a very high PHP memory limit and also what happens if the list gets bigger in future? When 64Mb stops being enough do we simply up it to 128Mb what about when that isn’t enough do we carry on upping it? That still leaves a period where errors are being thrown and updates are missed until it is picked up and the memory limit is upped.

I made sure I called wordpress without themes to reduce a little bit of load and a quick check through to make sure unset() was being used as it should be – I’ll admit my code discipline has been lax in the past with regards to this but as ever we are always learning and making sure that we can improve our techniques. Unsetting things properly to free up the memory is one of those things I now make sure I’m doing rather than just overwriting old variables.
So the script was unsetting as it should and with diligent debugging with php memory usage outputs it became apparent that it was around WordPress functions that the memory usage was going up and not being unset, gradually leading to the errors. Plenty of looking around and eventually I stumbled upon wp_cache_flush and it worked a treat – every time I went around a processing loop or finished a process I called the cache flush and it removed all the stuff WordPress had been storing. I’m sure this wouldn’t be the best fix all for every situation but it’s certainly something to be well aware of.

Adobe Fireworks – do not resuscitate

If you haven’t seen it already Adobe made an announcement yesterday about the future of their Fireworks software. Sadly for those fans of Fireworks it confirms the ever looming spectre that Fireworks is being put to bed and no longer developed.
It does surprise me a little that so many people seem to find this news unexpected, maybe they’ve been ignoring the inevitable? In the last iteration of updates most Adobe products got an updated darker interface, notably Fireworks didn’t, it’s not been looked at favourably for a while – it’s been on life support with Adobe and they’ve pretty much said it’s now do not resuscitate.
Continue reading

The web has made customer service so easy – stop messing it up

One of the great things about the web is the ease of communication, the ease of access it allows people to resources. Not just piles of data on Wikipedia but access to people and companies.
It has made customer service incredibly easy to do and yet so many organisations still do it badly. Some will complain that they are limited by budgetary constraints but customer service on the web is not just easy, it’s cheap.
I regularly take to twitter with my customer service issues and questions and its great when you get some dialogue and a question answered. It makes a huge difference to your perception of a brand and how much does it cost to set up a twitter account? Nothing. Ok admittedly you have to get someone to manage it but the setup cost is nothing.

But good customer service doesn’t start and end with twitter, so here are my major online customer service gripes and I’ll start with twitter.

Continue reading

Having a website and having a good website are hugely different things

If you live in the UK you will have definitely heard about the demise of HMV and those outside of the UK will no doubt be aware of it as well. Whilst they have so far only slipped into administration and not vanished forever it is shocking for some to see such a large long established name in such trouble, even though they aren’t the first big name to go under in the UK in recent years.

I’ve read a lot about the situation and the whole history of it* and a lot of blame, not unjustly, is sitting at the door of internet shopping – most notably Amazon. A lot of people accuse the HMV management of resting on their laurels and being too dismissive of the emergence of online shopping in the late 90s. But one comment that stood out to me amongst everything I read was the rather flippant assertion that this wasn’t the case because in 1997 HMV launched their own website selling online. It was presented as if that was enough – HMV had a website so online shopping can’t be the problem.
Continue reading

Why having an iPad means I’ll probably never buy a high end computer again

It wasn’t from Santa but over the festive period my coveting of shiny Apple things was satisfied with an iPad. I’ve wanted to get one for a while, not least as a great tool for me to take things around with me in work. I knew I’d use it at home as well and it’s turned out to be brilliant, but it’s certainly lead to some questioning of the value of my full work set up.

I’ve found I use the iPad all of the time at home and my MacBook that I use for work has been turned on only for work, oh and to transfer some DVDs onto my iPad. Now I couldn’t do without a laptop, the iPad isn’t a complete substitute, graphics work, coding etc aren’t really suited to the iPad, my typing speed is so much better with a physical keyboard – I know I could get a bluetooth one for the iPad. There isn’t any proper file structure so doing web work for sites could prove a bit problematic.

I lease my main work machine and it’s got just over a year to go on it, prior to that last year I have the option to upgrade the machine and extend the lease or just continue to the end of the lease at which point I own the machine outright. I’d always assumed I would continue to upgrade and keep abreast of the laptop market however the arrival of the iPad means I’m using it less and less and find it hard to justify the cost of having a top end machine. I rarely do anything too demanding graphically and the occasional frustrations with anything creative suite are just that – occasional. Can I really justify keeping a high end machine just to mostly edit some HTML and occasionally open Fireworks or InDesign? I’m not sure I can – when I was doing everything on my laptop and hauling it around with me I could say yes and if I did website work full time then maybe, but not anymore.

Which means there’s a good chance I might consider a switch back away from Apple, for one big reason, cost, but a few other smallers ones as well.
The other option to mitigate cost is of course is to keep behind the curve and buy second hand MacBooks as other people go after the new bright shiny stuff.
I did consider going for the Nexus 7 prior to getting the iPad, and I was very close to actually buying it. The main reasons I didn’t were that I wasn’t 100% convinced the screen size was right for me, some stuff for the day job was iPad only and lastly my budgetary constraints became a little less restrictive. However I was excited by the Nexus and had really warmed to the little machine. As much as enjoy using Apple’s ecosystem I’m not 100% married to it, yes I have an iPhone, iPad and MacBook, so I’m well and truly in there – we’re seriously dating maybe – but ironically it’s the iPad that has kind of led me to a point where I can see myself walking away from Apple again.

Still we will see where the market is when I come to change my laptop, I imagine I will now have this one until it dies, and whilst I may stick with Apple one thing I’m sure off is that in the absence of a big windfall I really can’t justify the outlay for buying a new top end machine anymore, it simply isn’t needed.