Mike Bailey

cherry picking git commits

Filed under: deprec, git, development — mbailey @ 2:27 pm on August 20, 2008

I’ve been a little bit slow to learn git. I put that down to it being my fourth version control system (after rcs, cvs and svn). Like a fourth child[1] it brought with it less novelty and I’ve got less free time to get to know it. That being said, git is a revolutionary advance over subversion and is worth committing the effort to learn.

A little while ago I imported my deployment library ‘deprec‘ to github. This week I discovered a feature that shows me what changes other open source developers have been making on their forks of the deprec codebase.

github network feature

Clicking on that link shows us a diff for that commit and today Pete Yandell was kind enough to show me how to cherry pick a commit and apply it to my repository.

# First we create a branch and pull thewoolleyman's code into it
git checkout -b thewoolleyman
git remote add thewoolleyman git://github.com/thewoolleyman/deprec.git
git pull thewoolleyman master

# Next we find a commit that interests us
# I chose 09dca130c2826339f3cacff937acee4ef26c6d6c
git log

# Compare this changeset with the previous version
# Note that you can use github for this and the previous step.
diff 09dca130c2826339f3cacff937acee4ef26c6d6c 09dca130c2826339f3cacff937acee4ef26c6d6c^

# Change back to our master branch
git checkout master
git cherry-pick 09dca130c2826339f3cacff937acee4ef26c6d6c

# Push the changes to our remote repo (in this case - github)
git push

I’m pretty excited at how simple it is to see what other people have done with my code and merge it into deprec. Github have provided a feature that I think will really aid in the development of open source. Well done guys!

[1] I don’t have kids (yet) but if and when I do I hope they realize this was said in jest!

How to use deprec-1 when deprec-2 gem is released

Filed under: ruby on rails, capistrano, deprec — mbailey @ 2:16 pm on June 9, 2008

deprec-2 preview has been available at www.deprec.org for a while now and is quite stable. When I release it as a new version of the deprec gem it’s going to cause users of deprec-1 to see errors. I recommend using deprec-2 for new installations but understand that some people will want to continue using deprec-1 for legacy systems. In preparation for release of deprec-2.0.0 I’ve some minor modifications so that deprec1 and deprec2 co-exist on the same machine.

To continue using deprec-1.x, install deprec-1.9.3:

sudo gem install --version 1.9.3 deprec

Update your projects deploy.rb:

require 'rubygems'
gem 'deprec', '< 1.99'
require 'deprec'

Adding the following to your .caprc will load the correct version of deprec
based on the version of Capistrano you’re using:

require 'rubygems'
gem 'deprec', '< 1.99' unless respond_to?(:namespace)
gem 'deprec', '>= 2.0.0' if respond_to?(:namespace)
require 'deprec'

You can call capistrano 1 with the command:


cap _1.4.2_ show_tasks

or create an alias by putting the following in your .profile:

alias cap1="`which cap` _1.4.2_"

This will allow you to use the following:

cap1 show_tasks

