Tag Archives: ruby

Event Report: GeekNight with Ola Bini – JRuby for the win

(This is a report of the GeekNight with Ola Bini written by Sandeep Mukhopadhyay)

ThoughtWorks Pune had invited all developers to their GeekNight held on May 25, 2011. GeekNight is a series of talks about cutting edge technology, where you also get to meet like minded geeks. This GeekNight featured a talk “JRuby for the win” by JRuby Core Developer Ola Bini.

Ola Bini is a core JRuby developer and is the author of the book “Practical JRuby on Rails”. He works for ThoughtWorks in Chicago. Ola’s wide technical experience ranges from Java, Ruby and LISP to several open source projects. He likes implementing languages, writing regular expression engines, YAML parsers, blogging, and other similar things that exist at the cutting edge of computer science.

This is a first hand report by Sandeep Mukhopadhyay:

The GeekNight Event kicked off officially with Ola Bini giving an overview of JRuby. JRuby is a 100% Java implementation of the Ruby programming language. It is Ruby for the JVM. A number of companies use JRuby, including Thoughtworks, as it is most compatible version of Ruby as coded in Java.

Ola also displayed a sample Application which showcased integration of Java APIs with JRuby. Using a combination of Explicit Extension API and OO internals in JRuby, integration bridges can be built with Legacy systems. Ola showed how to use Java and Ruby interchangeably in same program, and this feature was quite popular among those present.

Understandably, JRuby seems to be popular among many developers as it gives a free hand to use the best possible features of Java and Ruby in same ecosystem. Ola also discussed integration with different language like Erlang and Clojure just by adding jars into classpath and also talked about build tools for JRuby i.e. (Ant+Rake).

Just like in other technology events, the technical crowd soon started discussing issues like threading, Unicode, Performance, Memory Usage and Garbage Collector. Ola also brought up issues with threading as it runs on Native threads or Green Threads and briefly discussed as how to check memory usage of applications in JRuby using JConsole and other Java tools.

Gautam Rege (Co-founder Josh Software) and whose company extensively uses Ruby on Rails also discussed a few production issues.

Last but not the least, Ola and group also discussed issues about support at the Cloud level by Engine Yard as well as using Ruby Frameworks (Cucumber and JtestR) for testing.

It was a productive GeekNight

GeekNight with Ola Bini – Core Developer of JRuby – 25 May

ThoughtWorks Pune invites all developers to their latest GeekNight tomorrow at 6:30pm. GeekNight is a series of a talks about cutting edge technology, where you also get to meet like-minded geeks.

This GeekNight features a talk “JRuby for the win” by JRuby Core Developer Ola Bini.

JRuby is an implementation of Ruby for the JVM. It gives you unprecedented integration with the Java ecosystem while still having access to great Ruby libraries such as Rails, RSpec and many more. The last year has seen lots of uptake for JRuby, many new committers, thousands of bugs fixed and lots of new functionality.

This talk will give a short introduction to JRuby, and then provide more information about where the project is now and where it is going.

About the Speaker – Ola Bini

Ola Bini is a core JRuby developer and is the author of the book “Practical JRuby on Rails”. He works for ThoughtWorks in Chicago. His technical experience ranges from Java, Ruby and LISP to several open source projects. He likes implementing languages, writing regular expression engines, YAML parsers, blogging, and other similar things that exist at the border of computer science.

About GeekNight

GeekNight is an informal meeting for technologists to exchange ideas, code and learning. It is held periodically at ThoughtWorks offices in Bangalore, Pune, Chennai and Gurgaon.

Venue, Time, Fees and Registration

The event is on Wednesday, 25th May, from 6:30pm, at ThoughtWorks Technologies, Panchshil Tech Park, Yerwada. This event is free and open for anybody to attend. Please register here

What I like about Rails3 by Gautam Rege

