import psycopg2 as pg2
from psycopg2.extras import DictCursor
conn = pg2.connect()
cursor = conn.cursor(cursor_factory=DictCursor)
cursor.execute('select %s, %s', ('test', 2))
cursor.query
"select E'test', 2"
'2020/04'에 해당되는 글 7건
- 2020.04.29 [Python] psycopg2 에서 실행된 쿼리문 전체 보기
- 2020.04.27 [VueJs] CKEditor 연동하기
- 2020.04.27 [GIT] 윈도우 PowerShell 에서 git clone 후 github desktop에서 보기
- 2020.04.27 [Python] 이름으로 특정 프로세스 종료 시키기
- 2020.04.26 [VueJs] component 에서 벗어날때 이벤트 처리하기
// 설치
npm i --save @ckeditor/ckeditor5-vue @ckeditor/ckeditor5-build-classic
// package.json 확인
"dependencies": {
"@ckeditor/ckeditor5-build-classic": "^16.0.0",
"@ckeditor/ckeditor5-vue": "^1.0.1"
}
// template 파일 샘플
<template>
<ckeditor :editor="editor"
v-model="editorData"
:config="editorConfig"
/>
</template>
<script>
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import CKEditor from '@ckeditor/ckeditor5-vue'
export default {
name: 'CKEditor',
components: {
ckeditor: CKEditor.component
},
data: () => ({
editor: ClassicEditor,
editorData: '<p>Content of the editor.</p>',
editorConfig: {
// The configuration of the editor.
height: '500px',
language: 'ko'
}
})
}
</script>
팁
언어를 한국어(ko) 로 지정을 해도 메뉴들이 여전히 영어로 나올 경우, 한국어를 직접 참조할 수 있도록 추가
import '@ckeditor/ckeditor5-build-classic/build/translations/ko';
참조 URL : https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html
댓글을 달아 주세요
git desktop 설치
git clone으로 소스 가져오기
// 빈 디렉토리 만들고 powershell 호출
// repository clone
git clone ssh://[gituser]@[gitlab server]/[gitlab reopsitory]
// github desktop 실행
File > Add local repository 클릭
repository 디렉토리 선택
댓글을 달아 주세요
보통 콘솔에서 동작을 시킬때 동일한 프로그램이 좀비형태로 안죽고 있거나, 일정 시간 오버해서 동작하는 경우 강제로 종료시켜야할 필요성이 있을때 사용하면 유용합니다.
import psutil
# python filename.py로 실행된 프로세스를 찾음
for proc in psutil.process_iter():
try:
# 프로세스 이름, PID값 가져오기
processName = proc.name()
processID = proc.pid
if processName[:6] == "python": // 윈도우는 python.exe로 올라옴
commandLine = proc.cmdline()
# 동일한 프로세스 확인. code 확인
if 'filename.py' in commandLine:
parent_pid = processID #PID
parent = psutil.Process(parent_pid) # PID 찾기
for child in parent.children(recursive=True): #자식-부모 종료
child.kill()
parent.kill()
else:
print(processName, ' ', commandLine, ' - ', processID)
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): #예외처리
pass
print('동일 프로세스 확인 완료....')
댓글을 달아 주세요
페이지 이동 전에 특정 이벤트를 처리하고 싶은 경우가 있는 경우 유용합니다.
// component LIFECYCLE
components: { ... },
mounted: { ... }
methods: { ... },
beforeRouteLeave (to, from, next) { ... } // 컴포넌트를 벗어나는 경우 처리할 이벤트
// 샘플
beforeRouteLeave(to, from, next) {
const answer = window.confirm('데이터 저장이 되지 않았습니다. 이 페이지를 나가시겠습니까?')
if (answer) {
next()
} else {
next(false) // false를 추가한 경우 페이지 이동을 하지 않음
}
}
댓글을 달아 주세요
댓글을 달아 주세요