(https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript)

var arr=[
{"JANQTY":"49","STD_ITM_NM":"연결송수구명판" ,"EBGTAMT":"1" },
{"JANQTY":"38","STD_ITM_NM":"하론소화기"   , "EBGTAMT":"0"},
{"JANQTY":"49","STD_ITM_NM":"연결송수구명판" ,"EBGTAMT":"0" },
{"JANQTY":"15","STD_ITM_NM":"압력스위치"   ,"EBGTAMT":"0" },
{"JANQTY":"49","STD_ITM_NM":"연결송수구명판" ,"EBGTAMT":"1" }
];


console.log('BEFORE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ :', arr);

console.log('BEFORE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ :', JSON.stringify(arr));


arr = [...new Map(arr.map(obj => [JSON.stringify(obj), obj])).values()];


console.log('AFTER  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ :', arr);

console.log('AFTER  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ :', JSON.stringify(arr));

/*

Details:-

  1. Doing .map() on the data list and converting each individual object into a [key, value] pair array(length =2), the first element(key) would be the stringified version of the object and second(value) would be an object itself.
  2. Adding above created array list to new Map() would have the key as stringified object and any same key addition would result in overriding the already existing key.
  3. Using .values() would give MapIterator with all values in a Map (obj in our case)
  4. Finally, spread ... operator to give new Array with values from the above step.

*/


https://stackoverflow.com/questions/1344908/how-do-i-stage-all-files-at-once-in-git-gui

  1. Click 'Tools'>Add...
  2. Name it whatever you want (I chose 'add all')
  3. In the 'Command' field, type git add *
  4. Optionally check the boxes to remove a dialog window, output window, and global configuration.
  5. Click the Add button in the bottom right.

firefox hotkey

firefox 2019. 11. 15. 10:00


runsed

shell 2019. 11. 14. 10:53

mybatis 2 jsp

shell 2019. 11. 14. 10:49

mybatis 2 jsp

util.zip
0.00MB


source backup.sh

shell 2019. 11. 14. 10:36

NOW=`date "+%Y%m%d%H%M"`
TGT=$1-$NOW.tar
cd /cygdrive/c
if [ -z "$2" ]
then
echo "Second arguments not exists"
else
echo 'tabs are replaced into spaces'
find project_home/WorkSpace -iname "${1}*" | grep -v -E ".svn|class|bak|old" | xargs sed -i 's/\t/    /g'
fi

find project_home/WorkSpace -iname "${1}*" | grep -v -E ".svn|class|bak|old" | xargs tar -cvf /tmp/$TGT
echo $TGT 'is maden'


mv /tmp/$TGT /cygdrive/d/src-bak
echo $TGT 'is moved d drive'

tar -xvf /cygdrive/d/src-bak/$TGT -C /cygdrive/d/src-bak/src-for-git/project_home
echo $TGT 'is copied to git directory'

tar -tvf /cygdrive/d/src-bak/$TGT
echo $TGT


sql 2 mybatis

shell 2019. 11. 14. 10:21

$ cat input.sql

SELECT ID, NAME
FROM USERS
WHERE ID = :USERID

$ cat replace.sh

file1=input.sql
file2=$file1.bak

cp $file1 $file2
echo $file2

perl -pi -e "s/:/#{/g;" $file2
perl -pi -e "s/#\{\w*\b\K/}/g;" $file2

#sed -i 's/^/        /g' $file2

cp $file2 out

 

$cat out

SELECT ID, NAME
FROM USERS
WHERE ID = #{USERID}