strPhone.replaceFirst("(^02|[0-9]{3})([0-9]{3,4})([0-9]{4})$", "$1"+"-"+"$2"+"-"+"$3"); // 01012345678 -> 010-1234-5678


drop table test1;
create table test1 
(id varchar(10),
weight int,
height int
);
delete from test1;
insert into test1 values('id20', 20, 150);
insert into test1 values('id30', 30, 140);
insert into test1 values('id50', 50, 130);

SELECT test1.*
FROM
  test1
  JOIN
      (
        SELECT id,weight FROM test1
        ORDER BY RAND() * ( 1 / weight)
        LIMIT 1
      )
        t2
    USING (id)
;    

(https://www.tek-tips.com/viewthread.cfm?qid=1296084)


eclipse 에서 설정

project 선택 > 우마우스 > Configure > Add Gradle Nature

(https://stackoverflow.com/questions/14751276/eclipse-not-recognizing-project-as-gradle-project/28313449)


mysql, pivot

카테고리 없음 2021. 11. 2. 18:21

WITH RECURSIVE 
unwound AS (
SELECT CONCAT(1,',',2,',',3) AS colors
    UNION ALL
    SELECT regexp_replace(colors, '^[^,]*,', '') colors
      FROM unwound
      WHERE colors LIKE '%,%'
  )
  SELECT regexp_replace(colors, ',.*', '') colors
    FROM unwound

(https://stackoverflow.com/questions/17308669/what-is-the-opposite-of-group-concat-in-mysql)


Gson, \u003d

카테고리 없음 2021. 10. 26. 16:12

        // // \u003d (=) 에러 String req = new GsonBuilder().create().toJson(sendObj);
        String req = new GsonBuilder().disableHtmlEscaping().create().toJson(sendObj);

(https://acet.pe.kr/519)


    @NotEmpty
    private String userId;

-->

/* @NotEmpty */
    private String userId;

 

(https://tecoble.techcourse.co.kr/post/2020-09-20-validation-in-spring-boot/)



(https://stackoverflow.com/questions/12711786/convert-command-line-arguments-into-an-array-in-bash/12711837)

#!/bin/bash

echo "Dollar-1 : $1"
echo "Dollar-2 : $2"
echo "Dollar-3 : $3"
echo "Dollar-AT: $@"
echo ""

myArray=( "$@" )

echo "A Val 0: ${myArray[0]}"
echo "A Val 1: ${myArray[1]}"
echo "A Val 2: ${myArray[2]}"
echo "A All Values: ${myArray[@]}"


spring, @Controller @RestController

2021. 9. 24. 17:52

보호되어 있는 글입니다. 내용을 보시려면 비밀번호를 입력하세요.


java, Gson

카테고리 없음 2021. 9. 24. 17:52
$ cat build.gradle
...
dependencies {
....

implementation 'com.google.code.gson:gson'
...
}
...

$ cat GsonTest.java
...
import com.google.gson.GsonBuilder;
...
        String req = new GsonBuilder().create().toJson(obj);
        ...
                Mono<String> result = webClient.mutate()
                .build()
                .post()
                .uri(uri)
                .header("Content-Type", "application/json")
                .header("openapikey", openapikey())
                .bodyValue(req)
                .accept(MediaType.APPLICATION_JSON)
                .retrieve()
                .bodyToMono(String.class);