2011년 1월 17일 월요일

[PHP] short_open_tag 옵션


php소스 처음으로 잠깐만지다 잠깐 헤맴
저처럼 처음이신분들 헤매지 않도록...

php 설치폴더의 php.ini 파일에서
short_open_tag 를 찾는다


short_open_tag = on   →   <? ?> 사용가능
short_open_tag = off   →   <? ?> 사용불가능 / <?php ?>로 사용


수정 후 서버 재시작

ex) short_open_tag = off

<?php $g4_path = "TEST"; ?>
<?php echo $g4_path; ?>


ex) short_open_tag = on

<? $g4_path = "TEST"; ?>
<?=$g4_path?>






2011년 1월 14일 금요일

[Java] 색상 정보 형태 변환

필요한데로 가공해서 쓰면 편리함

/** * 색상 정보 형태 변환 * @param strColorValue(RGB 16진수) ex)ff,ff,ff -> 255,255,255 * @return */ public static String getColorValueType2(String strColorValue) { String[] strColorValues = strColorValue.split(","); String strCovColor = String.format("%02x", Integer.parseInt(strColorValues[0], 10)) + String.format("%02x", Integer.parseInt(strColorValues[1], 10)) + String.format("%02x", Integer.parseInt(strColorValues[2], 10)); return strCovColor; } /** * 색상 정보 형태 변환 * @param strColorValue(RGB 16진수) ex)ffffff -> java.awt.Color * @return */ public static Color getColorType1(String strColorValue) { int r = Integer.parseInt(strColorValue.substring(0,2),16); int g = Integer.parseInt(strColorValue.substring(2,4),16); int b = Integer.parseInt(strColorValue.substring(4,6),16); return new Color(r,g,b); }

2011년 1월 12일 수요일

[Java] 세자리마다 <,> 표시하기

/**
* 세자리마다 <,> 표시
* @param d
* @return
*/
public static String getNumFromatInstance(double d) {
 NumberFormat nf = NumberFormat.getInstance();
 return nf.format(d);
}