30歳過ぎたら、健康管理も仕事の内だと痛感


昨年10月末くらいから続いていた体調不良が今月に入って爆発。
免疫力が低下してたのか、昨日から高熱が出て完全にダウン。
しかも今月に入って2度目のダウン。
K-1ならKO負け。
と、結構凹んでいます…。


30歳を過ぎると、少しづつ積み重なった不摂生から病気になったり、病気からの回復も遅れがち。
なので日頃からの健康管理も大事な仕事だと改めて痛感しました。
とりわけフリーランサーは、不健康であってはいけないですね…。


そして、万が一病気になった場合は、無理して気合いで治そうとはせず、即座に病院に行ってソッコーで治す。


今年は体力づくり、健康管理を課題にして頑張りたいと思います。

TextmateでScala


せっかくなのでTextmateScalaの開発環境を整える。
(Textmateとは→TextMate: Text editor for macOS)


では早速、Scalaのバンドルをインストール。
http://micha.blog.monoid.net/2008/02/new-scala-bundle-for-textmate.html
↑の"The Scala Bundle"のリンクから ScalaBundle.zip をダウンロードして解凍。


解凍したファイル Scala.tmbundle をダブルクリックして設定をインストール。


以上w


よく使いそうなコマンド

⌃H ドキュメント表示
⌘R 実行
⌘B ビルド
class⇥ class
if⇥ if
ifelse⇥ if/else
def⇥ def

for とか var(val) とか無いんだね。
まぁ、いいか。



追記
Textmate の日本語化については以下を参照
http://hisasann.com/housetect/2008/05/railstextmate.html

MacでScalaをインストールしてみる

Mac Snow LeopardScalaインスコした時のメモ。



Scalaが気になって気になってしょうがないのでとりあえずインストール。
MacPortでインストールすればいいんじゃね?って軽い考え。

% sudo port install scala
Password:
--->  Computing dependencies for scala
--->  Fetching scala
Error: Please one of the numbered scala* ports instead.
Error: Target org.macports.fetch returned: obsolete port
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.
zsh% scala
zsh: command not found: scala


とりあえず失敗orz
scalaじゃインストール出来ないっぽい。


検索でもするか

% port search scala
dspam @3.8.0 (mail, net)
    Scalable, open-source statistical anti-spam filter

mkpwd @0.7 (sysutils)
    mkpwd is a scalable password generator

omake @0.9.8.5-3 (devel)
    OMake is a build system designed for scalability and portability

p5-readonly @1.03 (perl)
    Facility for creating read-only scalars, arrays, hashes.

p5-readonly-xs @1.04 (perl)
    Readonly::XS is a companion module for Readonly. It speeds up read-only scalar variables.

p5-scalar-list-utils @1.22 (perl)
    Perl subroutines that would be nice to have in the perl core

py25-cometd @0.2 (python)
    Cometd is a scalable HTTP-based event routing bus that uses a push technology pattern known as Comet.

scala @2.7.7 (lang, java)
    The Scala Programming Language

scala-devel @2.8.0.Beta1-prerelease (lang, java)
    The Scala Programming Language

scala-migrations @0.9.2 (java)
    Database migrations written in Scala

scala27 @2.7.7 (lang, java)
    The Scala Programming Language

scala28 @0.2.8.0.Beta1-prerelease (lang, java)
    The Scala Programming Language

scalaz @2.3 (java)
    General utility library that extends the Scala core API

slepc @3.0.0-p7 (math, science)
    Scalable Library for Eigenvalue Problem Computations

splat @1.0 (net)
    Splat: Scalable Periodic LDAP Attribute Transmogrifier

Found 15 ports.

とりあえず、scala27をインスコしておけばいいみたい。scala28はBetaって書いてるし。

% sudo port install scala27
--->  Computing dependencies for scala27
--->  Fetching scala27
--->  Attempting to fetch scala-2.7.7.final.tgz from http://lil.fr.distfiles.macports.org/scala27
--->  Verifying checksum(s) for scala27
--->  Extracting scala27
--->  Configuring scala27
--->  Building scala27
--->  Staging scala27 into destroot
--->  Installing scala27 @2.7.7_0
--->  Activating scala27 @2.7.7_0
--->  Cleaning scala27


おっ、成功


一応確認

% scala -version
Scala code runner version 2.7.7.final -- Copyright 2002-2009, LAMP/EPFL


おk。


とりあえず、コレ読んで勉強する。

SCALAプログラミング入門

SCALAプログラミング入門

rvmでruby1.8.6,1.8.7のインストールに失敗したときは…。


個人的な備忘。
Macでrvmの環境を作りなおそうとしています。


