Christmas eve has finally arrived! To some, Christmas brings emotions of relief or salvation. To others, it's just one of those days filled with obligatory social calls and commercialism.
The days that precede Christmas have been as hectic as they possibly can. One one side I had to make some preparations for the social necessities. And on the other side there was the commercial aspect, in Christmas times known as 'desperately trying to find something to give to someone while moving to endless black crowds carrying baby buggies with loss of orientation and decency'.
If only had nothing else to do, I could fully indulge myself and study the strange mental state people get in while on a Christmas shopping spree...But, I had to attend also to more enlightened things such as coding my Shoes course assignments. The course is great and lots of fun. This is not just getting some exercises done. There is a great social aspect where you can interact with other coders and see solutions from other people, things you would have never thought of yourself. Also, having a skilled teacher who carries a contagious enthusiasm providing some excellent exercises helps to decrease the learning curve and keeps it fun! Unfortunately, the better must sometimes give way to the good...
But, if you are interested in learning some GUI programming, there is good news for you! The 3rd batch of the shoes programming course at Rubylearning has been announced, and it starts on 14 February. That's no holidays to bother you!
Throwing myself at the Christmas shopping crowd did pay off at the very end. The right presents were obtained, and to further add to the joy, I finally got hold of my own very ASUS EEE PC! After a disastrous adventure on eBay, countless disappointments in the shops, and a somewhat obsessive compulsive venture to the ugliest city of my country, I am pleased to announce: ladies and gentlemen: I got em. Apparently the very last, ASUS EEE PC 1000HD, and specially for Christmas: the white version! Unfortunately, _no_ shop in .nl sells the Linux version. Apparently consumers prefer to pay for a Windows license and the dreadful OEM CD instead of a nice 40GB SSD. Well, if the noise will start to bother, I guess I'll visit jkk mobile and put the SSD in myself. It's a relieve to find that ubuntu eee runs flawlessly and everything works like a charm. All adjustments have been made to resume my ruby coding and blogging as well.
The holiday's have not arrived for me yet though. Starting tomorrow I have the social calls to make and right after that I'll travel to Berlin for the 25C3. But there is one thing that's different in this busy week as opposed to the previous: an EEE with a full sized keyboard! I get to do some work while I'm wasting my time, finally salvation!
Marry Christmas!
24.12.08
Christmas: relief, salvation and commercialism
Labels:Ninja
25C3,
ASUS EEE,
Rubylearning,
Shoes,
Ubuntu EEE
11.12.08
GUI toolkit extravaganza part III: WxRuby
In the previous part of the GUI toolkit extravaganza we looked at the FXRuby toolkit. This time we will spend some time to look at the Yin of FXRuby's Yang, the wxRuby toolkit.
wxRuby
wxRuby is a library that enables Ruby code to use the wxWidgets library. wxWidgets is a cross-platform GUI library written in C++. wxRuby has arrived at version 2 so we will look at that one. Not only the name sounds like FXRuby but also it's features seem alike. Let's find out if there are any differences!
ease of installation
xwruby2 is available as a Ruby gem. This makes the installation process very easy. According to the documentation, all you have to do is: sudo gem install wxruby2. There are also binary and source packages are available. On my Ubuntu Hardy Heron system, this did not do the trick however. Apperently there is something else you need to to apart from installing the gem, and this is poorly documented. You can read more about the problems installing wxruby2 in my previous post.
documentation
There seems to be quite a decent ammount of documentation for wxruby2. The project website provides the complete API reference and a Tutorial. As far as I'm aware there are no books about wxruby2, nor have I seen it featured in a book. The project's website hosts two mailinglists.
supported platforms
Wxruby has been created to provide a cross platform GUI toolkit, so it runs on multiple platforms. Systems running Linux, UNIX, Windows or Os/X are all supported by wxruby.
complexity
Take a look at the following code sample. We create a main window and place a button on it. We use PLACEMENT_SCREEN to center it. Piece of cake!
wxruby2 provides a standard set of graphical functions. The focus lies on cross-platform availability and the usage of native window designs. So on a GNOME system, you get GTK look and feel, on and on Mac OS/X you get aqua and on Windows you get the well known theme from Redmond. I am curious though as how much of windows, aqua and gtk functionality is supported...Unfortunately, finding that out would take more time then I have at the moment.
performance
There was some flickering going on at the top of the window sometimes. But I have noticed that on Fxruby windows as well since I upgraded my system to Ubuntu Intrepid. It does not seem like it's a problem caused by any of these two kits. Otherwise this performs just good.
looks
There's not much difference to be seen in the example provided here and the one previously provided in parts I of the GUI toolkit extravaganza. There are some minimal details around the buttons and edges. Reason is that it uses native graphics, so on my system it uses GTK in the end. Instead of adding yet another picture of a window with one button with only miniscule differences. Here's a picture from one of the sample programs, in this case,
You can find the wxruby2 toolkit at:
http://wxruby.rubyforge.org
Next up for the GUI toolkit extravaganza part IV is Shoes!
wxRuby
wxRuby is a library that enables Ruby code to use the wxWidgets library. wxWidgets is a cross-platform GUI library written in C++. wxRuby has arrived at version 2 so we will look at that one. Not only the name sounds like FXRuby but also it's features seem alike. Let's find out if there are any differences!
ease of installation
xwruby2 is available as a Ruby gem. This makes the installation process very easy. According to the documentation, all you have to do is: sudo gem install wxruby2. There are also binary and source packages are available. On my Ubuntu Hardy Heron system, this did not do the trick however. Apperently there is something else you need to to apart from installing the gem, and this is poorly documented. You can read more about the problems installing wxruby2 in my previous post.
documentation
There seems to be quite a decent ammount of documentation for wxruby2. The project website provides the complete API reference and a Tutorial. As far as I'm aware there are no books about wxruby2, nor have I seen it featured in a book. The project's website hosts two mailinglists.
supported platforms
Wxruby has been created to provide a cross platform GUI toolkit, so it runs on multiple platforms. Systems running Linux, UNIX, Windows or Os/X are all supported by wxruby.
complexity
Take a look at the following code sample. We create a main window and place a button on it. We use PLACEMENT_SCREEN to center it. Piece of cake!
functionality
#!/usr/bin/env ruby
#!/usr/bin/env ruby
require 'wx'
Wx::App.run do
frame = Wx::Frame.new(nil, :title => "wxRuby window")
button = Wx::Button.new(frame, :label => 'Button')
evt_button(button) { puts 'WXRuby' }
frame.show
end
wxruby2 provides a standard set of graphical functions. The focus lies on cross-platform availability and the usage of native window designs. So on a GNOME system, you get GTK look and feel, on and on Mac OS/X you get aqua and on Windows you get the well known theme from Redmond. I am curious though as how much of windows, aqua and gtk functionality is supported...Unfortunately, finding that out would take more time then I have at the moment.
performance
There was some flickering going on at the top of the window sometimes. But I have noticed that on Fxruby windows as well since I upgraded my system to Ubuntu Intrepid. It does not seem like it's a problem caused by any of these two kits. Otherwise this performs just good.
looks
There's not much difference to be seen in the example provided here and the one previously provided in parts I of the GUI toolkit extravaganza. There are some minimal details around the buttons and edges. Reason is that it uses native graphics, so on my system it uses GTK in the end. Instead of adding yet another picture of a window with one button with only miniscule differences. Here's a picture from one of the sample programs, in this case,
You can find the wxruby2 toolkit at:
http://wxruby.rubyforge.org
Next up for the GUI toolkit extravaganza part IV is Shoes!
9.12.08
wxruby: reading error messages about libraries
As you might have noticed, some time has passed since I wrote about fxruby. Wxruby was to follow a few days after it. However I had been experiencing problems getting it to work. With only a few days to go before the Shoes class starts I wanted to put an end to this misery.
First thing people do nowadays when problem solving is to Google for solutions, so did I. Searching for the errors I got did return some mailing list postings from people with the same problem, but no useful answers. As you might have experienced yourself, searching for these kinds of things can quickly take hours without you realizing it. It is not only time consuming, but in the spirit of despair you might just actually try some really stupid recommendation from a person who's most likely just be guessing himself. Actually trying some of their suggestions can add even more problems and make the whole so complex you'll eventually just give up...but then that's not very Ninja, is it?
After installing the wx package I thought I'd only need to install the wxruby gem and be done with it.
sudo gem install wxruby
Unfortunately not so...
The problem might have been caused by one of the other errors. One of them seemed to originate from wx.rb. Wx.rb can be found in the same directory as wxruby2.so. This is the file you should require in your ruby code. Basically it loads both the wxruby2.so and ruby extensions to core wx classes. There was something about line 12. Using vim's :set nu command, the apparent culprit was displayed on my screen:
There were however three errors in custom_require.rb. The first impression was, judging from the directory, that this was a generic function used by or for rubygems. Obviously I was not very convinced that this might be the cause of the problem. But it would not hurt to take a look.
First look was at the code near line number 27:
Two other errors were caused at something near line 32.
* Run ruby with the -rubygems argument: eg ruby -rubygems my_wxruby_script.rb
* Set the RUBYOPT environment variable to -rubygems
* Add require 'rubygems' at the top of your wxruby program.
I had tried running my code with the -rubygems argument allready. And I did use the require 'rubygems' in my code. I did not set the RUBYOPT however, so I removed the require line and set this variable with RUBYOPT="-rubygems".
The same errors lit the screen after I ran my code again. A sense of defeat and disillusion filled my mind, what could be the problem? I had tried countless solutions, analyzed code, read documentation and yet I was no step further. Having no more ideas, I stared blankly at the screen, looking at the errors...
/var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so: libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so (LoadError)
Staring back was a half lit reflection of myself. I saw a person who was about to give up as I started to think about skipping this chapter of the GUI Toolkit extravaganza. At least I had Ruby-GTK2 and FXruby...GTK?...What's that gtk doing in my error message!
A quick query in my package management tool found that I did not have any libwx_gtk* libraries installed, why would I. The documentation certainly did not write about needing this library! I did encounter it while searching for ruby & wx libraries, but never made the connection...
Anyway, there were some dependencies and here's what was installed:
libwxgtk2.6-0
libwxgtk2.6-dev
libwxbase2.6-0
libwxbase2.6-dev
libwxgtk2.8-0
libwxgtk2.8-dev
libwxbase2.8-0
libwxbase2.8-dev
After this I could run the examples that come with wxruby. Looking back at the errors I wonder, did you overlook this one in the error messages as well?
Comming up: Part III of the GUI toolkit extravaganza, featuring wxruby!
First thing people do nowadays when problem solving is to Google for solutions, so did I. Searching for the errors I got did return some mailing list postings from people with the same problem, but no useful answers. As you might have experienced yourself, searching for these kinds of things can quickly take hours without you realizing it. It is not only time consuming, but in the spirit of despair you might just actually try some really stupid recommendation from a person who's most likely just be guessing himself. Actually trying some of their suggestions can add even more problems and make the whole so complex you'll eventually just give up...but then that's not very Ninja, is it?
After installing the wx package I thought I'd only need to install the wxruby gem and be done with it.
sudo gem install wxruby
Unfortunately not so...
ruby -rubygems ./wxtest.rbObviously it had some problems loading the wxruby2.so binary library. This file exists in the specified directory along with wx.rb. The permissions to wxruby2.so were set to readonly, this did not seem right for a binary. Adding execute permissions did not help however.
/var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so: libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so (LoadError)
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wx.rb:12
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `require'
from ./wxtest.rb:3
The problem might have been caused by one of the other errors. One of them seemed to originate from wx.rb. Wx.rb can be found in the same directory as wxruby2.so. This is the file you should require in your ruby code. Basically it loads both the wxruby2.so and ruby extensions to core wx classes. There was something about line 12. Using vim's :set nu command, the apparent culprit was displayed on my screen:
11 # load the binary libraryThere could not be anything wrong about that.
12 require 'wxruby2'
13
14 # alias the module
15 Wx = Wxruby2
There were however three errors in custom_require.rb. The first impression was, judging from the directory, that this was a generic function used by or for rubygems. Obviously I was not very convinced that this might be the cause of the problem. But it would not hurt to take a look.
First look was at the code near line number 27:
26 def require(path) # :nodoc:Hmm, this code wants a path to some gem thingy, else it throws an error. Not the error I got however. While this seemed illogical at that moment, sometimes one must keep problems simple and not add other problems along the way. The main point was this code wanted some path.
27 gem_original_require path
28 rescue LoadError => load_error
29 if load_error.message =~ /\A[Nn]o such file to load -- #{Regexp.escape path}\z/
Two other errors were caused at something near line 32.
32 gem_original_require pathNo more clues were necessary. The suspect was some unknown path variable. Since wxruby was installed as a gem. My code needed to load rubygems itself. According to the installation manual there's three ways to do this:
33 else
34 raise load_error
* Run ruby with the -rubygems argument: eg ruby -rubygems my_wxruby_script.rb
* Set the RUBYOPT environment variable to -rubygems
* Add require 'rubygems' at the top of your wxruby program.
I had tried running my code with the -rubygems argument allready. And I did use the require 'rubygems' in my code. I did not set the RUBYOPT however, so I removed the require line and set this variable with RUBYOPT="-rubygems".
The same errors lit the screen after I ran my code again. A sense of defeat and disillusion filled my mind, what could be the problem? I had tried countless solutions, analyzed code, read documentation and yet I was no step further. Having no more ideas, I stared blankly at the screen, looking at the errors...
/var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so: libwx_gtk2u_stc-2.8.so.0: cannot open shared object file: No such file or directory - /var/lib/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so (LoadError)
Staring back was a half lit reflection of myself. I saw a person who was about to give up as I started to think about skipping this chapter of the GUI Toolkit extravaganza. At least I had Ruby-GTK2 and FXruby...GTK?...What's that gtk doing in my error message!
A quick query in my package management tool found that I did not have any libwx_gtk* libraries installed, why would I. The documentation certainly did not write about needing this library! I did encounter it while searching for ruby & wx libraries, but never made the connection...
Anyway, there were some dependencies and here's what was installed:
libwxgtk2.6-0
libwxgtk2.6-dev
libwxbase2.6-0
libwxbase2.6-dev
libwxgtk2.8-0
libwxgtk2.8-dev
libwxbase2.8-0
libwxbase2.8-dev
After this I could run the examples that come with wxruby. Looking back at the errors I wonder, did you overlook this one in the error messages as well?
Comming up: Part III of the GUI toolkit extravaganza, featuring wxruby!
3.12.08
Book preview: Wicked Cool Ruby Scripts
Good things come to those who wait. And wait I did. Somewhere back in June when I could still just walk around in a T-shirt, I decided to buy a book. After getting scared from looking at my Amazon wish list'o-saurus I quickly found myself searching for completely other books. O'Reilly always was a good string to start the search. I mean the search after doing the meta search to get the damn name right. It seemed only more quick to order directly from O'Reilly, you know, cut out the middle online-book-giant. After deciding to go for a more advanced Ruby book this time, the Ruby Cookbook found it's way to my shopping basket. Clearly this was not a book to read from beginning-to-end, but more of a handy help in desperate times. So, why not try to find something else as well? Something to really read from beginning to end. This time I found a book from NoStarch, Ruby by example. I remembered two other books from this publisher which I really valued for it's size, content and readability. So it seemed like a good choice. Time to check out. While experiencing the online-shopping rush at it's peak moment, some promo drew attention. Three for two, 3:2, 3-2=1, I have two, get three, one for free! Finding the last book was a daunting task. Only a few days later I found a book that was just added to the book announcements: Wicked cool ruby scripts from NoStarch. Interresting. It featured a robot on it's cover holding some kind of gem. Good, robots are cool. The announcement mentioned something about system administration, web scripting, utilities and security.
That last one just did it, BANG, the collision of two of my favorite subjects! So I pre-ordered the book, which was to be published in September. No hurries, I had the other two books to read (on top of the to-read-stack I amassed already). But you can guess this one met with the most anticipation. After a while, having started on some other books just to get by, I received both the cookbook and ruby by example. So I started reading (reviews coming soon). Summer passed. September passed. No book. No word. Rescheduled release date. No word. Rescheduled release date. Still no word about my delayed order. So I sent mail to O'Reilly and after getting the most rude, dumb and hostile response. That's quite something coming from somebody who wants my money. To further add to the bad taste, even another release date slipped by. Was it ever going to be finished and sent? A few day's ago finally salvation in the mailbox: my book had been shipped!
After having to wait a few more days, due to a UPS guy being an idiot, I finally had it in my hands! I just took the book from it's cardboard prison.
First impression: this book is thin like it has been starving all those months I've been waiting. 189 is the number of the last page. If you have read my review on Learning Ruby you know I truly value short books. I feel an urge to tell you what I have against big, fat, long books...must..not...rant.
Second impression: the author writes he will skip explaining Ruby. this is not a 101 Ruby book. Ok, good, there are plenty of those already!
Next, I looked at the index, which read as follows:
Chapter 1: General Purpose Utilities...could be handy...Chapter 2: Website Scripting...nice, too many Ruby books fail to give it the attention it deserves, probably due to Rails......Chapter 3: Li(U)nix System Administration...*nix stuff, always nice!...Chapter 4: Picture Utilities...Chapter 5: Games and Learning Tools...Chapter 6: String Utilities...Chapter 7: Servers and Scrapers...what the hell is a scraper?...Chapter 8: Arguments and Documentation...
Chapter 9: Sorting Algorithms...some memories about my study years started to float around in my mind...quit sort...bubble sort in JAVA...beer...youth......Chapter 10: Writing a Metasploit 3.1 Module with Ruby...oh those sweet years, where have the times gone...wait: read again...Chapter 10: Writing a Metasploit 3.1 Module with Ruby......Metasploit...Oreally? OMFG that just ROCKS!
Starting from chapter 10, off course, I read a little, flipped some pages to get some impressions. Well it sure looks promising, short scripts that look really useful, not too long explanations and a clear look and readable format look that is so typical for NoStarch books. Well this can't go wrong can it?
There just remains one question: how the hell will I manage to read 7 books in the same time?
That last one just did it, BANG, the collision of two of my favorite subjects! So I pre-ordered the book, which was to be published in September. No hurries, I had the other two books to read (on top of the to-read-stack I amassed already). But you can guess this one met with the most anticipation. After a while, having started on some other books just to get by, I received both the cookbook and ruby by example. So I started reading (reviews coming soon). Summer passed. September passed. No book. No word. Rescheduled release date. No word. Rescheduled release date. Still no word about my delayed order. So I sent mail to O'Reilly and after getting the most rude, dumb and hostile response. That's quite something coming from somebody who wants my money. To further add to the bad taste, even another release date slipped by. Was it ever going to be finished and sent? A few day's ago finally salvation in the mailbox: my book had been shipped!
After having to wait a few more days, due to a UPS guy being an idiot, I finally had it in my hands! I just took the book from it's cardboard prison.
First impression: this book is thin like it has been starving all those months I've been waiting. 189 is the number of the last page. If you have read my review on Learning Ruby you know I truly value short books. I feel an urge to tell you what I have against big, fat, long books...must..not...rant.
Second impression: the author writes he will skip explaining Ruby. this is not a 101 Ruby book. Ok, good, there are plenty of those already!
Next, I looked at the index, which read as follows:
Chapter 1: General Purpose Utilities...could be handy...Chapter 2: Website Scripting...nice, too many Ruby books fail to give it the attention it deserves, probably due to Rails......Chapter 3: Li(U)nix System Administration...*nix stuff, always nice!...Chapter 4: Picture Utilities...Chapter 5: Games and Learning Tools...Chapter 6: String Utilities...Chapter 7: Servers and Scrapers...what the hell is a scraper?...Chapter 8: Arguments and Documentation...
Chapter 9: Sorting Algorithms...some memories about my study years started to float around in my mind...quit sort...bubble sort in JAVA...beer...youth......Chapter 10: Writing a Metasploit 3.1 Module with Ruby...oh those sweet years, where have the times gone...wait: read again...Chapter 10: Writing a Metasploit 3.1 Module with Ruby......Metasploit...Oreally? OMFG that just ROCKS!
Starting from chapter 10, off course, I read a little, flipped some pages to get some impressions. Well it sure looks promising, short scripts that look really useful, not too long explanations and a clear look and readable format look that is so typical for NoStarch books. Well this can't go wrong can it?
There just remains one question: how the hell will I manage to read 7 books in the same time?
Labels:Ninja
books,
Metasploit,
Preview,
Ruby
28.11.08
Analyze this
"The independent and problem-solving type. They are especially attuned to the demands of the moment are masters of responding to challenges that arise spontaneously. They generally prefer to think things out for themselves and often avoid inter-personal conflicts.
The Mechanics enjoy working together with other independent and highly skilled people and often like seek fun and action both in their work and personal life. They enjoy adventure and risk such as in driving race cars or working as policemen and firefighters."
Hmm that sounds about right, except they should have called them The Ninjas instead of mechanics!
Test your own at typealyzer.
The Mechanics enjoy working together with other independent and highly skilled people and often like seek fun and action both in their work and personal life. They enjoy adventure and risk such as in driving race cars or working as policemen and firefighters."
Hmm that sounds about right, except they should have called them The Ninjas instead of mechanics!
Test your own at typealyzer.
Labels:Ninja
Ninja
Shoes course at Ruby learning
No post for the GUI toolkit extravaganza this time since I've been having some problems getting wxRuby to run properly. But this posting is related since we will deal with Shoes in one of the upcoming posts in the GUI toolkit extravaganza. So I just wanted to let you know I rolled in to the Shoes online course at rubylearning.org. It's a paid course, the cost is 5$ which is not much money. Why, the author of Shoes, seems to be happy about this course so I thought I'd give it a try. Anyway, the POIRPWSC101 course starts at 13 December and ends at 26 Dec 2008. This is a nice short time, so I should be able to keep focus :)
Some while back I tried to follow the Free Online Core Ruby Programming Course (FORPC101), it was good but I did not manage to keep up due to poor planning on my side. It seems that since this time they are providing a few more interesting courses including the following:
POIRPWSC101 - Paid Online Ruby with Shoes Programming Course
POIRPWDC101 - Paid Online FXRuby and MySQL Programming Course
If the Shoes fit, I think I'll sign up for the FXRuby and MySQL course as well. But it depends a little on my private and professional schedules. Oh and offcourse I'll write about my experiences on this Ruby class on this blog as well. If you are interested in taking a free, or almost free course on Ruby take a look at Rubylearning.
Some while back I tried to follow the Free Online Core Ruby Programming Course (FORPC101), it was good but I did not manage to keep up due to poor planning on my side. It seems that since this time they are providing a few more interesting courses including the following:
POIRPWSC101 - Paid Online Ruby with Shoes Programming Course
POIRPWDC101 - Paid Online FXRuby and MySQL Programming Course
If the Shoes fit, I think I'll sign up for the FXRuby and MySQL course as well. But it depends a little on my private and professional schedules. Oh and offcourse I'll write about my experiences on this Ruby class on this blog as well. If you are interested in taking a free, or almost free course on Ruby take a look at Rubylearning.
24.11.08
GUI toolkit extravaganza part II: FXRuby
The FXRuby toolkit is the subject of the GUI toolkit extravaganza, part deux. In this 7 part series, we will take a look at the various GUI toolkits in existence to find the ultimate GUI toolkit. One of the best known GUI toolkits is FXRuby, wich we will look at in this post.
FXRuby
FXRuby is a library that enables Ruby code to use the Fox toolkit. Fox is a graphics toolkit which was written in C++ and known for it's speed. FXRuby was created way back in 2001 and one of it's aims is to provide a cross-platform Ruby GUI toolkit. Let's take a closer look!
ease of installation
FXRuby has an interactive installer for Windows systems. Macintosh systems can use the Mac ports. The sources are available so you can compile from source in any case. I had a bit of trouble installing it on my Ubuntu Hardy Heron system. But eventually I got it working. Here's what you need to do:
apt-get install libfox-1.6-0 libfox-1.6-dev libfox-1.6-doc
gem install fxruby
documentation
FXRuby has been nicely documented. The project website provides the complete API reference and a users guide.
There is also a book written solely about FXRuby. The project's website hosts two mailinglists as well.
supported platforms
FXRuby has been created to provide a cross platform GUI toolkit, so it runs on multiple platforms. Systems running Linux, UNIX, Windows or Os/X are all supported by FXRuby.
complexity
Take a look at the following code sample. We create a main window and place a button on it. We use PLACEMENT_SCREEN to center it. Piece of cake!
functionality
FXRuby provides a standard set of graphical functions. But one feature that makes it stand out on the feature front is the support for OpenGL, providing the posibility to render cool 3-D graphics from your Ruby code.
performance
The Fox toolkit is known for it's speed and limited use of system recourses. From what I have seen, the same goes for FXRuby, it is light and it is fast.
looks
There's not much difference to be seen in the example provided here and the one previously provided in parts I of the GUI toolkit extravaganza. There are some minimal details around the buttons and edges.
Update: ok, this does not help a lot. Here's an impression of one of the sample programs that come with Fxruby:
As you can see, it looks a bit like some apps did in the windows98 days...
You can find the FXRuby toolkit at:
Stay tuned for the GUI toolkit extravaganza part III: WxRuby
FXRuby
FXRuby is a library that enables Ruby code to use the Fox toolkit. Fox is a graphics toolkit which was written in C++ and known for it's speed. FXRuby was created way back in 2001 and one of it's aims is to provide a cross-platform Ruby GUI toolkit. Let's take a closer look!
ease of installation
FXRuby has an interactive installer for Windows systems. Macintosh systems can use the Mac ports. The sources are available so you can compile from source in any case. I had a bit of trouble installing it on my Ubuntu Hardy Heron system. But eventually I got it working. Here's what you need to do:
apt-get install libfox-1.6-0 libfox-1.6-dev libfox-1.6-doc
gem install fxruby
documentation
FXRuby has been nicely documented. The project website provides the complete API reference and a users guide.
There is also a book written solely about FXRuby. The project's website hosts two mailinglists as well.
supported platforms
FXRuby has been created to provide a cross platform GUI toolkit, so it runs on multiple platforms. Systems running Linux, UNIX, Windows or Os/X are all supported by FXRuby.
complexity
Take a look at the following code sample. We create a main window and place a button on it. We use PLACEMENT_SCREEN to center it. Piece of cake!
#!/usr/bin/env ruby
require 'fox16'
include Fox
app = FXApp.new
MainWindow = FXMainWindow.new(app, "FXwindow" ,
:width => 200, :height => 100)
FXButton.new(MainWindow,"Button",nil,nil,0,BUTTON_NORMAL|LAYOUT_CENTER_Y|LAYOUT_CENTER_X)
app.create
MainWindow.show(PLACEMENT_SCREEN)
app.run
functionality
FXRuby provides a standard set of graphical functions. But one feature that makes it stand out on the feature front is the support for OpenGL, providing the posibility to render cool 3-D graphics from your Ruby code.
performance
The Fox toolkit is known for it's speed and limited use of system recourses. From what I have seen, the same goes for FXRuby, it is light and it is fast.
looks
There's not much difference to be seen in the example provided here and the one previously provided in parts I of the GUI toolkit extravaganza. There are some minimal details around the buttons and edges.
Update: ok, this does not help a lot. Here's an impression of one of the sample programs that come with Fxruby:
As you can see, it looks a bit like some apps did in the windows98 days...
You can find the FXRuby toolkit at:
Stay tuned for the GUI toolkit extravaganza part III: WxRuby
GUI toolkit extravaganza part I: Ruby-GNOME2
Welcome to the first part of the GUI toolkit extravaganza. The previous post was an introduction to the GUI toolkit extravaganza. In this part, the first of 7, we will take a look at the Ruby-GNOME2 toolkit. Let's go ahead and take a peek at this interresting toolkit!
Ruby-GNOME2
Ruby-Gnome2 is a Ruby library that contains a set of bindings to various GNOME/GTK+2.0 libraries. Basically these are just Ruby wrappers around the GNOME/GTK+2.0 libs.
ease of installation
This toolkit is very easy to install if you happen to be using a system running GNOME and Ruby. If you use Ubuntu you only need to execute apt-get install ruby-gnome2.
documentation
There's quite a decent level of documentation for the Ruby-Gnome2 toolkit. There's a Wiki that includes the API reference and tutorials. There is quite a lot of documentation, but there are quite a lot of "fixme's" so not everything has been documented yet. The site also provides a few sample programs for instance a simple webbrowser, a simple audio player and the classic game Sokoban!
There are a few public mailinglists too.
supported platforms
You can probably guess this one. It runs only on systems running GNOME. So this one is restricted to Linux and Unix systems. No Windows or MacOS and no Linux systems running other window managers.
complexity
A simple window with one button is created by the following code. It's pretty straightforward, but the odd thing is that the buttoncode is written before the window code. It's also quite a big ammount of code lines for a such a simple window.
functionality
If you thought this toolkit was limited to using GTK2.0 drawing libraries you were wrong. This toolkit not only offers access to the GTK libraries but also, amongst others, the GDK, Pango, Poppler, ATK and libglade libraries. So you can see it provides far more then just GUI functionality. There's stuff for mulitmedia, text editing, creation of PDF, accessibility, internationalization and what not.
performance
This is just as fast as your average GNOME app.
looks
This toolkit provides decent looks since it uses the GNOME/GTK2.0 libraries. Here's what our code looks like when executed.
You can find the Ruby-GNOME2 toolkit at:
http://ruby-gnome2.sourceforge.jp/
Next one up is FXRuby!
Ruby-GNOME2
Ruby-Gnome2 is a Ruby library that contains a set of bindings to various GNOME/GTK+2.0 libraries. Basically these are just Ruby wrappers around the GNOME/GTK+2.0 libs.
ease of installation
This toolkit is very easy to install if you happen to be using a system running GNOME and Ruby. If you use Ubuntu you only need to execute apt-get install ruby-gnome2.
documentation
There's quite a decent level of documentation for the Ruby-Gnome2 toolkit. There's a Wiki that includes the API reference and tutorials. There is quite a lot of documentation, but there are quite a lot of "fixme's" so not everything has been documented yet. The site also provides a few sample programs for instance a simple webbrowser, a simple audio player and the classic game Sokoban!
There are a few public mailinglists too.
supported platforms
You can probably guess this one. It runs only on systems running GNOME. So this one is restricted to Linux and Unix systems. No Windows or MacOS and no Linux systems running other window managers.
complexity
A simple window with one button is created by the following code. It's pretty straightforward, but the odd thing is that the buttoncode is written before the window code. It's also quite a big ammount of code lines for a such a simple window.
#!/usr/bin/env ruby
require 'gtk2'
button = Gtk::Button.new("Button")
button.signal_connect("clicked") {
puts "Ruby-GTK2"
}
window = Gtk::Window.new
window.set_default_size(100, 100)
window.signal_connect("delete_event") {
puts "delete event occurred"
false
}
window.signal_connect("destroy") {
puts "destroy event occurred"
Gtk.main_quit
}
window.border_width = 100
window.add(button)
window.show_all
Gtk.main
functionality
If you thought this toolkit was limited to using GTK2.0 drawing libraries you were wrong. This toolkit not only offers access to the GTK libraries but also, amongst others, the GDK, Pango, Poppler, ATK and libglade libraries. So you can see it provides far more then just GUI functionality. There's stuff for mulitmedia, text editing, creation of PDF, accessibility, internationalization and what not.
performance
This is just as fast as your average GNOME app.
looks
This toolkit provides decent looks since it uses the GNOME/GTK2.0 libraries. Here's what our code looks like when executed.
You can find the Ruby-GNOME2 toolkit at:
http://ruby-gnome2.sourceforge.jp/
Next one up is FXRuby!
Labels:Ninja
GNOME,
GTK,
GUI,
Ruby,
Ruby-GNOME2
GUI toolkit extravaganza!
Lately I have been looking for the right toolkit to do some GUI coding. As it turns out, there are quite a lot of GUI toolkits available that are coded in Ruby or have Ruby binding's. At first glance, they rather seem not so different from each other. So it's time to put the candidates on the line and take a look at each one's pro's and cons. I am a bit biased in this comparison offcourse, since I do have my own specific needs for a GUI toolkit. So don't expect a fully scientific comparison here, this is biased, quick and dirty but I'll do you a favour and leave the religious aspects aside.
Personally I am mostly interested in a cross-platform toolkit that provides the most functionality but above all is fast and simple. Basically, I'm too lazy to learn multiple GUI toolkits, so I want something simple and cross-platform. Off course it should look good on various platforms too!
The usual suspects I have round up for you are:
Ruby-Gnome2
FXRuby
WXRuby
Ruby Cocoa
Shoes
Monkeybars
QtRuby
We shall compare these toolkits in the following blogposts on the following aspects:
ease of installation
What do you need to do to make it work. Install a Ruby Gem or compile from source? Are there any packages for different Operating Systems that ease installation? We will look at the ease of installation in general, and provide examples for Ubuntu Linux in specific.
documentation
Is there any online documentation, how about how-to's and faq's, are there any books on the subject, how about discussion groups?
supported platforms
On which platform can you program this toolkit? On what platforms does the toolkit run?
complexity
We will use a simple window with a title, a button and some text to see the difference in complexity. Remember, this is just quick and dirty.
functionality
What can you do with the toolkit? This will be a hard one to answer since this is just a quick peek at the various available kits. The documentation will be used as a primary source to assess the provided functionality.
performance
Did I write this was not a comparison with solid scientific fundaments? Well, I will just take a guess at the performance of the toolkit. Since I won't do some measurements it's just a subjective guess.
looks
This one is also subjective to one's personal taste. I'll post at least one picture so you can judge for yourself, but along with that you'll get my opinion for free :-)
We'll take a look at the first GUI toolkit, Ruby-Gnome2, in the next blogpost so stay tuned!
Personally I am mostly interested in a cross-platform toolkit that provides the most functionality but above all is fast and simple. Basically, I'm too lazy to learn multiple GUI toolkits, so I want something simple and cross-platform. Off course it should look good on various platforms too!
The usual suspects I have round up for you are:
Ruby-Gnome2
FXRuby
WXRuby
Ruby Cocoa
Shoes
Monkeybars
QtRuby
We shall compare these toolkits in the following blogposts on the following aspects:
ease of installation
What do you need to do to make it work. Install a Ruby Gem or compile from source? Are there any packages for different Operating Systems that ease installation? We will look at the ease of installation in general, and provide examples for Ubuntu Linux in specific.
documentation
Is there any online documentation, how about how-to's and faq's, are there any books on the subject, how about discussion groups?
supported platforms
On which platform can you program this toolkit? On what platforms does the toolkit run?
complexity
We will use a simple window with a title, a button and some text to see the difference in complexity. Remember, this is just quick and dirty.
functionality
What can you do with the toolkit? This will be a hard one to answer since this is just a quick peek at the various available kits. The documentation will be used as a primary source to assess the provided functionality.
performance
Did I write this was not a comparison with solid scientific fundaments? Well, I will just take a guess at the performance of the toolkit. Since I won't do some measurements it's just a subjective guess.
looks
This one is also subjective to one's personal taste. I'll post at least one picture so you can judge for yourself, but along with that you'll get my opinion for free :-)
We'll take a look at the first GUI toolkit, Ruby-Gnome2, in the next blogpost so stay tuned!
19.11.08
Book review: Learning Ruby
Time for some knowledge sharing! My first book review is off course about a book on Ruby. In fact, it is on a book to learn (a bit) about Ruby. It caries the appropriate title "Learning Ruby". I read this book a while ago which actually helps in writing a good review. The impressions a book makes on the long run are the ones that count!
So let's take a look at this book, and judge it by it's own promises shall we?
The promise
The reason I picked this book as my first Ruby book is the following text on the backside:
Great, exactly what I wanted. Just a quick peek at this Ruby thing I heard about. A taste to see if the hype-du-jour suits you. Enough to get you rolling down the road. Well let's look back at these promises and see if this book delivers shall we?
The delivery
Learning Ruby is a book of 11 Chapters written on 238 pages. The first two chapters provide a basic coverage and a quick tour on Ruby. Chapters 3, 4, 5, 6 and 7 deal with the building blocks of a programming language. Things like loops, strings, math, array's and hashes. Small samples of code demonstrate the various techniques that are covered. Chapter 8 handles the working with files. Chapter 9 covers classes, modules, inheritance and other Object Orientation techniques. Chapter 10 focusses on various practical things like rdoc, RubyGems, REXML and exception handling.
A bit of a surprise was chapter 11, which is about Rails. Rails is a web development framework that was written in Ruby.
The verdict
Learning Ruby is a small book, it's only 238 pages. If you think about it, this is quite unique for a book about computer stuff. Especially programming books have the bad habit of having at least 600 pages. I'm not a big fan of big books. First of all, they don't handle. They are heavy too. And, well there is just too much information in them! Try reading such a book in some busy public transport carriage, or find that you need to carry a backpack only because you want to bring along your book, pure evil!
The book covers most basic things, it gives a good feeling about what Ruby is and what it can do for you. The examples were short, which is a good thing because you will try them all yourself. A drawback is that they are not really functional by themselves. Most of the examples worked too! There was a chapter on GUI coding using TK, but these examples did not seem to work for me. The topics the book covers are mostly standard things programming books cover, with the exception of chapter10. I'm not a big fan of how programming books always cover basic things like strings, arrays and arithmetic. But ok, this book also focuses on newcomers to programming. More experienced programmers will appreciate the fact that the chapters are small, but do in fact explain certain Ruby aspects in depth. Programmers of Perl or Python may find this book usefull since it occasionally points out the differences with Ruby on specific techniques. I liked chapter 10 for discussing a few practical things such as dealing with XML or documenting with Rdoc. Chapter 11 however could have better been used to write about more Ruby stuff, not about a (rightly so) popular application that was written in it. People who want to know about Rails want and surely will read a book about Rails instead.
My conclusion is that this book delivers on it's promise. While this book is not an instant classic, the writing and examples in this book are mostly of good quality. If you are a beginning or experienced programmer looking for a taste of Ruby, you'll like this book. If however you are more of a practical person who has already read about basic programming things, you'll probably want to read another book instead.
Considering the price tag and the amount of pages, you'll might just want to buy this when you find yourself in a bookstore on a rainy day and happen to be a little bored but don't want to commit to something. Don't be surprised though if you find yourself getting hooked on Ruby thing after reading this book :-)
So let's take a look at this book, and judge it by it's own promises shall we?
The promise
The reason I picked this book as my first Ruby book is the following text on the backside:
You don't have to know everything about a car to drive one, and you don't need to know everything about Ruby to start programming with it. Written for both experienced and new programmers alike, learning Ruby is a just-get-in-and-drive book--a hands-on tutorial that offers lots of Ruby programs and explains how and why they work, just enough to get you rolling down the road.
Great, exactly what I wanted. Just a quick peek at this Ruby thing I heard about. A taste to see if the hype-du-jour suits you. Enough to get you rolling down the road. Well let's look back at these promises and see if this book delivers shall we?
The delivery
Learning Ruby is a book of 11 Chapters written on 238 pages. The first two chapters provide a basic coverage and a quick tour on Ruby. Chapters 3, 4, 5, 6 and 7 deal with the building blocks of a programming language. Things like loops, strings, math, array's and hashes. Small samples of code demonstrate the various techniques that are covered. Chapter 8 handles the working with files. Chapter 9 covers classes, modules, inheritance and other Object Orientation techniques. Chapter 10 focusses on various practical things like rdoc, RubyGems, REXML and exception handling.
A bit of a surprise was chapter 11, which is about Rails. Rails is a web development framework that was written in Ruby.
The verdict
Learning Ruby is a small book, it's only 238 pages. If you think about it, this is quite unique for a book about computer stuff. Especially programming books have the bad habit of having at least 600 pages. I'm not a big fan of big books. First of all, they don't handle. They are heavy too. And, well there is just too much information in them! Try reading such a book in some busy public transport carriage, or find that you need to carry a backpack only because you want to bring along your book, pure evil!
The book covers most basic things, it gives a good feeling about what Ruby is and what it can do for you. The examples were short, which is a good thing because you will try them all yourself. A drawback is that they are not really functional by themselves. Most of the examples worked too! There was a chapter on GUI coding using TK, but these examples did not seem to work for me. The topics the book covers are mostly standard things programming books cover, with the exception of chapter10. I'm not a big fan of how programming books always cover basic things like strings, arrays and arithmetic. But ok, this book also focuses on newcomers to programming. More experienced programmers will appreciate the fact that the chapters are small, but do in fact explain certain Ruby aspects in depth. Programmers of Perl or Python may find this book usefull since it occasionally points out the differences with Ruby on specific techniques. I liked chapter 10 for discussing a few practical things such as dealing with XML or documenting with Rdoc. Chapter 11 however could have better been used to write about more Ruby stuff, not about a (rightly so) popular application that was written in it. People who want to know about Rails want and surely will read a book about Rails instead.
My conclusion is that this book delivers on it's promise. While this book is not an instant classic, the writing and examples in this book are mostly of good quality. If you are a beginning or experienced programmer looking for a taste of Ruby, you'll like this book. If however you are more of a practical person who has already read about basic programming things, you'll probably want to read another book instead.
Considering the price tag and the amount of pages, you'll might just want to buy this when you find yourself in a bookstore on a rainy day and happen to be a little bored but don't want to commit to something. Don't be surprised though if you find yourself getting hooked on Ruby thing after reading this book :-)
Label cloud
Found a nice looking Label Cloud whilst decorating the Dojo here. There's a pretty decent writeup on how to add one to Blogger at phyeblog's. The layout of my Dojo here is subject to vast changes as I need to find a style that suits my clan ;-)
Labels:Ninja
Ninja
Ninja Entry
Welcome to the home of WaveNinja! Visit my Blog to follow me on my quest of knowledge and learning. I shall write mostly about interresting things I come across on my travels though the barren wastelands of science, technology and society. My posts shall mostly focus on the three elements: Wireless technologies, security and Ruby coding. But you will also find some scrolls on Soekris, MythTV, OpenBSD, Linux, Sci-Fi, books and movies from time to time.
My hopes are my scrolls will lead us both to a greater understanding and higher skills so we may be all Ninja masters one day...
My hopes are my scrolls will lead us both to a greater understanding and higher skills so we may be all Ninja masters one day...
Labels:Ninja
Ninja
Subscribe to:
Posts (Atom)