“Good for you. Good for me. Mmm, good.”

  Key-Value Store
For Local Environment
        誰でも使える技術で使える
          ローカル環境向け
          Key-Value Store

         こしば としあき
most
important
most important

Good for you. Good for me.
 Mmm, good.
  俺に良し
  お前に良し
  みんなに良し
about me
about me

TOSHIAKI
 koshiba
こしば としあき
  twitter:bash0C7
  hatenaid:bash0C7
about me
• RubyKaigi2009 実行委員
  – 受付/オペレーション担当
• 東京Ruby会議01 スピーカー
  – 「オフィスで踏み出すRubyの世界」
about me
• 最近の趣味
  – プロジェクトを設計すること
• 昼の仕事
  – ソフトウェア開発
    • 金融業/運輸業 適用業務システム開発
       –IBM COBOL on CICS
       –MFCOBOL on MTP
       –RPG on AS/400
    • その他、Web、開発ツール開発
  – 社員の提案・不満の収集窓口
about me

•IBM COBOL on CICS
•MFCOBOL on MTP
•RPG on AS/400
outline
outline
          Ruby Script                  User



           This KVS              Rich Client(GUI)



                        Entity Layer



                         local file
requirement
requirement

• store hash
• business person integrate
• on memory running
• without Web Application
• max_size < 1,000,000
design
design

         This KVS
                            Rich Client(GUI)

          API
                <<Entity>>
                middle ware



                    local file
implement
implement
                          concealed
       This KVS Class     Internal processing
            XLS_KVS


                          <<Presentation>>
        Win32OLE
                           Microsoft Excel

            COM API
                   <<Entity>>
                 Microsoft Excel


                 Excel Workbook
Microsoft Excel

    Entity & Presentation
feature
feature

• store key-value
• on memory running
• edit stored values
store
key-values
store key-value

defined same method as "Hash"
  –[](key)
  –store(key, value)
  –delete(key)
store key-value – find(1)




YAML.load(
  @app.WorksheetFunction.VLookup
   (YAML.dump(key),
    @sheet.Range(KEYVALUE_COLS), 2, false ))
store key-value – find(2)




@sheet.range(KEY_COLS).Find(YAML.dump(key),
                            @app.ActiveCell,
                            -4163, #xlValues,
                            1, #xlWhole,
                            1, #xlByRows,
                            1, #xlNext,
                            true,
                             false)
store key-value – insert

get tail row offset in worksheet


max_row =
   @sheet.UsedRange.Row +
   @sheet.UsedRange.Rows.count
@sheet.range("A#{max_row}").value =
   YAML.dump(key)
@sheet.range("B#{max_row}").value =
   YAML.dump(value)
store key-value – update




range = find(key)
range.offset(0, 1).value = YAML.dump(value)
store key-value - delete




target_row = find(key).Row
sheet.Range("#{target_row}:#{target_row}").Delet
  e (-4162)
on memory
  running
on memory running

• if call XLS_KVS#new
  –create XLS_KVS::Hash instance
  –lunch Microsoft Excel
• if call XLS_KVS::Hash#Close
  –save&close Excel Workbook
  –unload Microsoft Excel
edit
stored values
edit stored values
kvs = XLS_KVS.load(@xls_file, 1, false)
kvs.store(1, [Time.now, 'new running', 19])
kvs.store(2, [Time.now, 'I am Koshiba', 9])
kvs.store(3, self)
edit stored values
kvs = XLS_KVS.load(@xls_file, 1, false)
kvs.store(1, [Time.now, 'new running', 19])
kvs.store(2, [Time.now, 'I am Koshiba', 9])
kvs.store(3, self)
                                 edit directly!
edit stored values
kvs = XLS_KVS.load(@xls_file, 1, false)
kvs.store(1, [Time.now, 'new running', 19])
    Excel is useful
kvs.store(2, [Time.now, 'I am Koshiba', 9])

     for many people!
kvs.store(3, self)
                                 edit directly!
      engineers,
      business persons
      students,
      my mother, etc
edit stored values

  Microsoft Excel is



many people's friend
summary
summary

• Ruby is programmer's friend
summary

• Ruby is programmer's friend
• Excel is many people's friend
summary

• Ruby is programmer's friend
• Excel is many people's friend

•Ruby × Excel =
 everyone's friend
"everyone's friend"
   Ruby × Excel

  XLS_KVS
Key-Value Store Library

coming soon!
Thank you
      for
  listening.
ご清聴ありがとうございました

