view · edit · sidebar · attach · print · history

20120330-de-oddb-org-setup-ebps-update-table-in_fachinfos_yaml

<< | Index | >>


summary

commit

ebps
oddb.org

index


Setup de.oddb.org (continue)

setup: 90%

commented out require 'gd2'
in /path/to/lib/ruby/gems/1.8/gems/turing-0.0.11/lib/turing/image.rb

And ran oddbd

Namespace problem (ruby 1.8.6)

got this error.

/var/www/de.oddb.org/lib/oddb/import/pharmnet.rb:15: uninitialized constant ODDB::Import::PharmNet::Mechanize (NameError)
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /home/yasu/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /var/www/de.oddb.org/lib/oddb/html/state/drugs/admin/package.rb:6
...

suspend

update 20120331 -----

require 'mechanize'

module Test
  module Inner
    module More
      class Me < Mechanize::Page; end 
    end 
  end 
end
$ /usr/local/bin/ruby19 -r rubygems test.rb 
$ /usr/local/bin/ruby18 -r rubygems test.rb 
test.rb:9: uninitialized constant Test::Inner::More::Mechanize (NameError)

in /var/www/de.oddb.org/lib/oddb/import/pharmnet.rb

...
+ module Mechanize
+   class Page; end
+ end
module ODDB
...

e2mmap_error

same problem: http://www.ruby-forum.com/topic/856883

commented out this

#fail "Use Ruby 1.1" if VERSION < "1.1"

in vim /home/yasu/usr/local/lib/ruby/1.8/e2mmap.rb

rb_intern2 symbol error

/home/yasu/usr/local/bin/ruby18: symbol lookup error: /home/yasu/usr/local/lib/ruby/gems/1.8/gems/json-1.6.6/ext/json/ext/json/ext/parser.so: undefined symbol: rb_intern2

Refs

http://ruby.11.n6.nabble.com/ruby-dev-34997-Re-ruby-changes-5517-Ruby-r17021-trunk-vm-insnhelper-c-vm-c-proc-c-proc-call-allow-cah-td3525113.html (Japanese, about ~2() method in CRuby)

$ gem18 search -r -a json
json (1.6.6, 1.6.5, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0.1, 1.6.0, 1.5.4, 1.5.3, 1.5.2, 1.5.1, 1.5.0, 1.4.6, 1.4.5, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.9, 1.1.8, 1.1.7, 1.1.6, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.4.3, 0.4.2, 0.4.1, 0.4.0)

This error helped me, when I tried install json-1.1.3

 $ ~/usr/local/bin/ruby18 ~/usr/local/bin/gem18 install json -v 1.1.3
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

/home/yasu/usr/local/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/home/yasu/usr/local/include/ruby-1.9.1/i686-linux -I/home/yasu/usr/local/include/ruby-1.9.1/ruby/backward -I/home/yasu/usr/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64  -fPIC  -O2 -g -Wall -Wno-parentheses -Wall  -o parser.o -c parser.c
parser.rl:2:16: fatal error: re.h: No such file or directory
compilation terminated.
make: *** [parser.o] Error 1


Gem files will remain installed in /home/yasu/usr/local/lib/ruby/gems/1.8/gems/json-1.1.3 for inspection.
Results logged to /home/yasu/usr/local/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser/gem_make.out

I created symbolic link with ruby, not ruby18.
then I could solve it.

deprecated error

same problem

http://dev.ywesee.com/Masa/20110105-update-dbi-pg-oddbOrg

...
/home/yasu/usr/local/lib/ruby/gems/1.8/gems/deprecated-2.0.1/lib/deprecated.rb:176:in `instance_method': {:metaclass=>:singleton_class} is not a symbol (TypeError)
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/deprecated-2.0.1/lib/deprecated.rb:176:in `deprecate'
        from /home/yasu/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/object/metaclass.rb:13
