by James Douglas

AJAX Pagination in Joomla

Quick post today (I’ve got loads in draft, so there will be more to come…) about Joomla’s Pagination, and how to not-refresh the whole darn page when you click it.

Let me clarify that first; when you’re using a page set up to view ‘category blog’ or ‘featured articles’ you’re going to get a feed of articles onto your page. You can specify in Joomla how many articles get dumped into this feed before pagination, and on clicking the ‘next’ button you’ll get the next X number of articles. Great. The issue is, when you click this button the whole page will refresh because the button is appending ‘?start=X’ to your URL to display the next X number of specified articles starting at X. So, how can we stop it from doing that? Actually, fairly easily. It’s taken me ages to get my head around it (being new to Joomla) but actually, there’s not much to it. So here we go…

[ Read More.. ]

Upgrading RAM in a 2009 Unibody 13″ Macbook

Quick one really, but I just thought I’d write a quick post on how to replace the RAM in a 2009 Unibody Macbook. I did a quick bit of googling when I was looking to replace the RAM in my wife’s Macbook, but I couldn’t find anything online showing the process or even if it was possible. I had figured it would be possible, as the bottom of the Mac has a rubberised panel on it (that looks quite removable) and actually, the process was very easy. I’ve bought RAM from Crucial before so that was my first (and only) stop for getting the RAM. On their website they have a series of drop-down boxes for selecting your laptop type, and once you’ve selected the options you then get a few options of types of RAM you can order. I opted for the maximum supported memory, which in this case was 4GB kit (2GBx2) DDR3 PC3-8500 Unbuffered NON-ECC 1.5V 256Meg x 64, and at £32 I thought this was a good deal. Remember, you’ll need to get a matching pair of 2gb sticks and not 1 stick at 4gb. The Mac is 6 years old now and still going strong, so this 4gb of memory will double it’s current stock and hopefully breathe a little more life into it for another few years (I’m always impressed by just how long Macs will keep going for. 6 years for a laptop! That’s crazy).

[ Read More.. ]

A quick image gallery script for my blog posts

Every time I try and add images to my posts, I always end up messing around with CSS properties trying to get the images to responsively sit on the page, and up until now I haven’t really dealt with it because – well – I couldn’t be bothered. I can see a few posts coming up though, that are going to require images in them.. So I best stop messing around and actually write a plugin for this. So let me walk you through it..


First off, I’m thinking we have 2 or 3 images per row with a fluid width and a fluid height to keep it the right size on the page. I’ve had issues with this before though, when I’ve tried to preserve aspect ratios, specifically when I’m using portrait and landscape images together on a page.

The main issue we have is that portrait images and landscape images resize differently as our page changes, and if we have a portrait image sitting next to a landscape one then the height of the portrait will quickly expand to be higher than the landscape image if we’re trying to keep the widths of them both responsive. Since I’ve played with this before, I know the pain involved in the maths; so I’m going to cheat a bit for the solution and have the portrait image cap its size at the current height of the landscape image. With any luck, this should enable a portrait and landscape image to sit next to each other.

[ Read More.. ]

A Lego monitor.

So, I always like to have some kind of project on the go – and this time it’s for a second monitor, or more specifically in this case – a kind of up-cycled second monitor.

The concept

I like having a second monitor, it gives me loads of screen space and it lets me keep many things open at once without having to shift-tab all the time. I also like the idea of portrait monitors; I use web-inspector daily for work-related stuff and I never have enough screen space for Sublime Text, a browser and web-inspector to be all up at the same time without moving between work-spaces. My brother has a portrait monitor too (that he uses for text-base chat) and it looks like a really useful space that importantly doesn’t take up a lot of desk space.

