Bash
Git Bashにmanコマンド追加 GitBash For Windows で man コマンドを使いたい - Corredor
find
コマンドの-path
オプション便利
Git Bashにmanコマンド追加 GitBash For Windows で man コマンドを使いたい - Corredor
find
コマンドの-path
オプション便利
scala.util.parsing
を使うにはlibraryDependencyを追加しなくてはならない。
https://www.scala-lang.org/api/current/libraryDependencies ++= Seq(...)
で書いた方が可読性が上がるstr=sample.MP4 echo ${str%.MP4} # ⇒ sample
ヒアストリングとsedを組み合わせる
man pageの日本語化
scaladocの入力補完, ショートカット
withZoneSameLocal
とwithZoneSameInstant
の違い
def getGprmcRow(nmeaFile: File, ldt: LocalDateTime, zoneId: ZoneId) = { val zdt = ldt.atZone(zoneId) val utc = zdt.withZoneSameInstant(ZoneId.of("UTC")) //UTC時刻 }
val path = getClass.getResource("/imagedir").getPath
https://stackoverflow.com/questions/5285898/how-to-access-test-resources
shouldBe, assert? どっちがよい?
⇒ expected,actualを明確に意識するならshouldBeのほうが良さそう
Power Assert: 和田さん作成 https://github.com/power-assert-js/power-assert
import文の書く場所
Scalaは引数指定できるから、コンストラクタ引数を増やしてもOK?
⇒ 22個までならOK
java.nioの知識が曖昧。
Ctrl+Alt+O
: Optimize Import
Scala Consoleの文字コードはShift_JIS? http://mtoyoshi.hateblo.jp/entry/2013/05/13/000106
3 +=: buf
で先頭に追加buf += 1
は+=
というメソッドで、buf = buf + 1
とは異なる。
Predefクラスの中で、「Mapはイミュータブルを使う」という設定が定義されている
typeで別名を付けられる
unapply
とapply
メソッド
バッククォートで囲むと予約語も識別子として使える
型クラス(Java Comparetorのようなもの) コンセプトパターン()
%%
と%
の違い. %%
はScalaのバージョンをアーティファクト名に追加する。
https://www.scala-sbt.org/1.x/docs/ja/Library-Dependencies.html
sbt pack
: jarファイルを作成
sbt packArchive
: tar.gz
ファイルを生成
Ctrl+Shift+F
: ファイル検索(Find in Path)
ProjectをOpenしたときにResovle Errorが発生 ⇒ DetailでJREを設定していなかったため。
Ctrl+Shift+Q
: Implicit Conversion
Ctrl+Shift+Z: Redo
Ctrhl+Shift+S: Sbt Shell
コマンドラインアプリの引数チェック https://github.com/scopt/scopt
jarにまとめるライブラリ
Saclaの横田さん
https://twitter.com/eed3si9n_ja
正規表現の抽出: ワイルドカードがないとscala.MatchErrorが発生する。\d{6}
ではだめで(\d{6})
ならOK。
Json.prettyPrint : JsValue を整形された文字列にします (改行、インデントあり)
Json.toJsonT(implicit writes: Writes[T]) : 解決された暗黙の Writes[T] を使った Scala オブジェクトから JsValue への変換を試みます
play json sampleの意味 : https://qiita.com/miyatin0212/items/fdfe3c6141323ae281c3
定義の順番を変えて対応した
Error:(14, 42) No instance of play.api.libs.json.Writes is available for jp.co.yahoo.tool.PropDataExtractor.ImageInfo in the implicit scope (Hint: if declared in the same file, make sure it's declared before) implicit def jsonWrites = Json.writes[Props]
val Decimal = """(-)?(\d+)(\.\d*)?""".r val Decimal(sign, integerpart, decimalpart) = "-1.23"
Win+Ctrl+C
で、グレースケールになる
http://snow-white.cocolog-nifty.com/first/2017/12/windows-10-fe1d.html
Windows10でフォーカス部分が青枠になるのは、ナレータ機能が有効になっているから。
http://ascii.jp/elem/000/001/146/1146883/
lazy val
:遅延評価
Fat Jar: 一つのjarにいろんなライブラリのjarを含めるかたち
FAT JARを簡単に作る | Developers.IO
sbt-assemblyを使うと、Fat jarが作成できる
GitHub - sbt/sbt-assembly: Deploy fat JARs. Restart processes. (port of codahale/assembly-sbt)
sbtのプラグイン. CorePlugin, IvyPlugin, JvmPlugin
sbt Reference Manual — プラグインの使用
build.sbt の他に、project ディレクトリにはヘルパーオブジェクトや一点物のプラグインを定義した *.scala ファイルを含むことができる。
端末設定で「ローカルエコーをON」にすると、キーボード入力文字が2つずつ表示されてしまう。 テラタームで文字入力すると二重に表示されてしまいます。ただ、コマ... - Yahoo!知恵袋
端末設定で「送信:CR+LF, 受信:CR+LF」にすると、二重に改行されてしまう。 改行コードと TeraTerm の関係を整理してみよう - Schi Heil と叫ぶために
alternatives
コマンドでJavaのバージョンを切り替えた
【linux】 alternativesでjavaのバージョンを切り替える | approad