...
  • activesupport 2.3.8 -> above error caused.
  • activesupport 2.3.2 -> works.

oddbd in de.oddb.org works!

mod_ruby

I have to compile mod_ruby with ruby 1.8.6

in /var/log/apach/error_log

593 [Sat Mar 31 17:31:13 2012] [error] mod_ruby: error in ruby
594 [Sat Mar 31 17:31:13 2012] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:268:in `[]': Insecure operation - [] (Sec    urityError)
595 [Sat Mar 31 17:31:13 2012] [error] mod_ruby:

compiled with ruby 1.8.6 - oniguruma-patch

$ ~/usr/local/bin/ruby ./configure.rb --prefix=/home/yasu/usr/local --exec-prefix=/home/yasu/usr/local --with-apxs=/usr/sbin/apxs --with-apr-includes=/usr/include/apr-1
$ make
$ sudo make install

got this error.

$ sudo /etc/init.d/apache2 restart
 * apache2 has detected an error in your setup:
apache2: Syntax error on line 168 of /etc/apache2/httpd.conf: Cannot load /usr/lib/apache2/modules/mod_ruby186.so into server: /usr/lib/apache2/modules/mod_ruby186.so: undefined symbol: ruby_verbose
 * ERROR: apache2 failed to stop

EBPS conversion error

setup ebps

Ruby 1.9.3-p0

$ bin/oddb_stanze

Report Mail
NoMethodError: undefined method `each_document' for Psych:Module
/usr/local/lib/ruby/gems/1.9.1/gems/ebps-1.0.2/lib/ebps/conversion/fachinfo_yaml.rb:89:in `import'
/usr/local/lib/ruby/gems/1.9.1/gems/ebps-1.0.2/bin/ebps:58:in `<top (required)>'
bin/oddb_stanza:19:in `load'
bin/oddb_stanza:19:in `<main>'

same error: http://dev.ywesee.com/Masa/20111110-just-kindle-ebook-ebps#JustMedicalEbook

ebps needs ruby-1.9.1

In production server

$ ruby19 -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]
$ gem19 -v
1.3.1

Installed ruby-1.9.1-p243

  • ruby-1.9.1-p243
    • openssl 0.9.8
    • zlib
  • rubygems-1.3.1
  • imagemagick 6.7.5

following gems (ebps has dependency)

  • rclcnof
  • rmail
  • rmagick
  • builder
  • zip rubyzip

If installed zip, then got this error in conversion.

ArgumentError: wrong number of arguments (4 for 2)
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/epub.rb:11:in `block in compile_epub'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/zip-2.0.2/lib/zip/zip.rb:942:in `open'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/epub.rb:10:in `compile_epub'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/epub.rb:33:in `block in export'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:493:in `block in export'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:510:in `call'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:510:in `with_tmpdir'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:457:in `export'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/epub.rb:32:in `export'
bin/oddb_stanza:71:in `<main>'

I could run /bin/eps fine.

Format error in conversion

above error is.

Input file for conversion: /var/ebps/data/yaml/fachinfos.ch.oddb.yaml

NoMethodError: undefined method `formats' for #<YAML::Object:0xaa9c11c>
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/ebps-1.0.2/lib/ebps/conversion/oebps.rb:91:in `format'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/ebps-1.0.2/lib/ebps/conversion/oebps.rb:138:in `block (2 levels) in paragraphs'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in `call'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in `_nested_structures'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:63:in `method_missing'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/ebps-1.0.2/lib/ebps/conversion/oebps.rb:138:in `block in paragraphs'

Checked in development env

Setup for development

  • extracted some fachino from fachinfos.oddb.yaml
  • updated load path
  • created devel.yaml and data directories

and ran

