TeX capacity exceeded, sorry [save size=5000]
powerdotでスライドを作成しているのですが,MBAにしてからどうもコンパイルが通らない.
なにやら怪しい文字列が・・・
! TeX capacity exceeded, sorry [save size=5000]
どうやら,「保存サイズが足りないよ」とのことらしい.
詳しくは
「グループの終了時に復元する(各種レジスタなどの)値の保存領域のサイズ」
が足りないようである.(TeX のエラーメッセージ - TeX Wiki参照)
このサイズを増やしてあげれば問題が解決するようなので,「texmf.cnf」を変更してあげる必要がある.
場所がわからなければ,「kpsewhich」コマンドをつかえば,場所を教えてくれる!
$ kpsewhich texmf.cnf /xxx/xxx/texmf/web2c/texmf.cnf
texmf.cnfをエディタで開いて,下記の場所を変更すればOK
hyph_size = 8191 % prime number of hyphenation exceptions, >610, <32767. % http;//primes.utm.edu/curios/page.php/8191.html nest_size = 500 % simultaneous semantic levels (e.g., groups) max_in_open = 15 % simultaneous input files and error insertions param_size = 10000 % simultaneous macro parameters save_size = 10000 % for saving values outside current group stack_size = 5000 % simultaneous input sources
form_tag について
特定のコントローラのメソッドに送信する場合
- view
<%= form_tag "/コントローラ名/メソッド名" do %> <%= submit_tag "送信" %> <% end %>
他にもこんなふうに書けたりする。
- view
<%= form_tag controller: :コントローラ名, action: :メソッド名 do %> <%= submit_tag "送信" %> <% end %>
多分、「metahod:」もform_tag に書くことができる。
postgreSQL の覚え書き
Homebrew で postgreSQL をインストールすると途中で設定方法などが表示される。
書籍のやり方とちょっと違うのでメモ程度に残す。
# Build Notes If builds of PostgreSQL 9 are failing and you have version 8.x installed, you may need to remove the previous version first. See: https://github.com/mxcl/homebrew/issues/issue/2510 To build plpython against a specific Python, set PYTHON prior to brewing: PYTHON=/usr/local/bin/python brew install postgresql See: http://www.postgresql.org/docs/9.1/static/install-procedure.html # Create/Upgrade a Database If this is your first install, create a database with: initdb /usr/local/var/postgres To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, see: http://www.postgresql.org/docs/9.1/static/upgrading.html # Start/Stop PostgreSQL If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist Or start manually with: pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start And stop with: pg_ctl -D /usr/local/var/postgres stop -s -m fast # Loading Extensions By default, Homebrew builds all available Contrib extensions. To see a list of all available extensions, from the psql command line, run: SELECT * FROM pg_available_extensions; To load any of the extension names, navigate to the desired database and run: CREATE EXTENSION [extension name]; For instance, to load the tablefunc extension in the current database, run: CREATE EXTENSION tablefunc; For more information on the CREATE EXTENSION command, see: http://www.postgresql.org/docs/9.1/static/sql-createextension.html For more information on extensions, see: http://www.postgresql.org/docs/9.1/static/contrib.html # Other Some machines may require provisioning of shared memory: http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC To install postgresql (and ossp-uuid) in 32-bit mode: brew install postgresql --32-bit If you want to install the postgres gem, including ARCHFLAGS is recommended: env ARCHFLAGS="-arch x86_64" gem install pg To install gems without sudo, see the Homebrew wiki.
render から変数を渡す方法
render は部分テンプレートを呼び出すことができます。
次のコードは、同フォルダ内にある _hoge.html.erb を呼び出します。
<%= render "hoge" %>
ウェブサイト上では、hogeページが埋めこまれている様に表示されます。
で、誤解をしていたのですが、render はメソッドや関数みたいなモノらしいです。
main.html.erb
<% @Mains.each do | main| %> <%= render "hoge" %> <% end %>
_hoge.html.erb
<%= main %>
とやっても _hoge.html.erb は 「main なんてローカル変数知らない」というわけです。
表示は埋め込みされいるように見えるため、C言語の #define みたいなものかと勘違いしてました。
では、どうやって _hoge.html.erb で main という変数を使えるようにすればいいかというと・・・、メソッドや関数のように引数として渡してあげればいいんです。
書き方は
main.html.erb
<% @Mains.each do | main| %> <%= render "hoge", val: main %> <% end %>
_hoge.html.erb
<%= val %>
で、ローカル変数である main が _hoge.html.erb で val と言う名前で使えるようになります。
render は、引数として部分テンプレート名や、変数名だけでなく、オブジェクトも書くことができます。
変数は、ローカル変数やハッシュ、配列なども可能です。
オブジェクトについては・・・よくわかりませんでした。
まだまだ、勉強中。
mecab を使おうとするとエラーが出る
mecab を使おうとしたら次のようなエラーがでました。
$ mecab param.cpp(69) [ifs] no such file or directory: /usr/local/Cellar/mecab/0.993/lib/mecab/dic/ipadic/dicrc
バージョンが上がったせいでmecabのディレクトリが変更になったのかもしれないです。
というわけで、削除して入れ直します。mecab-ipadicも削除し、インストールし直してくださいね。
$ brew uninstall mecab $ brew uninstall mecab-ipadic $ brew install mecab mecab-ipadic
Homebrewでupdateをしたらエラーが出た
長いこと更新作業を忘れるとでやすいエラーです.
$ brew update
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/cabocha.rb
Please move or remove them before you can merge.
Aborting
Updating 7d2c1da..bfe50e3
Error: Failed while executing git pull origin refs/heads/master:refs/remotes/origin/master
対策の詳しいことは下記のサイトから
brew update fails · Issue #5128 · Homebrew/legacy-homebrew · GitHub
対処の仕方は次のようにするとOKです.
$ cd /usr/local $ git remote add origin git://github.com/mxcl/homebrew.git fatal: remote origin already exists. $ git fetch origin remote: Counting objects: 5, done. remote: Compressing objects: 100% (1/1), done. remote: Total 3 (delta 2), reused 3 (delta 2) Unpacking objects: 100% (3/3), done. From git://github.com/mxcl/homebrew 4d2d66e..8a968e9 gh-pages -> origin/gh-pages $ git reset --hard origin/master HEAD is now at bfe50e3 shen: another style issue
うまくアップデートできた!
$ brew update Already up-to-date.