(This article by Gautam Rege is based on a talk he gave at Techweekend #8. It was first published on the Josh Software blog, and is reproduced here with permission.)

This is NOT a post about differences between Rails 2.x and Rails 3 but these are some musings about what I love in Rails. A lot of goodies come ‘in the box’ (I hate saying out-of-the-box) with Rails3 and some of them have been there since early version of Rails but somehow less frequently used or talked about. I spoke about this at Techweekend #8 and the presentation is here.


Ever had a production system crash one day – without any code deployment or even anyone logging in. After the initial ‘its not me’ excuses, one system administrator says ‘Hey, I had updated the system libraries’. Having been burnt already before (hopefully), you check on the system and find that some system library has been upgraded and some gems have been upgraded and that is causing incompatibility between other gems etc. We had the case where rack (1.0.1) was upgraded to rack (1.1) causing incompatibility with the Rails gem we were running! The fix is simple — upgrade or downgrade your gems or libraries and you’re on your way. A few days later, another developer needs to deploy a simple sinatra application. He takes the latest version which requires rack > 1.1 and it automatically upgrades the gem. Boom! Your Rails app crashed again.

Did I hear you freeze the gems? Nah – not a good approach, as it causes your application deployment bundle to be huge and ‘frozen’. Every application you use would require to freeze gems and this does not really solve your problem.

Bundler (by Yahuda and Carl) built this awesome gem which is now the de-facto standard for any Rails application. In fact, it was so cool, its not Rails 2.x compatible and very highly recommended. You can now specify your dependencies in a Gemfile and prevent any clashes with any other gem versions and their dependencies. Since the gems are installed in the system default location (not frozen in your app), it means it us re-usable and version friendly!

source "http://rubygems.org"

gem "haml" # the latest version
gem "rack", "~>1.1" # v1.1 or greater
gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"
gem "splat", :path => "~/Code/splat" # local code base

group :test do # only in test environment
gem "rspec", :require => "spec"


Unobtrusive Java Script has been around for ages now but Rails lingered with prototype.js. Now, with the awesome features of JQuery, we can easily use UJS to solve some common and nagging problems:

  • Avoid submit if button clicked twice!
  • Make non-get requests from Hyperlinks!
  • Submit form data via Ajax

Add :remote => true to hyperlink, forms and other elements. This adds the data-remote=true in your html properties. The ‘live’ JQuery function binding kicks in and sets up the events for various elements. Simple and awesome – this is available here.


Cross site scripting has been a pain to handle for a long time. Rails does this under covers – you dont event need to know too many details:

protect_from_forgery is automatically added during basic rails project creation. This ensures that every form created by the application has an authenticity_token as a hidden data field. During a post request, this is verified and thus ensures that the source of the form creation is the same server – this avoid session stealing where a malicious form is posted to your server using an authenticated user’s session!

While using UJS, you need to add csrf_meta_tag in your layout to avoid silent Ajax errors.

SQL injection is cleanly avoided with new where syntax:

# Wrong
where("user_name = '#{user_name}' AND "password = '#{password}'").first

# Correct
where("user_name = ? AND password = ?", user_name, password).first

# Correct and clean
where(:user_name => user_name, :password => password).first

In Rails3, all html spewed out is HTML SAFE! So, you cannot leave gaps for non-HTML safe code, even by mistake! If indeed you do trust the source, you can use the ‘raw’ method to spew out the HTML as is.

Rails Eager Loading

The N+1 query problem is fairly common and largely ignored until you hit serious performance issues.  Straight out of the Rails guide, consider the case

clients = Client.all.limit(10)

clients.each do |client|
puts client.address.postcode

There are 11 queries fired here. Using the :includes construct, Rails does eager loading like this:

clients = Client.includes(:address).limit(10)

clients.each do |client|
puts client.address.postcode

Here only 2 queries are fired as Rails includes the address relationship too while fetching the client objects.

Transliteration / Babosa

What happens to your permalinks if a user enters the information in Arabic? We faced exactly this issue and were asked by our client to prevent input which is not English. Woh! ActiveSuppprt in Rails3 addresses a lot of these transliteration issues:

"Jürgen Müller".to_slug.transliterate.to_s #=> "Jurgen Muller"

Performance using Identity Map

The awesomeness of Rails progression – As of this inclusion the Identity Map pattern is now part of Rails 3 caching mechanism. An identity map is a design pattern used to improve performance by providing a in-memory cache to prevent duplicate retrieval of the same object data from the database, in context of the same request or thread.

Optimistic Locking

A really old concept which has been there since REALLY early versions of Rails. This is commonly overlooked but is critically important when it comes to concurrent request processing. By adding a ‘lock_version’ field in the table, Rails automatically kicks into optimistic locking mode and prevents concurrent writes when the data is stale. The StaleObjectError is raised incase the lock_version is not the same as when it was read.

Named Scopes

This is almost cliched now 🙂 Mames scopes were added since Rails 2.1. Its one of the things I love about Rails. The scopes are chained together and the query is fired only when the data is really needed. This is excellent for report filters! Adding new filters is a breeze as its only one of the scopes to be chained. Remember that scopes do not return an Array but an association object like has_many. That is how they can be chained to other scopes.

I’m pretty sure I have missed some things here. Do comment on what features you like best about Rails3! 😉


TechWeekend 8: Web Development Frameworks – Rails, Grails, Django

TechWeekend #8 (#tw8) this Saturday will focus on Web Development Frameworks. We have the following talks lined up, and one more is likely to get added in the next day or two

  • Grails, and other web development techniques in Groovy, by Saager Mhatre
  • Interesting new things in Rails3, by Gautam Rege
  • “A Django Case-Study: Use of advanced features of Django in http://wogma.com” by Navin Kabra. This talk will be structured in such a way that people who are not familiar with Python/Django might find the features interesting; while Django developers will be interested in how they were implemented in Django.

TW8 will be this Saturday, 19th March, from 10am to 2pm, at the Sumant Moolgaonkar Auditorium, Ground Floor, A Wing, ICC Trade Center, SB Road.

About Techweekend

TechWeekend Pune is a volunteer run activity. TechWeekend talks are held on the 3rd Saturday of every month from 10am to 2pm at Sumant Moolgaonkar Auditorium, Ground Floor, ICC Trade Center, SB Road. Each TechWeekend event features 3 or 4 talks on advanced technical topics. These events are free for all to attend. See PuneTech articles about past techweekends to get an idea of the events.

Join the techweekend mailing list to keep in touch with the latest TechWeekend activities.

About the Sponsor – Microsoft

Many thanks to Microsoft for sponsoring the venue for Techweekend. Microsoft wants to get more closely involved with the tech community in Pune, and particularly the open source enthusiasts – with the intention of making everybody aware that their cloud technologies (like Azure) actually play well with open source, and that you can deploy your php applications, your drupal/joomla installs on Azure.

When, Where, How much

TechWeekend #8 will be on Saturday, 19th March, from 10am to 2pm, at Sumant Moolgaonkar Auditorium, Ground Floor, Wing A, ICC Trade Center, SB Road.

This event is free and open for anybody to attend. Register here.

Pune Rails Drinkup: Ruby-on-Rails tech talks over (free) drinks

The Pune Rails Meetup Group invites all enthusiasts of Ruby-on-Rails for their second “Drink Up” event. Gautam Rege writes:

This time we have a technical drink-up. We shall have 1 or 2 technical sessions followed by networking.

Thanks to IntelleCap for sponsoring this meetup entirely!

Venue: Boat Club

Agenda: We have 2 technical talks of 45 minutes each.

6pm – 6.45pm: “Rhodes in a Nutshell” by Akshat Paul & Abhishek Nalwaya
7pm – 7.45pm: Talk from IntelleCap (TBD)
7.45pm – 8pm: A short talk from our sponsor – IntelleCap

8pm – onwards: networking! 😉

This event is free and open to all but, there is reserved seating to meet at most 30 people. Please RSVP in advance to avoid organizing constraints. You must register here

Meeting Report: Pune Rails Meetup (Dec 2009)

(This is a report of Pune Ruby on Rails meetup that happened on 12th December. This report was originally written by Gautam Rege on his blog, and is reproduced here with permission for the benefit of PuneTech readers.)

Click on the logo to find all punetech articles about Rails in Pune

It was great to be a part of the Pune Rails Meetup which was held yesterday (19th December, 2009) at ThoughtWorks, Pune. It was an idea initiated by Anthony Hsiao of Sapna Solutions which has got the Pune Rails community up on their feet. Helping him organize was a pleasure!

It was great to see almost 35 people for this meet — it was a probably more than what we expected. It was also heartening to see a good mix in the crowd – professionals in rails, students working in rails and students interested in rails – not to forget entrepreneurs who were very helpful.

Proceedings began with Vincent and _______ (fill in the gaps please — am really lousy with names) from ThinkDRY gave an excellent presentation on BlankApplication – a CMS++ that they are developing. I say CMS++ because its not just another CMS but has quite a lot of ready-to-use features that gets developers jump-started. There were interesting discussions regarding how ‘workspaces’ are managed and how its indeed easier to manage websites.

After this technical talk, I spoke next on my experience at the Lone Star Ruby Conference in Texas. I tried to keep the session interactive with the intention of telling everyone how important it is to know and use Ruby effectively while working in Rails. Dave Thomas’s references to the ‘glorious imperfection’ of Ruby did create quite a buzz. To quote a little from Dave’s talk:

name {}

This is a method which takes a block as a parameter but the following line is a method which takes a has as a parameter! A simple curly parenthesis makes all the difference!

name ( {} )

Similarly, the following line is a method m() whose result is divided by ‘n’ whose result is divided by ‘o’


but add a space between this and its a method m() which takes a regular expression as a parameter!

m /n/o

It was nice to see everyone get involved in these interactive sessions. More details about my experience at LSRC is here.

After this there was another technical talk about a multi-app architecture  that has been developed by Sapna Solutions. Anthony and Hari gave a talk on this and it was very interesting to see it work. Using opensource applications like shopify, CMS and other social networking apps to work with a shared-plugin and a single database, its possible to create a mammoth application which is easily customizable and scalable.

Hari did mention a few problems like complexity in migrations and custom routes which they currently ‘work-around’ but prefer a cleaner approach. Some good suggestions were provided by Scot from ThoughtWorks regarding databases. I suggested some meta-programing to align models. Working with git submodules and ensuring rake scripts to sync up data, this indeed seems to have a lot of potential.

There were some new entrepreneurs from ______ who have already developed a live application in Merb which they discussed and explained details of. It was good to hear about how they managed performance and scalability testing. The Q&A forum which was the next event was extremely interactive. Some of the discussions were:

Which are really great CMS in Rails?

There were some intense discussions regarding RadiantCMS, Adva and even BlankApp. The general consensus was a ‘programmable CMS’ Vs WYSIWYG. Those who prefer more of the content management prefer CMS’s like Drupal, Joomla. Those who prefer more customization via programing and code, prefer Radiant. This topic could not close and is still open for discussion.. Do comment in your views – I am a radiant fan ;)

What about testing? Cucumber, Rspec, others?

Usually its still adhoc – testing is expensive for smaller firms — so adhoc blackbox testing is what is done. I opined that cucumber and rspec ROCK! Cucumber is great for scenario testing and testing controller logic and views. Rspec is great for Direct Model Access and Cucumber can make great use of Webrat for browser testing.

In Rpsec, when do we use mocks and stubs?

It was suggested that mocks and stubs should be used when there are no ready model and code. If the code is ready, its probably just enough not to use mocks and stubs directly. Comments welcome on this!

How do you do stress testing?

Stress testing, concurrency testing and performance testing can be done using http-perf. It was interesting to note that ____ have actually done their own implementation for stress and concurrency testing. I recommended they open source it.

How are events, scheduled job and delayed jobs handled?

This was my domain :) Using delayed_job is the way to go. Following the leaders (github) and using Redis and resque would be great too but definitely not backgrounDrb or direct cron!

