以前、iPhone・iPod touch ラボ紹介して頂いたezPhotoMail, バージョン1.2をリリースしましたので、お知らせします。

@nakimoさん、その節はお世話になりました!
全然お礼も言わずに申し訳ありません... m(_ _)m 今後ともよろしくお願い致します。


Icon.png ezPhotoMail V1.2

AppStore
http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=305784712&mt=8

今回のupdateは下記の内容が主です:

  • 画像リサイズ指定の変更:
    • 20%などのパーセンテージ
    • 240x320 with padding
      → スクリーンショット等の中途半端な画像サイズのリサイズ時、余白を入れることでキレイに(240x320)にリサイズしてくれる
  • サポートフォーマットにPNGを追加:JPEG・PING
    → 上のwith paddingモードの際、PINGだと透過な余白を入れてくれる

画像リサイズ指定の画面

メモ:1200x1600の場合、

  • 20%:240x320
  • 40%:480x640
  • 50%:600x800
  • 80%:960x1280

ezPhotoMail_UI3.jpg

P.S ちなみに今回は4/11に申請して、4/20リリース(申請時間、9日間)という感じでした。

posted by Png satoko on Mon 20 Apr 2009 at 08:05

GAEを使う上での大きな制限として、ファイル数1000までというのがあります。 これを乗り越えるために、unpackしたGemの中から不要なファイルを掃除したりする必要があったのですが、 関連するGem群をjarファイルにまとめる事でこの問題を乗り越えられます。

上記のファイルをlibの下に配置して、config/init.rb あたりでrequire_fixを読み込みます。 これはjarファイルの中のrbファイルの読み込みに関するバグを 回避するためのものです。

実際に以下のサイトでmerb.jarを使って運用しています。

これによって、事実上ファイル数制限に左右されずにアプリケーションを開発する事が出来るようになります。 ただ、1ファイルのサイズ制限(10MB)が存在するので、jarファイルが大きくなりすぎた場合は分割する必要があります。

posted by Png genki on Sun 19 Apr 2009 at 08:46

I shipped new dm-datastore-adapter today.

This update is a long jump from previous version. It includes following functions

  • Transaction. It utilizes the DataStore's Transaction API
  • OR conditions
       1  Post.all(:id => [1,2])
    
  • NOT conditions
       1  Post.all(:id.not => 4)
    

So now we can use most of functions defined in DM by using this adapter.

Enjoy!

posted by Png takiuchi on Fri 17 Apr 2009 at 17:25

JRubyを使っていて、JavaのArrayListを作りたい場合には、以下のようにすると良いようです。

   1  java.util.Arrays.as_list([1,2].to_java).getClass.to_s
   2  # => "class java.util.Arrays$ArrayList"

posted by Png genki on Fri 17 Apr 2009 at 11:08 with 2 comments

紙のページがペラっとめくれているところを英語でdog earというのですが(page curlとも言うらしい)、作りたくなってちょっと調べてみました。

GIMPのPage Curlフィルター

GIMP_pagecurl_filter.png

Filters → Distorts → Page Curl で作成:

http://docs.gimp.org/en/plug-in-pagecurl.html

GIMPのツールで作成

GIMP_pagecurl_tool.png

上記のフィルターはあまりオプションがないのでちょっと不満。シンプルなものも探してみました。Path・Rotate・Drop Shadowを使って作成:

Creating a Page Curl & A Simple Website Template.
http://gimpology.com/submission/view/creating_a_page_curl_amp_a_simple_website_template_/

Photoshopでの作成の仕方のhowto

Photoshop_dogear.png

GIMPではないですが、参考になったので挙げておきます:

Dog Ear Tutorial
http://designoahu.com/dog-ear-tutorial

posted by Png satoko on Fri 17 Apr 2009 at 06:51

前の記事のsnippets以外にも参考になった記事を集めておきます。

Scenario, Features, Steps サンプル

Tutorials and Related Blog Posts

@variablesについての議論

http://www.ruby-forum.com/topic/181116

@userなどstep?scenario?にまたがる変数の使い方ですが、極力使わないのがスパゲッティ防止によさそうらしいです。900を超えるシナリオがある中で使ったけど、ポイント押さえて使えば大丈夫だったよというエピソードが出てきました。ただ、シーンに応じて使うのだったらありだろうというのが大方の見方かな。

script/generate feature Article

body:stringなどとfieldも渡すと、それに応じてテーブルデータ等も生成してくれます: http://d.hatena.ne.jp/amacou/20090127/1233058682

Cookieの値が保持されないworkaround

http://stackoverflow.com/questions/681183/how-to-handle-cookies-when-testing-with-webrat

The workaround is use Webrat with Selenium back end. It runs all tests in a separate Firefox window, so cookies or javascript is not a problem. The downside is extra time and resources required to run Firefox and do all the real clicks, rendering etc.

他にもhackishなworkaroundが紹介されていました。

posted by Png satoko on Fri 17 Apr 2009 at 05:09

[追記] 次に書いたScenario, stepのリンク集もどうぞ:
http://blog.s21g.com/articles/1441


