husband, dad, steelers fan and software engineer

Some favorite posts to check out:

MySQL Strict Mode on OS X

If you are a web developer on OS X you probably are sporting your own installation of your database server.  If you are running MySQL you might be haunted by strict mode.  MySQL has modes as documented here that effect the behavior of various parts of the system.  In strict mode values do not get casted between types, which is where I ran into issues.  My favorite ORM was passing a boolean true into a tinyint(1) and causing the transaction to abort.  This is thanks to STRICT_TRANS_TABLES in my case.  The first thing I checked was my /etc/my.cnf to see if "sql_mode" was set in the [mysqld] section.  It was not.  So I tried setting it to something other than STRICT_TRANS_TABLES and restarted MySQL.  No luck, the setting was still on.  After a lot of poking around I found out that MySQL for OS X from Oracle ships with a /usr/local/mysql/my.cnf which is loaded on startup. In this file is a sole configuration directive for sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES.  Once I commented this out and restarted the server strict mode was off, my ORM worked and I was happy.

Composer on OpenShift

Yesterday I talked about running composer on Amazon's Elastic Beanstalk.  There it is builtin and works out of the box for you.  If you are on OpenShift (my preferred PaaS) composer does not come out of the box.  Matthew Weier O'Phinney has posted an article on the steps he took to get composer installing his project's dependencies, and that's definitely a worthy read.  However, my deployment hook for OpenShift is a little bit different and I wanted to share that.

There were two things I wanted to accomplish.  First, I did not want composer.phar in source control.  Second, I wanted to take advantage of composer's ability to cache dependencies to speedup my deployment process up.  So here is what I use in my ./.openshift/action_hooks/deploy script:


As a bonus here's a tip about markers... OpenShift will restart Apache and Zend Server with every deployment. You may not want or need to do this. If you don't, simply touch a file to ./.openshift/markers/hot_deply and then next time you push your changes up OpenShift will leave all those services running when it deploys.

Composer on Elastic Beanstalk

Amazon's Elastic Beanstalk is another git-driven deployment service, this time directly to EC2 and RDS instances on Amazon Web Services.  It's similar to what Red Hat is doing with OpenShift conceptually.

If you are a PHP developer like myself your first question is probably, will it install my composer dependencies for me?  The answer is YES.

Here's the kicker, and quite frankly this does not make any sense to me...  If you have stubbed your vendor folder in place, so you've either touched ./vendor/empty or ./vendor/.gitkeep, you are going to have to removed it.  Elastic Beanstalk will use composer based upon the presence of a composer.json or composer.lock file, but if it sees the vendor folder it bails out and doesn't execute the install command. Again, I really don't know why this is and I could not find any documentation about it.  Yet this exactly what I needed to do to get my dependencies installed.

Square Footage

When we first started house hunting in Indiana I was grateful that MLS listed the total square footage of homes. Back in Pittsburgh MLS didn't do this and we always found that a bit puzzling.  In our (original) assessment it was easier to see if a house had the mass we needed for our family based upon this number.

Fast forward and I now realize why it's probably more advantageous to not have square footage on MLS. Having it seems to lessen the requirement for a complete set of room dimensions.  Worse yet, there is no consistent way of doing square footage.

We've seen a lot of places that use the footprint of the house, then multiply it by the number of finished floors.  We've seen places that appear to have legitimate footage values for livable space, but these are few and far between.  We actually saw one place where the sellers had taken the foot print, added that same amount to the total for an unfinished half-basement and then added the same for the second floor that was smaller then the base and then they added the total footage of the garage to it for the size of the bonus room above the garage which turned out to have knee walls and be smaller then the garage. That house's total footage was probably half of what was listed and made for a horrible misrepresentation of the house. It was misleading and confusing.  When livable space is actually the metric being used you often also have to wonder which rooms are being counted or not. Taking a list of houses and comparing them based upon square footage just does not give you an accurate representation of what space is available.

All in all there is just no better trade off then a decent set of room measurements for every livable space in the house.

Naked Domain Workaround

I've become a pretty big fan of Red Hat's OpenShift platform.  I love the idea of doing deployments based off of DVCS operations. Almost two years ago when I was working for Wizzard Software we came up with a deployment process not to far off from this concept.  We were a Mercurial based team so the DVCS system was different, but we basically issuing pull's from repositories on the effected systems and out rolled new software that way.  OpenShift is a whole lot better then that though, because it's push triggered and deploys to the cloud and Red Hat has a bunch of awesome hooks tied in to make it even more powerful.  Did I mention it's FREE?  Yes, free hosting driven by git in the cloud - it doesn't get much better then this!

But what happens if you want to add a custom domain name to OpenShift?  In order to do this you have to do two things, first add the appropriate aliases to your OpenShift application, see here for more information. Second is to edit your DNS records and add CNAME records to point to the OpenShift subdomain for your application.  As with many things in the cloud, IP addresses are ever-changing so you cannot count on them when setting up your domain.  If you're lucky enough to have NameCheap as your registrar this isn't a problem, because they let you add a CNAME record as your apex (not sure how they do this, but just go with it... it works!). If you are on GoDaddy or a similar DNS service (like Route 53) you aren't so lucky.

Fortunately, Satoru systems has a naked domain redirect service over at wwwizer that fills this need.  They basically give you an IP address to use for your A record and their system automatically redirects it to "www.domain.com" where "domain.com" is the apex entry. It's dead simple to use. Best of all, this too is FREE.

As with all cloud systems, you never know how long you can get these services before they are bought out, shutdown or just run out of money, so don't use them with mission critical systems. But if you're a hobbyist or have a pet-project this is a great way to get it out on the web without incurring a lot of costs.

Check out wwwizer's naked domain redirect service.