Total(379)
-
동적변수
for i in range(0,20): globals()['value_{}'.format(i)] = i print(value_1) print(value_19) 참고로 동적변수를 print 하였을 때 계속 null값이 나와서 당황하였으나, 이후 알고 보니 변수 선언을 해줘서 발생했던 문제이다. 아래는 잘못된 표현이다. value_1 = value_2 = ....... value_19 = '' => 잘못된 선언 for i in range(0,20): globals()['value_{}'.format(i)] = i print(value_1) print(value_19) 위 잘못된 선언을 하고자 한다면 globals() 대신 locals()를 사용하면된다. value_1 = value_2 = ....... va..
2022.07.28 -
파일에 쓰기
#!/bin/sh today=`date +%Y%m%d` before=~date +%Y%m%d -d "-1 year"` connect='/mysql/local/mysql/bin/mysql -uroot -p123456 DBNAME -S /tmp/mysql.sock -N ' $connect -e "select * from dept where reg_date > ${before} " > /data/dept_${today}.txt
2022.07.28 -
bz2
>> import bz2 >> str = b"sqlplus scott/tiger" # compress >> compress_str = bz2.compress(str) >> print(compress_str) b'BZh91AY&SYY\xf9\xdb\xc5\x00\x00\x07\x11\x80@\x00\x8a\xa4\xfe\x00 \x001\x00\x00\x08@d\xf0\xa1X\xedh\x9b\x14\x18~N\xfe.\xe4\x8ap\xa1 \xb3\xf3\xb7\x8a' # decompress >> decompress_str = bz2.decompress(compress_str) >> print(d) b"sqlplus scott/tiger" >> print(d.decode()) sqlplus scott..
2022.07.20 -
UTL_HTTP 에러
1. UTL_HTTP 사용하는 프로시저를 컴파일을 하였지만 다음과 같은 에러가 발생하였다. ORA-06550: line 3, column 6: PLS-00201: identifier 'SYS.UTL_HTTP' must be declared ORA-06550: line 3, column 6: 2. 원인을 찾던 중 utl_http 가 정의(?)가 되지 않았음을 알 수 있었다. 알 수 있었던 방법은 단순하였다. https://community.oracle.com/tech/developers/discussion/469405/problem-calling-utl-http-in-oracle-xe $ sqlplus "/as sysdba" SQL> desc utl_http utl_http의 정보들이 출력이 될 것이다. ..
2022.06.21 -
yum 에서 설치가 되지 않을때(appstream)
$ yum install vim -y yum에서 vim을 설치하고자 하였으나 다음과 같은 에러가 발생하였다. CentOS Linux 8 - AppStream 60 B/s | 38 B 00:00 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist repo쪽의 경로가 잘못 인식되어서 발생되는 경우이다. 아래와 같이 URL을 변경하여 해결 할 수 있다. $ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* $ sed -i 's|#baseurl=http://mirror.centos.org|..
2022.06.20 -
[docker] CentOS에 Hadoop 설치하기
1. 리눅스 설치(CentOS)$ docker search centos$ docker pull centos$ docker run -it --name hadoop centos /bin/bash 2. wget, vim 설치[hadoop] yum install wget -y && yum install vim -y 아래와 동일한 에러가 발생할 경우 클릭Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 3. Java 설치$ yum install java-1.8.0-openjdk-devel.x86_64 -y$ java -versionopenjdk version ..
2022.06.20