Given, When and Thenの基本はわかったんだけど、なんとなくスマートに書けるようになるにはまだ足りない気がする。というので色々snippetとして集めてみました。
(文法的にはもう古い物もあるので注意)

Given, When and Then

基本はここで:
http://wiki.github.com/aslakhellesoy/cucumber/given-when-then

Given -> When -> Then の順にしかこないのかと思ったら、下記にシナリオの途中にあらわれるThenもあった:
http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/

   1    Scenario: A visitor successfully submits a new animal
   2      Given no animal named 'Alligator' exists
   3      When visitor goes to /animals/new
   4      Then visitor should see the Animal submission form
   5      When visitor submits an animal with name: 'Alligator', phylum: 'Chordata', animal class: 'Sauropsida', order: 'Crocodilia', family: 'Alligatoridae', genus: 'Alligator', and lay eggs:  'true'
   6      Then an animal named 'Alligator' should exist

Thenの後にWhenがくるのもありなのかも。

Stepの入れ子

http://wiki.github.com/aslakhellesoy/cucumber/calling-steps-from-step-definitions

   1  Given /^(.*) is logged in$/ do |name|
   2    Given "the user #{name} exists" 
   3    Given "I log in as #{name}" 
   4  end

記事作成のfeature

http://railscasts.com/episodes/155-beginning-with-cucumber

   1    Scenario: Create Valid Article
   2      Given I have no articles
   3      And I am on the list of articles
   4      When I follow "New Article"
   5      And I fill in "Title" with "Spuds"
   6      And I fill in "Content" with "Delicious potato wedges!"
   7      And I press "Create"
   8      Then I should see "New article created."
   9      And I should see "Spuds"
  10      And I should see "Delicious potato wedges!"
  11      And I should have 1 article
  12  
  13  #article_steps
  14  Given /^I have no articles$/ do
  15    Article.delete_all
  16  end

Scenarioは完結に、Stepで細かく

Imperative vs Declarative Scenarios
http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/

Scenarioを短くnarrativeに書いて、stepで細かいフォーム入力などを扱う感じに書かれていて一番しっくりきました。

Imperative 命令法/形の
Declarative => narrative 叙述の

   1   Story: Animal Submission
   2    As a Zoologist
   3    I want to add a new animal to the site
   4    So that I can share my animal knowledge with the community
   5  
   6    Scenario: successful submission
   7    Given I'm on the animal creation page
   8    When I add a new animal
   9    Then I should see the page for my newly created animal
  10    And the notice 'Thank you for your animal submission!'

   1  # animal_steps.rb
   2  When "I add a new animal" do
   3    fills_in 'Name', :with => 'Alligator'
   4    selects 'Chordata', :from => 'Phylum'
   5    fills_in 'Animal Class', :with => 'Sauropsida'
   6    fills_in 'Order', :with => 'Crocodilia'
   7    fills_in 'Family', :with => 'Alligatoridae'
   8    fills_in 'Genus', :with => 'Alligator'
   9    checks 'Lay Eggs'
  10    clicks_button 'Create'
  11  end

posted by Png satoko on Fri 17 Apr 2009 at 04:59

DataMapper用のDataStoreアダプター、dm-datastore-adapter-0.2.2をリリースしました。

今回のリリースで以下のような機能がサポートされます。

  • トランザクション
  • OR条件
       1  Post.all(:id => [1,2,3])
    
    のような事が出来るようになりました。
  • NOT条件
       1  Post.all(:updated_at.not => nil)
       2  Post.all(:id.not => 3)
    
    などが出来るようになりました。

DataMapperのアダプタとして主に必要な機能はだいたい揃ってきました。

デモサイトであるWatchMe!もアップデートしています。

まだ実用的なサービスになってないですが、登録したサイトをクローリングして全てのページの監視を行い、エラーが発生したらメールで知らせるサービスになる予定です。

posted by Png genki on Fri 17 Apr 2009 at 04:37 with 8 comments

最新にしたらpaths.rbとBackgroundが追加されていたのでメモ。

features/support/paths.rb

Cucumberを最新にしてfeatureをgenerateしようとしたらpaths.rbがないと怒られたので、script/generate cucumberでpaths.rbファイルを生成しました。

Scenarioで記述するページはここで定義:

   1  #features/support/paths.rb
   2  module NavigationHelpers
   3    def path_to(page_name)
   4      case page_name
   5      when /the homepage/
   6        root_path         

Background

1feature内のScenarioに共通な前提条件を記述する。
Backgroundで書かれた条件は、各Scenario実行前、かつBefore Hookの後に実行されるようです。

The background is run before each of your scenarios but after any of your Before Hooks.
http://wiki.github.com/aslakhellesoy/cucumber/background

   1    Background:
   2      Given a global administrator named “Greg   3      And a blog named “Greg’s anti-tax rants” 
   4      And a customer named “Dr. Bill   5      And a blog named “Expensive Therapy” owned by “Dr. Bill

posted by Png satoko on Fri 17 Apr 2009 at 04:04
16th Thu

s21gってなに

なにもわからず、新しいブログサイトにsingupしてしまった:-)

posted by Face ac1965 on Thu 16 Apr 2009 at 17:36 with 1 comment