Developing software in the Real World

Converting databases between MySQL and SQL Server

I regularly deal projects that target SQL Server, but mostly develop against MySQL to avoid having to run a full Windows stack locally all the time. One of the nice things about PHP with DBAL and Migrations is that the database is pretty well abstracted from my code. Of course, this means that I don't target any of the specialist features, but for these projects, this hasn't been an issue. To convert data from SQL… continue reading.

Jerry-rigging pygments to support new PHP keywords

I use rst2pdf to create my presentations and noticed that the syntax highlighter wasn't highlighting instanceof. rst2pdf uses pygments for syntax highlighting, so I wondered what was going on. A short investigation led to me realise that the current stable version of pigments is 1.6 and they are working on 2.0. It seems that 2.0 has a number of changes to the PHP lexer, which aren't in 1.6. While I'm waiting, I modified my local… continue reading.

View status of all Vagrant environments

I've just upgraded to Vagrant version 1.6, and vagrant global-status is possibly my favourite new feature. This command lists all currently up Vagrant environments wherever they may be on your computer:

As you can see by the helpful information message, you can then pass the id to any of the usual Vagrant commands in order to work with that Vagrant install rather than changing directory first. I tend to use this to halt VMs… continue reading.

Z-Ray for Zend Server 7

I see that Zend Server 7 has now been released. I've been running the beta for all my development work for a while now and the main reason is the new Z-Ray feature. Z-Ray is a bar that is injected into the bottom of your page showing lots of useful information. This is what it looks like in its closed state when run on my development version of joind.in: At a glance, I can see… continue reading.

Styling a Chosen select to fit Bootstrap 3 better

One project that I'm currently working on is an internal business application that's using stock Bootstrap 3. I needed a searchable select box and Chosen fitted the bill, so I'm using that. However, the default styles for the Chosen select box differ slightly from Bootstrap. The most noticeable being the height of the control.

Perl syntax highlighting in Sublime Text 3

I'm currently writing a project in Perl for a client and have discovered that the default Perl syntax highlighting in Sublime Text is terrible. Fortunately, the community has stepped up and Blaise Roth has created the ModerlPerl package. Install via Package Control. To get all Perl files to open with the new syntax highlighter, use View > Syntax > Open all with current extension as… and select ModernPerl from the sub-menu.

Setting up Zend Server 6 on OS X for PHP development

I recently decided to upgrade my Mac's PHP to 5.4. One of the available options is Zend Server 6.1, Free edition. These are my notes how to set it up so that it works the way I develop. Installation Mount the disk image and follow the installation wizard. On OS X, Zend Server installs PHP, Apache and MySQL inside /usr/local/zend. The Zend Server admin interface is at at http://localhost:10081. On first run you have to… continue reading.

Password less command line scripts with MySQL 5.6

I have a number of command line scripts that copy MySQL databases down from staging servers and store them locally. These scripts set the password on the command line using the -p option. With MySQL 5.6, a new warning is displayed every time my scripts run:

This is annoying! The way to solve this is to use the new command line tool mysql_config_editor to set up a "login path" which the mysql command line… continue reading.

Adding Diff syntax highlighting to Sublime Text

My chosen colour scheme for Sublime Text doesn't include support for diff/patch files, so I added my own. To the bottom of my .tmTheme file, I added this just above the closing </array>:

This sets up a green colour for the meta information, blue for added lines, red for deleted lines and a yellowish colour for changed.

Notes on embedding fonts in rst2pdf

I wanted to use Helvetica Light in a PDF that I'm creating using rst2pdf and this proved a little tricker than I expected. Note that to use fonts with rst2pdf, you need to install fontconfig using brew:

Now, on to the problem! In this case, I discovered that setting stdFont: Helvetica-Light or stdFont: HelveticaLight in the style file resulted in Verdana being used in the PDF file! Fortunately, the -v switch to rst2pdf is… continue reading.