IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

2016-01-01から1ヶ月間の記事一覧

関数をn回適用する

foldr (.) id (replicate n f) を理解したい。 stackoverflow.com *Main> :t foldr (.) の型を考える。 *Main> :t foldr foldr :: (a -> b -> b) -> b -> [a] -> b 置き換えておく。 foldr :: (x -> y -> y) -> y -> [x] -> y *Main> :t (.) (.) :: (b -> c)…

swiftを使ってみた

某Wimax2の制限なしの2年縛りが近づいてきているので、諸々の大きめなファイルのダウンロードをしていました。xcodeもこの機会にダウンロードしました。せっかくなのでswiftを使ってみました。 起動する。 ガチで開発しない場合はPlaygroundを使うようです。…

JSONのVisitorPatternをやってみた

背景もどき 諸般の事情があり、JSONをVisitorパターン的に取り扱うことになりました。JSONはツリー構造になっているので、Visitorパターンが使える仕組みがあるのかとおもったのですが、org.jsonのAPIにはVisitorパターンはサポートされていないようです。 …

Warning:Gradle version 2.10 is required. Current version is 2.8

経緯 Android Studio 2.0 でのgradleのビルドエラーが発生しました。 Warning:Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in ...hoge...\myproject\gradle\wrapper\gradle-wr…

Custom cursor sample

AbstractCursor AbstractCursor implements CrossProcessCursor protected int mPos; // index public final boolean moveToPosition(int position) // various methods -> moveToPosition -> onMove (check) public boolean onMove(int oldPosition, int ne…

Android Custom Cursor Sample

追記 バージョンによっては動作しない。 column_keyに_idが必要 column数取得を実装する必要がある ContentProviderを別APKにすると、Cursor利用側でキャッシュがされる。 ScreenShot Class MainActivity-->MyAdapter (ItemLayout)<-->MyCursor<-->MyContent…

PowerShellでファイルの行数を取得する

手元にWindowsマシンがなくて試せないが、こんな感じのコードだったはず。 PASH /home/cg/root> Get-ChildItem C:\foo\bar.* -Include *.java -Recurse | %{$_.fullname + "`t" + (Get-Content $_.fullname).length} /home/cg/root/mmm.java 74 /home/cg/roo…