u16suzuの blog

日々学んだことのメモブログです。

2013-06-01から1ヶ月間の記事一覧

Rails Admin でナビゲーションに表示されるモデルの順番を指定する

Change models order in navigation By default, they are ordered by alphabetical order. If you need to override this, specify a weight attribute. Default is 0. Lower values will bubble items to the top, higher values will move them to the bo…

プロダクション環境でマイグレーション時に superclass mismatch for class Word エラーが発生した

[sakura] RAILS_ENV=production bundle exec rake db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:mig…

Objective-C でマルチスレッドプログラミング

マルチスレッド処理のやり方がいくつかあるが、それぞれ試してみた。 GCDが最近の書き方らしいけど、まだまだgithubに上がっているライブラリをみると NSOperationを使っていたりするので、ひと通りやってみました。 // part1 シンプルなパターン [self perf…

データを永続化する。

データを永続化するというのは、iPhoneにデータを保存するということ。 NSUserDefault でもデータ保存はできるけど、これはユーザが設定したアプリの設定項目に使用するべきで アプリ内で定義したモデルの情報を保存することに使うべきではない。 以下の方法…

配列を小さい配列に分割する

a = [1,2,3, 4,5,6, 7,8,9, 10] res = [] while a.size > 0 res << a.slice!(0, 3) end p res # => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]