이번에 구글 WAVE 초대권 8장이 생겨서 원하신분 8분에게 선착순으로 보내드립니다.
원하시면 비밀댓글로 gmail 주소 알려주시기 바랍니다...
1. 제가 받아본 결과 보내드려도 바로 도착하지는 않더군요..^^ 저같은경우 1일정도 걸린것 같습니다.
2. 8명 선착순으로 보내드리며 완전소진시 글을 남기도록 하겠습니다...
이번에 구글 WAVE 초대권 8장이 생겨서 원하신분 8분에게 선착순으로 보내드립니다.
원하시면 비밀댓글로 gmail 주소 알려주시기 바랍니다...
1. 제가 받아본 결과 보내드려도 바로 도착하지는 않더군요..^^ 저같은경우 1일정도 걸린것 같습니다.
2. 8명 선착순으로 보내드리며 완전소진시 글을 남기도록 하겠습니다...
[내용]
조인을 걸때 인덱스가 안걸려있어 큰일이 났었다.
t1,t2,t3 테이블에 각각1000 개의 데이터가 들어있다고 가정하면
SELECT t1.i1, t2.i2, t3.i3
FROM t1, t2, t3
WHERE t1.i1 = t2.i2 AND t2.i1 = t3.i3;
일경우 1000 * 1000 * 1000 번이 되기 때문에 속도에 문제가 발생되어버렸다..
그래서
1.t2 테이블에 t1 테이블의 데이터와 관련있는곳에 인덱스를 사용한다.
2.t3 테이블에 t2 테이블의 데이터와 관련있는곳에 인덱스를 사용한다.
으로 처리하여 엄청난 효과를 봤다...라는 내용입니다.
[중략]
Suppose that you have three unindexed tables, t1, t2, and t3, each containing a column i1, i2, and i3, respectively, and each consisting of 1,000 rows that contain the numbers 1 through 1000. A query to find all combinations of table rows in which the values are equal looks like this:
SELECT t1.i1, t2.i2, t3.i3 FROM t1, t2, t3 WHERE t1.i1 = t2.i2 AND t2.i1 = t3.i3;
The result of this query should be 1,000 rows, each containing three equal values. If we process the query in the absence of indexes, we have no idea which rows contain which values without scanning them all. Consequently, we must try all combinations to find the ones that match the WHERE clause. The number of possible combinations is 1,000 x 1,000 x 1,000 (one billion!), which is a million times more than the number of matches. That's a lot of wasted effort. The example illustrates that as tables grow, the time to process joins on those tables grows even more if no indexes are used, leading to very poor performance. We can speed things up considerably by indexing the tables, because the indexes allow the query to be processed like this:
Select the first row from table t1 and see what value the row contains.
Using the index on table t2, go directly to the row that matches the value from t1. Similarly, using the index on table t3, go directly to the row that matches the value from t2.
Proceed to the next row of table t1 and repeat the preceding procedure. Do this until all rows in t1 have been examined.
In this case, we still perform a full scan of table t1, but we can do indexed lookups on t2 and t3 to pull out rows from those tables directly. The query runs about a million times faster this way—literally. This example is contrived for the purpose of making a point, of course. Nevertheless, the problems it illustrates are real, and adding indexes to tables that have none often results in dramatic performance gains.
[root@localhost]perl -MCPAN -e shell cpan> install XML::Parser
하였으나 expat.h: No such file or directory 오류가 발생된다면
yum install expat-devel 한다음 설치를 하면
정상적으로 설치가 됨
1] mysql 데이터의 복구 요청이 옴
2] srp -rp ./mysql폴더 계정명@ip주소:. 이용 백업데이터를 가져옴 [frm,MYI,MYD]
3] 소유권을 mysql:mysql 로 수정
4] /mysql 디렉토리에 넣어줌
5] 혹시나 해서 "flush privileges" 실행시킴
6] 쿼리를 날림
select * from tablename where name='notice'; // 홀따옴표일경우 아무런 데이터가 나오지 않음select * from tablename where name="notice"; //쌍따옴표 일경우 정상적으로 데이터가 나옴
7] mysqldump 로 복구시킨 데이터를 다시 덤프함
mysqldump -u root -p db명 > db명.sql
8]덤프뜬 자료를 다시 복구시킴
mysql-u root -p db명 < db명.sql
select * from tablename where name='notice'; // 홀따옴표일경우 정상적으로 데이터가 나옴
select * from tablename where name="notice"; // 쌍따옴표 일경우 정상적으로 데이터가 나옴
이렇게 해서 정상복구를 시켰습니다만...왜 이러는지 아시는분 있나요???
첫번째 방법 [문자형에 * 1 을 한다.]
정렬하고자하는 pos 가 문자형 숫자 일경우
select pos from tablename ORDER BY pos *1 desc;
두번째 방법 [CAST(expression AS type) => 형변환을 해서 정렬을 한다.]
select pos from tablename ORDER BY CAST(pos as signed) desc;
///////// JQUERY 가 지원하는 필터 셀렉터 /////////
##########
//[애니메이션이 적용되고 있는 엘리먼트]
$(":animated");
##########
//[모든 버튼을 선택한다.]
$(":button");
##########
//[모든 체크박스를 선택한다.]
$(":checkbox");
##########
//[선택된 체크박스나 라디오 버튼을 선택한다.]
$(":checked");
##########
//[텍스트 foo를 포함 하는 엘리먼트만을 선택한다.]
$(":contains(foo)");
##########
//[비활성된 모든 폼 엘리먼트를 선택한다.]
$(":disabled");
##########
//[활성된 모든 폼 엘리먼트를 선택한다.]
$(":enabled");
##########
//[모든 파일 엘리먼트를 선택한다.]
$(":file");
##########
//[헤더 엘리먼트를 선택한다. <h1>~<h6>]
$(":header");
##########
//[감춰진 엘리먼트를 선택한다.]
$(":hidden");
##########
//[폼 이미지를 선택한다.]
$(":image");
##########
//[폼 엘리먼트를 선택한다.(input,select,textarea,button)]
$(":input");
##########
//[필터의 값을 반대로 설정한다.]
$(":not(filter)");
##########
//[빈엘리먼트를 제외하고 텍스트도 포함해서 자식 엘리먼틀 가지는 부모 엘리먼트를 선택한다.]
$(":parent");
##########
//[패스워드 엘리먼트를 선택한다.]
$(":password");
##########
//[라디오 엘리먼트를 선택한다.]
$(":radio");
##########
//[리셋버튼을 선택한다.]
$(":reset");
##########
//[선택된 엘리먼트를 선택한다.]
$(":selected");
##########
//[전송버튼을 선택한다.]
$(":submit");
##########
//[텍스트 엘리먼트 선택한다.(input type=text)]
$(":text");
##########
//[보이는 엘리먼트를 선택한다.]
$(":visible");
///////// JQUERY 가 지원하는 위치 기반 셀렉터 /////////
##########
//[모든 짝수번째<p>엘리먼트를 선택한다.]
$("p:even");
##########
//[모든 홀수 번째<p>엘리먼트를 선택한다.]
$("p:odd");
##########
//[(첫|마지막)번째<p>엘리먼트를 선택한다.]
$("p:(first|last)");
##########
//(첫|마지막)번째 자식 엘리먼트. 각 리스트의 (첫|마지막)번째의 아이템을 반환한다.
$("li:(first-child|last-child)")
##########
//형제가 없는 모든 엘리먼트를 반환한다.
$("only-child")
##########
//[모든 테이블에서 첫째행을 선택한다.] => n값은 1부터 시작
$("table tr:n-child(1)");
##########
//[모든 테이블에서 (짝수 | 홀수)행을 선택한다.]
$("table tr:nth-child(even|odd)");
##########
//[n번째로 일치하는 엘리먼트] => n값은 0부터 시작
$("eq(n)");
##########
//[n번째(포함하지 않음) 이후로 일치하는 엘리먼트] => n값은 0부터 시작
$("gt(n)");
##########
//[n번재(포함하지 않음) 이전의 일치하는 엘리먼트] => n값은 0부터 시작
$("lt(n)");
Then, in your button's click event, just call doAction().
모듈 설치 셀로 들어가기.
# 들어가기전 설항목을 물어보는데 거의 디폴트 선택하고 국가만 asian 해주면 됨.
perl -MCPAN -e shell
사용법은 intall 모듈이름 하면 되며,
모듈 검색은 다음과 같이 하면 됨.
i /검색할 모듈이름/ 한다음
install 검색되었던 모듈 하면 설치 완료
UTF-8 환경에서 GET값으로 한글을 넘기실경우
http://도메인/test.php?key=원룸
으로 보내시면 정상적으로 받지를 못합니다. 한글의 경우 urlencode를 하셔서 보내야 정상적으로
값을 받을수 있습니다.
도메인 네임서버 변경후 isp 별 네임서버가 어떻게 변경되었는지 확인이 필요할때가 있습니다.
이때 써먹는것!
<?
$domain = 도메인명;
$ispArray = array(array("KT","168.126.63.1","168.126.63.2"),
array("파워콤","164.124.101.2","203.248.252.2"),
array("SK 브로드 밴드","221.143.20.131"),
);
$cmt = count($ispArray);
for($i=0;$i<$cmt;$i++){
$subCmt = count($ispArray[$i]);
for($k=0;$k<$subCmt;$k++){
if($k == 0) echo("<tr bgcolor=#0099CC><td align=center><font color=#ffffff><strong>{$ispArray[$i][0]}</strong></font></td></tr>");
if($k>0){
exec("nslookup $domain {$ispArray[$i][$k]}", $result2);
echo("<tr><td align=center bgcolor=#ffffff>");
foreach ($result2 as $line2) {
if(preg_match("/^Address/i",strtolower($line2))) {
echo("$line2");
}
}
echo("</td></tr>");
unset($result2);
unset($line2);
}
}
}
?>
///////// JQUERY 가 지원하는 css 셀렉터 /////////
##########
//[<body>의 바로 아래 자식인 <div> 엘리먼트를 선택한다.]
$("body > div");
##########
//[확장자 pdf 파일의 링크를 선택한다.]
$("a[href$=pdf]");
##########
//[http://로 시작하는 링크를 선택한다.]
$("a[href^=http://]");
##########
//[<body>의 바로 아래 자식이면서 링크를 포함하는 <div>엘리먼트를 선택한다.]
$("body > div:has(a)");
##########
//[속성값이 임의의 문자열을 포함하는 엘리먼트를 찾아오라]
$("a[href*=jquery.com]");
##########
//[선택자 id someElement 에 html을 삽입한다.]
$("#someElement").html("엘리먼트에 텍스트를 추가한다.");
##########
//[다수의 엘리먼트와 일치하는 셀렉터에 html 추가한다.]
$("div.fillMeIn").html("노드 그룹에 텍스트를 추가한다.");
##########
//[모든 엘리먼트와 일치한다.]
$("*");
##########
//[E 엘리먼트 형제로 바로 다음에 나오는 엘리먼트 F와일치]
$("E+F");
##########
//[E 엘리먼트 형제로 다음에 나오는 엘리먼트 F와일치]
$("E~F");
jQuery 기본문법
##########
//[notLongForThisWorld <div> 엘리먼트를 서서히 사라지는 효과를 준다.]
$("div.notLongForThisWorld").fadeout();
##########
//[notLongForThisWorld <div> 엘리먼트를 서서히 사라지는 효과를 준후 removed 클래스를 추가한다.]
$("div.notLongForThisWorld").fadeout().addclass("removed");
##########
//[전체 문서가 모두 로드된다음에 테이블의 짝수번째 행들에 even 클래스를 추가한다.]
window.onload = function(){
$("table tr:nth-child(even)").addClass("even");
} //문제점 문서가 모두 로드가 된다음 돌기 때문에 시간차가 발생하며 하나의 함수만을 이용할수 있다.
##########
//[문서구조를 파싱하고 브라우저가 HTML을 DOM트리로 변환할 때까지만 기다린 다음 동작하는법]
$(function(){
$("table tr:nth-child(even)").addClass("even");
});
##########
//[#followMe id 밑에 문단을 삽입하라]
$(function(){
$("<p>안녕</p>").insertAfter("#followMe");
});
##########
[httpd.conf]
LogFormat "%{%Y/%m/%d %H:%M:%S}t\t%h\t%{Referer}i\t%{Host}i%U%q" mylog
CustomLog "|/usr/local/apache/bin/rotatelogs /usr/local/apache/logs/myAccess_log.%m%d-%H 3600 +540" mylog
문자열찾기 방법 1 - 영어만 주로 가능
# grep -rw "abc" ./
문자열찾기 방법 2 - 대/소문자 구분 안하고 검색
# grep -i -l "찾는문자열" * -r 2> /dev/null
문자열찾기 방법 3 - 한글, 영어 모두 가능
# find . -exec grep -l "찾는문자열" {} \; 2>/dev/null
문자열찾기 방법 4 - 한글,영어, 대소문자 안가리고 검색
# find . -exec grep -i -l " $UPLOAD_FC" {} \; 2>/dev/null
문자열찾은 후 치환
# find . -exec perl -pi -e 's/찾을문자열/바꿀문자열/g' {} \; 2>/dev/null
파일명 찾기
# find / -name 파일명 -type f
파일명 찾기(대소문자 구별없음)
# find / -iname 파일명 -type f
디렉토리 찾기
# find / -name 파일명 -type d
디렉토리 찾기(대소문자 구별없음)
# find / -iname 파일명 -type d
home 디렉토리의 하위디렉토리 포함하여 검색
#grep -e "문자열" ./home -R
HTML
<form action="/select_demo.php"> <label for="ctlJob">Job Function:</label> <select name="id" id="ctlJob"> <option value="1">Managers</option> <option value="2">Team Leaders</option> <option value="3">Developers</option> </select> <noscript> <input type="submit" name="action" value="Load Individuals" /> </noscript> <label for="ctlPerson">Individual:</label> <select name="person_id" id="ctlPerson"> <option value="1">Mark P</option> <option value="2">Andy Y</option> <option value="3">Richard B</option> </select> <input type="submit" name="action" value="Book" /> </form>
/////////////////////////////////
Server-side
<?php
if ($_GET['id'] == 1) {
echo <<<HERE_DOC
[ {optionValue: 0, optionDisplay: 'Mark'}, {optionValue:1, optionDisplay: 'Andy'}, {optionValue:2, optionDisplay: 'Richard'}]
HERE_DOC;
} else if ($_GET['id'] == 2) {
echo <<<HERE_DOC
[{optionValue:10, optionDisplay: 'Remy'}, {optionValue:11, optionDisplay: 'Arif'}, {optionValue:12, optionDisplay: 'JC'}]
HERE_DOC;
} else if ($_GET['id'] == 3) {
echo <<<HERE_DOC
[{optionValue:20, optionDisplay: 'Aidan'}, {optionValue:21, optionDisplay:'Russell'}]
HERE_DOC;
}?>///////////////////////////////////
jQuery & AJAX Request
script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
$("select#ctlJob").change(function(){
$.getJSON("/select.php",{id: $(this).val(), ajax: 'true'}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#ctlPerson").html(options);
})
})
})
</script>출처:http://www.jagadishwor.com.np/2009/08/auto-populating-select-boxes-using-jquery-ajax/
iconv( "UTF-8", "CP949", "한글") => 폼에서 넘겨받은 GET값을 이용 DB 에서 select 하고자 할때
$result = iconv( "CP949", "UTF-8", "한글" ) => 찾은값을 JSON 형태로 하여 다시 넘길려고 할때
넘길때 편한 방법은 다음과 같다.
echo <<<HERE_DOC
[ $result]
HERE_DOC;