RPCFN: Average Arrival Time For A Flight - 2 repost

Ruby Programming Challenge For Newbies RPCFN: Average Arrival Time For A Flight (#2) – By Chris Strom Thank you for the very encouraging response to the first-ever “Ruby Programming Challenge For Newbies (RPCFN)“. The second Ruby challenge is from Chris Strom. About Chris Strom Chris Strom (twitter / blog) in his day job, is the Director of Software Engineering for mdlogix, a small company in Baltimore, Maryland. They develop software that manages clinical research trials and associated data.

Cookie-based Sessions in Sinatra

Poll: Ruby Problems for Beginners and Prizes

Many RubyLearning participants wrote in asking RubyLearning to start a weekly post containing a problem to be solved using Ruby. A problem will be posted here every week / fortnight and anyone is free to offer their solution (the solution should be clear-cut, follow Ruby conventions and still be easy to understand) as a comment to the blog post. A small panel will evaluate the solutions received and decide the best amongst them all.

TMail: Sending email

TMail is a commonly used library by the ActionMailer component of Ruby The students of the FORPC101 batch wanted to know how they could send an email in Ruby. Today, out of the various options available, we will have a quick look at TMail – a library used for composing and manipulating email messages for Ruby. TMail is designed to be an Request For Comments (RFC) compatible library. The goal of TMail is to allow you to create emails programatically without having to know about the RFCs or how they work, or what their standards are.

Ruby and Twitter

Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing? They say that Twitter is on its way to becoming the next killer app. RubyForge has a command line interface and Ruby api wrapper for twitter. I got hooked on to Twitter just today, when I came across this api. The documentation is not all that complete, given the fact that only John Nunemaker is working on this project.

"AkitaOnRails" On Ruby Symbols

RubyLearning recently caught with Fabio Akita from Brazil and got his viewpoint on one of the vexing areas for beginners in Ruby – Symbols.

Ruby MySQL Tutorial

This brief Ruby MySQL Tutorial shows you how you can connect to MySQL in Ruby. MySQL support in Ruby was made possible by Tomita Masahiro. He has developed a pure Ruby binding called Ruby/MySQL. We need to install the same on our PC and the installation (you need to be connected to the internet and it takes some time) is as shown below: C:\>gem install mysql Bulk updating Gem source index for: http://gems.rubyforge.org Select which gem to install for your platform (i386-mswin32) 1.

Ruby Quirks

Ruby Quirks – peculiarity of behavior? I know this topic is debatable and remember “one man’s meat is another man’s poison!” I plan to write down here (in no particular order), some of the little Ruby quirks that I’ve picked up and which, I now use comfortably. 1. Peter Cooper, the author of the book ‘Beginning Ruby’ introduced me to Real-Time chat using an IRC client. On the #ruby channel at irc://irc.freenode.net/ I heard of this quirk: class MotorCycle def initialize(make, color) @make, @color = make, color end end m = MotorCycle.new('Honda', 'blue') m.instance_variable_set(:@make, 'Kawasaki') m.instance_variable_set(:@gears, 4) puts m.inspect Check the output of the above program.

Ruby Snips

Your favourite bit of Ruby code?

An interesting thread at Ruby_talk is ‘Your favorite bit of Ruby code.’ Setting aside time for learning HTML is beneficial to any web host. John Carter from New Zealand has this interesting snippet of code: # Ruby is Objects all the way down and open for extension... class Integer def factorial return 1 if self <= 1 self * (self-1).factorial end end puts 6.factorial Technorati Tags: Ruby code

Convert bytes to megabytes

In one of my projects, I need to find the file-size in megabytes again and again. This simple method helps me to convert the size of a file in bytes to megabytes. This is useful for very large files. MEGABYTE = 1024.0 * 1024.0 def bytesToMeg bytes bytes / MEGABYTE end # big file len = File.size("Dreamweaver8-en.exe") puts len.to_s + ' bytes' # displays 62651176 bytes puts bytesToMeg(len).to_s + ' MB' # displays 59.7488174438477 MB One of the uses for PDF conversion is that by going through the process of converting PDF to Word you’ll have a more easily editable document than if you didn’t do PDF conversion and tried to edit a PDF file.