≡ Menu


shoes – A cross-platform Windowing Applikit

Shoes is a very informal graphics and windowing toolkit. It's for making regular old apps that run on Windows, Mac OS X and Linux. It's a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. Shoes uses Ruby as its interface language.

It borrows a few things I like from the web:
=> Hyperlinks and URLs within Shoes and to the web.
=> Simple text layout -- though Shoes eschews floats.
=> Images and colors in the layout and in the background.
=> Margin and padding.
=> Resizable layouts.

How do I install shoes ?

First, get source code, enter:
$ cd /tmp
$ wget http://shoooes.net/dist/shoes-0.r925.tar.gz

Untar it:
$ tar -zxvf shoes-0.r925.tar.gz
$ cd shoes-0.r925
Now install required stuff under Debian / Ubuntu Linux:
$ sudo apt-get install libcairo2-dev libpixman-1-dev libpango1.0-dev libungif4-dev libjpeg62-dev libgtk2.0-dev vlc libvlc0-dev libsqlite3-dev libcurl4-openssl-dev ruby1.8-dev rake
If you are using RHEL / CentOS / Fedora Linux, enter:
# yum install giflib-devel cairo-devel libpixman-devel pango-devel libjpeg-devel gtk2-devel sqlite-devel vlc-devel libcurl-devel ruby-devel
Install it:
$ make
$ sudo make install

Sample output:

build options: shoes raisins (0.r925) [i486-linux]
CC       = cc
RUBY     = /usr
installing executable file to /usr/local/bin
installing libraries to /usr/local/lib/shoes

See READM for for more information.

Hello World application

Sample hello.rb

Shoes.app {
  para strong("Hello, "), " world!"


Shoes.app (:width => 200, :height => 50, :title => "Hi, Guest!") {
   para strong("Hello, "), " world!"
   @buttonQuit = button "Exit"
   @buttonQuit.click { exit() }

Run it as follows:
$ /usr/local/bin/shoes hello.rb
Another example:

Shoes.app {
  name = ask("Please, enter your name:")
  para "Hello, ", name

You can include images from web or create a simple links / urls:

Shoes.app (:title => "My App" ) {
  image "http://theos.in/wp-content/uploads/2008/06/honda-fcx-clarity-car-photo.jpg"
  para( link("Info").click{ alert ("The FCX Clarity, which runs on hydrogen and electricity, emits only water and none of the noxious fumes believed to induce global warming.") })
  para( link("Exit").click{ exit() } )

Sample output:

Loading images from the web

Fig.01: Loading images from the web

Sample applications

You can find sample application in /tmp/shoes-0.r925/samples/ directory. Here is animated clock program:

# Shoes Clock by Thomas Bell
# posted to the Shoes mailing list on 04 Dec 2007
Shoes.app :height => 260, :width => 250 do
  @radius, @centerx, @centery = 90, 126, 140
  animate(8) do
    @time = Time.now
    clear do
      stack do
        background black
        para @time.strftime("%a"),
          span(@time.strftime(" %b %d, %Y "), :stroke => "#ccc"),
          strong(@time.strftime("%I:%M"), :stroke => white),
          @time.strftime(".%S"), :align => "center", :stroke => "#666",
            :margin => 4
      clock_hand @time.sec + (@time.usec * 0.000001),2,30,red
      clock_hand @time.min + (@time.sec / 60.0),5
      clock_hand @time.hour + (@time.min / 60.0),8,6
  def draw_background
    background rgb(230, 240, 200)
    fill white
    stroke black
    strokewidth 4
    oval @centerx - 102, @centery - 102, 204, 204
    fill black
    oval @centerx - 5, @centery - 5, 10, 10
    stroke black
    strokewidth 1
    line(@centerx, @centery - 102, @centerx, @centery - 95)
    line(@centerx - 102, @centery, @centerx - 95, @centery)
    line(@centerx + 95, @centery, @centerx + 102, @centery)
    line(@centerx, @centery + 95, @centerx, @centery + 102)
  def clock_hand(time, sw, unit=30, color=black)
    radius_local = unit == 30 ? @radius : @radius - 15
    _x = radius_local * Math.sin( time * Math::PI / unit )
    _y = radius_local * Math.cos( time * Math::PI / unit )
    stroke color
    strokewidth sw
    line(@centerx, @centery, @centerx + _x, @centery - _y)
Fig. 02: Animated clock

Fig. 02: Animated clock

Shoes manual

The manual can be launched by typing the following command
$ shoes -m

Further readings:

Ubuntu Linux Critical OpenSSL and Ruby Vulnerabilities Fix Released

An unpatched security hole in Ubuntu Linux 8.04 LTS operating system could be used by attackers to send a crafted packet and cause a denial of service via application crash in applications linked against OpenSSL to take control of vulnerable servers. Also ruby package can be used to run a malicious script - an attacker could cause a denial of service or execute arbitrary code with the privileges of the user invoking the program. It is recommended that you immediately update your system. Affected systems:
OpenSSL Vulnerability - Ubuntu Linux LTS 8.04 and corresponding versions of Kubuntu, Edubuntu, and Xubuntu.
Ruby Vulnerability - Ubuntu 6.06 LTS Ubuntu 7.04 Ubuntu 7.10 Ubuntu 8.04 LTS and corresponding versions of Kubuntu, Edubuntu, and Xubuntu.

How do I fix this issue

Simply type the following two commands:
$ sudo apt-get update
$ sudo apt-get upgrade

After a standard system upgrade you need to reboot your computer to effect the necessary change:
$ sudo reboot

The portupgrade command is used to upgrade installed packages via ports or packages. This is one of the tool you need to use under FreeBSD. However, recently, it give me out following error on FreeBSD r6.2-p10-amd64 bit:
missing key: categories: Cannot read the portsdb!
/usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:567:in `open_db': database file error

The solution is pretty simple tp fix this error, enter:
# rm -f /usr/ports/INDEX*.db /var/db/pkg/pkgdb.db
# pkgdb -fu
# rm -rf /usr/ports
# portsnap fetch && portsnap extract && portsnap update

Next find out current portupgrade version:
# pkg_info | grep portupgrade
Sample output:

portupgrade-2.4.3_2,2 FreeBSD ports/packages administration and management tool s

# pkg_delete portupgrade-2.4.3_2,2
# cd /usr/ports/ports-mgmt/portupgrade && make clean && make install clean
# portupgrade -a

See /usr/ports/UPDATING file for more information.

Download of the day: e tool to extract rpm, rar, zip and other formats under Linux

Sure you can use unzip, unrar, and other tools to extract files under Linux. e is little tool that can extract almost any archive in Linux so you do not need to remember which tool and what command lines are necessary.

You need ruby lanaguage installed on your computer to use this tiny tool. Apart from Ruby, e uses the linux tool file to determine what kind of archive it is dealing with. This tool should be available on any proper Linux installation. Once e knows the archive type, the appropriate extraction tool is executed.

You can read more about this tool, installation and other notes at Martin Ankerl blog.

See also