Over the weekend I was migrating several of my sites over to an nginx-based VPS.  Whilst the migration itself seemed to go fine, I was getting a weird issue with the WordPress admin where the styles and javascript was not fully loading.

After inspecting the requests with the Firebug Console, I saw that the culprit was the request:

/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,plupload&ver=4.2.3

I tried the normal fixes such as checking permissions, updating everything, and even reinstalling WordPress but to no avail.  Then I started looking on Google for a potential fix and found this article which not only provides the solution, but also a detailed explanation of why the error occurs in the first place.

As soon as I made the recommended updates, all the sites started working properly with no issue whatsoever.

Full credit goes to the article author.  Just posting here for my own reference more than anything else!

UPDATE: As the original article no longer exists I’ve posted the instructions below:

It turns out the solution to this is quite simple. Nginx and php-fpm need to run as the same user and the directory /var/lib/nginx needs to be owned by that user. Personally I like to run all my web-related services under a www-data user, but running it under a nginx or apache user is also common. To change the user nginx runs under, edit the main nginx config file usually located at /etc/nginx/nginx.conf:

user www-data;
worker_processes 4;
pid runnginx.pid;

Now to change the user php-fpm runs under we need to edit its config file. On my Amazon Linux system this was located at /etc/php-fpm.d/www.conf while on my old Debian setup it was located at /etc/php5/fpm/pool.d/www.conf. There are two user-related settings in the config file. First, if php-fpm runs as a socket (as opposed to listening on a port), the user and group owner of the socket should be set to the same user as nginx so that nginx can access it to run php files. This is not relevant for our error, but can cause other issues if nginx doesnt have permissions to access the socket. Second, the user and group that the php-fpm process runs under needs to be the same as nginx.

    user  = www-data
    group = www-data
     
    listen = varrunphp5-fpm.sock
    listen.owner = www-data
    listen.group = www-dataL

To change the ownership of the nginx lib directory simply run the command chown -R www-data:www-data /var/lib/nginx as root (sudo will do on most systems). Finally, if we edited any config files, we need to restart the appropriate services for the changes to take effect. On most systems this can be done by running service nginx restart or /etc/init.d/nginx restart as root. For php-fpm the service name is php5-fpm.

Introduction

This year I’ve decided that I want to learn at least one new language and have decided that I’ll be learning Ruby.  I’ve read great things about Ruby and Rails, all about how it’s made development fun again for devs, lets you actually get on with creating responsive web applications and is generally just so awesome.  I’ll be writing up everything I discover, whether it’s finding things which are much easier than their PHP alternative, or getting frustrated by the fact that I can’t figure out how to do something I’d normally consider trivial in PHP.

Part I is based on me setting up Rails on my local Windows machine and then spending a couple of hours working my way through the Getting Started tutorial.

Ruby VS Ruby On Rails

One of the first things I asked myself was, “am I learning Ruby or Ruby on Rails?” and went off in search for an answer, which was “both”.

Ruby is the language.  Rails is a framework written in Ruby which makes creating web applications really easy.
So me learning Rails is actually me learning how create Rails applications in Ruby.  Got it?

Setup

The setup of Rails itself wasn’t too bad.  I just downloaded the Windows installer from Ruby Installer and the DevKit from the same site, which allows me to compile and use gems natively.  That was it for Rails installation, simple enough.

MySQL Setup

To create my first application I simply fired up Netbeans, which is my IDE of choice, and created a new Ruby on Rails Application.  This was pretty cool, except for the fact that I couldn’t get MySQL working.  I have MySQL running locally as part of WAMP, but installing the mysql gem for Ruby wasn’t enough.  Whenever I tried running the app it’d complain and quit.

I started looking up solutions, and spent a lot of time searching for people with similar issues, but no matter what I tried I couldn’t get it working.  I spent at least an hour looking for a fix and got really frustrated, it was quite a dark time, however I kept looking and finally found this solution on how to install MySQL on Windows 7 64-bit with Ruby.  The tutorial was simple to follow, and as soon as I’d finished my app started working, good times.