What project management tools do you use? Pivotal Tracker, Trac, Mingle?

Pivotal tracker suits startup needs. Mingle rocks but becomes expensive. Scott ? ;) Dhaval from TW mentioned how easy it was to co-ordinate an ‘mingle’ with their 200 strong team over distributed geographies.

Which SCM do you use? git, svn, cvs?

People have been very comfortable with git and more and more are migrating from svn to git.  It was heartening to see that nobody uses CVS :) Jaju (I have have misspelt) gave an excellent brief about how code and diffs can be squished and ‘diff’ed with another repository before the final merge and push to the master. Dhaval gave an idea about how they effectively used git for managing their 1GB source code (wow!)

Some pending questions – probably in next meet-up

  1. Which hosting service do you use and why?
  2. TDD or BDD?

Suggestions are welcome!

About the Author – Gautam Rege

Gautam Rege is the co-founder and managing director at Josh Software, Pune.

Gautam has an engineering degree in Computer Science from PICT, Pune. In his 9 years in the IT industry, he has worked in companies like Symantec, Zensar and Cybage before starting Josh 2 years ago.

Gautam’s technical knowledge spans from various languages like C, C++, Perl, python, Java to software expertize in various industry domains like Finance, Manufacturing, Insurance and even advertising.

As with the company name, Gautam has a lot of ‘josh’ about new and emerging technologies. His company is one of the few which works almost exclusively in Ruby on Rails, the cutting edge web technology that has taken the industry by storm.

