Changing form Apache to NGINX – Part 1

I’m currently in the process of switching my webserver from Apache with mod_php to the much faster NGINX with PHP-FPM, as I’m finding BugMuncher is running out of memory on the old apache set up.

I’ve been using Apache on webservers for as long as I can remember, so switching to NGINX has been a bit odd so far, especially understanding requests. So I’ve decided to write a series of posts documenting the lessons I learn, partly so I can refer to them, but also for anyone else making the switch to NGINX.

(more…)

Posted in: Programming,Technology by Matt Bearman on 8th February 2012 at 11:25 am
Tags: , , , ,

Idea Dump 2011

I’m constantly thinking of ideas, and I find myself wanting to develop all of them. Unfortunately I’m just one incredibly handsome man, and all my time is spent on BugMuncher.

It’s starting to feel like these ideas are weighing me down, I find myself dividing my thoughts between all of them, and I want out.

So I’m going to put these ideas here, for all to see, in the hope that it offloads them from by brain. If you like any of these ideas please feel free to take them and develop them. All I ask is that you let me know, as I’d love to see how it turns out. (more…)

Posted in: Programming,Technology by Matt Bearman on 30th December 2011 at 11:19 am
Tags: , , , , ,

Sometimes you have to manage memory in PHP

I’m currently working on a Google maps based project for a client, which deals with large numbers of points and overlays. At one point in the program I was getting around 16,000 Lat/Lng points from the database, which formed 70 polygons. Before the polygons could be rendered on Google Maps, I needed to group the points by polygon in an array. (more…)

Posted in: Programming by Matt Bearman on 2nd December 2011 at 3:53 pm
Tags: , , ,

BugMuncher – The website feedback tool with the silly name

So I’ve just launched a new project, the BugMuncher feedback tab widget, and it’s (as far as I know) the only visual feedback tool for websites.

If you want to know what it does, you don’t even have to go to the site, as I’ve installed it on this very website, simply click the ‘feedback’ button at the bottom left of any page on this site, and you can see BugMuncher in action.

I’d love to hear what you think, either in the comments or by using BugMuncher, after all, that is what it’s there for.

– MB

Posted in: Programming,Technology by Matt Bearman on 17th July 2011 at 9:18 am
Tags: , ,

Fork Me!

…on GitHub.

So I’ve just set up a GitHub account and put a couple of little projects on there, I’ve always been an SVN man, so bare with me while I’m still getting to grips with Git.

My GitHub account is https://github.com/mattbearman I’ll be adding a lot more to it in future, so be sure to keep an eye out.

- MB

Posted in: Programming by Matt Bearman on 5th May 2011 at 6:18 pm
Tags: , , , , ,

PHP Convert Array to Object

Just a quick one today, I’ve seen a few people asking how to convert an array to an object in PHP. All the responses to these questions seem to involve creating a recursive function to loop through the array and create corresponding properties in a stdClass for each key in the array.

There happens to be a MUCH simpler way built in to PHP from version 5.2, all you need to do is this:

$object = json_decode(json_encode($array));

This works because when you encode an array using JSON in PHP, non-numeric keys become object properties, so when the JSON string is convered back to an object, the new properties remain instead of being turned back into array keys.

Give it a try, it works perfectly.

- MB

Posted in: Programming by Matt Bearman on 27th April 2011 at 11:41 pm
Tags: , , , ,

Six ways to protect yourself from SQL Injection

There’s been a  recent resurgence of SQL injection themed tech news as of late, including a Welsh Government site that was aparently try to protect itself with JavaScript, and the SQL homepage it’s self falling pray to an injection attack.

In the last few years I’ve learned a lot in this area and I thought I’d share my knowledge with the world. I realise there are other, possibly better techniques than the ones I list here, and I’d love to hear about them in the comments. (more…)

Posted in: Programming,Technology by Matt Bearman on 29th March 2011 at 10:53 pm
Tags: , , , , ,

PHP Super Accessor

I’m currently working on a little project using the twitter api, and part of it involves an object for tweets. Each instance of the tweet object has properties for ID, screen name of the author, the tweet text, time stamp, author’s profile picture, and the tweet it was posted in reply to. (more…)

Posted in: Programming by Matt Bearman on 1st October 2010 at 11:57 pm
Tags: , , ,

How to install Zend framework with XAMPP

I, like most web developers, use the excellent XAMPP to develop and test PHP/MySQL websites and applications on my local machine. The problem is the XAMPP doesn’t come with the Zend framework installed by default.

If you want to develop with Zend, you could always use Zend Server CE instead of XAMPP, as Zend Server comes with the Zend framework installed. The downside to that is that the Zend server is not as simple to set up and use as XAMPP, and if you’ve already been using XAMPP, migrating to Zend server can be a real pain in the ass, and you can’t run both XAMPP and Zend server together.

If you google installing Zend in XAMPP, there are many different guides, all of which seem overly complicated. Installing the zend framework under XAMPP is actually a lot simpler than most guides online would suggest, and using the following guide you should be able to run Zend Apps in your existing XAMPP environment in a matter of minutes. (more…)

Posted in: Programming by Matt Bearman on 18th May 2010 at 10:19 am
Tags: , , , ,

Website Design – You’re doing it wrong

I think all website designers like to think they know what’s good and bad in a design, yet if you get a bunch of us together we’ll disagree on a lot of things, after all design is very subjective. (more…)

Posted in: Programming,Rants by Matt Bearman on 27th August 2009 at 2:28 pm
Tags: , , ,
Older Posts »