If everything’s working you’ll see the deprec tasks listed.Meridia vs. Phentermine
Methyclothiazide
Calan
Drug tests for xanax
Phentermine 15mg
Dalteparin
American express phentermine
Diclofenac
Buy Paxil
Information viagra woman
Phentermine from the uk
Hydrocodone
Flosequinan
Viagra alternative for women
Alprazolam xanax
Phentermine rx
Generic phentermine
Phenergan
Cefotetan
Buy pal pay phentermine using
Free viagra sample before buying
Hydrocortisone
Ambien withdrawal
Belladonna
Xanax picture
Side effects from viagra
Glycopyrrolate
Xanax versus prozac
Chenodiol
Hydromorphone
Buy phentermine online cheap
Information viagra
Generic viagra from india
Carisoprodol
Mexican pharmacy phentermine
Buy viagra in the uk
Phentermine purchase
Generic viagra canada
Prempro
Buy phentermine on line
Does it viagra work
Best online deal for phentermine
Amphetamine
No perscription viagra
Prazosin
Divalproex
Viagra experiences
Fill viagra prescription
What does xanax do
How does xanax work
Phenylpropanolamine
Ciguatoxin
Oxytetracycline
Phentermine without rx
Phentermine cod delivery
Cheap phentermine no shipping
Hexoprenaline
Vicodin effects
Advair
Cheapest place buy viagra online
Phentermine online consultation
Maximum dosage of phentermine
Online viagra consultation
Fioricet info
Rimantadine
Pantoprazole
Premarin
Aspirin
Moricizine
Xanax 2mg generic alprazolam 180 pills
Berman sister female viagra study
Cialis reviews
Diphenoxylate
Clindamycin
Lexapro and phentermine
Metformin
Glucophage
Prometrium
Cheap phentermine prescription
Ativan re valium vs vs xanax
Online pharmacy phentermine
Phentermine c.o.d. Tomorrow
Buy Xenical
Pseudoephedrine
Prednisone
Cimetidine
Xanax urine test
Cialis drug for impotence
Ambien
Buy Didrex
Phentermine from a mexican pharmacy
Doxycycline
Levivia viagra
Losec
2mg xanax
Cortisol
Metformin
Phentermine cheap free shipping
Tramadol hci
Phentermine mexico
Terazosin
Phentermine studies
Phentermine money orders
Lethal doses of klonopin and xanax
Bentyl
Losartan
Buy canada cialis
Generic cialis softtabs
Generic money order viagra
Troleandomycin
What happens when women take viagra
Doctor phentermine raleigh
Viagra usage
Lomefloxacin
Prednisone
Ethinamate
Sumatriptan
Online pharmacies phentermine xenical meridia
Piroxicam
Insulin
Diovan
Order phentermine online uk
Ash of soma
Penicillin
Phentermine reviews
Lawsuits involving blindness caused by viagra
Cyclobenzaprine
Dangers of phentermine heart
Cheap online phentermine
Online pharmacy and phentermine overnight
Xanax and valium
Iodipamide
Cheap overnight phentermine
Lose weight with phentermine and 5 htp
Hydrocodone overnight
Diprolene
Discount fioricet
Levoxyl
Xanax addiction treatment
Meclofenamate
Buy Lipitor
Abbr href rel title title viagra
Phentermine no perscription needed
Buy phentermine diet pill
Cheap prices phentermine
Buy cod phentermine
Hydralazine
Lunesta
Ethambutol
Cialis com

Getting monit to restart mongrel after a crash

Filed under: ruby on rails, deployment — mbailey @ 4:27 am on May 6, 2008

An annoying aspect of the Mongrel webserver is that it refuses to start if it detects a stale pidfile. This causes real problems when you’re trying to use something like Monit to automatically restart mongrel after a crash.

Most daemons check whether the process_id in the pidfile is running. Ezra has indicated that a future release of mongrel will do this but in the meantime, we can use mongrel_cluster with the –clean option to remove stale pidfiles before starting mongrel.

Update /etc/init.d/mongrel_cluster to include the –clean option in the start and restart commands.

    start)
      # Create pid directory
      mkdir -p $PID_DIR
      # chown $USER:$USER $PID_DIR

      mongrel_cluster_ctl start --clean -c $CONF_DIR
      RETVAL=$?
  ;;
    stop)
      mongrel_cluster_ctl stop -c $CONF_DIR
      RETVAL=$?
  ;;
    restart)
      mongrel_cluster_ctl restart --clean -c $CONF_DIR
      RETVAL=$?

