$ docker run -d --name memcached memcached
b40a0f915d7ade1b6ad91c7cc9b2257da1013c21ff61821cc1a59d597b9f734b
docker ps コマンドで実行状況を確認すると実行されていることが確認できます。
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a40a0f915d7a memcached "/entrypoint.sh memca" About a minute ago Up 59 seconds 11211/tcp memcached
// 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