<< | Index | >>
Commit
Commit
Replace
Commit
Task
Replace
Updates
def new_fachinfo
#if((pointer = @session.user_input(:pointer)) && (registration = pointer.resolve(@session)))
if(reg = @session.user_input(:reg) and registration = @session.app.registration(reg))
_new_fachinfo(registration)
end
end
def fachinfo(model, session=@session, css='square infos') if(link = _fachinfo(model, css)) link elsif(!model.has_fachinfo? && @session.allowed?('edit', model)) link = HtmlGrid::Link.new(:fachinfo_create, model, @session, self) #ptr = model.is_a?(Registration) ? model.pointer : model.registration.pointerreg = model.is_a?(Registration) ? model.iksnr : model.registration.iksnr
#args = {:pointer => ptr, :chapter => 'composition'}args = [:reg => reg, :chapter => 'composition']
link.href = @lookandfeel._event_url(:new_fachinfo, args) link.css_class = 'square create-infos' link end end
Error
error in SBSM::Session#to_html: /de/gcc/new_fachinfo/reg/61322/chapter/composition ArgumentError wrong number of arguments (2 for 1) /usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?' /usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/value.rb:33:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/namedcomponent.rb:34:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:70:in `new' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:70:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /home/masa/ywesee/oddb.org/src/view/drugs/fachinfo.rb:278:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `new' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `content' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:50:in `init' /home/masa/ywesee/oddb.org/src/view/privatetemplate.rb:16:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `new' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `view' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:197:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:529:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:177:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `synchronize' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service' bin/oddbd:38 ODDB::View::Drugs::RootFachinfoComposite::COMPONENTS[[1, 0]] in create(company_name) ODDB::View::Drugs::RootFachinfo::COMPONENTS[[0, 3]] in create(content) error in SBSM::Session#http_headers: /de/gcc/new_fachinfo/reg/61322/chapter/composition ArgumentError wrong number of arguments (2 for 1) /usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?' /usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/value.rb:33:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/namedcomponent.rb:34:in `initialize'
Update
#def respond_to?(key)
def respond_to?(key, *args)
key != :pointer_descr
end
Commit
Update
# encoding: utf-8 module EBPS module Decorator module JustMedical def self.decorate modelmodel.chapters.each_with_index do |chap, i|
if chap.heading =~ /Zulassungsinhaberin/
if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
table = Text::Table.new
table.rows[0][0] = Text::LinkedParagraph.new('http:/www.astrazeneca.ch/', 'AstraZeneca AG')
table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
chap.paragraphs[0] = table
end
end
end
if codes = model.metadata['article_codes'] size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact unless size_ean13s.empty? chapter = Text::Chapter.new chapter.heading << 'Stammdaten' size_ean13s.each do |size, dose, ean13| reg = ean13[4,5] href = "http://www.med-drugs.ch/?main=/de/just-medical/show/reg/#{reg}" chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s) end model.add_chapter chapter end end end end end end
# encoding: utf-8 module EBPS module Decorator module JustMedical def self.decorate modelmodel.chapters.each_with_index do |chap, i|
if chap.heading =~ /Titulaire de l’autorisation/
if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
table = Text::Table.new
table.rows[0][0] = Text::LinkedParagraph.new('http:/www.astrazeneca.ch/', 'AstraZeneca AG')
table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
chap.paragraphs[0] = table
end
end
end
if codes = model.metadata['article_codes'] size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact unless size_ean13s.empty? chapter = Text::Chapter.new chapter.heading << 'Base des données' size_ean13s.each do |size, dose, ean13| reg = ean13[4,5] href = "http://www.med-drugs.ch/?main=/fr/just-medical/show/reg/#{reg}" chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s) end model.add_chapter chapter end end end end end end
Run
masa@masa ~/ywesee/ebps $ ruby1.9 -I lib bin/meddrugs.ch_de_kindle config="etc/meddrugs.ch_de_kindle.yml"
Experiment
ch.oddb> ODBA.cache.prefetch
Result
/usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:340: [BUG] Segmentation fault ruby 1.8.6 (2009-06-08) [x86_64-linux] Abgebrochen
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15: [BUG] rb_gc_mark(): unknown data type 0x16(0x7fc2897d1930) non object ruby 1.8.6 (2009-06-08) [x86_64-linux] Abgebrochen
Note
# A Persistable instance can be _prefetchable_. This means that the object # can be loaded at startup by calling ODBA.cache.prefetch, and that it will # never expire from the Cache. The prefetch status can be controlled per # instance by setting the instance variable @odba_prefetch, and per class by # overriding the module constant ODBA_PREFETCH
Check
masa@masa ~/ywesee/oddb.org $ grep -ri odba_prefetch src/ src/model/activeagent.rb: ODBA_PREFETCH = true src/model/registration.rb: ODBA_PREFETCH = true src/model/sequence.rb: ODBA_PREFETCH = true
Before prefetch
After prefetch
Note
Experiment
class Package < PackageCommon
ODBA_PREFETCH = true
Prefetch
ch.oddb> ODBA.cache.prefetch
Log
2011-11-17 16:23:04: sessions: 0 - threads: 6 - memory: 284MB ... 2011-11-17 16:33:05: sessions: 0 - threads: 7 - memory: 1448MB
Note
Experiment
def initialize opts={} @rss_mutex = Mutex.new @admin_threads = ThreadGroup.new start = Time.now @system = ODBA.cache.fetch_named('oddbapp', self){ OddbPrevalence.new } puts "init system" @system.init @system.odba_store puts "init system: #{Time.now - start}" puts "setup drb-delegation" super(@system) return if opts[:auxiliary] puts "reset" reset() puts "reset: #{Time.now - start}" log_sizeputs "ODBA.cache.prefetch start"
puts Time.now
ODBA.cache.prefetch
puts "ODBA.cache.prefetch done"
puts Time.now
puts "system initialized" puts "initialized: #{Time.now - start}" end
start_oddbd.sh
#!/bin/sh count = 1 while : do echo "start bin/oddbd: $count" count=`expr $count + 1` bin/oddbd done
Run
masa@masa ~/ywesee/oddb.org $ sh start_oddbd.sh
Result