Baking a Cake

For the two weeks or so, I’ve been dabbling with CakePHP, which has been something of a painful experience.  My pain comes from meshing my PHP experience into a Rails frame of mind, which is essentially what CakePHP is.  PHP on Rails if you’d like, though, it doesn’t do all of what I’ve come to expect from rails.

Migrations are something I miss, though I’ve been seeing some progress on that front on GitHub.

Another thing I’m having trouble getting my head around is that I’m using PHP to write Rails-ish concepts and code, which is weird. Normally I don’t have this problem with context switching, but I find my Ruby brain being overpowered by my PHP brain.

Like Rails, it works best to define a default database config file, and Cake does this for you in the config directory, where you get a database.php.default, instead of the database.yml file in Rails.

Again, it’s these little things that get you.  From what I’ve seen, you can make CakePHP more Rails-like, but the way I see it, if you need to write Rails or Ruby, use Ruby on Rails.

CakePHP is a great product, despite some of the gripes I’ve seen.  If you want to do some rapid prototyping, but need to use PHP, such as if you’re a PHP shop, or that’s your strongest language, go bake a cake.

Here are some useful links to get you started:

http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

http://net.tutsplus.com/tutorials/php/getting-started-with-cakephp/

Error establishing database connection WordPress on Mac OSX Lion

I’ve recently gotten my hands on a new-ish iMac with a freshly installed copy of Lion (as opposed to my 6+ year old macbook which has seen so many versions of the kitty branded OS, it now LoLz all the time) and found that setting up a local WordPress Multisite dev environment to be somewhat tricky.

Out of the box, Lion comes with all the goodies you need to run a php/MySQL project, but nothing is ever in the right place.

Case in point, enabling apache is as simple as going to System Preferences > Sharing > Web Sharing, and Boom, you have a local web server running.  Just go to http://localhost/ and you should see the traditional apache “It Works!” message.

A simple change to your http.conf is all you need to get PHP set up, provided you can find it. Any Apache guru will tell you it varies from system to system, and OSX lion is no exception.

For those not in the know, it’s at /etc/apache2

After setting that part up, I had many issues with permissions, but this may not affect you, as I was working in a high security environment, and the image was totally locked down.  You don’t want to know what I had to do to get local admin rights.

Once I had apache and php set up, MySQL was pretty straight forward. Just go to MySQL’s download page and get the DMG. Setting up was a breeze, so I should have realized something went wrong.

I went ahead to start the WordPress 5 Minute Install and got stuck on the config.

No matter what I did, I kept getting this odd error message in my log files:

“Error establishing a database connection”

…and…

Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock

I searched the interwebs for various articles, thankful I wasn’t the only one to get caught up by this issue.  The good folks over at foolswisdom.com had a really good article about this database connection issue.

In short, the php.ini file was looking for mysql.sock in /var/mysql/mysql.sock, but the file itself was installed under /tmp/mysql.sock

A quick change to the php.ini file and I was all set.

Related Articles

http://smartwebdeveloper.com/mac/httpd-conf-location-mac

http://foolswisdom.com/mac-wordpress-error-establishing-a-database-connection/

http://support.apple.com/kb/ts1999

http://www.mysql.com/downloads/mysql/

http://www.perfectline.ee/blog/how-to-setup-apache-and-php-on-mac-os-x-snow-leopard

http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/

WordPress Basics Tutorial

For those of you who may not be in the know, I’m a web developer.  One of the platforms that I do quite a bit of work on, is WordPress.  You may have seen a plug-in or two with my name on it, as well as a few blogs I’ve built using the platform.

I keep getting asked many of the same question by my users, and I’ve decided to roll them up into various tutorials and instructions, in easy to consume videos.

I’ll be posting them onto the site as they come out, and without further ado, here’s the first one after the jump.

Continue reading

Should You Pay Off A High Balance or High Interest Rate Credit Card First? – Credit Cards – Lifehacker

I get a lot of people asking me for minor financial advice, since rarely am I seen worrying about money or penny pinching.  I’m sure this is more because of my devil may care attitude, than my financial acumen, but regardless, my brain is valued by more than just zombies.

Behold this article from Lifehacker.com, reposted from Free from Broke, which settles the debate on which kind of credit card you should pay off.

Should You Pay Off A High Balance or High Interest Rate Credit Card First? – Credit Cards – Lifehacker.

Personally, I’ve viewed credit cards as a necessary evil.  When you’re starting to build your credit, it’s good to have at least three that you pay off regularly, without lateness and a stable balance.  Over time however, they start feeling like the One Ring, warping you into a sick and twisted shadow of your former self, like Gollem. You start maxing them out, building up your debt beyond control, and engaging in forced frugality to try to make ends meet.

A few things about credit cards that should be common sense:

  • Whatever you do, make sure you pay off whatever you put on your card within that billing cycle
  • Always pay at least twice the minimum balance
  • After you’ve established credit history, get rid of all but one of your credit cards

It’s my personal thought that people of modest income should only have one credit card for online purchases, or those cases when they don’t want to carry cash.  Personally, I’d rather a check card of some sort, so that any purchases are made using real money taken out of my account, versus credit.  However, I see the need for a possible “emergency” credit card, as there have been moments where I’ve had to drop a grand or two to save a family member (not from prison, but from outstanding parking tickets).

My advice to you all, is spend a few minutes a day looking at your expenses, and make hard decisions on what you’re willing to cut, for the sake of some financial freedom.

Exercise or Not, Sitting at a Desk All Day Is Bad for You – Fitness – Lifehacker

What a shock, sitting all day at a desk is bad for you…

Exercise or Not, Sitting at a Desk All Day Is Bad for You – Fitness – Lifehacker.

Seriously people, stand up from time to time and take a walk, hit the gym, or walk a few more blocks, rather than driving to the corner store!