June 30, 2015

Installing Sonar Source on Mac OSX – Part 2

I had some notes a while ago for installing Sonar on a Mac. Recently I upgraded to a new Mac, OS X Yosemite (10.10.3), and found I needed to add a few steps to the install process. You need the JDK to run Sonar You need xdebug xdebug To install xdebug run: sudo pecl install xdebug Then add to your php.ini the following (I just added it to the bottom), replace the version in the path with whichever you installed: ... Read more

May 29, 2015

Disabling the Flash plugin for testing

Sometimes you want to test things without the Flash plugin enabled, using Chrome this is nice and easy! Just type chrome://plugins/ in the address bar to open the Chrome plugin settings page. Should look something like: Note the Adobe Flash Player on the last line, just disable that and you’re good to go. Don’t even need a browser restart, just a new tab. You can test this using Adobe’s Flash Player Help page

May 17, 2015

Installing VirtualBox Guest Additions

Currently I have VirtualBox 4.3.18 installed on Mac OS X Mavericks. I recently downloaded several Windows 7/8/8.1 images from either modern.ie or MSDN, and I wanted to install guest additions as well so I could do things like: change the size of the guest window turn on bidirectional shared clipboard add shared folder(s) etc There is a handy menu option to do this from the VirtualBox VM menu: ... Read more

May 6, 2015

Opening .eml files on a mac

More and more I’m getting emails from clients with .eml attachments. These are generally email messages created by Microsoft Outlook and may contain their own attachments (files or images etc). The issue for me is that I don’t use Outlook…but I still need to find a way to open them, ideally a way that includes accessing the original attachments. Luckily there are a several options, including (first download the eml file): ... Read more

December 16, 2013

Simple JSON prettify

I went looking for a quick and easy way to style JSON content for display in the browser and quickly came across this answer at stack overflow with a corresponding jsfiddle entry. However the problem is that this is kinda broken, the output isn’t valid JSON because the keys aren’t quoted. It’s just outputting a JavaScript object intead. A quick fix (and slight refactor) to the JavaScript gave me what I needed, I couldn’t post on SO as I don’t have the reputation (yeah that’s annoying) so I’m posting here for reference and I forked the original JSFiddle. ... Read more

June 22, 2013

Careful using PHP array_merge

Using array_merge bit me today when I merged an array (which happened to be empty) with a numerically indexed array. Because the array I was merging was empty, I expected my other (numerically indexed) array to remain untouched. However that wasn’t the case, from the docs: Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array. This meant that the following array keys went from being their constant numeric values, to 0, 1, 2, 3: ... Read more

June 21, 2013

PHP ['SCRIPT_NAME'] returning empty string

I was working with Slim (v2.2.x) the other day and saw that a PHP warning was being thrown in one of the interal Slim files: Warning: strpos(): Empty needle in /vendor/slim/slim/Slim/Environment.php on line 143 The code throwing the warning was the following if statement: if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) { The actual issue was that $_SERVER['SCRIPT_NAME'] was an empty string, so strpos was complaining as that is invalid syntax. ... Read more

June 19, 2013

Problem dumping MySQL database - Unknown system variable 'GTID_MODE'

I was trying to dump and restore a MySQL database today, but received the following error when I tried to dump: mysqldump: Couldn't execute 'SELECT @@GTID_MODE': Unknown system variable 'GTID_MODE' (1193) The MySQL version of the database I was trying to dump was 5.5.28 and the server I was trying to restore into was 5.6.10. A quick google told me that the error was likely due to this mismatch in versions. ... Read more

June 13, 2013

INI Syntax Highlighting in Sublime Text

I went searching for a package to provide syntax highlighting for INI files in Sublime Text. The reason? INI files are ugly ;( I found one that works well called sublime-text-2-ini. Installation isn’t done via the package manager, but it’s still simple. Open a terminal and navigate to your Sublime Packages folder, then clone in the package from github. cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/ git clone git@github.com:clintberry/sublime-text-2-ini.git ./INI That’s it! ... Read more

June 8, 2013

Error writing git commit messages with vi

I typically write my git commit messages in the terminal, but today I wanted to write a multi-line comment so I left out the -m argument to git commit so it would open up my default editor, which is vi: git commit I wrote my comment, saved and exit but got an error: $ git commit error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option. ... Read more

© Michael Sharman 2017