Posted by
Neil – January 14, 2010
Today, I came across the need for a function that would make most source control mechanism’s cry. Essentially I needed some work that was due to go into production in a few weeks, to go today, which meant I somehow had to grab some code that was deep down in my bleeding edge branch out into the limelight of the live server.
In Subversion, this would be pain, but luckily I’m using Git.
Out of the box, git comes with a very useful command cherry-pick. Essentially what this does is take one single commit, and then merges just those changes into the other branch. This is different to a regular merge in that it doesn’t pull ALL changes, so it’s much more precise.
git cherry-pick -n [The commit's SHA-1 Hash]
(Note that the -n option should be used when you don’t want Git to automatically commit the change into the new branch, but you should make sure your new commit message references the old commit for sanities sake).
Remember though, your newly merged into branch might not be working perfectly now, as you may now have unsatisfied dependencies, so test, test test!
Posted by
Neil – January 14, 2010
I came across an issue today whilst putting together a site using the BrowserCMS content management system for Rails (and if you need a CMS, look no further).
Essentially I was ending up with a situation whereby when I was trying to remove an item from a container I was getting the following error:
No action responded to show. Actions: cms_connectable_path, cms_index_path_for,
cms_index_url_for, cms_new_path_for, cms_new_url_for, cms_toolbar, container,
container_has_block?, create, current_page, destroy, edit_cms_connectable_path,
handle_access_denied, handle_server_error, move_down, move_to_bottom,
move_to_top, move_up, new, page_title, render_breadcrumbs, and render_portlet
After a little digging, I discovered that this is not a rails bug, or a BrowserCMS issue, but a missing Javascript file that needs to be in all of your templates (as well as the cms_toolbar) cms/application.js. This file attaches all the required js functions to the BCMS buttons, and thus turns the necessary GETs into POSTs etc etc etc.
However, you don’t want this included all the time, but only when you’re logged in as an adminstrator or someone who requires the use of those buttons. Therefore, the following code is required in each of your templates:
< %= able_to? :edit_content, :publish_content, :administrate do
javascript_include_tag ["cms/application"], :cache => true
end %>
This will ensure that everything hooks up as it needs to, and only when it needs to.
Posted by
Neil – January 11, 2010
This is here more as a future note to myself, but hopefully someone out there will find this useful.
Essentially, imagine this: You have a remote repository (say, on GitHub), and that repo has many branches. You clone the repo and end up with the master branch in your local dev environment. Now what happens if you want to use one of the other branches in the repo?
Well, initially, you’d think you would create the branch locally, and pull the differences down:
git branch production
git checkout production
git pull origin production
but what if master is ahead of production (a likely scenario)? In this case this won’t work as your local production branch will now contain the changes in the master branch – as that’s where you originated production from on your machine.
What you need to do is:
git checkout -b <local_name_for_branch> <remote_source>/<remote_branch>
e.g
git checkout -b production origin/production
What this does is create a tracking branch. Tracking branches are local branches that have a direct relationship to a remote branch. If you’re on a tracking branch and type git push, Git automatically knows which server and branch to push to. Also, running git pull while on one of these branches fetches all the remote references and then automatically merges in the corresponding remote branch.
Posted by
Neil – December 23, 2009
Following on from last weeks post about how SEO people should be trying to perform, I had a thought about something that appears to be common across nearly all SEO companies I have worked with in the past, and how wrong it is.
Picture this, you have a website, and an SEO monkey putting some stuff together for you on a monthly basis to report how well you’re doing. From my experience, most companies seem to want to issue you with some form of keyword rankings report…
“Oh, lookie here sir, we’ve now got you to the number one spot on Google for the term “web design company horsham bob mitchell cheap”! We’re going to make you millionaires!”
Hang on a second there chummie. This is all very well if I have all of my customers searching for terms that are very specific to my business, but they aren’t, they’re searching for all sorts of things.
In fact, as a website owner, I do not give a fuck what my users are searching for, I only care that they are coming to my site, and doing things which generate me income/profile/whatever the point of having the website in the first place is.
SEO people should be reporting on their work with analytics and conversion rates, not how great you are at appearing on terms that no-one gives a toss about.
Search engine optimisation is not a black art that’s only doable by some sort of SEO wizard – it’s a measurable level of marketing that will return you measurable results.