언어 썸네일형 리스트형 Background로 실행직후 stopped가 뜨는 현상 해결하기 php를 background로 띄우려고 $ php some_code.php & 와 같이 실행하고 나면 곧바로 '[1]+ Stopped php some_code.php'처럼 프로세스가 멈춰버린다. 이는 php://stdin에서 입력을 기다리고있기 때문인데, 다음과 같이 실행시켜주면 일단 실행은 된다. $ php some_code.php < /dev/null & 더보기 [Postgres] psql로 모든 database와 table 보기 mysql만 사용하다가 Postgres를 배우려니 이래저래 다른 것들이 많다. psql이라는 command line tool로 postgres DB에 접속한 상태에서, DB의 내용을 보고싶다면 다음과 같이 하면 된다. \list는 전체 데이터베이스 나열, \dt는 전체 table들을 나열한다. 물론, 현재 접속한 psql의 계정에서 볼 수 있는 데이터베이스들의 내용만 보이게 된다. 더보기 mysql에서 한글 설정 Mysql의 character_set_server 가 latin1으로 설정되어있을 때, 이를 utf8로 변경하기 위해서는윈도우의 경우 C:\Program Files\MySQL\MySQL Server 5.1의 my.ini파일을 , 리눅스의 경우 /etc/mysql의 my.cnf 파일을 열어 캐릭터 설정변수를 다음과 같이 추가/수정하면 된다.[client]default-character-set=utf8 [mysql]default-character-set=utf8 [mysqld]default-character-set=utf8 하지만, 특정 버전 이상의 mysql에서는 이렇게 설정하고 mysql을 재시작하면 구동에 실패하는 것을 볼 수 있는데, 이는 default-character-set 이라는 변수가 depr.. 더보기 strpos_array() : 여러 번의 strpos 결과를 행렬로 저장할 때 function strpos_array($haystack, $needles, $offset=0) { $matches = array(); //Avoid the obvious: when haystack or needles are empty, return no matches if(empty($needles) || empty($haystack)) { return $matches; } $haystack = (string)$haystack; //Pre-cast non-string haystacks $haylen = strlen($haystack); //Allow negative (from end of haystack) offsets if($offset 더보기 file_get_contents_utf8() : file_get_contents()로 가져온 내용 UTF-8로 바꾸기 다음 code snippet으로 웹에서 긁어온 내용을 UTF-8로 저장할 수 있다. 더보기 file_get_contents() : Web content를 변수로 가져오기 file_get_contents(PHP 4 >= 4.3.0, PHP 5)file_get_contents — Reads entire file into a stringReport a bug Descriptionstring file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )This function is similar to file(), except that file_get_contents() returns the file in a string, starting at the specified offset up to maxlen.. 더보기 Mac X11로 eclipse 돌리기 1. eclipse tar.gz 파일을 다운받아 압축을 푼다.2. xhost 192.168.?.?(eclipse가 설치된 서버)3. Mac에서 X11을 실행4. ssh -Y -l (id) (server IP)로 붙어야 화면이 제대로 나온다. (-Y 옵션이 중요한듯..) 더보기 Exception in thread 'main' java.lang.NoClassDefFoundError: Foo/class Q: 자바를 컴파일한 후, 실행시키려면 Exception in thread "main" java.lang.NoClassDefFoundError: Foo/java 이런 에러가 납니다. 원인은 무엇입니까? A: 대부분의 경우, 파일명을 잘못 입력했기 때문입니다. 예를 들어, Foo.java 라는 소스를 컴파일하여, Foo.class 라는 파일을 만든 후, Foo.class 를 실행시킬 때는, java Foo 라고 해주어야 합니다. D:\Z>java Foo.java Exception in thread "main" java.lang.NoClassDefFoundError: Foo/java 에러! .java 라는 확장자를 붙였음 (이것은 소스 파일이니 당연히 에러가 남) D:\Z>java Foo.class Exce.. 더보기 [mysql] 비밀번호 관련 1. 초기 mysql root 패스워드 설정하기 mysql 서버에 패스워드 없이 로그인 하게되면 서버에 만들어진 데이터베이스나 테이블 기타 이곳에 저장된 자료가 외부인에게 노출될 수 있다. 따라서 이러한 보안을 목적으로 root 패스워드를 지정하면 mysql 서버를 안전하게 보호할 수 있다. mysql> use mysql; mysql> update user set password=password('123456') where user='root'; Query OK, 2 rows affected (0.03 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> flush privileges; select host, user, password from user; +-----.. 더보기 [mysql + php] login페이지 만들기 [mysql] 초반 tutorial에 관한 내용은 다음을 참고: http://dev.mysql.com/doc/refman/5.5/en/tutorial.html 이런저런 명령어들과 관련된 내용은 다음을 참고: http://www.pantz.org/software/mysql/mysqlcommands.html [php] login 화면 구성 관련된 내용: http://www.phpeasystep.com/phptu/6.html 더보기 이전 1 2 다음