めも

技術メモとその他

2019-01-01から1年間の記事一覧

using Set not to duplicate values

sample code below package homeWork; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class distinctSample2 { public static void main(S…

how stream().distinct() works - list of maps

sample code below: package homeWork; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; public class distinctSample { public static void main(String[] args…

awk like sql

1)sample data tk-no-MacBook-Pro:~ tk$ cat test.csv 01,8888888,9999999999 09,7777777,6666666666 02,2777333,9999992222 03,8888888,6567637476 2)select col2,col3 from ... where col1 = 09 tk-no-MacBook-Pro:~ tk$ awk -F, '{if ($1 == 09) print $2…

how to grouping and maxBy (list of maps)

1) list of maps : sample list of maps 2) grouping and maxBy main codes 3) before and results appendix) to copy List<Optional<Map<String, Object>>> aggrList = mockList.stream().collect(Collectors.groupingBy(p -> (String)p.get("niveau_1")+ (String)p.get("niveau_2")+(Str</optional<map<string,>…

spring batch : junit test sample

1.project files are below(use terasolua spring batch sample) 2.test codes(test class) package batch; import static org.junit.Assert.fail; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.s…

its util

ttps://www.atmarkit.co.jp/ait/articles/0704/20/news130.html

ls with timestamp (BSD ver.)

ls -l below tk-no-MacBook-Pro:webapps tk$ ls -l total 51584 drwxr-xr-x@ 10 tk staff 340 1 29 2008 ROOT drwxr-xr-x@ 5 tk staff 170 1 29 2008 balancer drwxr-xr-x@ 23 tk staff 782 1 29 2008 jsp-examples drwxr-xr-x@ 11 tk staff 374 1 29 2008 s…

thanks for ...

https://gonsuke777.hatenablog.com/entry/20170112/1484215308

sts old dw

sts(spring tools suite) legacy download below https://spring.io/tools3/sts/legacy

copy files timestamp

-rw-r--r-- 1 tk staff 40988 3 22 21:58 2.log-rw-r--r-- 1 tk staff 40988 3 25 03:16 3.log tk$ touch -r 2.log -m 3.log -rw-r--r-- 1 tk staff 40988 3 22 21:58 3.log-rw-r--r-- 1 tk staff 40988 3 22 21:58 2.log

file and directory counts

count files find /Users/tk/ -type f | wc -l count directory find /Users/tk/ -type d | wc -l and.. list full path with subDirectory ls -ltrh -d $(find `pwd`) > list.log

how to save [jsonb_pretty] format data

1)data is below prototype=# select jsonb_pretty(memo) from foo prototype-# where id = 1; jsonb_pretty --------------------------- { + "name": "japan", + "currency": "JPY", + "population": "10000"+ } (1 row) 2)if you use copy to stdout, psq…

how to get and put pdf in bytea (postgres)

only using sql and sql-command0)main table to store binary file belowprototype=# \d storedpdf Table "public.storedpdf" col name type description id integer key name character varying file name pdf bytea to store files 1)create temporary ta…