Hello Ruby

Now that I had Rails setup and installed on my machine, it was time to start learning how to build things.  I went to the getting started tutorial and worked my way through it.  As I worked through it I spotted a LOT of things which seemed to make me love Ruby, and lot of things which went well and truly over my head.

Things I Loved

  1. Sprockets – In your application directory, Rails has assets directories for JavaScript, Stylesheets and Images.  Whenever you use the CLI to create a new controller, it creates new .scss and .coffee files with the name of your controller.  This means that you can separate out all the style and scripts for each component of your site really easily.  Rails then compiles your Sass and CoffeeScript files when your run your application into a single CSS and a single JavaScript file.
  2. Response types – it was so stupidly easy to return content in a specific format based on the URL extension.  For example:
    myurl.com/posts – would be the expected HTML output all my blog posts
    myurl.com/posts.json – would route to the same controller and action, but return all the blog posts as a JSON string
    myurl.com/posts.xml – all the posts but now as valid XML
  3. Rails IS an MVC framework – Rails is built to be an MVC framework.  The moment you generate your first app (easy as: `rails new myappname`!) it creates a base application which follows the MVC pattern and easily allows you to extend it into your own.
  4. Syntax that “just makes sense”– here’s a sample of a Model in Ruby:
    class Post < ActiveRecord::Base
      validates :name,  :presence => true
      validates :title, :presence => true,
                        :length => { :minimum => 5 }
    
      has_many :comments
    end
    It amazes at me at how much you can understand just from looking at the class declaration.
  5. It’s So Simple – whilst you could argue that I now have the benefit of a few years PHP experience, I still remember that when I first started with PHP, which was my first web language (I’d done Java and C++ before), I spent a whole summer just going over the basics and working my way up to creating a blog as part of working through a book.  In fact, the blog was pretty poor an lacked a lot of key features like security and it was done in procedural programming.  It wasn’t until about a year into PHP that I started working with frameworks and OOP properly.  In comparison, it took me just a few hours to go from “I want to learn Ruby”, to having a working blog application using MVC conventions.

It’s Over My Head

When I said there were a few things that went well over my head, well…I lied, it was basically just the syntax.  Whilst in some cases the syntax made a lot of sense, in other cases I was getting really confused e.g. when they were generating forms in the views and I had no idea what the hell was going on.  At the time I decided the best thing to do was to carry on the guide and then go through everything and look up the bits I didn’t get.
This is actually as far as I’ve got to date, but see the next section on how I intend to learn the syntax.

Where To Next?

Whilst I’ve completed the basic blog tutorial, the next step is to learn how to make a full web application.  I’ve looked around and found that the book Agile Web Development With Rails is THE book to learn Rails with according to a lot of people.  I managed to find an early edition at work today and have brought it home to start looking through for the rest of this evening.
The book has an appendix which contains a quick-start guide to the Ruby language and syntax so I’m going to start with that to understand the things from the blog tutorial which I didn’t quite get, and then make my way through the book which should also clarify some of the things for me.

Verdict.

Simply put, I think Rails is ACE.  So far it’s been great.  Whilst there’s some bits I don’t quite get yet, well what can you expect, it’s been about 3 hours so far!  Overall it seems to be a very powerful framework which not only enforces but also simplifies the best web programming conventions.  Lovin’ it.

This post is a copy of an email which I sent to Fractal this morning.  After reading over it, I decided that it made a pretty good review too, so here’s me sharing it with you!

Hi there,

I just wanted to take some time out to provide you with feedback for one of your products which I recently purchased.

I was in the market for a new case, and was looking for something which would reduce the amount of noise produced by my machine.  My previous build was ridiculously loud, with noise coming from all the fans, hum of the hard drives and occassionally a random clicking which I never figured out where it was coming from…needless to say this was very frustrating and so I decided to start looking for a new case.