(Comments on this article are closed. Please comment at the location of the original article)

Reblog this post [with Zemanta]

Pune Rails Meetup – Dec 19

What: Pune Ruby on Rails Meetup
When: Saturday, December 19, 4pm-7pm
Where: ThoughtWorks Technologies, Tower C, Panchshil Tech Park, Yerwada
Registration and Fees: This event is free for all to attend. Register here.
Event Page: Link


Click on the logo to find all punetech articles about Rails in Pune

Hang out with other Rails geeks in Pune, discuss what’s hot, learn about the bleeding edge and find other like minded people on Rails!


  • Introduction (conducted Session introducing practicioners and their apps on Rails)
  • BlankApplication (Vincent – ThinkDry)
  • my experience at Lone Star Ruby Conference (Gautam, Josh Software)
  • Engine Yard Cloud (Anthony, Sapna)
  • General Open Forum – ask questions to other rails practicioners
  • other spontaneous talks
Reblog this post [with Zemanta]

Pune Rails Meetup #1 – 21st May

Pune Rails LogoWhat: A get together for Pune’s Ruby on Rails enthusiasts
When: Thursday, 21st May, 8pm
Where: North Main Lounge, Koregaon Park
Registration and Fees: This event is free for all to attend. No registration required
Links: Follow @punerailsmeetup on twitter, Facebook Pagex

