반응형
반응형
반응형

 

Github 에서 소스를 clone 하는데 아래와 같이 에러가 발생했다.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/...../'

 

 

내용인즉슨...

GitHub에서 2021년 8월 13일부터 HTTPS를 통한 비밀번호 인증을 더 이상 지원하지 않는다는 것이다!!

대신 **Personal Access Token (PAT)**을 사용해야 한다고 한다!

 

 

Github 내 프로필의 설정에서 토큰을 발급 페이지

- Settings > Developer Settings

https://github.com/settings/tokens

 

GitHub · Build and ship software on a single, collaborative platform

Join the world's most widely adopted, AI-powered developer platform where millions of developers, businesses, and the largest open source community build software that advances humanity.

github.com

 

 

Generate new token(classic) 메뉴를 클릭해서 토큰을 생성

 

 

Select scopes 은 아래와 같이 설정

 

 

결론

 - 비밀번호 대신에 토큰을 입력하면 된다!!!

 

 

반응형
반응형

 

MySQL 사용시 테이블 대소문자 구분하지 않고 사용하기

 

Server version: 5.7.13

 

MySQL 설정 확인

mysql> show variables like 'lower%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 0     |
+------------------------+-------+

 

lower_case_table_names

 - 1 : 대소문자 구분하지 않고 사용.

 - 0 : 대소문자 구분하여  사용.

 

 

MySQL 설정 변경

- read ony 값이라 set 명령어로 변경할 수 없음.

mysql> set lower_case_table_names=1;
ERROR 1238 (HY000): Variable 'lower_case_table_names' is a read only variable

 

- my.cnf 파일 수정 후 재구동

$ vi /etc/my.cnf

[mysqld]
...
lower_case_table_names = 1
...

 

반응형
반응형

java 소수점 처리

 - 데이터 타입이 float 이나 double 이어야 합니다.

 

ex) 나누기 연산을 해서 소수 둘째자리까지 출력하는 방법.

1. String.format

 - 반올림 된 값으로 결과값 출력.

 - 소수점 자릿수 지정(고정)

private static void div(int mb) {
        double gb = (double)mb / 1024;
        System.out.println("\n---------------------------------");
        System.out.println("" + mb + " / 1024 = " + gb);

        System.out.println("String.format = " + String.format("%.2f", gb));
}

div(1024);
div(1540);
div(1550);
div(1400);


결과 :
---------------------------------
1024 / 1024 = 1.0
String.format = 1.00

---------------------------------
1540 / 1024 = 1.50390625
String.format = 1.50

---------------------------------
1550 / 1024 = 1.513671875
String.format = 1.51

---------------------------------
1400 / 1024 = 1.3671875
String.format = 1.37

 

2. BigDecimal

 - 반올림/올림/내림 설정 가능.

 - 소수점 자릿수 지정(고정 / 마지막이 0 인 경우 버림 가능)

private static void div(int mb) {
        double gb = (double)mb / 1024;
        System.out.println("\n---------------------------------");
        System.out.println("" + mb + " / 1024 = " + gb);

        BigDecimal bdMb = new BigDecimal(mb);
        BigDecimal bdKb = new BigDecimal(1024);
        System.out.println("BigDecimal = " + bdMb.divide(bdKb, 2, RoundingMode.DOWN));
        System.out.println("BigDecimal(stripTrailingZeros) = " + bdMb.divide(bdKb, 2, RoundingMode.DOWN).stripTrailingZeros());
}
    
div(1024);
div(1540);
div(1550);
div(1400);


---------------------------------
1024 / 1024 = 1.0
BigDecimal = 1.00
BigDecimal(stripTrailingZeros) = 1

---------------------------------
1540 / 1024 = 1.50390625
BigDecimal = 1.50
BigDecimal(stripTrailingZeros) = 1.5

---------------------------------
1550 / 1024 = 1.513671875
BigDecimal = 1.51
BigDecimal(stripTrailingZeros) = 1.51

---------------------------------
1400 / 1024 = 1.3671875
BigDecimal = 1.36
BigDecimal(stripTrailingZeros) = 1.36

 

3. DecimalFormat

 - 반올림 된 값으로 결과값 출력.

 - 소수점 자릿수 지정(고정 / 마지막이 0 인 경우 버림 가능 / 0 버림 갯수 지정 가능)

private static void div(int mb) {
        double gb = (double)mb / 1024;
        System.out.println("\n---------------------------------");
        System.out.println("" + mb + " / 1024 = " + gb);

        DecimalFormat formatter = new DecimalFormat("0.##");
        System.out.println("DecimalFormat(0.##) = " + formatter.format(gb));

        DecimalFormat formatter2 = new DecimalFormat("0.0#");
        System.out.println("DecimalFormat(0.0#) = " + formatter2.format(gb));
}

