Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Ruby module R106
Input and Output in Ruby
Exercises, examples and other material relating to training module R106. This topic is presented on public courses Learning to program in Ruby, Ruby Programming

Background
User and file input and output - and also reading from other streams such as connections to other processes and other (remote) web services. Not to forget file system checking and manipulation
Articles and tips on this subjectupdated
3429Searching through all the files in or below a directory - Ruby, Tcl, Perl
Many of our customers want to learn how to traverse all the files in a directory, or perhaps even all the files in or below a directory. I quite often write a demonstration program during our courses which looks though part of a file system tree for files over a certain size, or for the largest (so ...
2011-09-09
 
2974Formatting your output - options available in Ruby
Almost every program I've ever written (and almost every program you'll ever write) is required to output a mixture of constant character strings and results - formatting the output into a human readable form, or adding in separators between values in data files which the next program in a chain will ...
2010-09-29
 
2893Exclamation marks and question marks on ruby method names
In ruby, you'll find some function/method names that are just a series of letters (a rather conventional sort of name for a function or a variable), and others that have a ! or ? on the end. What's the significance of these? • A function with a ! on the end usually alters the incoming object ...
2010-07-30
 
2621Ruby collections and strings - some new examples
From yesterday's Ruby course - a whole set of new examples on Ruby collections - arrays (which are ordered lists) and hashes (which are unordered). In other words, you look somethng up in an array by its position number, whereas you look something up in a hash based on its unique key, and the way it's ...
2010-02-03
 
2614Neatly formatting results into a table
Would you like to produce a neat table of results, with the columns just wide enough to take the data? That sounds straightforward, but you can't output anything until you've looked through all the lines to see how long each of them will be. I was talking about this algorithm today, and this evening ...
2010-02-02
 
2290Opening and reading files - the ruby fundamentals
Once you've noted that File.new doesn't create a new file, but rather (default) opens an existing one for read ... you'll find Ruby's file handling interface easy to use. The new methof returns a file handle object - a sort of buffer that sits between the file and your program - and each time you run ...
2009-07-16
 
1887Ruby Programming Course - Saturday and Sunday
We're so busy during the week at the moment that I'm running an extra Ruby Course this weekend. The main use of Ruby is within "Ruby on Rails", but our course concentrates on the language itself and so it's suitable for people who are using RSpec, cucumber and Watir as well as Rails. Here are some ...
2008-11-16
 
1587Some Ruby programming examples from our course
I was giving a Public Ruby Course to a small group at the end of last week ... and having a small group gave me the opportunity to write some demonstrations in front of them. I have now tidied these up and have pleasure in presenting to more Ruby demonstrations: Ruby's BEGIN block The compact method ...
2008-03-21
 
Examples from our training material
afid.rb   All files in a directory
amaze1   Find and count matching lines in file
courseprice   Checking if a file exists and writing to a file
d3_1   iterating through a file, file output
d3_2   Testing files
d3_3   Reading from another process
ddd   parse a directory
filemore   Analysing a file / counting events
filestuff.rb   File handling demonstration
finfo.rb   File status checks
formprint   Formatted printing
large   Checking a whole directory tree
ndo   Running another process - netstat example
sysact.rb   Run a process from Ruby, stream output back
two   chop and chop!
webreader.rb   Read a page given its url
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from http://www.training-notes.co.uk.
Topics covered in this module
Opening and closing files.
Reading and writing from files.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre. Also available is the Opentalk Forum for discussion of technical questions.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/R106.html • PAGE BUILT: Wed Mar 6 10:39:20 2013 • BUILD SYSTEM: wizard