Programming/php2017. 1. 2. 09:18

음.. C로 치면 전역 변수로 쓰면

함수 내에서 반드시

$GLOBALS["var"]

이런식으로 불러와야 한다. 아구 귀찮아..


[링크 : http://php.net/manual/en/reserved.variables.globals.php]


아무튼 자매품(?)으로

$_GET

$_POST

$_SESSION 등이 있네

Table of Contents ¶

[링크 : http://php.net/manual/en/reserved.variables.php]

'Programming > php' 카테고리의 다른 글

php "str"과 'str' 차이점  (2) 2017.01.03
php class 그리고.. 구조체가 없다?  (0) 2017.01.02
php print_r  (0) 2017.01.02
php 게시판  (0) 2016.12.28
php db connection pool  (0) 2016.12.28
Posted by 구차니
분류가 모호한 글2017. 1. 2. 09:14

표준상 어쩔수 없이 그렇게 하는건 알고 있지만

매번 일일이 타이핑 하는것도 귀찮고 찾아보니

주소에서 가장앞 한글자 빼고(그럼 자동으로 http://를 제외하게 되니) 복사 하는것도 방법인듯


확장기능 설치는 더 귀찮..


[링크 : http://bryan7.tistory.com/757]

[링크 : http://stackoverflow.../copying-a-utf-8-url-from-browsers-address-bar-gives-only-the-ugly-encoded-one]

'분류가 모호한 글' 카테고리의 다른 글

카라비너 (독일어)  (0) 2017.04.01
샘플 pcb 5만원!  (0) 2017.02.24
NVD - National Vulnerability Database  (0) 2016.02.01
dense 3d reconstruction  (0) 2015.09.22
입식 책상  (0) 2015.09.01
Posted by 구차니
Programming/php2017. 1. 2. 09:09

db에서 값을 불러오면 array로 읽히는데

print 하면 Array 라고만 나와서

내용을 편하게 보는 법을 찾아 보니.. 이런 애가 있었네?


[링크 : http://m.blog.naver.com/diceworld/220295811114]

[링크 : http://php.net/manual/en/function.print-r.php]

[링크 : http://blog.habonyphp.com/entry/php-배열을-읽기-편하게-출력해-주는-printr-함수]

'Programming > php' 카테고리의 다른 글

php class 그리고.. 구조체가 없다?  (0) 2017.01.02
php 변수 스코프  (0) 2017.01.02
php 게시판  (0) 2016.12.28
php db connection pool  (0) 2016.12.28
php 로그인 예제 2  (0) 2016.12.27
Posted by 구차니
Linux2017. 1. 1. 07:19

stat으로는 시간을 볼 수 있낀한데 birth 까진 보기 힘들고

ext4에서는 저장은 한다고 한다.


그러니까 posix에서는 atime ctime mtime으로

마지막 접근 / 변경 / 수정 시간 정도 만 나오고


파일 시스템에서 값을 뺴내야 한다.

$ stat sshd_config

  File: ‘sshd_config’

  Size: 2551            Blocks: 8          IO Block: 4096   regular file

Device: b302h/45826d    Inode: 110939      Links: 1

Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2017-01-01 07:05:20.413654980 +0900

Modify: 2017-01-01 07:05:20.413654980 +0900

Change: 2017-01-01 07:05:20.433654929 +0900

 Birth: - 


$ sudo debugfs -R "stat /etc/ssh/sshd_config" /dev/mmcblk0p2

debugfs 1.42.12 (29-Aug-2014)


Inode: 110939   Type: regular    Mode:  0644   Flags: 0x80000

Generation: 2068774389    Version: 0x00000000:00000001

User:     0   Group:     0   Size: 2551

File ACL: 0    Directory ACL: 0

Links: 1   Blockcount: 8

Fragment:  Address: 0    Number: 0    Size: 0

 ctime: 0x58682ba0:67643244 -- Sun Jan  1 07:05:20 2017

 atime: 0x58682ba0:629f7f10 -- Sun Jan  1 07:05:20 2017

 mtime: 0x58682ba0:629f7f10 -- Sun Jan  1 07:05:20 2017

crtime: 0x58682ba0:629f7f10 -- Sun Jan  1 07:05:20 2017

Size of extra inode fields: 32

EXTENTS:

(0):1031812

(END) 


읭? 왜 ctime와 crtime이 같지?


[링크 : http://webdir.tistory.com/236]

[링크 : http://unix.stackexchange.com/questions/91197/how-to-find-creation-date-of-file]

'Linux' 카테고리의 다른 글

원격지 mac address 얻기  (0) 2017.03.13
리눅스 쉘에서 시리얼 포트로 쓰기  (0) 2017.02.15
ctime mtime.. 엌?!  (0) 2016.12.31
base64 유틸리티  (0) 2016.12.28
리눅스 런레벨  (0) 2016.12.12
Posted by 구차니
Linux2016. 12. 31. 10:10

ctime이 create가 아니라 change네..(inode)

mtime은 modify time


[링크 : http://onecellboy.tistory.com/223]

[링크 : https://www.unixtutorial.org/2008/04/atime-ctime-mtime-in-unix-filesystems/]

$ man ls

       -c     with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by  name; otherwise: sort by ctime, newest first 

       -u     with  -lt:  sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time


'Linux' 카테고리의 다른 글

리눅스 쉘에서 시리얼 포트로 쓰기  (0) 2017.02.15
리눅스 파일 시간관련  (0) 2017.01.01
base64 유틸리티  (0) 2016.12.28
리눅스 런레벨  (0) 2016.12.12
yaffs2 / ext4 비교?  (0) 2016.11.04
Posted by 구차니
embeded/raspberry pi2016. 12. 31. 09:41

신버전이 나와서 깔았더니 SSH가 안된다 -ㅁ-

확인을 해보니.. 일단 ssh가 비활성화 되어 있고

기본암호인 raspberrypi로 쓸 경우 부팅시에 경고를 띄우게 되어 있다.

아무래도 데스크 탑 대용이라던가 기본값으로 쓰다 보니 보안 문제가 있어서

이런식으로 기본은 SSH로 작동을 하지 않도록 바뀐듯..

그런데 그러면 무조건 모니터 연결해야 해서 이래저래 불편하네..

[링크 : https://www.raspberrypi.org/downloads/raspbian/]


그리고 화면은 HDMI overscan 활성화..

그거와 별개로 집에서 HDMI to DVI를 통해 1600x900 뜨는건 모니터 쪽 EDID 정보 문제일 듯..

배경은 무지 이뻐졌네 ㅋㅋ




+

2018.01.10

$ touch /boot/ssh

하듯 파일을 생성해주면 ssh가 활성화 된다.

2016년 11월 이후 릴리즈에 대해서 보안상의 이유로 변경


[링크 : https://blog.naver.com/opusk/220984515191]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 + 태양전지!  (0) 2017.01.25
라즈베리 파이 4k 대응 @15p  (2) 2017.01.17
라즈베리 저전력 발악해보기?  (0) 2016.12.16
라즈베리 파이 xorg.conf  (0) 2016.11.03
rpi microSD slot  (0) 2016.10.31
Posted by 구차니

으으 말일까지 나와서 테스트 해보네 ㅠㅠ

LC_ALL 만 설정하고 LC_ALL=""로 빼고 테스트 하니 한글이 깨지는 현상 발생

그래서 테스트 해보니 되는 듯



아무튼 결론

synology nas에서

svn 1.9.4 인데

hook-env 로는 설정이 안되고

post-commit 내에서

로 로케일과 언어를 설정해주니 문제없이 해결 -_-

export LC_ALL=en_US.utf8

export LANG=en_US.utf8



[링크 : https://www.lesstif.com/pages/viewpage.action?pageId=18220003]

[링크 : http://svnbook.red-bean.com/vi/1.8/svn.reposadmin.create.html]

[링크 : http://askubuntu.com/questions/795455/python-default-locale-is-not-working]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git-svn 관련글  (0) 2017.04.25
svn list 예제  (0) 2017.02.03
svn commit email - python / synology  (0) 2016.12.30
svn diff 결과물 컬러로 보기  (0) 2016.12.30
svn commit시 email 알림  (0) 2016.12.29
Posted by 구차니

어라?

파이썬으로 메일보내는데

새가

ㅅㅐ 로 보내지네.. 머지?


[링크 : http://unicode.scarfboy.com/?s=U%2BC0C8]

[링크 : http://unicode.scarfboy.com/?s=U%2b1109]

[링크 : http://unicode.scarfboy.com/?s=U%2b1162]



+

설정해도 안되고..

일단 ssh에서 직접 스크립트를 실행하면 한글이 안깨지고 가는데..

svn 통해서 hook 실행되면 깨진다.

[링크 : https://mikewest.org/2006/06/subversion-post-commit-hooks-101]

[링크 : http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python이 인기라는데..  (0) 2014.03.19
python2 vs python3  (0) 2013.01.02
PyOpenGL  (0) 2011.10.04
Posted by 구차니

svn에서 hook을 통해 commit-post를 실행하면 희한하게 한글이 깨지네..

파이프쪽 로케일이 문제인가..


$ cat mailer.py

#!/usr/bin/python

# -*- coding:utf-8 -*-


import smtplib

import sys

import os

from email.mime.multipart import MIMEMultipart

from email.MIMEText import MIMEText

from subprocess import Popen, PIPE


smtp_hostname="smtp.mailserver.com:port"

smtp_username="mailer@mailserver.com"

smtp_password="password"

toaddrs  = ['user1@mailserver.com','user2@mailserver.com','user2@mailserver.com']

project_name = os.path.basename(sys.argv[1])

subject = "["+project_name+"]"+" svn repository update required"

content = project_name + "\n" + "rev : " + sys.argv[2]+ "\n"


cmd_1 = ['svnlook','changed','-r',sys.argv[2],sys.argv[1]]

proc = Popen(cmd_1, stdout=PIPE)

difflist = proc.stdout.read()


cmd_2 = ['svnlook','info','-r',sys.argv[2],sys.argv[1]]

proc = Popen(cmd_2, stdout=PIPE)

svninfo = proc.stdout.read()


content = "[" + project_name + "]\n" + "rev : " + sys.argv[2]+ "\n" + difflist +"\n" + svninfo


msg = MIMEMultipart()

msg['From'] = smtp_username

msg['To'] = ", ".join(toaddrs)

msg['Subject'] = subject

msg.attach(MIMEText(content,_charset='utf-8'))


print msg.as_string()


server = smtplib.SMTP_SSL(smtp_hostname)

server.login(smtp_username,smtp_password)

server.sendmail(smtp_username, toaddrs, msg.as_string())

server.quit()



[링크 : http://stackoverflow.com/questions/10147455/how-to-send-an-email-with-gmail-as-provider-using-python]

[링크 : http://stackoverflow.com/.../python-subject-not-shown-when-sending-email-using-smtplib-module]

[링크 : http://blog.saltfactory.net/python/send-mail-via-smtp-and-python.html]


[링크 : http://ngee.tistory.com/159]

[링크 : http://www.janosgyerik.com/setup-and-test-svn-post-commit-hook-to-send-commit-log/]


[링크 : http://stackoverflow.com/questions/3925096/how-to-get-only-the-last-part-of-a-path-in-python]

[링크 : http://stackoverflow.com/questions/8729071/is-there-any-way-to-add-multiple-receivers-in-python-smtplib]


[링크 : https://docs.python.org/2/library/email-examples.html]


[링크 : http://stackoverflow.com/questions/4537259/python-how-to-pipe-the-output-using-popen]


msg.attach(MIMEText(content,'plain',_charset="utf-8"))

[링크 : http://stackoverflow.com/questions/882712/sending-html-email-using-python]

[링크 : http://blog.saltfactory.net/python/send-mail-via-smtp-and-python.html]

'프로그램 사용 > Version Control' 카테고리의 다른 글

svn list 예제  (0) 2017.02.03
svn hook encv  (0) 2016.12.30
svn diff 결과물 컬러로 보기  (0) 2016.12.30
svn commit시 email 알림  (0) 2016.12.29
svn console에서 엔터 입력하기  (0) 2016.11.08
Posted by 구차니

리눅스에서 하다 보니 귀찮은게 하나둘씩 보이네 ㅋㅋ


$ sudo apt-get install colordiff

$ vi ~/.subversion/config

[helpers]

diff-cmd = colordiff 


[링크 : https://gist.github.com/westonruter/846524]

'프로그램 사용 > Version Control' 카테고리의 다른 글

svn hook encv  (0) 2016.12.30
svn commit email - python / synology  (0) 2016.12.30
svn commit시 email 알림  (0) 2016.12.29
svn console에서 엔터 입력하기  (0) 2016.11.08
svn add를 취소하기  (0) 2016.11.04
Posted by 구차니