Many times you can trace a bug back to a particular code change that was made. Or maybe it was caused by a package upgrade. But have you ever had something break when no code changed at all? How does that happen?
I have the habit of picking up a new programming language or two each year, not necessarily to master them or even to write production code with them, but just to be exposed to new approaches to familiar problems. For the last few months, two friends of mine have been urging me to try out Go, a relatively new language from Google. Since I had a 17-day vacation planned in Florida, I decided to give Go a try while I had abundant free time.
This week, I finally blocked some time to seriously investigate Vagrant and Puppet. The documentation for both tools is decent.
Taking the knowledge I gained from reading through the “Quick Start” documents, my next logical step was to spin up my own custom development environment for local usage. I quickly ran into some issues and wanted to enable the “debug” mode of Puppet. Since I’m not calling Puppet directly, it’s not as easy as tacking on a --debug option to the puppet command line. Instead, I need to tell Vagrant to run Puppet in debug mode, using the Vagrantfile.
My preferred workflow is to be able to push changes into production using git. However, sometimes the project/server doesn’t support this (yet).
In these scenarios, it is very useful to be able to see which files have not yet been pushed to origin. Here is a nice one-liner that does exactly this:
Date and time manipulation is an area of programming that seems relatively simple on its surface, but lots of danger lurks just out of view. How hard could it possibly be to take a date/time and add 1 day to it? or 1 week? Piece of cake, right? You might do something like this:
$eventTime = strtotime('2011-09-15'); //add one day to the date $newEventTime = $eventTime + (24 * 60 * 60); //expects 2011-09-16 and will USUALLY work echo date('Y-m-d', $newEventTime);