ブログトップ 記事一覧 ログイン 無料ブログ開設

kurusaki note このページをアンテナに追加 RSSフィード

2012-01-14

スマートフォン勉強会 in 埼玉 #12 1/28(土) 15:00〜 戸田公園

今月のスマートフォン勉強会は、1/28(土)に開催します。

開催場所はいつもどおり戸田公園です。

スマートフォン勉強会 in 埼玉 #12

http://atnd.org/events/24066

日時:2012年1月28日(土) 15時〜17時30分

会場 : 戸田市起業支援センター オレンジキューブ 会議室 (埼玉県戸田市本町1-24-18)

参加登録は、こちら

2012-01-09

[]ページめくりを途中でやめる方法

書籍アプリなど最後のページでページめくりしようとした時に、

少しだけめくれて元に戻るような感じにしたい。

ページを少しだけめくって、元に戻るようにアニメーションさせる。

詳細はAtotok Lab

http://www.atotok.com/labo/ios_dev/20120109070128.html

2011-12-11

[iOS App]軍艦島黙示録 vol.02 「昭和のタイムカプセル」をリリース


12/9(金)にオープロジェクトの軍艦島黙示録の第二弾、

軍艦島黙示録 vol.02 「昭和のタイムカプセル」をリリースしました。


DVD『とっておきの軍艦島ガイド』『軍艦島オデッセイ』、写真集『軍艦島 全景』等で

おなじみの軍艦島伝道師オープロジェクトによるトーキングブックシリーズ第二弾!

軍艦島に残る生活の痕跡を中心に、操業時の写真や資料画像をふんだんに使用し、

軍艦島の生活を追跡。そこから見えてくる昭和時代に迫ります。


  • アプリ内でアドオンを購入すると全ての機能が有効になります。
  • 同一IDで購入する場合は2重に課金されることはありません。
  • ギャラリーに収録されている写真はオープロジェクトが撮影したもののみとなります。

App Storeより提供中、ダウンロードこちら

目次

スクリーンショット

f:id:kurusaki:20111211034328p:image:medium f:id:kurusaki:20111211034317p:image:medium f:id:kurusaki:20111211034324p:image:medium

f:id:kurusaki:20111211034313p:image:medium f:id:kurusaki:20111211034309p:image:medium f:id:kurusaki:20111211034305p:image:medium






著者:オープロジェクト

アプリケーション開発:(株)アトトック

企画・制作:(株)エス・シー・アライアンス

2011-11-06

[][]Rails3でMySQL

Rails3にしてからMySQLへの接続ができなくなっていたので調べてみた。

取りあえず、動くようになったのでメモです。



database.ymlを変更

adapterをmysqlからmysql2に変更。

development:
#  adapter: sqlite3
#  database: db/development.sqlite3
#  pool: 5
#  timeout: 5000
  adapter: mysql2
  database: test1_development
  username: hedgehog
  password: hogehoge
  host: localhost
  encoding: utf8

Gamfileにmysql2を追加

gem 'mysql2'

bundleを実行

$ bundle
Fetching source index for http://rubygems.org/
/Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler.rb:207: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Using rake (0.9.2.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.1) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.1) 
Using erubis (2.7.0) 
Using rack (1.3.5) 
Using rack-cache (1.1) 
Using rack-mount (0.8.3) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.0.3) 
Using actionpack (3.1.1) 
Using mime-types (1.17.2) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.1.1) 
Using arel (2.2.1) 
Using tzinfo (0.3.30) 
Using activerecord (3.1.1) 
Using activeresource (3.1.1) 
Using ansi (1.4.0) 
Using bundler (1.0.12) 
Using coffee-script-source (1.1.2) 
Using execjs (1.2.9) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.1) 
Using rdoc (3.11) 
Using thor (0.14.6) 
Using railties (3.1.1) 
Using coffee-rails (3.1.1) 
Using jquery-rails (1.0.16) 
Installing mysql2 (0.3.7) with native extensions 
Using rails (3.1.1) 
Using sass (3.1.10) 
Using sass-rails (3.1.4) 
Using sqlite3 (1.3.4) 
Using turn (0.8.3) 
Using uglifier (1.0.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.


scaffoldするとエラーになる

/Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `require': dlopen(/Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `<top (required)>'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
	from /Users/kuru/Documents/00_Projects/_dev01/01.atotok_webapp/study/test1/config/application.rb:7:in `<top (required)>'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/commands.rb:21:in `require'
	from /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/commands.rb:21:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'

ライブラリの install name を書き換える

$ sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle


db:migrateするとエラーなる

$ rake db:migrate
/Users/kuru/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777

rake aborted!
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

database.ymlを修正

database.ymlのhostをlocalhostから127.0.0.1に修正し、rake db:migrateすると正常に実行できた

修正前のdatabase.yml
  host: loaclhost
修正後のdatabase.yml
  host: 127.0.0.1



開発環境

Mac OS X 10.7.2 Lion

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin11.0.0]

Rails 3.1.1





Atotok note Rails Wiki

[][]お名前.comのVPSでRails3を動かす - (1) rubyバージョンアップ


お名前.comのVPS

http://www.onamae.com/server/vps/

CentOS release 5.3 (Final)

メモリ: 基本512MB 最大1GB


お名前.comのVPSで動作しているrubyRailsのバージョンを確認する。

-bash-3.2$ ruby -v
ruby 1.8.5 (2006-08-25) [x86_64-linux]
-bash-3.2$ rails -v
Rails 2.1.1

ruby ruby 1.8.5とRails 2.1.1が動いている。

これでもRailsを動かすことは出来るが、せっかくなのでRails3を動かしたいので

rubyは1.9に変更し、Rails3をインストールすることにする。


