Exercises, examples and other material relating to training module R117. This topic is presented on public courses Learning to program in Ruby
, Ruby Programming
Related technical and longer articlesInterfacing applications to a MySQL database engineGraphic User Interfaces (GUIs)
|Articles and tips on this subject||updated|
|4679||Reading in XML in Ruby with xmlsimple|
The xmlsimple Ruby gem allows you to load in a file (or IO handle object or string) of XML as a multidimensional collection - hashes of arrays of hashes. There's a sample program here which includes this code to load the data from after __END__:
info = XmlSimple.xml_in(DATA)
|4006||Ruby / SQLite3 example program, showing JOIN v LEFT JOIN|
Ruby includes support for the SQLite3 database ... and SQLite is an excellent tool for developing and testing ("Spike solutions") your database structure and concepts before implementing a larger system. For a smaller and straightforward requirement, SQLite may be all that you require.
Towards the ...
|2714||A simple example - XML from a Ruby program|
The REXML module is supplied with the Ruby distribution and provides a neat way of handling XML data in Ruby. There is a very wide range of methods available, though, and sometimes it's hard to see the wood for the trees.
So here - to start - is the [full source] of an application which reads an ...
|1890||MySQL database from Ruby - an example|
Both MySQL and Ruby are huge subjects - the former being an excellent database engine and the latter a superb programming language. Yet although each individually is a huge subject, linking the two (i.e. accessing data stored in a MySQL database via a Ruby program) is so each that it's almost trivial.
Examples from our training material
|dbl|| Using MySQL databases from Ruby|
|myrssfeed.xml|| Sample XML data|
|tag2|| SQLite example with table joins|
|tago|| SQLite example|
|x1.rb|| REXML - XML in Ruby - absolute basics|
|xmls.rb|| XML in Ruby with xmlsimple gem|
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
Ruby/Tk, Ruby/GTK, Glade, etc.
FOX and FXRuby.
VisualuRuby, SWin and VRuby.
SAX and DOM - XMLParser and others.
SQL and ODBC connection.
Using Ruby/DBI to connect to MySQL, Oracle, etc.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
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.