CakePHP 3 vs Yii 2

I love both CakePHP and Yii. I use them a lot. In fact, I always been urged to find the better framework but to no avail. However, I’ve always wanted to list the pros and cons of each framework. This is my measly attempt to create one.

CakePHP 3

Pros

* Better URL considerations on Controller and Method names * Database Migrations now an off

Cons

* Uploading files need a third party plugin * Lack on OOTB integration with Codeception

Yii 2

Pros

* Built-in File Uploading * Database Migrations * Has integration for Codeception

Cons

Difference Between update_attribute and update_attributes

There a number of ways to update a field in ActiveRecord. update_attribute and update_attributes are about the most used of them all.

Without checking any of the documentation, Update attribute and update_attributes are very similar with update_attribute being used for a single field and update_attributes for multiple fields.

But there’s a really really important difference to remember is that validations are skipped when you used update_attribute

WARNING: UNPROTECTED PRIVATE KEY FILE!

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/Users/you/Downloads/thepemfile.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /Users/you/Downloads/thepemfile.pem
debug1: No more authentication methods to try.
Permission denied (publickey).

The above is a common error that you see when you try to connect to an amazon server using a pem file. A pem file is a security certificate. For amazon aws, it allows you to access the server.

The common fix for this is to chmod the pem file.

chmod 400 /Users/you/Downloads/thepemfile.pem

Chmoding the file to make it only readable by the owner is the key to fixing the problem.

An error occurred while installing capybara-webkit

In Rails development, some testing would require capybara to be installed. However, sometimes, errors like this show up.

An error occurred while installing capybara-webkit (1.1.0), and Bundler cannot
continue.
Make sure that `gem install capybara-webkit -v ’1.1.0’` succeeds before
bundling.

The fix is to install Qt.

brew update
brew install qt

You will have something like the following:

$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 201664, done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 201664 (delta 19), reused 10 (delta 7)
Receiving objects: 100% (201664/201664), 42.32 MiB | 310.00 KiB/s, done.
Resolving deltas: 100% (145935/145935), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      go         -> origin/go
 * [new branch]      master     -> origin/master
HEAD is now at 4baa24c gmtl: add 0.6.1 bottle.
Already up-to-date.
$ brew install qt
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.6.mavericks.bottle.5.tar.gz
######################################################################## 100.0%
==> Pouring qt-4.8.6.mavericks.bottle.5.tar.gz
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
==> Summary
/usr/local/Cellar/qt/4.8.6: 2790 files, 119M