ruby 1.9.3-p0にバージョンアップする


最新版のrubyftp://ftp.ruby-lang.org からダウンロードする。

現時点の最新版は、ruby 1.9.3-p0

-bash-3.2$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
-bash-3.2$ tar xfvz ruby-1.9.3-p0.tar.gz


ruby 1.9.3-p0をVPSインストール
$ cd ruby-1.9.3-p0
$ ./configure
$ make
$ su
# make install
rubyのバージョンが、1.9.3に変わっていることを確認
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]


Atotok note Rails Wiki

[][]お名前.comのVPSでRails3を動かす - (2) railsインストール

Rails3をインストール

$ su
# gem install rails

Rails3がインストールされたがワーニングがる。

取りあえず、後で対応することにする。

gem install railsでのワーニング
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

Railsのバージョンを確認すると3.1.1に変わっている

<<<

[root@atotok work]# rails -v

Rails 3.1.1

>>>



rails new test1を実行するとプロジェクトは作成されるがエラーになってしまう。

/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.



yamlインストール

yamlhttp://pyyaml.org/wiki/LibYAMLからダウンロード

$ wget  http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xvfz yaml-0.1.4.tar.gz
yamlインストール
$ cd yaml-0.1.4
$ ./configure
$ make
$ su
# make install


rubyを再インストール

# cd ruby-1.9.3-p0
# make clean
# ./configure
# make
# make install


これでrails newしてもYAMLのエラーは出なくなっったが、別のエラーが


statement.c:52: 警告: implicit declaration of function ‘sqlite3_prepare_v2’
statement.c: In function ‘bind_param’:
statement.c:268: error: ‘sqlite3_int64’ undeclared (first use in this function)
statement.c:268: error: (Each undeclared identifier is reported only once
statement.c:268: error: for each function it appears in.)
statement.c:268: error: expected expression before ‘long’
make: *** [statement.o] エラー 1


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.4), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.4'` succeeds before bundling.

[][]お名前.comのVPSでRails3を動かす - (3) sqliteアップデート


sqliteのバージョンを確認
# sqlite3 -version
3.3.6
sqliteの最新版をインストールしてみる
# wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz
# tar xvfz sqlite-autoconf-3070900.tar.gz
# cd sqlite-autoconf-3070900
# make
# make install
sqliteのバージョンを確認
# sqlite3 -version
3.7.9 2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e

これで、rails newするとエラーがなくなった。

[][]お名前.comのVPSでRails3を動かす - (4) アプリケーションを実行するとエラー


rails sでアプリケーションを実行するとエラーになってしまう。

# rails s
/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
	from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:5:in `<module:ExecJS>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:4:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
	from /var/www/vhosts/00_default/user/work/test5/config/application.rb:7:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:52:in `require'
	from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:52:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
	from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'


execjsとtherubyracerをインストール

プロジェクトのGemfileに下記の行を追加

gem 'execjs'
gem 'therubyracer'

インストール

# bundle install

この状態でrails sを実行すると正常に起動

 rails s
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-06 21:33:21] INFO  WEBrick 1.3.1
[2011-11-06 21:33:21] INFO  ruby 1.9.3 (2011-10-30) [x86_64-linux]
[2011-11-06 21:33:21] INFO  WEBrick::HTTPServer#start: pid=11268 port=3000
[2011-11-06 21:33:24] INFO  going to shutdown ...
[2011-11-06 21:33:24] INFO  WEBrick::HTTPServer#start done.

これで、rails s でアプリケーションが正常に起動できるようになった。

[][]お名前.comのVPSでRails3を動かす - (5) ファイアーウォールの設定

お名前.comのファイアーウォールの設定

お名前.comでは、Railsデフォルトのポート番号の3000では外部から接続できない。

お名前.comのVPSのシステム設定でファイアーウォールの設定を変更する。

ポート番号10000〜12000の間で、任意のTCP/UDPポートを追加する事ができるので

テスト用のポート番号を決めて、ファイアーウォールの設定でポート追加する。


ポート番号を指定してアプリケーションを起動

rails s -pポート番号

これで起動して、

http://hogehoge:ポート番号

ブラウザからアクセスするとRailsのWelcomeページが表示された。


これでWEBrickで実行できるところまでは確認できたので

次は、MySQLに接続して動作することを確認する。

2011-10-16

スマートフォン勉強会 in 埼玉 #11 10/22(土) 10:30〜 戸田公園

今月のスマートフォン勉強会は、10/22(土)に開催します。

開催場所はいつもどおり戸田公園です。

今回は午前中の開催になります。

スマートフォン勉強会 in 埼玉 #11

日時:2011年10月22日(土) 10時30分〜12時30分

会場 : 戸田市起業支援センター オレンジキューブ 会議室 (埼玉県戸田市本町1-24-18)

参加登録は、こちら

タイムテーブル
時間 タイトル 発表者
10:30 - 10:35 挨拶 クソアプリ工房 代表 中目弘也
http://kuso.nzc.jp
3Dゲーム開発環境 Unity を効率よく学ぶ
http://www.school.pocket-queries.co.jp/
株式会社ポケット・クエリーズ 代表取締役 佐々木 宣彦
http://www.pocket-queries.co.jp/
SPIN スマートフォンライブラリ 2DゲームをC++でサクサク製作!
http://interio-inc.com/index.html?page=smartphone_0/
インタリオ株式会社 代表取締役 石塚 亘
http://interio-inc.com/
トーキング・ブック形式 電子書籍アプリの紹介 株式会社アトトック 代表取締役 来崎洋一
http://atotok.co.jp
12:00〜12:30交流会、告知など



当日、順番など変わる場合があります。