Archive for February, 2007
Christian Billen is the Chief Information Officer, IT Department at WarmlyYours. Recently, I had a chance to talk to him and requested him to share some of his experiences. Here goes.
Could you tell us something about yourself - your background, where you are based?
I was born in Belgium. My father was a programmer and I have self thought myself IT from an early age, even though I was forbidden around the computers of the house (but that’s what makes it fun). I studied programming analysis in school and immediately came to the USA after getting my degree. I worked for various companies as a consultant implementing e-business solutions in the dot com era and also helped small business build an IT infrastructure. I have certifications from Microsoft, Sun, Cisco and PMI and now I am managing the IT infrastructure and development of web based systems for WarmlyYours, a business located in the northwest Chicago suburbs.
Could you tell us a little more about WarmlyYours.com?
WarmlyYours is a twelve year old company based in the Chicago suburbs. We specialize in providing home comfort solutions to consumers and trade professionals. Our most popular product is an electric floor heating system that goes right under your tile. WarmlyYours is unique in that their growth was entirely due to the successful exploitation of the internet as a low cost marketing platform. We have invested a lot of R&D into our e-tools and continue to this day. We also strive to be as lean and efficient as possible by using powerful back end systems.
Why did you choose Ruby on Rails (RoR) as a framework for WarmlyYours.com?
Until then we had been mostly a Microsoft shop, .NET was the language of choice. We wanted to bring open source to the enterprise and leveraging that model. RoR had the potential to be a positive force because of its cross platform capabilities, the elegance of the language, the power of the framework and the strong support of the community behind it. We also wanted to adopt a more agile philosophy and RoR seemed designed around these concepts. So we decided to try it with a new project and were impressed by its success; now we would not develop in anything else when it comes to web applications.
Were there any surprises in working with RoR?
Sometime it could get quite complex to implement certain libraries (like Rmagick or Geos) and we had to trade our ability to be cross platform and focus on the *nix to get the most of the functionality. Beyond that RoR was quite painless.
You recently made a trip to India to setup your off shore development unit at Hyderabad. What was your impression about the RoR scene in India?
It is very much in its infancy, and in Hyderabad nearly non-existent as the hub seems to be in Pune, but we hope to remedy that. Luckily we found many enthusiastic people willing to help us achieve this goal.
What advice would you give startups about platform choices?
To be open minded about your options and evaluate the platform that will allow you to get the most accomplished in the least amount of time, time to market is everything. Sometime technology isn’t just the answer, consider the support of the community and how active the talent pool is.
Getting back to WarmlyYours, what are your future plans?
We plan to continue planning the next features of our flagship application Myprojects.warmlyyours.com, get our offshore team up and running as soon as possible, so that the real work can begin.We hope to deliver new features every month and increase our market share by offering value added tools to our partners, helping them with the selling of home comfort solutions.
Technorati Tags: Christian Billen, WarmlyYours
Posted by Satish TalimI thought I would let you know that I have added Google AJAX Search on my Learning Ruby site. This embeds a video bar on the web page and lets you watch Ruby and Rails related videos (presentations, tutorials, etc.) you’ve selected, right there on the site itself. Have fun!
Technorati Tags: AJAX, Google, Google AJAX Search, Ruby Video Search
Posted by Satish TalimRuby/Tk
Ruby/Tk provides Ruby with a graphical user interface (GUI). The Tk extension works on Windows, Mac OS X and Unix systems.
Previous versions of the Ruby One-Click Installer contained an (old) version of Tcl/Tk. Now this Ruby installer only contains the Ruby bindings to whatever version of Tcl/Tk you wish to install. It’s recommended to use ActiveTcl. Download the file ActiveTcl8.4.13.0.261555-win32-ix86-threaded.exe and install it. Reboot your PC.
Simple Tk applications
Let’s understand the following program hellotk.rb
require 'tk'
hello = TkRoot.new {title "Hello World"}
Tk.mainloop
The Tk documentation shows the class hierarchy. Briefly, the hierarchy is as follows:
Object->TclTkIp->TkKernel->TkObject->TkWindow->TkRoot
Object->TclTkIp->TkKernel->TkObject->TkWindow->TkLabel->TkButton
There are many modules like:
Tk, Tk::Wm and many others.
TkKernel is the superclass of TkObject. The subclass redefines the class method new to take a block.
TkObject is the superclass of all widgets and has an included Tk module.
TkRoot class represents the root widget. The root widget is at the top of the Ruby/Tk widget hierarchy and has the included module Tk::Wm for communicating with a window manager. The methods introduced here are normally used as instance methods of TkRoot.
In the program, after loading the tk extension module, we create a root-level frame using TkRoot.new. With Tk you create widgets and then bind code blocks to them. When something happens (like the user clicking a widget), Tk runs the appropriate code block. In our program, we use the title and minsize instance methods (of module Tk::Wm) in the code block to TkRoot.new. We are now ready with our GUI and we invoke Tk.mainloop
Let us now add some widgets to the above program, namely a TkLabel. The modified program is hellotk1.rb
require 'tk'
hello = TkRoot.new do
title "Hello World"
# the min size of window
minsize(400,400)
end
TkLabel.new(hello) do
text 'Hello World'
foreground 'red'
pack { padx 15; pady 15; side 'left'}
end
Tk.mainloop
Here, we make a TkLabel widget (representing a label) as a child of the root frame, setting several options for the label. Finally, we pack the root frame and enter the main GUI event loop.
We also need to be able to get information back from our widgets while our program is running by setting up callbacks (routines invoked when certain events happen) and sharing data. The next example, hellotk2.rb does that.
require 'tk'
TkButton.new do
text "EXIT"
command { exit }
pack('side'=>'left', 'padx'=>10, 'pady'=>10)
end
Tk.mainloop
Callbacks are very easy to setup. The command option takes a Proc object, which will be called when the callback fires. This means that the code block passed into the command method is run when the user clicks the button, allowing you to programmatically execute the same functionality that would be invoked on an actual button press. Note that the Kernel#exit method terminates your program here.
We shall now build a rudimentary GUI interface to our SOAP server hosted at www.puneruby.com. The program is the soapguiclient.rb
require 'soap/rpc/driver'
require 'tk'
class SOAPGuiClient
def connect
@buttonconnect.configure('text' => 'Reset')
@buttonconnect.command { reset }
begin
driver = SOAP::RPC::Driver.new('http://217.160.200.122:12321/',
'urn:mySoapServer')
driver.add_method('sayhelloto', 'username')
s = driver.sayhelloto('Satish Talim')
rescue Exception => e
s = "Exception occured: " + e
ensure
@label.configure('text' => s)
end
end #connect
def reset
@label.configure('text' => "")
@buttonconnect.configure('text' => 'Connect')
@buttonconnect.command { connect }
end # reset
#---
def initialize
root = TkRoot.new do
title 'SOAP Client'
# the min size of window
minsize(535, 100)
end
#---
@label = TkLabel.new(root) do
pack
end
#---
@buttonconnect = TkButton.new(root)
@buttonconnect.configure('text' => 'Connect')
@buttonconnect.command { connect }
@buttonconnect.pack('side'=>'bottom')
#---
Tk.mainloop
end #initialize
end # class
SOAPGuiClient.new
#---
In the above program, we reconfigure a widget while it’s running. Every widget supports the configure method, which takes a code block in the same manner as new. We have also modified the soapserver.rb program shown earlier to soapserver2.rb. We have included the Logger class.
require 'logger'
require 'soap/rpc/standaloneServer'
class MyServer < SOAP::RPC::StandaloneServer
def initialize(* args)
super
add_method(self, 'sayhelloto', 'username')
@log = Logger.new("soapserver.log", 5, 10*1024)
end
def sayhelloto(username)
t = Time.now
@log.info("#{username} logged on #{t}")
"Hello, #{username} on #{t}."
end
end
server = MyServer.new('PuneRubyServer','urn:mySoapServer','www.puneruby.com',12321)
trap('INT') {server.shutdown}
server.start
The Logger class helps write log messages to a file or stream. It supports time- or size-based rolling of log files. Messages can be assigned severities, and only those messages at or above the logger’s current reporting level will be logged. Here, we log to a file called soapserver.log, which is rotated when it gets about 10K bytes and keeps up to five old files.
Technorati Tags: Ruby/Tk, Ruby/Tk Tutorial
Posted by Satish TalimSeveral of my students keep asking me for URLs of free, Downloadable Ruby Tutorials and to help them out I decided to make a list here.
If you use this Ruby Installer for Windows, the installed Ruby includes the First Edition of the Programming Ruby book.
So, here’s my list:
- Ruby Tutorial by Daniel Carrera
- The Little Book of Ruby by Huw
- Poignant Guide to Ruby by Why the Lucky Stiff
- Humble Little Ruby Book by Jeremy McAnally
- Ruby Study Notes/Guide by Satish Talim
I would like you to comment here with links to Downloadable Ruby Tutorials, that I have missed out.
Technorati Tags: Downloadable Ruby Tutorials, Ruby Guide, Ruby Study Notes, Ruby Tutorials, Tutorials
Posted by Satish TalimAn 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
Posted by Satish Talim