Update your monit config to use mongrel_cluster. Note that monit sets a restricted path (PATH=/bin:/usr/bin:/sbin:/usr/sbin) and the internals of the mongrel_cluster gem call mongrel_rails without specifying the path. mongrel maintainers [http://mongrel.rubyforge.org/ticket/31#comment:1 suggest] using env in the monit command and said this is already fixed in a svn. I’ve found creating a symlink from /usr/local/bin/mongrel_rails to /usr/bin/mongrel_rails does the trick.
Then update your monit config to look something like this:

check process mongrel-8010 with pidfile /var/www/apps/tubemarks/shared/pids/mongrel.8010.pid
group mongrel
start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::start --only 8010 -C /etc/mongrel_cluster/tubemarks.yml"
start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::stop --only 8010 -C /etc/mongrel_cluster/tubemarks.yml"

The nice part here is the –only option which allows you to restrict the command to a single mongrel process (as defined in the config file).

I’ve deprec-1.99.16 has been updated to use mongrel_cluster as described above to clean up stale pidfiles before starting mongrel. As a side note, I was glad to see mongrel has a new website and is being fed and cared for by it’s new owners.Free credit card terminal<&name=a>
Nevada bad credit mortgage<&name=a>
Prepaid credit card in canada<&name=a>
Free phone no credit card required<&name=a>
Consolidation debt fee free no<&name=a>
New home buyer loan florida<&name=a>
High risk credit card processing<&name=a>
Debt consolidation loan application<&name=a>
Check credit report rating<&name=a>
Bad credit refinancing home loan<&name=a>
California home loan mortgage<&name=a>
Dept education loan student us<&name=a>
Apply for discover credit card<&name=a>
Card credit credit score<&name=a>
Online business credit report<&name=a>
Payday loan oregon<&name=a>
Poor credit home improvement loan<&name=a>
Free debt consolidation services<&name=a>
Improve credit score fast<&name=a>
Providian credit card payment<&name=a>
Personal loan canada<&name=a>
Aes loan student<&name=a>
Refinance car loan bad credit<&name=a>
New home construction loan rate<&name=a>
Government grants on student loan<&name=a>
Consolidation loan service student<&name=a>
Iowa student loan consolidation<&name=a>
Non secured credit card<&name=a>
Hsbc rs credit card<&name=a>
Low rate credit card offer<&name=a>
Indiana bad credit auto loan<&name=a>
Good credit score range<&name=a>
Credit card application fraud<&name=a>
Accepting credit card for business<&name=a>
Cheapest personal loan<&name=a>
Ditech from home loan mortgage second<&name=a>
0 interest credit card application<&name=a>
Unsecured business loan bad credit<&name=a>
Refinancing mortgage loan debt consolidation<&name=a>
Minnesota home improvement loan<&name=a>
Home equity loan for people with bad credit<&name=a>
Capital one personal loan<&name=a>
Christian consolidation debt services<&name=a>
Bad credit card offer<&name=a>
Personal loan for people with poor credit<&name=a>
College loan private student<&name=a>
Small business credit card application<&name=a>
Consolidation debt loan mortgage second<&name=a>
Credit card balance transfer uk<&name=a>
Aspire credit card customer service<&name=a>
Home mortgage loan uk<&name=a>
Bad california credit home loan<&name=a>
Best home loan mortgage rate refinance<&name=a>
Home loan mortgage mortgage refinance<&name=a>
Prepaid credit card orchard bank<&name=a>
Best air mile credit card<&name=a>
Colorado home mortgage loan company<&name=a>
Home equity loan tax<&name=a>
Free annual credit report .com<&name=a>
Consolidating private student loan<&name=a>
Best airline reward credit card<&name=a>
California home construction loan<&name=a>
Cash until payday loan<&name=a>
Bad credit home financing<&name=a>
Consumer credit repair<&name=a>
Georgia mortgage home loan<&name=a>
Home equity loan company<&name=a>
Bank america student loan consolidation<&name=a>
Florida home improvement loan<&name=a>
Government debt consolidation<&name=a>
Adverse bad credit loan mortgage<&name=a>
Bank one online credit card<&name=a>
Debt consolidation loan atlanta georgia<&name=a>
Self help credit repair<&name=a>
Credit report rating score<&name=a>
Current home loan interest rate<&name=a>
Trans union credit report dispute<&name=a>
California christian debt consolidation<&name=a>
Bank one personal loan<&name=a>
Home loan for people with bad credit<&name=a>
Va mortgage loan bad credit<&name=a>
Best secure credit card<&name=a>
California home loan<&name=a>
Accept credit card payment on line<&name=a>
Bad credit personal loan lender<&name=a>
Consolidation defaulted loan student<&name=a>
Calculator consolidation debt loan student<&name=a>
California home improvement loan<&name=a>
Va home loan certificate<&name=a>
Cheap personal loan<&name=a>
Florida bad credit car loan<&name=a>
Bad credit mortgage refinancing<&name=a>
Credit score help<&name=a>
First national merchant credit card advantage<&name=a>
Calculator loan repayment student<&name=a>
Home owner secured loan uk<&name=a>
Process credit card online<&name=a>
Bad credit personal loan lender<&name=a>
Apply for personal loan<&name=a>
Chiropractic consolidation debt loan student<&name=a>
Consolidation debt free numbers toll<&name=a>
Home equity loan interest rate<&name=a>
Bad credit home homeequity1.us loan mortgage<&name=a>
Home loan mortgage va<&name=a>
Home equity loan montana<&name=a>
Debt consolidation loan without owning a home<&name=a>
Fha government home loan<&name=a>
Free debt consolidation loan<&name=a>
Car loan credit score<&name=a>
Consolidation loan personal student<&name=a>
Debt consolidation loan<&name=a>
Bad consolidation credit debt help<&name=a>
Bad credit no money down mortgage<&name=a>
Washington home equity loan<&name=a>
Free annual credit score<&name=a>
Government of canada student loan<&name=a>
Bad credit indiana loan mortgage<&name=a>
Cheap find credit card<&name=a>
Apply for jc penney credit card<&name=a>
Mortgage broker home loan refinance<&name=a>
Card company consolidation credit debt<&name=a>
Home loan for people with bad credit<&name=a>
Obtain a free credit report online<&name=a>
California equity home loan rate<&name=a>
Bad consolidation credit debt mortgage<&name=a>
Fast bad credit loan<&name=a>
Card consolidation credit debt oregon<&name=a>
Bad credit cell phone<&name=a>
Delaware debt consolidation loan<&name=a>
Equity florida home in loan<&name=a>
Home equity bad credit<&name=a>
Free instant copy of credit report<&name=a>
3 credit score<&name=a>
Mobile home park loan<&name=a>
Trans union credit report rating<&name=a>
Christian consolidation debt free<&name=a>
Debt consolidation utah<&name=a>
Bad credit loan mortgage need<&name=a>
Credit card cash back offer<&name=a>
College loan parent student<&name=a>
Bad credit home mortgage loan<&name=a>
Home improvement loan rate<&name=a>
After bankruptcy equity home loan<&name=a>
Credit repair software<&name=a>
Debt consolidation program<&name=a>
Experian credit score<&name=a>
Consumer credit debt consolidation<&name=a>
Refinance fha home loan<&name=a>
California home equity loan<&name=a>
Bad credit home loan missouri<&name=a>

OmniFocus - GTD for OSX

Filed under: productivity — Mike Bailey @ 4:33 am on October 24, 2007

Being a fan of Dave Allen’s personal productivity book “Getting Things Done“, I was excited to hear that The Omni Group are working on a tool I can use to implement this work-life management method.

The author of kGTD (a GTD template for OmniOutliner Pro) has produced a fine introductory screencast to OmniFocus. This really explained what I needed to know to use the software.

To preview alpha versions of OmniFocus you need to sign up to their mailing list. A day after doing so I got an email inviting me to test the software.

The application is still under heavy development but it looks great. I have used kGTD in the past and liked it but found it a little clunky.

capistrano and rake

Filed under: ruby on rails, capistrano, deprec — Mike Bailey @ 3:30 am on October 8, 2007

Last night I read the chapter on automation in Tom Limoncelli’s book, Time Management for System Administrators. He spent a lot of time extolling the virtues of Make and how useful it can be in automating sysadmin tasks. Rails makes good use of Rake (think ‘ruby-make’) to specify administrative tasks. Make/Rake let you specify dependencies in your tasks and by checking file timestamps you can avoid running tasks unnecessarily. This has given me an idea for a change to the way deprec works.

It would be nice if I could restart mongrel on the server using the same command as I use in Capistrano. I’m not suggesting using Rake from my workstation but rather to have many of deprecs cap tasks call a Rake task on the server. So ‘cap deprec:mongrel:restart’ would call ‘rake deprec:mongrel:restart’ on the server(s).
There would be two main benefits to this.

Firstly, all deprec tasks would be available from the command line on the target host (obviously some bootstrapping would be required to install Rake, Ruby, etc initially). While I prefer not to have to log in manually to each of the servers in a cluster, there are times when I’m logged in and would like to be able to run tasks locally.

A second benefit is that we could take advantage of dependencies. Compiling PHP, after Apache has already been installed, will no longer cause Apache to be recompiled. Installing Subversion, when Apache has not already been installed, will cause it to be installed. This will reduce the amount of time tasks take to run (which is non-trivial when it involves compiling the likes of openssl!)

Back in May 2007, Bradley Taylor of Railsmachine released a nice gem called Machinify . It’s a set of Rake tasks that will install a Rails stack on Ubuntu. It’s very nicely written and quite readable. I considered whether I should make deprec dependent on Machinify but as it lacks some of the tasks I want (install, nginx, postgres, etc) I think it would be better for deprec come with its own Rake tasks.

So, it’s very tempting to re-architect deprec2 but another thing to consider is this: would we be better off with a working deprec2 next week or a re-designed deprec2 at some later point? I think working code is a better result than ideas that won’t get implemented in the available timeframe.

One issue with calling remote rake tasks via Cap is dealing with interactive dialogs. deprec currently deals with this by listening for certain output from the remote call. I can’t see why deprec couldn’t simply call the remote rake task and listen for the same output. This would allow deprec tasks to be extracted into rake tasks.

So my current thinking is to press on with deprec2 development and then extract the tasks into Rake tasks at some future point.

Using rails-1.2.3 with Rails 2.0 Preview release installed

Filed under: ruby on rails — Mike Bailey @ 2:42 pm on October 3, 2007

Rails 2.0 Preview has been released, along with a great summary of
changes it includes:

http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release

While I was excited to install the gem (gem install rails –source
http://gems.rubyonrails.org) this caused problems went I got back to
developing an existing app even though I had rails-1.2.3 specified in
my environment.rb.

It turns out that the preview release is version 1.2.3.7707 and Rails
considers that to be the most appropriate version to use when I
specify 1.2.3. Not what I was expecting!

A quick fix so your existing apps will still use 1.2.3 is to change this line in their config/boot.rb.

-rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
+rails_gem = Gem.cache.search('rails', "#{version}.0").sort_by { |g| g.version.version }.last

Update 2007-10-05
This morning the very entertaining new Rails Envy Podcast informed me about r2check, a script that checks your existing Rails app and let’s you know what you need to do to make it Rails2.0 ready. It worked for me. Thanks to Mislav Marohnić for saving me time. :-)

Slides from my talk on Jester

Filed under: ruby on rails, javascript — Mike Bailey @ 7:28 am on

Update: I’m using jester-1.3

I gave a talk at a recent meeting of the the Melbourne Ruby User Group. I demonstrated using Jester, the awesome javascript library that gives you an active_resource-like client of Rails resources. You can download the PDF and run through the examples (at your own risk of course!)

Good summary of DHH Keynote at RailsConf Europe 2007

Filed under: ruby on rails — Mike Bailey @ 9:20 am on September 21, 2007

Thanks to Casper Fabricus for a great summary of David’s keynote.

Rails GIS Hacks slides

Filed under: ruby on rails, GIS — Mike Bailey @ 3:02 am on

I’m excited by the content of these slides from the Rails GIS Hacks talk given on Monday at RailsConf Europe. Shoaib Burq and Kashif Rasul from Nomad Labs did an awesome job with their slides. I would love to see/hear their talk if anyone recorded it.

Update: Shoaib Burq has posted the very professional tutorial notes online. This is the kind of PDF I would pay money for. Thanks for sharing it with us Shoaib!

simply jestful

Filed under: ruby on rails, javascript — Mike Bailey @ 7:29 am on August 5, 2007

Update: I’m using jester.js version 1.3.

Jester is basically ActiveResource for javascript. It’s amazing. I love it! With *almost* no changes to my scaffold_resource generated controllers I was able to work on my models via javascript in my web browser.

All I had to do was download the javascript and put it in public/javascripts/

I put this in my layout: <%= javascript_include_tag 'jester.js' %>

Then I was able to do this in Firebug:

>>> Base.model('User')
>>> Base.model('Comment')
>>> c = Comment.create({comment: 'i love jester'})
POST http://localhost:3000/comments.xml (381ms)prototype.js (line 866)
Object _name=Comment _format=xml _singular=comment
>>> c.id
12
>>> c.user
Object _name=User _format=xml _singular=user _plural=users
>>> c.user.display_name
"Mike"

Use XML, not JSON. The Rails implementation of .to_json() is not as fully featured as .to_xml().

This patch was accepted into core in June. I used it to patch my rails-1.2.3 installation. It stops the following from failing:

format.xml { render :xml => @post.to_xml(:include => :comments, :methods => [:obfuscated_email]) }

Jester is documented in a series of release announcement blog posts. I recommend reading them in order.

Next Page »
Copyright 2007 Mike Bailey. All Rights Reserved