Looking back over the years, my average budget for a case is £30, sometimes I spend less (I’ve had a £10 case which was perfect for me and lasted years) and sometimes I spend a little bit more; I bought an Antec 300 which lasted about 2 months before the power button broke off.

This time I was so desperate to get a case that would be as close to silent as possible, that I decided that I’d be willing to extend my budget significantly to pretty much double what I usually pay.  Whilst looking around on the eBuyer website I came across a couple of your cases and what drew me in to find out more about your brand and to take a closer look at your products was the simplicity in the design of your cases.  After reading more into it, checking out out some reviews and quite a long time debating with myself whether I was ready to part with so much money for a computer case, I chose to purchase the Fractal Design Define R3.

From what I’d read, this case has been just optimised for noise reduction, from Hard Drive pads, absorbing material, ModuVents and I’d even heard good things about the fans included.  On top of all that, it had plenty of space to house all the components that I have in my PC.

When I received it, I was thoroughly impressed by the build quality, the looks and just from the amount of space inside, not to mention how well organised it was!  After putting it all together, getting the cabling all nice and tidy I turned my PC on for a test drive.

Unfortunately, this was the point when I became so disappointed with it that I honestly wish I’d just stuck to the cheap cases! At least when I pay less for something, I’m not really surprised when it has issues, but I had so great expectations from the Fractal case which I was happy to spend £80 on for its features it was a massive let down and feels like a great waste of money.

The noise coming from the PC was almost as bad as what my previous case sounded like.  After investigating the source of the noise, I found that whilst the hard drive pads had eliminated the hum, the noise was actually coming from the rear fan included with the case.  When I realised then I was very surprised considering that most reviews say that the fans with this case are supposed to be superb, but after verifying that the fan was causing the noise by temporarily disconnecting it..well I knew better at that point.

For the time being I’ve left the fan connected but from the amount of noise it creates it’s only a matter of time before I give in and end up spending even more money on a new fan.

I’ll end up keeping the case, other than the noise it’s pretty much perfect and the build is incredible.  With the fan disconnected, I’ve found that the computer makes pretty much no noise, so well done on the noise reduction techniques.  The only thing which let the entire case down is the fan which creates such a racket that it renders the rest of noise elimination features useless.

Regards
A very disappointed customer.

This guide shows you how to watch video files on your LG 32LD450 using a Kameleon URC-8204 All-In-One remote.

Requirements

  1. Compatible LG television (e.g. LG 32LD450)
  2. Kameleon All-In-One Remote

Setting Up The Remote

Only do these steps if you haven’t configured your remote to work with your TV yet!

  1. Hold down the Top Hat button for a few seconds (a rabbit will appear out of the hat)
  2. Press the Search button
  3. Press the Television icon
  4. Point the remote at the television and press the Channel – button until your television responds – mine came up with a message saying “Function not supported at this time”.  As long as the television responds it’s good as it means the remote is communicating with the TV.
  5. Press Esc to return to the normal remote mode and you’ll find you can now use this remote with your TV

Instructions to Unlock Video Feature

  1. Hold down the Top Hat button on your remote until the rabbit appears out of it
  2. Select the Keymagic option
  3. Press the Television icon
  4. Press the Top Hat button (just press, don’t hold!)
  5. Enter 00018 on the number pad
  6. Press the A key at the bottom of your remote
  7. At this point you’ll notice the top of your remote pulse a couple of times which means the shortcut for the service menu has been set
  8. Press Esc button
  9. Press the A key at the bottom of your remote
  10. You’ll be prompted for a PIN.  Enter 0413 (if that doesn’t work try 0000).
  11. Using your LG remote, go down to Tool Option 3 and select the DivX option.  Set it to 1
  12. Use the back button to exit the menus.
  13. When you go to the Input menu and select USB, you’ll now notice an option for Movie Playback!

This method is also known to work on the 42 inch version (LG42LD450).

If you don’t have this particular remote then other One For All remotes and Harmony Remote Controls will also do the same trick but with slight differences to the method in terms of button labels.