README

Path: README
Last Update: Sat Nov 26 19:58:30 GMT+9:00 2005

$Id: README,v 1.6 2005/11/26 10:58:30 noir Exp $

SimpleZDB - a ruby extension module providing the simple access to ZDB Copyright (C) 2005 Hiroyuki KUROSAKI <noir (at) st . rim . or . jp>

What it is

"SimpleZDB" is a Ruby extension which provides access to the PIM database of Sharp Zaurus(TM).

See the comment in the source code (simplezdb.cpp) for details. You can get the HTML document using rdoc command.

  rdoc simplezdb.cpp

Example

Example 1

  require 'simplezdb'

  include SimpleZDB

  DataBase.open(DataBase::ADDRESSBOOK) do |db|
    db.each do |contact|
      if contact.categories.include?("Friend") then
        puts contact["FULL"]
      end
    end
  end

Example 2: Customize the class of the argument of each block

  require 'simplezdb'

  module SimpleZDB
    class Contact < Card
      def fullname
        self["FULL"]
      end
    end

    class Addressbook < DataBase
      def initialize(*args)
        is_readonly = args.shift
        super(DataBase::ADDRESSBOOK, is_readonly, Contact, *args)
      end
    end
  end

  Addressbook.open(true) do |db|
    db.each do |contact|
      if contact.categories.include?("Friend") then
        puts contact.fullname
      end
    end
  end

Build and Installation

Build from Source

For convenience, this package includes the executable extention file (simplezdb.so). If you want to modify this extention and to build it yourself, follow the steps below.

  • Prepare a cross development environment for Sharp Zaurus.
  • Get the source code of Ruby (ruby-1.8.0.tar.gz), and build for Zaurus.
  • Edit extconf.rb script included in this package, and modify the paths.
  • Run extconf.rb script.
      ruby extconf.rb --with-qte-dir=/opt/Qtopia/sharp
    
  • Make.
      CXX=arm-linux-g++ make
    

Installation

If you don’t have Ruby installed on your Zaurus, get ruby_1.8.0-1_arm.ipk from the following page and install it. sourceforge.jp/projects/zaurus-ja/files/

I recommend using ipkg installer. If you prefer installing it manually, follow the steps below.

  • Copy simplezdb.so, lib/simplezdb/*.rb and test_simplezdb.rb to Zaurus.
  • Locate simplezdb.so to the architecture-dependent library directory, i.e., /opt/QtPalmtop/lib/ruby/site_ruby/1.8/arm-linux/simplezdb.so
  • Locate lib/simplezdb/*.rb to the library directory, i.e., /opt/QtPalmtop/lib/ruby/site_ruby/1.8/simplezdb/card.rb /opt/QtPalmtop/lib/ruby/site_ruby/1.8/simplezdb/filterinfo.rb
  • Run the test script.
      ruby ./test_simplezdb.rb
    

Note

Zaurus is a trademark of Sharp Electronics.

Author

Hiroyuki KUROSAKI <noir (at) st . rim . or . jp>

License

GNU General Public License Version 2.

See the COPYING file for details.

Acknowledgements

Thanks to kenji for Ruby install package for Zaurus.

Thanks to Hidaka Takahiro for Ruby/Qte. takahr.dhis.portside.net/cgi-bin/rwiki.cgi?cmd=view;name=Ruby%2FQte

Thanks to yakty for zdbat. This extention owes much for the the source code of zdbat and the relating information in his wiki page: tbox.jpn.org/wiki/linuzau/wiki.cgi?zdbat

Thanks to ichitokumei for Qualendar. The source code includes much information, especially on database filter method. ichitokumei.hp.infoseek.co.jp/qualendar/

[Validate]