When I was a kid, maybe 8 years old, I would go to the flea market with my parents a couple of times a year. I had a small allowance at the time and would walk around looking for cool things. One time I saw a broken VCR for sale for $5. It was so cool! I asked my mom if I could buy it to take it apart, and soon I was the happy owner of a broken VCR.
When I got home I couldn’t wait to go at it. I sat in the garage with a couple screwdrivers and did my best to dis-assemble the whole thing. I wanted to know how it worked, and what was inside the box.
The Forge UI is great, and takes away a ton of the pain of server and application configuration. Following best practices, we use environment variables to manage environment specific settings like the database name and credentials. One of the features Forge provides is the ability to automate deployment from your github / bitbucket repo upon a post to a specific branch.
The problem we were having was that our migrations would not run. The error was:
In our case, we are using a non-standard repo directory structure where instead of the typical Laravel app directory structure:
we have another layer above:
Upon inspection of the directory on the server, we found the “.env.php” file was in the base directory. The problem with this was that artisan, the application responsible for Laravel migrations, could not see the environment variables, and so the database configuration was wrong. The solution was simply to move .env.php file into our “laravel” directory so that artisan had access to it.
In a recent project I was trying to create new users with just their email addresses in an instance of WordPress Multisite. To do this, I planned to use the email address as the new user’s username. But I kept getting this error:
“only lowercase letters (a-z) and numbers are allowed”
In case you run into this problem to, there is a solution: the Network Username Restrictions Override plugin. There’s a setting in the plug to allow email addresses for usernames. Click that and you should be good to go.
Here’s another way to solve the same problem that overrides the error that pops up if you try to use an email address as a username in WordPress Multisite. It attaches a custom filter to the the ‘wpmu_validate_user_signup’ hook that unsets the email address error.
Recently, I added a new feature that significantly changes one of the database tables in my application. I ran into problems when I created a non-reversible database migration, and realized that other branches I am developing on still require the older database scheme. In the end I had to end up dropping the DB, deleting the offending migration, rebuilding the DB, and figuring out a smarter way to migrate. Not fun, and time wasted. Continue reading →
A little over a year ago I started on my first Rails app. I’ve been off in the business world for the past 10 years, and have been itching to get back into application development of some kind again. Some of my still developer friends had been talking about Rails and it sounded really interesting, so I thought I’d make that the focus of my first development side project.
I had an idea I wanted to implement, and searched around for some sort of Rails documentation or tutorial. In a short period of time I found Michael Hartl’s Rails tutorial and dug in. What an awesome resource! I mean, Rails is pretty complex, and takes care of a lot, and I didn’t know any Ruby yet… but my first night working on the tutorial I had something really basic working, and I was hooked. The nomenclature was weird, I didn’t understand the makeup of the whole stack, and a lot of times things seems to work magically and fail mysteriously, but but I got enough positive feedback I knew I could get better.