Result
[
Input file for conversion: /home/yasu/Documents/workspace/ywesee/ebps/data/yaml/fachinfos.ch.oddb.yaml

The Ebook compendium_ch.oddb.org.stanza.epub was generated and stored in /home/yasu/Documents/workspace/ywesee/ebps/data/books

Postprocess: the following commands were executed
 - mv compendium_ch.oddb.org.stanza.epub /var/www/oddb.org/data/downloads/compendium_ch.oddb.org.stanza.epub in directory /home/yasu/Documents/workspace/ywesee/ebps/data/books/
]

This is normal result report.

released ebps as gem and HEAD of git have some difference.

Attach:diff-ebps-gem-and-head-20120330.txt

It may ebps gem dose not have this commit
Updated fachinfo_xm.rb, oebps.rb for emediat to include drug pictures and link

But when I ran bin/ebps (git HEAD) with full fachinfos.oddb.yaml, same error caused.

Input file for conversion: /home/yasu/Documents/workspace/ywesee/ebps/data/yaml/fachinfos.ch.oddb.yaml

NoMethodError: undefined method `formats' for #<YAML::Object:0x8e1b24c>
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:95:in `format'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:164:in `block (2 levels) in paragraphs'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in `call'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in `_nested_structures'
/home/yasu/usr/local/lib/ruby/gems/1.9.1/gems/builder-3.0.0/lib/builder/xmlbase.rb:63:in `method_missing'
/home/yasu/Documents/workspace/ywesee/ebps/repo/lib/ebps/conversion/oebps.rb:164:in `block in paragraphs'
...

This error comes from yaml file.

Experiment1

in lib/ebps/conversion/oebps.rb
with sample fachinfos.ch.oddb.yaml

...
        def format paragraph
          p paragraph.class
          return unless paragraph
          paragraph.formats.each do |format|
            if txt = paragraph.text[format.range]
              reduce_formats format.values, txt 
            end 
          end 
        end
...
EBPS::Text::Subheading
EBPS::Text::Subheading
EBPS::Text::Subheading
EBPS::Text::Paragraph
EBPS::Text::Subheading
EBPS::Text::Paragraph
...
Experiment2

in lib/ebps/conversion/oebps.rb
with full fachinfos.ch.oddb.yaml

...
        def format paragraph
          return unless paragraph
          unless paragraph.respond_to?(:formats)
            p paragraph.class
          else
            paragraph.formats.each do |format|
              if txt = paragraph.text[format.range]
                reduce_formats format.values, txt 
              end 
            end 
          end 
        end
...
"ODDB::Text::Table"
"ODDB::Text::Table"
"ODDB::Text::Table"
"ODDB::Text::Table"
"ODDB::Text::Table"
"ODDB::Text::Table"

6 invalid table in fachinfos.

$ grep -r Text::Table fachinfos.ch.oddb.yaml | wc -l
$ 12

There are cases that 1 paragraph has some tables.

Problem
table in Fachinfo
NOTE

This is pre tag (not table)

pre in Fachinfo

Update ebps Text object

In ebps, We have to replace ODDB::Object by YAML.add_domain_type.
I added Text::Cell(extends Paragraph) class, and Updated Text::Table class.

and updated format method to prevent above error.

Refs

Update exporter

We have to update exporter to export ODDB::Text::Table object, correctly.

- !ruby/object:ODDB::Text::Table
- !oddb.org,2003/ODDB::Text::Table

NOTE

in fachinfos.de.oddb.yaml
- !de.oddb.org,2007/ODDB::Text::Table

I updated ext/export/src/oddb_yaml.rb then exported with bin/admin

/var/www/oddb.org 606(master) $ bin/admin 
ch.oddb> Exporter.new(self).export_fachinfo_yaml
-> 

TO DO

  • to export Newest DATA to fachinfo.yaml.
  • to check fachinfo of de.oddb.org.
  • to note update step in production server.
  • to commit change of ext/exportd (commit of ebps is depends on this update, to display table)
view · edit · sidebar · attach · print · history
Page last modified on March 31, 2012, at 06:37 PM