Key Value Store For Local Environment

  • 1.
    “Good for you.Good for me. Mmm, good.” Key-Value Store For Local Environment 誰でも使える技術で使える ローカル環境向け Key-Value Store こしば としあき
  • 2.
  • 3.
    most important Good foryou. Good for me. Mmm, good. 俺に良し お前に良し みんなに良し
  • 4.
  • 5.
    about me TOSHIAKI koshiba こしばとしあき twitter:bash0C7 hatenaid:bash0C7
  • 6.
    about me • RubyKaigi2009実行委員 – 受付/オペレーション担当 • 東京Ruby会議01 スピーカー – 「オフィスで踏み出すRubyの世界」
  • 7.
    about me • 最近の趣味 – プロジェクトを設計すること • 昼の仕事 – ソフトウェア開発 • 金融業/運輸業 適用業務システム開発 –IBM COBOL on CICS –MFCOBOL on MTP –RPG on AS/400 • その他、Web、開発ツール開発 – 社員の提案・不満の収集窓口
  • 8.
    about me •IBM COBOLon CICS •MFCOBOL on MTP •RPG on AS/400
  • 9.
  • 10.
    outline Ruby Script User This KVS Rich Client(GUI) Entity Layer local file
  • 11.
  • 12.
    requirement • store hash •business person integrate • on memory running • without Web Application • max_size < 1,000,000
  • 13.
  • 14.
    design This KVS Rich Client(GUI) API <<Entity>> middle ware local file
  • 15.
  • 16.
    implement concealed This KVS Class Internal processing XLS_KVS <<Presentation>> Win32OLE Microsoft Excel COM API <<Entity>> Microsoft Excel Excel Workbook
  • 17.
    Microsoft Excel Entity & Presentation
  • 18.
  • 19.
    feature • store key-value •on memory running • edit stored values
  • 20.
  • 21.
    store key-value defined samemethod as "Hash" –[](key) –store(key, value) –delete(key)
  • 22.
    store key-value –find(1) YAML.load( @app.WorksheetFunction.VLookup (YAML.dump(key), @sheet.Range(KEYVALUE_COLS), 2, false ))
  • 23.
    store key-value –find(2) @sheet.range(KEY_COLS).Find(YAML.dump(key), @app.ActiveCell, -4163, #xlValues, 1, #xlWhole, 1, #xlByRows, 1, #xlNext, true, false)
  • 24.
    store key-value –insert get tail row offset in worksheet max_row = @sheet.UsedRange.Row + @sheet.UsedRange.Rows.count @sheet.range("A#{max_row}").value = YAML.dump(key) @sheet.range("B#{max_row}").value = YAML.dump(value)
  • 25.
    store key-value –update range = find(key) range.offset(0, 1).value = YAML.dump(value)
  • 26.
    store key-value -delete target_row = find(key).Row sheet.Range("#{target_row}:#{target_row}").Delet e (-4162)
  • 27.
    on memory running
  • 28.
    on memory running •if call XLS_KVS#new –create XLS_KVS::Hash instance –lunch Microsoft Excel • if call XLS_KVS::Hash#Close –save&close Excel Workbook –unload Microsoft Excel
  • 29.
  • 30.
    edit stored values kvs= XLS_KVS.load(@xls_file, 1, false) kvs.store(1, [Time.now, 'new running', 19]) kvs.store(2, [Time.now, 'I am Koshiba', 9]) kvs.store(3, self)
  • 31.
    edit stored values kvs= XLS_KVS.load(@xls_file, 1, false) kvs.store(1, [Time.now, 'new running', 19]) kvs.store(2, [Time.now, 'I am Koshiba', 9]) kvs.store(3, self) edit directly!
  • 32.
    edit stored values kvs= XLS_KVS.load(@xls_file, 1, false) kvs.store(1, [Time.now, 'new running', 19]) Excel is useful kvs.store(2, [Time.now, 'I am Koshiba', 9]) for many people! kvs.store(3, self) edit directly! engineers, business persons students, my mother, etc
  • 33.
    edit stored values Microsoft Excel is many people's friend
  • 34.
  • 35.
    summary • Ruby isprogrammer's friend
  • 36.
    summary • Ruby isprogrammer's friend • Excel is many people's friend
  • 37.
    summary • Ruby isprogrammer's friend • Excel is many people's friend •Ruby × Excel = everyone's friend
  • 38.
    "everyone's friend" Ruby × Excel XLS_KVS Key-Value Store Library coming soon!
  • 39.
    Thank you for listening. ご清聴ありがとうございました