Changeset 2526 for lang/ruby/ssb

Show
Ignore:
Timestamp:
12/06/07 03:35:55 (13 months ago)
Author:
coji
Message:

lang/ruby/ssb: improved emoji filter perfomance at UTF-8 page,

supports Shift_JIS URL parameter(Now you can use search web sites like Google Mobile!),
show filter proccess / total time.

Location:
lang/ruby/ssb/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/ssb/trunk/libs/ssb.rb

    r2455 r2526  
    9393 
    9494    def run(cgi_request, cgi_response) 
     95      @time_stamp.stamp(:request_start) 
     96 
    9597      # リクエストの生成 
    9698      @ssb_uri = 'http://' + cgi_request.host + File.basename(cgi_request.script_name) + '/' 
     
    99101      # ログ 
    100102      log(@request.method, @request.uri, @request.term.get_useragent(true), @request.term[:uid]) 
    101       @time_stamp.stamp(:request_start) 
    102103 
    103104      # リクエスト 
     
    118119      end 
    119120 
    120       # 変換処理終了 
    121       @time_stamp.stamp(:proc_finish) 
    122  
    123121      output_template(@request.uri, 
    124122                      response, 
     
    150148      # qrcode 
    151149      qrcode = SSB::Qrcode.make_qrcode(request_uri.to_s) 
     150 
     151      # 変換処理終了 
     152      @time_stamp.stamp(:proc_finish) 
    152153 
    153154      begin 
  • lang/ruby/ssb/trunk/libs/ssb/emoji.rb

    r2414 r2526  
    1515    RE_IMODE_SJIS = Regexp.new("((#{SJIS_IMODE_PICTOGRAM})|(#{SJIS_ONE_BYTE}|#{SJIS_TWO_BYTES}))") 
    1616 
     17    @@ez_uni2_table = nil 
     18    @@docomo_uni2_table = nil 
     19 
    1720    # TODO: speed up! 
    1821    def self.ez_uni2number(uni) 
    19       table = YAML.load_file(File.join(SSB::CONFIG[:dat_dir], 'kddi-table.yaml')) 
    20       table.each {|x| 
     22      if @@ez_uni2_table.nil? 
     23        @@ez_uni2_table = YAML.load_file(File.join(SSB::CONFIG[:dat_dir], 'kddi-table.yaml')) 
     24      end 
     25      @@ez_uni2_table.each {|x| 
    2126        if x['unicode'] == uni 
    2227          return x['number'] 
     
    2732 
    2833    def self.docomo_uni2sjis(uni) 
    29       table = YAML.load_file(File.join(SSB::CONFIG[:dat_dir], 'docomo-table.yaml')) 
    30       table.each {|x| 
     34      if @@docomo_uni2_table.nil? 
     35        @@docomo_uni2_table = YAML.load_file(File.join(SSB::CONFIG[:dat_dir], 'docomo-table.yaml')) 
     36      end 
     37      @@docomo_uni2_table.each {|x| 
    3138        if x['unicode'] == uni 
    3239          return x['sjis'] 
  • lang/ruby/ssb/trunk/libs/ssb/request.rb

    r2404 r2526  
    88require 'cgi' 
    99require 'net/http' 
     10require 'nkf' 
    1011require 'ssb/misc' 
    1112Net::HTTP::version_1_2 
     
    8586          uri_base = value.dup.untaint 
    8687        else                    # passing parameters 
    87           uri_params[key.dup.untaint] = CGI.escape(value.dup.untaint) 
     88          uri_params[NKF::nkf('-s', key)] = CGI.escape(NKF::nkf('-s', value)) 
    8889        end 
    8990      end 
  • lang/ruby/ssb/trunk/templates/ssb.rhtml

    r2455 r2526  
    6161  end %> 
    6262              <td class="<%= time_class %>"><%= SSB::Misc.numeric(request_time) %></td> 
     63              <td class="time_unit">ms</td> 
     64            </tr> 
     65            <tr> 
     66              <td class="time_label">変換処理時間</td> 
     67              <td class="time"><%= SSB::Misc.numeric(proc_time) %></td> 
     68              <td class="time_unit">ms</td> 
     69            </tr> 
     70            <tr> 
     71              <td class="time_label">合計</td> 
     72              <td class="time"><%= SSB::Misc.numeric(total_time) %></td> 
    6373              <td class="time_unit">ms</td> 
    6474            </tr>