Blog

Returning a list of array keys in MongoDB

Here’s how I return a list of keys from an associative array (i.e. an embedded document) without also returning their value. The data structure I have is shown below. It’s made up of an associative array [friends], which contains a set of keys (Twitter usernames) and values (details about the user). My aim was to return a list of the Twitter usernames, without all of the details associated to them which – in some cases – could be quite a […]

Latency between Amazon Web Services Regions

Recently I’ve had to spend quite a bit of time working out which of the 5 Amazon regions is best positioned for various services I’ve been setting up. As part of this I measured the latency between each of the Amazon regions. For anyone who’s interested – here are the results. Note: For ease of reading I’ve including all measurements under each region. Half of the data will therefore be duplicated as I’ve assumed (rightly or wrongly) that EU-West -> […]

Adding my “3rd party” module into /vendor in Zend Framework

This wasn’t initially obvious to me, but when creating a generic module to use across multiple Zend Framework 2 projects (thus putting it in /vendor) you can include a Module.php file in the root of the module’s directory to make registering the namespace with Zend’s StandardAutoloader simple. (I had assumed this was just how it worked under the /module directory). So for example – I have a module with the namespace ‘Nas’, so I store it under: /zf2/vendor/Nas And then […]

Facebook PHP SDK Zend Framework 2

In ZF1 I would generally include 3rd party API wrappers (Facebook, MailChimp, Google, etc) in Bootstrap.php using something like: 1 2 3 4 5 6 7 8 9 protected function _initIncludes(){ include_once( ‘MobileDetect/Mobile-Detect-2.php’ ); include_once( ‘Facebook/php-sdk-v3.1.1-27/src/facebook.php’ ); include_once( ‘Google/google-api-php-client-0.5.0/src/apiClient.php’ ); include_once( ‘MailChimp/MCAPI-1.3.class.php’ ); } //_initIncludes Facebook PHP SDK Zend Framework 2 However there isn’t really anywhere appropriate to ‘include’ things this way in ZF2. Ideally we want to include the 3rd party class in the (/all) module(s) that actually use […]

Youtube

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper leo eget sapien ultrices vitae facilisis massa dictum. Fusce eu purus a urna accumsan luctus. Nullam sit amet nisi non ante ultrices egestas. Proin erat nulla, congue adipiscing accumsan id, sollicitudin eget dolor. Vestibulum ipsum urna, consequat vel cursus ut, scelerisque vel nisl. Suspendisse molestie facilisis dui, et rutrum enim fermentum id. Curabitur tincidunt tellus sed risus vulputate fringilla. Mauris luctus posuere odio, quis viverra purus consequat ac. Aliquam luctus […]

Vimeo

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam semper leo eget sapien ultrices vitae facilisis massa dictum. Fusce eu purus a urna accumsan luctus. Nullam sit amet nisi non ante ultrices egestas. Proin erat nulla, congue adipiscing accumsan id, sollicitudin eget dolor. Vestibulum ipsum urna, consequat vel cursus ut, scelerisque vel nisl. Suspendisse molestie facilisis dui, et rutrum enim fermentum id. Curabitur tincidunt tellus sed risus vulputate fringilla. Mauris luctus posuere odio, quis viverra purus consequat ac. Aliquam luctus […]

This is a link

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus blandit porta tellus non vulputate. Nam in nulla ut augue bibendum aliquet eget eu velit. Suspendisse non ligula sit amet felis volutpat hendrerit eu ac odio. Etiam elementum dui vel libero laoreet sagittis. Vestibulum ac elit orci, et cursus mauris. Nulla vehicula lorem odio. Mauris vel mauris justo, sed adipiscing neque. Nam ipsum dolor, congue ac vestibulum eget, luctus nec ipsum