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…

sample cat files in directory listed

code: #!/bin/sh dir_test=/Users/tk/test/ ( IFS=$'\n'; ls -1 test/ | while read line do for linef in `cat $dir_test$line` do echo $linef done done )

delete file if query results not returned

package homeWork; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.s…

memo : svn man

https://tortoisesvn.net/docs/release/TortoiseSVN_ja/tsvn-dug-diff.html

<java>save pdf in postgres and get sample

package homeWork; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; imp…

normal way to save dbdata in files

package homeWork;import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;import or…

dbunit + postgresql

package homeWorkTest;import static org.junit.Assert.*;import org.junit.Test; import java.io.FileOutputStream; import org.dbunit.JdbcDatabaseTester; import org.dbunit.database.DatabaseConfig; import org.dbunit.database.IDatabaseConnection; …

java : reduce stream of list of maps

package homeWork;import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors;public class sumSample { publi…

java : string check ”” OR null

package homeWork;import org.apache.commons.lang3.StringUtils;public class stringCheck { public static void main(String[] args) { // TODO Auto-generated method stub String strEmptyStr=""; String strNullObject =null; System.out.println("no s…

java : filter list of map sample

package homeWork;import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors;public class filterSample { public static void main(String[…

java : sort list of map by multiple key

package homeWork;import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map;public class sortSample001 { public static void main(String[] args) { List> countries = new Arr…

sort memo(windowsXp )

import java.io.File; import java.util.Arrays; import java.util.Comparator;public class folderSorts { /** * @param args */ public static void main(String args) { // TODO 自動生成されたメソッド・スタブ String path = "C:/test"; File dir = new…

how to re-make weblogic web application

http://www.oracle.com/webfolder/technetwork/jp/obe/fusion_middleware/coherence/obe34coherence_wls/coherenceweb_wls_appconfig/coherenceweb_wls_appconfig.htm

how to constract "ejb" projects.

http://gihyo.jp/dev/serial/01/start_webap/0005

java shit-jis problem

http://www.m-bsys.com/character-code/java-sjis http://hpcgi2.nifty.com/a-yama/wiki.cgi?Java%2FTips

ldap with c# 2

search way 1)with protocol SearchRequest findme = new SearchRequest(); findme.DistinguishedName = "ou=People,dc=example,dc=com"; //Find all People in this ou findme.Filter = "(objectClass=person)"; //The type of entry we are looking for fi…

ldap with c#

http://www.codeproject.com/Articles/34468/Talk-to-Sun-One-LDAP-with-NET-DirectoryServices1)way 1 //Use the servername and port that you setup LDAP Directory Service on //9605 is the example port here LdapDirectoryIdentifier ldapDir = new L…

ldap sample to get optional attributes such as "createtimestamp"

import java.util.Hashtable; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.text.ParseException; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.Nam…