A meetup for all the developers in and around Pune working on ruby on rails – the coolest web technlogy available. A meetup to chill out together and talk! It is being organized for the first time to initiate and encourage interaction between the rails community in Pune!

Also: Check the Facebook Page for PuneRailsMeetup

Reblog this post [with Zemanta]

Geek Night @ Thoughtworks: IronPython, Ruby in C#, Distr. VCS – 4 April

thoughtworker logo, thoughtworksWhat: Geek Night at Thoughtworks. Three discussion – 1) IronPython 2) Writing Ruby like code in C# and 3) Distributed Version Control Systems
When: Saturday, 4th April, 2pm onwards
Where: Thoughtworks, GF-01 & MZ-01, Tower C, Panchshil Tech Park, Yerwada
Registration and Fees: This event is free for all to attend. Register here

The following 3 exhilarating talks are scheduled for this Geek Night.

1. Aroj George: “IronPython”

Aroj will take you through some cool ways you can use the power of Python in the .NET world. This talk includes a demo of embedding an IronPython engine in a .NET application to enable interactive exploration and dynamic behaviour.

2. Ravi Kumar Pasumarthy: “Why Ruby? You have C#”

Ravi’s talk is all about how to write Ruby-like code (short and less verbose) in C# without using dynamic language features. It also brings a new way of thinking about extending existing libraries to add new features. The presentation also covers topics like Extension Methods, Linq, Type inference, and Closures.

3. Shodhan Sheth and Nikhil Fernandes: “Distributed Version Control Systems”

This duo will talk about version control systems for distributed and disconnected teams. They help you think about, whether the version control system you are using is the “best tool for the job”?

Who To Contact: Pradip Hudekar at +91 9923000987

Write To: phudekar@thoughtworks.com

Reblog this post [with Zemanta]

Seminar: Strengths and weaknesses of various programming languages – 28th March

What: A presentation on the strengths and weaknesses of various programming languages, and how to choose one for your application, by Dhananjay Nene
When: Saturday, March 28th, 4pm
Where: SICSR – Symbiosis Institute of Computer Studies and Research – Map
Registration and Fees: This event is free for all. No registration required.

Confused about whether to use C/C++, or Java for your application? Or unsure of whether to go with Python, or Ruby, or PHP, or one of the many other “new” languages? Are you wondering whether it is worth the trouble to learn a hot new language?

Popularity of programming languages, or the number of jobs being offered for some programming language are not really good indicators by which to make your choice. It’s time to get some data on the fundamental technical differences between the major language groups today. It’s time to get some useful insights on the business implications your choice.

Dhananjay will discuss the relative merits and weaknesses of the major classes of modern programming languages and they reasons why you should choose one over the other for a specific application. He will cover both – technical issues in choosing a language, and business reasons.

This is targeted towards both – developers as well as managers who want to go past the religious debates over programming languages and want to be able to take decisions based on technical/business reasons as opposed to faith.

To get a primer for the material to be covered, check out the article Dhananjay wrote yesterday about how to improve your web based software development and maintenance ROI with dynamic programming languages

About the author – Dhananjay Nene

Dhananjay is a Software Engineer with around 17 years of experience in the field. He is passionate about software engineering, programming, design and architecture. He did his post graduation from Indian Institute of Management, Ahmedabad, and has been involved in Senior Management positions and has managed team sizes in excess of 120 persons. His tech blog, and twitter stream are a must read for anybody interested in programming languages or development methodologies. Those interested in the person behind the tech can check out his general blog, and personal twitter stream. For more details, check out Dhananjay’s PuneTech wiki profile.

Reblog this post [with Zemanta]