So, I already have a second monitor, a hefty 15 inch LCD that has a fair chunk of weight to it. I had this swing-arm mounted to my wall on my previous desk setup, but I had to remove it when I bought my new desk from Ikea. This presented a problem, I now couldn’t use my second monitor – I had no access to the wall, so couldn’t mount it… (#firstworldproblems) and I didn’t want to sit it on my desk, because it’s an older model and it’s pretty big. I’d lose too much desk space if I used it. This is when I started doing a bit of research, looking at lighter, smaller alternatives, and I stumbled across a bit of a DIY project; recycling old laptop screens.

Now as luck would have it, my sister in law has a broken laptop. I’m not sure why it’s dead, but I do know that the screen-clasps are trashed and the laptop can no longer open and close. As far as I am aware, the screen still works. Bingo, here’s the start of the project.

[ Read More.. ]

Pebble Time: a smart little watch

So yesterday I put in enough money to the kickstarter for Pebble Time to get myself one of them. I’m pretty excited, and it would seem a lot of the internet is too. Pebble hit their goal of $500,000 in 17 minutes. I mean, holy crap. That’s fast. Not only did they hit their target quicker than you can say ‘I’ll pass on the Apple Watch’ but they blew their budget out the water – and last time I checked – they had raised £10,000,000. I think that speaks for itself when we’re talking about the hype around this, that’s a crazy amount of money in a very short amount of time.

So what’s the hype about?

Pebble Time is a new smart watch that offers a lot of functionality that people have been looking for, in a very attractive package. It follows on from it’s older brother (the Pebble Steel) as the next iteration of Pebbles smart watch designs. If you can’t be bothered to go google it, or click my links; I’ll summarise the PT

[ Read More.. ]

Raising the issue of ‘Mobile Strategy’

So I recently came out of a meeting and the last thing that was said was ‘As a company, we should have a mobile strategy’, and I completely agreed. I would love our company to have a mobile strategy. A solid one, one that had a lot of thoughtful consideration in it by people who knew something about the topic. So why do we need one?

People are browsing your stuff on a mobile

(Or if they’re not, they’re probably trying to)

We need to face the obvious fact; a lot of people have smart phones (some stats). That’s a lot of people with accessible mobile Internet in their pocket, and a lot of potential customers. Our company is split into many parts, and the part I work for runs regular user stats from our Google Analytics to take a good look at who is using what, what they’re using it on and what they’re trying to get out of it. Our stats this year are currently saying that…

Mobile users:

  • 2011-2012 we had a 4% increase in mobile users.
  • 2012-2013 we had a 9% increase in mobile users.
  • 2014-to date we had a 15% increase in mobile users.

Tablet users:

  • 2011-2012 we had a 3% increase in tablet users.
  • 2012-2013 we had a 8% increase in tablet users.
  • 2014-to date we had a 9% increase in tablet users.

[ Read More.. ]

Re-inventing the wheel vs changing the tyres

It’s one of my most common problems, and one that always takes a bit of thinking over when I get to it. When is it appropriate to upgrade/edit some code, and when is it appropriate to nuke everything and start again? When this situation occurs I normally stop and consider the following points…

  1. How old is the code? Have I learnt a lot since I last wrote it, and will the code benefit from being re-written? Code with a few miles on it might have a few bodges and hot fixes in there, I could probably iron those out now that I’ve learnt a bit more and we’ve got a better idea of how this particular code is being used.
  2. How long will it take? If we’re looking at a day, I’ll probably just start it again. A week? That’s a bit longer.. when we’re looking at 2 days+ I’ll need to work out exactly what I’ll benefit from if I start again, or if I just leave it and bodge it a little more.
  3. Room for improvement? Did I consider decent future proofing when I made it? There might be already building blocks in place to make my changes without having to do too much. If I do need to start again, it might be worth considering that I may need to make similar changes in future, so I should write some future proofing into the revised version so I won’t need to overhaul it as much next time.
  4. Am I going to learn anything new if I re-write? I tend to approach things differently when I’ve been using them a while and I know the full extent of their use, and it’s likely I may want to use new technology to solve the original problem. If there’s room for me to learn something from the re-write and it will take a reasonable amount of time to do, it’s defiantly worth starting again.
  5. Is this going to save me time in the future? A fix now might sort out my problem for the next few weeks, but what about next month? If I save a day in development now, will it cost me a week later when my code just runs out of extendibility? Probably.

Balancing these points and understanding what you want from your project, and what you’ll get out of it, goes a long way to helping you understand your code and your own coding-development. I like to think that I make everything a little better every time I re-write it, and I learn a little along the way. As the sole developer in my team, it’s hard for me to keep challenging myself and pushing forward my skills, so I always swing in the favour of coding development and growth when I approach a project.