A couple of days ago, we pushed the latest version of our app into the UAT environment. It wasn’t too long after that when I started noticing that we were getting an increased number of errors on the box. Odd errors that didn’t seem to relate to one another. On top of that, we were getting complaints that response time had moved into the unbearably slow range.
I took a look at the server and pulled up top. Right at the top was a host of Rack processes that were vying for the top slot. An instance would launch, it would jump up to 100% cpu, and then it would keep on going. Killing the processes made things run smoothly, but they would just come back. And I wasn’t getting any information.
A bit of googling and manual reading later:
1
$ kill -s SIGABRT
This caused the process to stop (which is happy making in itself) and also placed a backtrace into the log. This exposed the infinite loop and allowed us to deploy a solution.
When I’m coding and I need to remove a file, I rarely remember to
use git rm instead of rm. It’s just ingrained in my fingers I
guess. Unfortunately, this means that when I create my commit I end
up with a bunch of files that I need to use git rm on.
It’s not exactly a hardship, but here’s a simple method for doing
that:
Just put that into your .bashrc and you’re ready to go.
I found a great way to test my protected attributes while looking
around online.
like to code my model tests using the stock unit testing libraries.
It’s clean and simple and it does everything that I need. So I took
the existing rspec code and I converted it into a standard test
helper.
Put this in your test_helper.rb file and you’re good to go.
They only really have the beginners Git tutorials in place right
now, but I can see this becoming a very useful link for me. I
particularly like the fact that the information has been segregated
into different levels and into different “tracks”.
I wish that more tutorial sites used a layout like this.
It looks like Josh Susser
has much the same daily workflow as I have. Take a read,
it’s a good example of how cheap local branches can make your
development life a whole bunch easier.
Since my last post
I’ve been using git more and
more. It really suits the way I work a lot better than subversion.
Because of this, I wanted to convert one of my projects from svn to
Git. It’s a private project, and while I could pony up the cash and
get a paid account on GitHub, I’d rather keep everything on
something under my control.
I’ve already moved the main project over to slicehost, and since
I’m already paying for the space I thought it would be a great idea
to host my repositories there.
It was a hell of a lot easier than I thought it would be.
One of the requirements of the install is that I connect to the git
repository over ssh. I’ve got it set up so that my ssh server is
listening on port 30000 and it authenticates using a public key. No
faffing about with passwords here!
Here’s what I did.
Install Git
The first thing we need to do is install git. I’m using aptitude,
so this would be done like this:
1
sudo aptidude install git-core
Now you’re ready to create the actual repository.
Create Your Remote Repository
While still connected to your slice, enter the following. Change
anything you need to, of course.
1
mkdir ~/repos/example.git cd ~/repos/example.git git init
It doesn’t really get much easier than that.
1
### Create Your Local Repository
Now we go to work on making the local repsitory. All of this is on
your local machine:
1234567
mkdir example
cd example
git init
touch README
git add README
git commit -m "initial repository import"
git remote add origin ssh://username@yourdomain/example.git
I was going through my old posts and converting some of the old
uncategorized links to something a bit more useful. Uncategorized
doesn’t really count as useful as far as I can tell. Three edits
in, I notice the Quick Edit link and give that a try.
I honestly don’t know how I didn’t see this before.
edit In a pique of stoopid, I just forgot to categorize this.
Nice.
I still work more often in Subversion than I do in git, and the
commands aren’t quite under my fingers yet. So, more for my memory
than anything else, here’s my current git workflow for when I’m
working on my own stuff.
First, I create a local version of the repository to work on.
1
git clone my-great-repository @
Next, I’m going to create a branch for whatever it is I’m working
on at the moment. I tend to be a bit of a splitter when it comes to
branches. One change, feature or fix, per branch. Git is great for
that.
1
git checkout -b "stuff_Im_working_on"
After that, I do a small change at a time. Lots and lots of small
commits. Loop over this as many times as you need.
1
git commit -a -m "Changed the text as requested."
When I’ve finished everything and it’s time to check my code back
in, I checkout my master branch and make sure that I’ve got the
latest commit.
1
git checkout master git pull
At that point, I’m ready to merge my new code into the master
branch, run all of my tests, and push everything back up to the
origin.
1
git merge "stuff_im_working_on" git push
When I’m done, I usually just trash the branch I’ve been working
on.
1
git branch -d "stuff_im_working_on"
Please note, I generally work by myself and I’m not too worried
about conflicting merges and the like. This workflow would
obviously have to be modified to handle that.
Recently, I started going back to the gym. Hours of working on web
applications have added to a puffier physique than I would like. I
find endless hours of cardio to be boring as hell, and the body
builders staring into the mirror while trying to “pump” make me
chuckle.
So I’m doing some powerlifting. I’m not at all interested in the
competitive nature of it, but I love the fact that everything is
quantifiable. And the goals are easy - increase your maximum lift
in the squat, the deadlift, and the bench press.
Anyway.
As a good little programmer and emacs addict, I’ve added a simple
function to my .emacs to help me keep track of what I’m lifting.
A lot of the heavy lifting is being done by org-mode. The table
mode makes everything line up nicely. You’ll probably want to add a
header for each column, but that’s not completely necessary.
Just pop these into your .emacs file, change the path on your
files, and start logging your progress.