MySQLでInnoDBが動かない

InnoDB: Error: log file ./ib_logfile0 is of different size 0 134217728 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! rm -f /var/lib/mysql/ib_logfile0 rm -f /var/lib/mysql/ib_logfile1 /etc/rc.d/init.d/mysqld restart

rakeの中でrvmを使用したい

#!/bin/bash if [ -f /etc/profile.d/rvm.sh ] then source /etc/profile.d/rvm.sh else echo '$0: /etc/profile.d/rvm.sh not found' exit 1 fi

Railsでlogを書きだす場所を変更する。

time = Time.now.strftime "%Y%m%d" file_name = time + "test.log" ActiveRecord::Base.logger = Logger.new("/var/log/test/"+file_name)

View-based Applicationが見つからない。

View-based Applicationが見つからない。 「View-based Application」と同じ構成にするには、「Single View Application」を選択し、「Next」ボタンを押し、「Use storyboard」のチェックを外し「Next」ボタンを押し保存するれば同じ構成になっているようで…

sudo heroku keys addの際に出たエラー

/usr/local/heroku/vendor/gems/rest-client-1.6.1/lib/restclient.rb:9:in `rescue in ': /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient.rb:9: no such file to load -- net/https. Try running apt-get install libopenssl-ruby (LoadErr…

herokuでaddonを管理

addonの一覧を見る heroku addons addonを追加 heroku addons:add newrelic:standard addonを削除 heroku addons:remove newrelic:standard addonをアップグレード heroku addons:upgrade newrelic:professional

Railsでtinyintを数字として認識したい。

railsでMySQLをActiveRecordを通して使うとtinyintが勝手にboolean型になって困った。 元々がRailsを意識していないdatabaseだったです。 カラム名_code_before_type_cast としたらtinyint型のを数字として扱えました。 ActiveRecord::ConnectionAdapters::M…

HerokuのSQLでは別名をつける際にasをつけないとエラーが出る。

ActiveRecord::StatementInvalid (PGError: ERROR: syntax error at or near "high_price" 2011-10-30T09:02:04+00:00 app[web.1]: LINE 1: SELECT MAX(high_price) high_price,created_on FROM "exchange... Error: SELECT MAX(high_price) high_price,crea…

gitのファイルをexport

$ git checkout-index -a -f --prefix=export/

herokuにデータをimport

sudo heroku db:push Taps Load Error: no such file to load -- taps/operation You may need to install or update the taps gem to use db commands. On most systems this will be: sudo gem install taps checking for sqlite3.h... no sqlite3.h is mi…

railsでdefault_scopeを外したい

Partner.unscoped{ Partner.all } meta_searchの場合でも Partner.unscoped{ Partner.search(params[:search]) } pagerを利用したい時とか Partner.unscoped{ @search.page(params[:page]).per(params[:per]) }

herokuコマンド

herokuにプロジェクト作成 sudo heroku create appname herokuにプッシュ git push git@heroku.com:xxxx-rain-4919.git master herokuでmigrate sudo heroku rake db:migrate herokuでログを見る heroku config:add LOG_LEVEL=DEBUG sudo heroku logs --tail…

Ubutuでrails3をPostgresQLで動かす

rake db:migrate Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)Gemfileに追加 gem 'pg' sudo vi /etc/postgresql/8.4/main/pg_hba.conf 以下の行を変更 #loca…

Railsのテーブルにテストデータをinsertする。

/test/fixtures/table名.ymlを作成 # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html one: opening_price: 9.99 low_price: 9.99 high_price: 9.99 closing_price: 9.99 average_price: 9.99 currency_type: 1 created_on: 2011-…

UbuntuにpostgreSQL9をインストールします。

sudo add-apt-repository ppa:pitti/postgresql sudo apt-get update sudo apt-get install postgresql sudo apt-get install libpq-dev sudo apt-get autoremove sudo service postgresql restart postgreSQL9のためのpgadminの最新版はここからダウンロー…

Ubuntuでheroku loginでerrorが発生

heroku login :29:in `require': no such file to load -- readline (LoadError) from :29:in `require' from /usr/local/heroku/lib/heroku/command/run.rb:1:in `' from :29:in `require' from :29:in `require' from /usr/local/heroku/lib/heroku/comman…

UbuntuにHerokuのツールをinstall

apt-add-repository 'deb http://toolbelt.herokuapp.com/ubuntu ./' curl http://toolbelt.herokuapp.com/apt/release.key | apt-key add - gpg: 書込み可能な鍵輪が見つかりません: eof gpg: 「-」の読出しエラー: 一般的なエラー gpg: import from `-' fa…

Ubuntuでrails3.1を動かすがopensslでエラーが出る。

rails s no such file to load -- opensslruby-1.9.2-p290/ext/opensslに移動 ruby extconf.rb コンパイルできない。 sudo apt-get install libssl-dev ruby extconf.rb make sudo make install

Ubuntuでrails3.1を動かす

/usr/local/lib/ruby/gems/1.9.1/gems/execjs-1.2.8/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 …

rails generate modelでエラー。gem install activerecord-mysql2-adapter

`rescue in establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)メモ書き。適当にこんなんやってたら動い…

rails consoleのエラーを修正する。

/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError) sudo yum install readline-devel cd /usr/local/rvm/src/ruby-1.9.2-p180/ext/readline ruby extconf.rb make make…

Rails3開発メモ[モデルの命名規則][rails server]

モデル関連の命名規則 モデルクラス 先頭は大文字で単数形 Book モデルクラス(ファイル名) 先頭は小文字で単数形 book.rb テーブル 先頭は小文字で複数形 books テストスクリプト xxx_test.rb(先頭は小文字で単数形) book_test.rbrails serverコマンド rails…

Rails3の開発メモ[Ubuntu11.04]

bundle installをした時のエラー対応libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. sudo apt-get install libxml2 libxml2-dev libxslt is missing. please visit http…

Ubuntu11.04にrvmでrails2とrails3を入れてみた。

作業途中で権限でエラーが出る時は.rvm以下の権限を777でやってみて下さい。 chmod -R 777 ~/.rvm sudo apt-get install ruby ruby -v ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux] sudo apt-get install curl sudo apt-get install git vi ~/.bash…

Rails3でscaffoldを使ってアプリの作成。

rails new depot sudo apt-get install libsqlite3-dev gem install sqlite3 rails generate scaffold Product title:string description:text image_url:string price:decimal rvm install rake rake db:migrate URLで確認してみる。 http://localhost:3000…

MongoDBとSQL文の比較

SELECT daily_info_id, SUM(imp_count) as sc, SUM(click_count) as scc, SUM(click_amount) as sca FROM daily_info WHERE daily_info_id = 200911241225 GROUP BY daily_info_id var m = function(){ emit( {k1:this.daily_info_id}, {icsum : this.imp_co…

Hadoopのインストール(install)とHiveのインストール(install)

Hadoopのダウンロード場所 http://ftp.kddilabs.jp/infosystems/apache//hadoop/core/stable/Hadoopのダウンロード wget http://ftp.kddilabs.jp/infosystems/apache//hadoop/core/stable/hadoop-0.20.2.tar.gz解凍 tar -xvzf hadoop-0.20.2.tar.gzHadoopの…