んで、rvmを再インストール後、rubyのインストールを仕様とすると以下のような感じでインストール出来ない場合があります。

% rvm install 1.8.6
Installing Ruby from source to: /Users/myuser/.rvm/rubies/ruby-1.8.6-p399
Downloading ruby-1.8.6-p399, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4473k 100 4473k 0 0 1805k 0 0:00:02 0:00:02 --:--:-- 2179k
Extracting ruby-1.8.6-p399 ...
Configuring ruby-1.8.6-p399, this may take a while depending on your cpu(s)...
Compiling ruby-1.8.6-p399, this may take a while, depending on your cpu(s)...
Error running 'make ', please check /Users/myuser/.rvm/log/ruby-1.8.6-p399/make*.log
There has been an error while running make. Aborting the installation.


んな時は、以下のコマンドを試してみるといいかも

% rvm install 1.8.6 --reconfigure --configure --with-readline-dir=/opt/local
Installing Ruby from source to: /Users/myuser/.rvm/rubies/ruby-1.8.6-p399
/Users/myuser/.rvm/src/ruby-1.8.6-p399 has already been extracted.
Configuring ruby-1.8.6-p399, this may take a while depending on your cpu(s)...
Compiling ruby-1.8.6-p399, this may take a while, depending on your cpu(s)...
Installing ruby-1.8.6-p399
Installation of ruby-1.8.6-p399 is complete.
Installing rubygems dedicated to ruby-1.8.6-p399...
Retrieving rubygems-1.3.6
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 278k 100 278k 0 0 69135 0 0:00:04 0:00:04 --:--:-- 99016
Extracting rubygems-1.3.6 ...
Installing rubygems for /Users/myuser/.rvm/rubies/ruby-1.8.6-p399/bin/ruby
Installation of rubygems ruby-1.8.6-p399 completed successfully.
Installing gems for ruby-1.8.6-p399.
Installing rdoc to /Users/myuser/.rvm/gems/ruby-1.8.6-p399@global
Installing rdoc to /Users/myuser/.rvm/gems/ruby-1.8.6-p399
Installing rake to /Users/myuser/.rvm/gems/ruby-1.8.6-p399@global
Installing rake to /Users/myuser/.rvm/gems/ruby-1.8.6-p399
Installation of gems for ruby-1.8.6-p399 is complete.


でけた

最近の仕事


とりとめなく、つらつらと。


数カ月前から、今までにないタイプのプロジェクトに携わっている。


今日は私用で早々に帰宅できたけど、ここ最近は家は寝るだけの場所。
ひたすら仕事。
数日ぶりに起きている子供の顔を見た。


たくさんの技術的課題。
そして高スキルなプロジェクトのメンバ。
その中に囲まれて自信を無くしそうにもなる。ってか無くしたww


けど、挫折感を埋める以上の刺激を受けまくってる!!
毎日、仕事場に行くのがワクワクしてしょうがない。
そんな感じで、けっこう疲労はたまっているんだろうけど、スッゲー楽しい。


プロジェクトに誘ってもらったメンバに感謝。


もちろん、その環境に文句も言わない家族にも感謝。
たまには早く帰ります。

Rails3のコマンド


昨日の続き


参考:Rails3 リリースノート全文和訳 (ただし適当) - gom68の日記
参考:#200 Rails 3 Beta and RVM - RailsCasts

scaffold作成

コマンド変わっている
ってか"ruby script/***""rails ***"にすれば良いです。

rails generate scaffold todo title:string memo:text fixed:boolean

もしくは

rails g scaffold todo title:string memo:text fixed:boolean


削除

rails destroy scaffold todo

その他、コントローラとかモデルとかマイグレーションファイル作成

rails generate controller welcome index

rails generate model blog title:string text:text

rails generate migration AddFixedToBlogs fixed:boolean

migrate

変更なし

rake db:migrate

サーバ起動

rails server

もしくは

rails s


オプション

-p, --port=port Runs Rails on the specified port.
Default:
-b, --binding=ip Binds Rails to the specified ip.
Default:
-c, --config=file Use custom rackup configuration file
-d, --daemon Make server run as a Daemon.
-u, --debugger Enable ruby-debugging for the server.
-e, --environment=name Specifies the environment to run this server under (test/development/production).
Default:

-h, --help Show this help message.

サーバ起動のオプション変わってないかなー。

コンソール

rails console

もしくは

rails c

irb(main):001:0> t = Todo.new
=> #
irb(main):002:0> t.save
=> true

まぁ、変わらんね。

プラグインインストール

rails plugin install プラグイン

とりあえず、こんな感じ。