July 14th, 2012
I gave a talk at Wordcamp Boston 2012 entitled Avoiding Disaster: Setting Up Your Local WordPress Development Environment. Slides available in PDF and Powerpoint. Here’s the description of the talk:
Editing a WordPress site on a live server is quick and simple. It’s also one step away from disaster. The goal of this talk is to give you all the knowledge and tools you need to develop WordPress on a local machine, and then to push those changes to a live website. We will automate as much of the process as possible, giving you more time to actually develop your site instead of copying files back and forth or clicking dozens of menus to export and import databases. Topics discussed will include local web servers and databases, file version control (Git), and database synchronization.
Feel free to email me with any questions. Want to work with me? Head on over to Adaro Consulting.
Here is a list of resources I mention in the talk:
Not mentioned during the talk, but here are my favorite Git clients
Here is the command SQL code I referenced:
1) Run this command on the live server:
mysqldump -umyusername -p database_name > database_name.sql
2) Transfer database_name.sql locally (using scp or sftp)
3) Run this command on the local server:
mysql -uroot -proot database_name < database_name.sql
4) Run this command on the local server:
mysql -uroot -proot database_name < update.sql
The contents of update.sql should look like so:
SELECT * FROM wp_options WHERE option_name = “home” OR option_name = “siteurl”;
UPDATE wp_options SET option_value = “http://localhost/local_folder_name” WHERE option_name = “home” OR option_name = “siteurl”
Of course, replacing “local_folder_name” with the name of your website.
| 7 Comments »
June 1st, 2012
One of my current projects has been developing an eCommerce site in WordPress for a client. One of their requirements is having all orders exported nightly and then sFTP’d to their fulfillment center.
We’re using the WooCommerce plugin for their eCommerce needs, which so far has proven to be excellent and flexible enough to meet their requirements.
For this specific requirement, I modified a WooCommerce plugin to export the orders to a CSV file, which was easy enough. But I then had to modify that plugin so that I could call it from a nightly cron script.
Turns out, that is pretty simple to do. At first I thought I might have to fake logging into the site using curl and cookies, and then call the script and push through a GET request.
I then found this blog post over at CodeGarage.com which addressed the exact same issue, and he outlined a much simpler solution:
- Include wp-load.php
- Inlcude wp-admin/admin-functions.php
- Call the function
So basically, all I had to do was extricate the actual function which exported the CSV from the plugin, put it in a new PHP file, include those aforementioned files, and then I was all set.
The last step was setting up a cronjob to run /usr/bin/php on the script which was simple enough.
| 1 Comment »
May 11th, 2012
As a developer, I love caffeine. I also mentioned in an earlier post that I have been waking up before dawn to code recently, meaning I love caffeine even more than usual.
For decades I drank coffee like (most) everyone else, from a drip coffee maker. In 2007 I started a new job that had this magical new coffee maker, called a Keurig, that made near-instant coffee that tasted much better than, well, instant coffee.
I was in love, and bought a home version for myself a year later. Like I always had, I added cream and (fake) sugar without a second thought. The coffee tasted fine this way. People sometimes raved about Starbucks or complained about Dunkin Donuts, but to me, all coffee tasted the same.
Of course, that was because I was adding cream a sugar. Sadly I can’t remember when it happened, but one day I tried a cup of good quality coffee without any additives whatsoever. The first sip was somewhat bitter, but after that, I realized it’s possible to appreciate coffee as a drink itself, rather than a way to streamline caffeine into your system.
Sadly, I realized around this time that the coffee made from Keurig machines was pretty sub-par. I decided to make the jump to making myself good coffee.
It took a few months, but I ended up with this setup:
I actually started with just the Aeropress, since it was so cheap. I bought beans from places like Trader Joes, ground them at the store, then brought them home. The coffee was pretty good, but I noticed an exponential decrease in the coffee as early as the second day after grinding them. I realized an investment in a decent grinder was needed.
I did some research on coffee grinders used with Aeropress, and found out that you really need to spend the extra money on a burr grinder, as the blade grinders not only have the issue of burning the beans (due to the heat the friction generates), but also that the lack of consistency makes for a poor press.
- Preheat Keurig (yes, I now use my old coffemaker as a hot water machine.
- Measure five Tbps of whole beans and grind on the medium setting
- Prepare Aeropress filter
- Pour beans into the filter
- Pour two ounces of water into the plunger
- Stir for two seconds, wait another twenty
- Plunge the coffee
- Clean up the plunger
- Pour the remaining water into the coffee
- (Optional) Add some frothed milk on top
Even though it’s ten steps, the entire process takes about two minutes of actual work.
Best of all, the cleanup takes literally eight seconds (I timed it). I briefly used a french press, and while I loved the taste, the cleanup was such a pain. An Aeropress makes such good quality coffee for the incredibly low amount of effort it requires.
I was ecstatic after a week of using my new grinder though, and it was absolutely worth the investment. Shortly after I purchased the glass container to store the coffee in. I’ll usually pour out about 1/4th cup of beans into the storage container and put the rest in the freezer until I need them.
I also created my Google spreadsheet right at the beginning. I found there was such a vast difference in the taste of each coffee that I needed to keep track of it, in order to avoid repeating bad coffees or forgetting the best ones.
As for the next step? I should really purchase a digital scale to measure the amount of beans and water I add. I actually lost my Aeropress scoop a few months ago, which is why I’m estimating with five tablespoons of beans.
| 1 Comment »
May 2nd, 2012
I always used to consider myself a late night person. But really, who doesn’t in college and their mid-twenties?
But then I had a kid, and sleeping later than 6:30am became a luxury, and suddenly I was getting quite tired by 9:00 at night.
I kept trying to force myself to stay up later (8:30pm coffee anyone?), but it just wasn’t working. This was especially true when trying to run my consulting business. I just didn’t feel as productive and motivated after dark.
A few weeks ago, I got a treadmill, and decided I was going to start waking up early enough to exercise, which meant around 5:15am. Well turns out I really do not like exercising in the morning. Actually I don’t like doing anything in the morning without a shower to wake me up first, which meant I would shower, exercise, then shower again, which felt a bit silly.
So I moved exercise to after work. But instead of abandoning waking up early, I kept doing it — and started doing consulting in the morning instead.
It is awesome. The world is completely silent, both inside (my three year old might have trouble going to sleep but sleeps like a rock in the early morning) and out (no email interruptions, not even Twitter activity to distract me).
My brain is working its absolute best at this time of day too, especially when compared to late at night. At least, it is after an Americano from my Aeropress.
There’s also something immensely satisfying about getting an hour of work done even before I start my actual “work” day. I’m able to address any client concerns before most of them even wake up, which seems to make them happy.
Really though, one of the best benefits is completely non-work related: I wake up with enough time to spend ten or twenty minutes playing with my son, who of course at three is also a morning person and is thrilled to be able to play cars with his dad at 6:45 in the morning.
| No Comments »
April 20th, 2012
A few months ago I researched a whole bunch of color picking apps. I had two basic requirements:
- Allow me to quickly copy the hex code
- Allow me to paste the hex code without the # in front of it.
Apps which met the first requirement were easy to find; the second, not so much.
Around that time I just happened to see a top article on Hacker News for a color picking app someone had developed. I tried it, and really liked it, except it also was missing feature requirement number two.
I mentioned that in the comment thread in Hacker News, and lo and behold, the developer added it that very night.
Best of all, it’s free!
Color Picker Pro
| 1 Comment »