Worcester Web Group Blog

JSON Decoding Failure in WordPress Migrate DB Pro

On two client websites I had recently run into an error that I couldn’t get to the bottom of with WordPress Migrate DB Pro.

JSON Decoding Failure — Our AJAX request was expecting JSON but we received something else. Often this is caused by your theme and/or plugins spitting out PHP errors. If you can edit the theme or plugins causing the errors, you should be able to fix them up, but if not, you can set WP_DEBUG to false in wp-config.php to disable errors from showing up. (#144)

ajax_migrate_table was expecting a valid numeric but got something else: “{“wpmdb_error”:1″

This message appeared immediately (or within the first 5 seconds) of a migrate, preventing me from pushing or pulling from remote, stage, and local.  The error normally appears when there is a blocking issue with a plugin, but even removing plugins using WPMDB’s compatibility mode did not solve the issue.  I had also tried deactivating themes thinking that could be part of the problem, even though my activated themes did not have any errors.

Turns out the issue is with incompatible versions of MySQL where one environment will support utf8mb4 encoding and the other does not.  Normally, this would give you a more descriptive error, but for whatever reason, there is a bug with WPMigrateDB Pro 1.5.1 that prevents the helpful error from displaying and gives you that unhelpful error above.  If you do have this error, you should update your instance of MySQL to the latest to ensure that both remote/stage and local support utf8mb4 encoding.  If you do not have access to update MySQL or maybe it’s not your specialty, there is a patch for WP Migrate DB that does the trick.

Thankfully, the Jeff from Delicious Brains shared a patch for getting around this error that should get you by until an update for the plugin is out or you can fix your instance of MySQL.  The patch has been added to his gists page in github.  If you have experience creating wordpress plugins, jump right in and install this, but if not, it shouldn’t take long if you follow the instructions below.

Instructions for installing:

  1. On the Gists page click “Raw,” and copy out the raw code.
  2. Open a text editor (SublimeText, TextMate, or even Notepad will do) and paste the contents of the raw gist into this file.
  3. Go to File -> Save, and save this file as something like wp-migrate-db-pro-tweaks.php
  4. Connect to your server using FTP, and navigate to your /wp-content/plugins/ directory.
  5. Create a new folder called “wp-migrate-db-pro-tweaks” and then upload the file you just created, wp-migrate-db-pro-tweaks.php, into this directory
  6. Now go to your website’s Admin panel, navigate to the Plugins page, and you should see this new plugin appear in your plugins list.  Click “Activate”

Once activated, your migrations should start working again.

The PHP file here has a lot of tweaks that may be absorbed into a full future release of WP Migrate DB Pro, so if you’d like to just focus on the tweak that resolves with uft8mb4 encoding issue, you can use this snippet alone:

/**
 * By default WP Migrate DB Pro will abort an attempt to go from utf8mb4 to utf8 in case of data loss.
 * Return false for the wpmdb_abort_utf8mb4_to_utf8 filter to override this.
 * @see https://deliciousbrains.com/wp-migrate-db-pro/doc/source-site-supports-utf8mb4/
 *
 * @param bool $abort_utf8mb4_to_utf8
 *
 * @return bool
 */
 function abort_utf8mb4_to_utf8( $abort_utf8mb4_to_utf8 ) {
 return false;
 }

Drop a comment if you have any issues.

Madden 16 Framerate & Clearing the Xbox One Cache

EA Sports’ Madden NFL 16 came out on Xbox One this past Wednesday as part of the EA Access early release system.  While the game has a number of improvements, many players have had issues with framerate, myself included, as the game ran deplorably on release.  Fortunately, this problem seems to be an issue introduced by installing the game from EA Access and can be easily solved by clearing the Xbox One cache.

Xbox One does not have any menu or setting to clear the cache, but you can still do it by following these steps.  This only takes a minute or two and, don’t worry, you do not lose any game save data, games, or anything else.

Follow these steps to clear the Xbox One Cache:

  1. Shut down the Xbox by holding the power button on the console for about 10 seconds. This powers the console down.
  2. Wait 5 seconds
  3. Unplug the power supply
  4. Press the power button on the Xbox 2 or 3 times (sounds crazy but it discharges the CMOS battery inside the Xbox that prevents surges) while the power supply is unplugged
  5. Plug the power supply back in, wait about 5 – 10 seconds for the light on the PSU to turn to yellow
  6. Press the power button on the Xbox One and it’ll boot up (Boots a little longer than usual)

That’s it!

Now, when you boot up Madden 16 you’ll notice that the game runs how it should, which is about the same as Madden 15 (reportedly, 60 FPS mostly pretty steady).

Shoot a comment if you have any questions.

Preserve Uber Service in Worcester

I recently signed a petition to preserve Uber in Worcester.  This is the letter that I attached to it.

Since Uber has become available in Worcester, my friends and I routinely use the service for nights out when we know that we’ll be having a couple of drinks. While cabs have provided this service in the past, there is a growing chasm between the kind of service that people expect and the lack of service that Worcester’s primary cab companies, Red & Yellow Cabs, provide. On busy Friday and Saturday nights, the cab companies occasionally do not pick up the phone or promised cabs simply don’t show up. Admittedly, this has only happened maybe a half-dozen to 12 times in the 10-years that I’ve been taking cabs when going out, but the result is that you simply can’t trust the cab companies to reliably pick you up, and that causes you to pause when going out and think “Are we going to be able to get a ride home from a cab company tonight?”

Uber does not have this issue. In two years, I’ve taken Uber scores of times with friends and because of the technology behind the service, you at least know if a driver is going to take 5, 10, or 15 minutes to pick you up — something that isn’t available at any of Worcester’s cab companies. Beyond that, the cars are nicer, the drivers tend to be more professional, and you are assured an upfront price at the end of your trip with some recourse (the review system) if something does not work out (which, by the way, every ride from an Uber driver has been perfect, a far cry from the cab experience in Worcester).

Further, Worcester has a non-existent public transportation system that only serves working people during the workweek. The WRTA bus doesn’t run on the weekends (and even if it did, the routes are circuitous and serve a fraction of neighborhoods in the city), so if you had any hope of taking the bus on a night out, that chance is lost. For this reason, Uber serves as a reliably method of nearly-public transportation, something that simply isn’t available in the city.

Uber (and others like Lyft) have also introduced the conversation of improving our cab systems in cities like Worcester, something that had never been a topic of conversation before Uber appeared. Now, you have cab companies saying that they’re going to introduce mobile apps and streamline their payment systems. Prior to Uber being in Worcester, only a fraction of cabs even took cred cards in the city and why would they? There was no motivation to change because they held a complete monopoly on paid drivers.

Finally, is the opportunity for drivers. Every Uber driver I’ve ever hired has liked the work — they’re friendly and courteous, professional and take their work seriously. I can’t imagine a single reason why legislators in Massachusetts would be against independent job growth and citizens being able to supplement their income by providing a service that is sorely needed.

Beyond the reasons to preserve Uber service in cities like my hometown, Worcester, is that the arguments against it are assinine. Cab companies and their advocates have argued that traveling in a cab is safer than Uber because of the cab inspection system. This is ludicrous. There is not a single chance that a 2001 Chevy Impala or 2000 Ford Taurus, the typical cabs that pick you up in Worcester, are more reliable or safer cars than my last Uber ride which was in a 2013 Acura TL. Cab companies have been quick to point out the absurdly few examples of abuse by Uber drivers around the world, focusing typically on service in countries like India (which few seem to recollect that these countries have torrid records of abuse within public transportation systems, lest we remember the Dehli bus gang rape in 2012), and have held those small examples up as reasons for why Uber is not safe. This, again, is absurd. Now, I have had many safe, professional rides with cab drivers. However, I — and everybody who routinely rides in cabs — have also had clear examples where drivers were noticeably intoxicated, operating a vehicle when they shouldn’t (for instance, days without sleep), or other noteworthy incidents when the drivers seemingly didn’t have a command of the rules of the road. Admittedly, these circumstances are rare, but I’m more likely to trust the system that has a predictable way for me to self-report driver abuse — which Uber has — versus the system where your feedback would probably go unanswered, unheard, and forgotten.

Despite these myriad reasons, I think the most important one is the service that Uber provides in a city like Worcester which has a clearly deteriorated cab service and a non-existent weekend bus service. Uber is providing the public service that the city is unwilling to provide, and it does so in a professional, reliable, convenient, and above all affordable way.

Sincerely,
Mike Murray
Worcester, Ma