[Quick Links] |
Search Site

Site Details

rendered in 0.0428 secs

Captain's Log | Monday 8th of June 2015

elseif vs Switch Case
My rule of thumb is if you're going to be comparing a single variable it's quicker to use switch. If your comparison statement is going to change for any elseif statement then use elseif.
book review: no place to hide (Edward Snowden and Gleen Greenwald)
Must read for everyone, gives you a good understanding of how governments are trying to stay on top in the digital age. Their job is to protect the country in an age where technological developments are happening so fast and to stay ahead they seem to be making choices first and then pondering the legalities afterwards, or not at all.
How to apply a git patch
cd to the root of the git project
wget the patch file
wget https://github.com/CPIGroup/phpAmazonMWS/pull/48.patch
vim 48.patch

If required change the "a" and "b" paths so they both match the file you are patching, usually there are 4 places this needs to be changed. On the example file it is 2 x instance on line 11 and one instance on line 13 and 14. Save and close.
git apply --stat 48.patch
1 file changed, 3 insertions(+), 2 deletions(-)

This will show you the number of changes, insertions and deletions that would be made but doesn't actually apply the patch. View the actual patch file if you want to see more details of what lines will be changed with what data.
git apply --check 48.patch
Again, no data is changed. If you don't get any output it means the patch will be applied without any known conflicts. And then:
git apply -v 48.patch
Checking patch application/third_party/amazon/classes/AmazonOrderItemList.php...Applied patch application/third_party/amazon/classes/AmazonOrderItemList.php cleanly.
git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

modified:   application/third_party/amazon/classes/AmazonOrderItemList.php

Untracked files:
  (use "git add ..." to include in what will be committed)


no changes added to commit (use "git add" and/or "git commit -a")

You can now remove the .patch file and commit the update.
rm 48.patch ; git commit -av