Hosting Control Panel
Posted by tom March 25th, 2006
Besides my normal day work I am starting up a little webhosting service (a hobby!). There are many different webhosting solutions, ie software products which allow you to maintain that business: ISPConfig, VHCS2, CPanel, WebCP, Plesk, etc. What struck me the most with these was how they impact your system configuration. They seem to have impact almost everywhere. Ofcourse you ask: Why are you telling this here?
Read the rest of this entryException handling in Ruby
Posted by tom March 21st, 2006
begin
loc = Location.find_by_name("NL-ELC")
@lp.move(loc)
rescue LicenseplateLocationException => lple
print "Licenseplate not for your location: " + lple
rescue StockException => se
print "Not enough stock: " + se
end
Currently my employer’s error handling is like such:
IF( theErrorMessage = "" ) THEN GOSUB moveLP END ELSE CRT "Error!" END
What is true?
Posted by tom March 20th, 2006
This is one I needed to write down, in case I forget: In Ruby any value that is not nil or false is true.
Printing / Create printable documents
Posted by tom March 17th, 2006
Austin Ziegler wrote an article back in October 2005 on “Creating Printable Documents with Ruby”, but it’s applicable to RAILS as well. It does not state HOW you can actually send these documents to the printer, but we could assume the user is capable of pressing print. The article uses PDF and in specific PDF::Writer
Read the rest of this entryBuilder: The other template
Posted by tom March 15th, 2006
Builder is a library which RAILS will use if you end your templates in .rxml. As you can probably guess it’s very helpful in case you want to generate XML files.
Charmed columns
Posted by tom March 15th, 2006
RAILS/Ruby well, actually ActiveRecord maintains a number of magical column names. These are automatically updated by ActiveRecord and have some nice side effects.
Read the rest of this entryDissecting Rails, Part 1
Posted by tom March 13th, 2006
How does RAILS work and in specific how does it’s ORM (Object-Relational Mapping) work? A bit of it’s power is exposed in the below code, which is a normal Ruby program using the ActiveRecord orm-library.
Read the rest of this entryTask T: Testing
Posted by tom March 12th, 2006
As I went through the book “Agile Web Development with Rails” I now reached chapter 12, which is on testing. Upto chapter 12 we (the author and I :) ) have been adding code to our Depot application, but chapter 12 is not like that. It’s a chapter on testing! In my normal day work, we do testing, but it is nothing like this! Rails has it’s testing split up in unit testing and functional testing.
While at first unit testing may start a little slow, loading a record from the database and checking whether it does that correctly, it’s actually great fun to see it working! This will really ensure a working application!
When you’re reading this chapter you might want to take a look at: Mike Clark’s Weblog concerning testing.
Even more fun are the functional tests (or what Rails calls functional tests), for example testing whether somebody can reach administration pages without an username/password. Or testing whether somebody trying to login with an invalid username/password combination can actually login. Ofcourse you can test this yourself, by using your browser and your mouse, but it will take time. With Test::Unit (part of Ruby and therefor part of Rails) you test all this faster than you can ask: “Where’s my mouse?”.