div(1024);
div(1540);
div(1550);
div(1400);


결과 :
---------------------------------
1024 / 1024 = 1.0
DecimalFormat(0.##) = 1
DecimalFormat(0.0#) = 1.0

---------------------------------
1540 / 1024 = 1.50390625
DecimalFormat(0.##) = 1.5
DecimalFormat(0.0#) = 1.5

---------------------------------
1550 / 1024 = 1.513671875
DecimalFormat(0.##) = 1.51
DecimalFormat(0.0#) = 1.51

---------------------------------
1400 / 1024 = 1.3671875
DecimalFormat(0.##) = 1.37
DecimalFormat(0.0#) = 1.37

 

4. DecimalFormat + BigDecimal

 - 반올림 된 값으로 결과값 출력.

 - 소수점 자릿수 지정(고정 / 마지막이 0 인 경우 버림 가능 / 0 버림 갯수 지정 가능)

private static void div(int mb) {
        double gb = (double)mb / 1024;
        System.out.println("\n---------------------------------");
        System.out.println("" + mb + " / 1024 = " + gb);

        DecimalFormat formatter = new DecimalFormat("0.##");
        DecimalFormat formatter2 = new DecimalFormat("0.0#");
        System.out.println("DecimalFormat(BigDecimal, 0.##) = " + formatter.format(bdMb.divide(bdKb, 2, RoundingMode.DOWN)));
        System.out.println("DecimalFormat(BigDecimal, 0.0#) = " + formatter2.format(bdMb.divide(bdKb, 2, RoundingMode.DOWN)));
}
    
div(1024);
div(1540);
div(1550);
div(1400);
        

결과 :
---------------------------------
1024 / 1024 = 1.0
DecimalFormat(BigDecimal, 0.##) = 1
DecimalFormat(BigDecimal, 0.0#) = 1.0

---------------------------------
1540 / 1024 = 1.50390625
DecimalFormat(BigDecimal, 0.##) = 1.5
DecimalFormat(BigDecimal, 0.0#) = 1.5

---------------------------------
1550 / 1024 = 1.513671875
DecimalFormat(BigDecimal, 0.##) = 1.51
DecimalFormat(BigDecimal, 0.0#) = 1.51

---------------------------------
1400 / 1024 = 1.3671875
DecimalFormat(BigDecimal, 0.##) = 1.36
DecimalFormat(BigDecimal, 0.0#) = 1.36

 

반응형
반응형

 

MySQL 사용자 생성 시 에러가 발생했습니다.

mysql> create user 'user1'@'%' identified by 'passwd1';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

패스워드가 정책 요구사항에 맞지 않다는 얘기입니다.

 

 

그럼 현재 정책이 어떤지 확인을 해보겠습니다.

mysql> show variables like 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+
7 rows in set (0.01 sec)

 

패스워드 정책이 MEDIUM 으로 설정되어 있는 것을 확인할 수 있습니다.

| validate_password_policy             | MEDIUM |

 

 

※ 패스워드 정책은 MySQL 문서에 따르면 이렇게 정의되어 있네요.

 

 

해결책

1. 현재 설정되어 있는 정책에 맞게 패스워드를 만든다.

mysql> create user 'user1'@'%' identified by '유저1!Pw처럼';

2. 현재 설정되어 있는 정책을 바꾼다.

# MySQL 8
mysql> set global validate_password.policy=LOW;
Query OK, 0 rows affected (0.00 sec)

# MySQL 5
mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)

 

 

반응형

'Database > Mysql' 카테고리의 다른 글

MySQL 테이블 대소문자 구분  (0) 2024.03.08
index 생성 기준?  (0) 2021.09.24
[API] 앱 버전 체크 시 사용할 만한 쿼리  (1) 2017.10.11
mysql 에서 unix time 구하기  (0) 2015.09.23
mysql bin log 삭제.  (0) 2014.05.15
반응형

 

빗버킷에 저장소(repository) 생성 후 로컬 PC 에서 git 처음 사용시 에러 발생.

$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'http://git.com/test.git'

 

아마도 remote 의 master 브랜치를 인식하지 못하는 것 같다.

$ git branch -m master

 

위 처럼 master 브랜치를 설정 한 후 push 하면 잘된다.

$ git push -u origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 209 bytes | 209.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://git.com:7990/test.git
 * [new branch]      master -> master
branch 'master' set up to track 'origin/master'.

 

반응형

+ Recent posts