This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Hadoop0202 < Formula | |
url 'http://www.gtlib.gatech.edu/pub/apache/hadoop/core/hadoop-0.20.2/hadoop-0.20.2.tar.gz' | |
homepage 'http://hadoop.apache.org/common/' | |
md5 '8f40198ed18bef28aeea1401ec536cb9' | |
def shim_script target | |
<<-EOS.undent | |
#!/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPEN_JDK_HOME=/Developer/SDKs/openjdk-6-src-b23-05_jul_2011/ | |
find $OPEN_JDK_HOME -name "*.cpp*" -print > cscope.files | |
find $OPEN_JDK_HOME -name "*.hpp*" -print >> cscope.files | |
cscope -bqk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set up databases to run AS YOUR USER ACCOUNT with: | |
unset TMPDIR | |
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
To set up base tables in another folder, or use a different user to run | |
mysqld, view the help for mysqld_install_db: | |
mysql_install_db --help | |
and view the MySQL documentation: | |
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
junichi-macbook-pro:~ junichi$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
Installing MySQL system tables... | |
OK | |
Filling help tables... | |
OK | |
To start mysqld at boot time you have to copy | |
support-files/mysql.server to the right place for your system | |
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Play < Formula | |
url 'http://download.playframework.org/releases/play-1.2.3.zip' | |
homepage 'http://www.playframework.org/' | |
md5 '75822b1ec443239a4467147a94882442' | |
def install | |
rm_rf 'python' # we don't need the bundled Python for windows | |
rm Dir['*.bat'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scala | |
scala> val name = "Junichi Kato" | |
name: java.lang.String = Junichi Kato | |
// 定数なので初期化できない | |
scala> name = "HOGE" | |
<console>:8: error: reassignment to val | |
name = "HOGE" | |
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scala | |
// 代入される値の型により変数の型が決定する | |
scala> val num1 = 1 | |
num1: Int = 1 | |
scala> val num2 = 1.5 | |
num2: Double = 1.5 | |
// 型を明示的に指定するなら、:型で指定する。型アノテーションという。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package money | |
import java.util.Currency | |
class Money(amnt : BigDecimal, creny : Currency){ | |
val amount = amnt // フィールド宣言 | |
val currency = creny // フィールド宣言 | |
// フィールド宣言でありながら、コンストラクタのボディとなっているので、処理も書けます。 | |
} | |
// 上記は下記のように省略して記述できる。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Money(val amount: BigDecimal, val currency: Currency){ | |
def plus(other: Money) = { | |
require(other.currency == currency) // falseだとIllegalArgumentException | |
new Money(amount + other.amount, currency) // 最後の式で評価された値が戻り値 | |
} | |
override def equals(obj: Any) = obj match { // 該当したcaseの=>の右側の式が評価され、その結果がmatch式の戻り値 | |
case that: Money => amount == that.amount && currency == other.currency | |
case _ => false // defaultケースのようなもの |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package money | |
import java.util.Currency | |
import java.util.Locale | |
class Money(val amount : BigDecimal, val currency: Currency) { | |
// 補助コンストラクタ | |
def this(amount : BigDecimal) = this(amount, Currency.getInstance(Locale.getDefault)) | |
// ... | |
} |