Joined July 2012
·

Nathan Malcolm

Software Engineer at MyBB Group
·
United Kingdom
·
·

Posted to HipHop PHP [HHVM] with subdomains over 1 year ago

@jtreminio I'm sure you can gather from the rest of that sentence, and the marvelous contributions Facebook has made to the open source community, that it was purely a joke.

Posted to HipHop PHP [HHVM] with subdomains over 1 year ago

I've updated the Pattern for checking for a www subdomain. The previous one... didn't exactly work.

This has already been shared, but it's good nonetheless. :)

https://coderwall.com/p/-t2lwa

Posted to Multi-threading in PHP over 1 year ago

@ichiriac I am aware of that (Hence the 'fork' tag), but my main reason for using this rather than other solutions (i.e. the threading extension you linked to) is because:

1) It doesn't require any server side changes.
2) CPU/memory isn't an issue in the environment I run it in.

I was referring to a large amount of data as the amount of data of the combined forks handles. 20 forks will perform 20x the work of one worker which is what I required. It's not the most efficient way, but it works, and it works nicely.

As per the original article:

Since threading it’s not available in PHP, I’ve emulated the threads with child processes which are available in php. A thread object simply encapsulates a new process started with pnctl_fork() and emulates – to some extent – the behaviour of the java.lang.Thread class ...

Ah, the joys of trying something new. :-)

@darkmantiscs I completely agree. The results can vary from environment to environment but when you're shipping code, for say, an open source project, these can come in handy as it'll be run on many different versions of PHP, OS, etc... so it can give you a rough estimate. From there you can make an informed choice of which functions and constructs to use.

Posted to Get external IP with CLI over 1 year ago

A new addition to my .bash_aliases ;)

alias myip='curl ifconfig.me'
Posted to New Webmaster Protip over 1 year ago

"Their stats only come from people who use their toolbar."

That is actually incorrect. I have never used the Alexa Toolbar, but when I added an unregistered domain name to my hosts file for local testing, after a few days of browsing that domain during work the domain did have an Alexa rank. It had a very high rank, in the 22,xxx,xxx range but it does prove that Alexa doesn't just use it's toolbar to collect statistics. Alexa also state on their help page they use other sources too.

http://www.alexa.com/help/traffic-learn-more

"The traffic rank is based on three months of aggregated historical traffic data from millions of Alexa Toolbar users and data obtained from other, diverse traffic data sources, and is a combined measure of page views and users (reach)."

I do agree that Alexa rank isn't a suitable way to measure either a site's worth, traffic, or statistics, as after all it can easily be manipulated, but it does depend on certain conditions. I would only consider Alexa a suitable source of statistics for websites within the 10,xxx range. Below the 1xx range and you're really getting accurate.

Posted to High Performance MySQL with Percona over 1 year ago

@euantor I've never personally tried MariaDB, but there are some interesting statistics regarding Percona vs MySQL here: http://www.mysqlperformanceblog.com/2012/02/23/percona-server-vs-mysql-on-intel-320-ssd/

If I can find any Percona vs MariaDB specific statistics I'll be sure to pass them along. :)

Posted to Perfect Workflow in Sublime Text over 1 year ago

@darkmantiscs No problem, this was the series which really got me interested in using Sublime Text. I highly recommend it to anyone looking to increase their productivity. :)

Posted to Frameworks save time, usually. over 1 year ago

I highly recommend Laravel. There are times where building an in-house solution is best but a third party framework can reduce development time dramatically.

Posted to Securing memcached servers over 1 year ago

@euantor On larger sites it can be a regular thing. For example, one piece of software I run on my server which is updated daily requires a web server restart otherwise it cannot perform the schema upgrades to the database.

It also happens under certain circumstances which you may not be aware of, for example on a handful on distros when you rotate log files Apache will restart itself on each rotate. If you're dealing with a lot of traffic under Apache, chances are it'll restart quite often.

Posted to Securing memcached servers over 1 year ago

@euantor Indeed it can, but even though memcached has been developed for distributed environments it does has its advantages on a single server too.

Also related; A snippet from an article on the MySQL Performance Blog:

APC will be great for caching small but frequently accessed things which are not taking too much memory. For example if you store list of states in the database you can cache it this way.

Memcached is good for caching things which take large amount of space combined and which you only need to fetch few per page. For example search results may be good candidate (assuming we want to cache them and want to cache them in memory).

APC and memcached both work in different ways and therefore have different advantages and disadvantages. For example, as APC is a PHP extension as soon as you restart your web server the cache will be emptied. With memcached, as long as the server is running (And you don't run out of memory or have a TTL set for the data) the data will always be available so there's no need to recache it each time the web server is restarted.

On larger sites you clearly don't want to have your total cache cleared - at least not in most cases. That's why I tend to use memcached in my projects while leaving APC to work in the background. :-)

Posted to Securing memcached servers over 1 year ago

@euantor I use them both. APC, as an opcode cache, increases performance even without using it in your applications whereas memcached is great for storing data, as it implies, in memory. :-)

Very nice article! Working with open source projects myself I can relate to many points the author has made, especially regarding cutting out distractions. It's not always so easy but it does dramatically improve both my work and the time it takes to get what I need done. :-)

Posted to Block spammers automatically in nginx over 1 year ago

@euantor Sharing is caring. ;)

Posted to Multi-threading in PHP over 1 year ago

@euantor Indeed, although for a more stable solution I would suggest taking a look at Zend Server Job Queue ( http://www.zend.com/en/products/server/zend-server-job-queue ). The method above is far from perfect but it gets the job done. A solution is a solution nonetheless. :)

Achievements
1,111 Karma
104,902 Total ProTip Views