// Keywords
<- // Used on for-comprehensions, to separate pattern from generator
=> // Used for function types, function literals and import renaming
// Reserved
( ) // Delimit expressions and parameters
[ ] // Delimit type parameters
{ } // Delimit blocks
. // Method call and path separator
// /* */ // Comments
# // Used in type notations
: // Type ascription or context bounds
<: >: <% // Upper, lower and view bounds
" """ // Strings
' // Indicate symbols and characters
@ // Annotations and variable binding on pattern matching
` // Denote constant or enable arbitrary identifiers
, // Parameter separator
; // Statement separator
_* // vararg expansion
_ // Many different meanings
どちらも記号を名前としたメソッドを定義することで演算子を定義できる。
class Foo
def +(other)
"add method"
end
end
foo1 = Foo.new
foo2 = Foo.new
foo1 + foo2 # "add method"
class Foo {
def +(other: Foo): String = "add method"
}
val foo1 = new Foo
val foo2 = new Foo
foo1 + foo2 // "add method"
引数のデフォルト値
Ruby
class Foo
def bar(baz = 1)
baz
end
end
foo = Foo.new
foo.bar() # => 1
foo.bar(2) # => 2
Scala
class Foo {
def bar(baz: Int = 1): Int = {
baz
}
}
val foo = new Foo()
foo.bar() // => 1
foo.bar(2) // => 2
可変長引数
Rubyでは定義するときも呼び出すときも * という記号をまえにつける。
class Foo
def bar(baz, *hoge)
# 2つめ以降の引数はhogeに配列として入る
end
end
foo = Foo.new
baz = 1
hoge = ["foo", "bar"]
foo.bar(baz, *hoge)
class Foo {
def bar(baz: Int, bar: String*): Unit = {
// 2つめ以降の引数は bar にSeqとして入る
}
}
val foo = new Foo
val baz = 1
val hoge = Seq("foo", "bar")
foo.bar(baz, hoge:_*)
# cd /usr/local/src
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
# tar zvxf yasm-1.3.0.tar.gz
# cd yasm-1.3.0
# ./configure
# make
# make install
# cd /usr/local/src
# wget ftp://ftp.jp.netbsd.org/pub/pkgsrc/distfiles/opencv-2.4.6.1.tar.gz
# tar vxzf opencv-2.4.6.1.tar.gz
# cd opencv-2.4.6.1
# cmake28 .
# make
# make install
# ldconfig
PROMPTING
When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to
be customized by inserting a number of backslash-escaped special characters that are decoded as follows:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
\e an ASCII escape character (033)
\h the hostname up to the first ‘.’
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell’s terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patch level (e.g., 2.00.0)
\w the current working directory, with $HOME abbreviated with a tilde (uses the value of the PROMPT_DIRTRIM variable)
\W the basename of the current working directory, with $HOME abbreviated with a tilde
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] end a sequence of non-printing characters
[vagrant@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4e05429b2b2f mysql:latest "/entrypoint.sh /bin/" 4 minutes ago Up 4 minutes 3306/tcp pensive_payne
[vagrant@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
なにも表示されなくなりました。
MySQLを使う
次は mysqlサーバを起動します。
起動
run コマンドを使います。
[vagrant@localhost ~]$ docker run -e MYSQL_ROOT_PASSWORD=password -d mysql:latest
8e05ca461fa74135cf84e1f0f5f2e229810b40402e865c28fc593320bd26ba3a
[vagrant@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e05ca461fa7 mysql:latest "/entrypoint.sh mysql" 19 seconds ago Up 15 seconds 3306/tcp small_lichterman
-dデタッチオプション。コンテナをバックグラウンドで動作させる
mysql コンテナはmysqldをフォアグラウンドで起動するので、サーバとして起動させるならば -d オプションは必須です。
サーバに接続する
コンテナ中の mysql クライアントを使って接続するには以下の通り。
[vagrant@localhost ~]$ docker exec -it small_lichterman sh -c 'mysql -uroot -p'
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
また、Center for Magnetic Recording Researchは、次のように述べている『データの完全消去はディスクに対する1回の上書きのことである。アメリカ国家安全保障局も推奨要綱にて、同相信号除去比(CMRR)試験をした結果、複数回の上書きは何ら安全性の向上に優位な差をもたらさず、1回の上書きで十分であることを認めている』。