2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

19,000 people fit into the new Barclays Center to see Jay-Z perform. This blog was viewed about 87,000 times in 2012. If it were a concert at the Barclays Center, it would take about 5 sold-out performances for that many people to see it.

Click here to see the complete report.

Advertisements

OpenShift Rails QuickStart

  1. Create a Ruby 1.9 application
    rhc app create -a railsdemo -t ruby-1.9
    
  2. After running the command railsdemo folder will get created in your directory. Run the command shown below. This will generate rails code in the railsdemo folder.It will ask you whether you want to override, say yes.
    rails new railsdemo
    
  3. Next run commands shown below
    cd railsdemo
    bundle install
    rails generate controller home index
    rm public/index.html
    
  4. Add the following route to config/routes.rb:
    root :to => "home#index"
    
  5. Generate Post entity with fields as shown below
    rails generate scaffold Post name:string title:string content:text
    
  6. Add Database support by uncommenting following lines from .openshift/action_hooks/deploy script
    pushd ${OPENSHIFT_REPO_DIR} > /dev/null
    bundle exec rake db:migrate RAILS_ENV="production"
    popd > /dev/null
    
  7. Add mysql cartridge
    rhc cartridge add -a railsdemo -c mysql-5.1
    
  8. Update config/database.yml
    production:
      adapter: mysql2
      encoding: utf8
      database: <%=ENV['OPENSHIFT_APP_NAME']%>
      pool: 5
      host: <%=ENV['OPENSHIFT_MYSQL_DB_HOST']%>
      port: <%=ENV['OPENSHIFT_MYSQL_DB_PORT']%>
      username: <%=ENV['OPENSHIFT_MYSQL_DB_USERNAME']%>
      password: <%=ENV['OPENSHIFT_MYSQL_DB_PASSWORD']%>
      socket: <%=ENV['OPENSHIFT_MYSQL_DB_SOCKET']%>
    
  9. Add gem in Gemfile
    gem 'mysql2'
    
  10. Add, Commit, and Push the Code
    git add .
    git commit -a -m "Initial setup"
    git push
    
  11. Finally you can view the application running at http://railsdemo-domainname.rhcloud.com and you can create new posts at http://railsdemo-domainname.rhcloud.com/posts