'아이폰/개발'에 해당되는 글 13건

  1. 2009/03/12 Trac-ko 0.10.4 에서 Gantt Chart Plugin 한글화 (2)
  2. 2009/02/20 SVN Ignore pattern
  3. 2008/10/24 INAMES 웹호스팅에서 TextCube 파일 업로드 문제
  4. 2008/10/23 vim 시작 시 임의(random) 컬러 스킴(color scheme)으로 설정하기
  5. 2008/08/28 FreeBSD Apache 2.0/2.2 extra/ 설정 파일들 vim Syntax hightlight 사용하기
  6. 2008/08/28 vim 에서 인코딩 자동으로 설정하기
  7. 2008/08/22 PHP 한글 메뉴얼 페이지
  8. 2008/05/06 PHP에서의 BIG5 문자열 처리
  9. 2008/03/11 CString to Hex
  10. 2008/03/06 Keep your Window Always On Top

Trac-ko 0.10.4 에서 Gantt Chart Plugin 한글화

개발/SVN & Trac 2009/03/12 10:45
강순권님의 블로그 글을 보고 저도 한글 Trac 0.10.4에서 Gantt 한글화를 해봤습니다.
OS는 우분투(Ubuntu) 리눅스입니다

1. Download - 0.10 버전으로 다운로드를 했습니다.
# cd /usr/local/src
# svn co http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/ganttcalendarplugin/branches/0.10/
# mv 0.10 ganttcalendarplugin
2. 한글화 작업
총 4개의 파일을 수정해야합니다. 아래와 같습니다
ganttcalendar/ticketcalendar.py
ganttcalendar/ticketgantt.py
ganttcalendar/templates/calendar.cs
ganttcalendar/templates/gantt.cs
UTF-8 인코딩으로 파일을 열어서 보면 일본어로 되어있는 부분들이 있습니다. 이걸 적당히 수정해 주면 됩니다. ex. 日 → 월, イルストーン → Milstone
글에 다 쓰긴 그렇고 첨부파일로 업로드~





3. 설치
easy_install을 이용하여 간단히 설치했습니다.
# cd /usr/local/src/ganttcalendarplugin
# easy install .
4. 설정
trac.ini을 아래 처럼 수정해줍니다. 강순권님 글에서 datefieldplugin 설정 부분을 제거했습니다. 사실 저는 datefieldplugin도 사용해서 이 글의 내용처럼 설정을 했지요
[components]
ganttcalendar.ticketcalendar.* = enabled
ganttcalendar.ticketgantt.* = enabled

[ticket-custom]
complete = select
complete.label = % Complete
complete.options = 0|5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100
complete.order = 3
due_assign = text
due_assign.label = Start (YYYY/MM/DD)
due_assign.order = 1
due_close = text
due_close.label = End (YYYY/MM/DD)
due_close.order = 2
그리고 서비스 (apache 또는 trac)를 재시작해 줍니다. 안그러면 적용이 안되기도 하더군요

아래는 설치 스샷~ (윗부분은 짜름 ^^; )

사용자 삽입 이미지
사용자 삽입 이미지




크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comments 2

SVN Ignore pattern

개발/SVN & Trac 2009/02/20 10:41
개인적으로 vim, eclipse 로 요즘 웹 개발을 하고 있습니다.
SVN을 사용하면서 일반적으로 아래의 제외/무시 패턴을 사용하면 불필요한 파일은 Commit하지 않게 됩니다.
~* *~ * *.bak .* *.class Thumbs.db *.tmp *.~* _*.*

Visual Studio 개발시에는 아래 항목도 추가..
*/debug *\debug */Debug *\Debug */Release *\Release */release *\release *.obj *.pdb *.pch *.ncb *.suo  *.~ml *.o *.exec


크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

INAMES 웹호스팅에서 TextCube 파일 업로드 문제

개발/PHP 2008/10/24 14:37
이번에 회사에서 블로그를 운영한다고 아이네임즈에서 웹 호스팅을 받고, TextCube를 설치하였답니다. 그런데, 글쓰기에서 파일 업로드가 되지 않는거에요. 그래서 디버깅을 해보니까.... 이상하게도 SWF Uploader에서만 403 에러를 뱉는 것이었습니다.. (정확하게는 302 -> http://error.uhost.co.kr/stop/403_Error_Page.html 이동)

그래서 호스팅업체에 문의해서 확인해 보니까 웹 방화벽님께서 막아주시더군요.
아무튼 이렇게 저렇게 테스트 해보니까 SWF Upload가 될 경우에는 방화벽에서 막히고, FF나 IE 등에서 업로드 될 경우엔 막히지 않더군요.

그래서 일단 해결책으로 config.php 에서 $service['flashuploader'] = false; 를 설정하여 해결을 했습니다.

웹방화벽에서 막은 이유는 "... request body: Multipart: final boundary missing ..."이라는데 SWF에서 업로드 될 경우엔 마지막 부스래기가 빠진건지.. 나원참... -_-;

크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

vim 시작 시 임의(random) 컬러 스킴(color scheme)으로 설정하기

개발/vim 2008/10/23 16:36
gvim을 사용하다가 몇가지 맘에는 컬러 스키마중에서 고민이 되더라구요.
그러다가 random colors vim 으로 검색을 했더니 짠 하고 나오는게 있더군요.

아래 코드를 vimrc 에 등록하고 gvim 을 다시 켜보면! 랜덤하게 색상이 변경되는 것을 볼 수 있습니다.

" Create the comma-separated list of colorscheme files
let s:colors = substitute(globpath(&runtimepath, 'colors/*.vim'), '\n', ',', 'g')
if strlen(s:colors)
  " Count the number of color schemes
  let s:num = strlen(substitute(s:colors, '[^,]\+', '', 'g')) + 1
  if s:num > 1
    let s:loop = localtime() % s:num
    " Rotate the list s:loop times
    while s:loop
      let s:colors = substitute(s:colors, '^\([^,]\+\),\(.*\)$', '\2,\1', '')
      let s:loop = s:loop - 1
    endwhile
  endif
  let s:color = matchstr(s:colors, '^[^,]\+')
  unlet! g:colors_name
  execute 'source' s:color
  " Prevent the message from disappearing
  redraw
  " 스킨이름을 보고 싶으면 아래 주석을 푸세요~
  "echomsg 'Color applied: '.(exists('g:colors_name') ? g:colors_name : '').' ('.s:color.')'
endif
unlet! s:colors s:color s:num s:loop
[edit] - [startup settings] 에 등록하시고 :wq! 하고 실행하면 짠~ 하고 계속 바뀝니다 ^^

출처 : http://vim.wikia.com/wiki/Set_a_random_color_scheme_at_startup

크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

FreeBSD Apache 2.0/2.2 extra/ 설정 파일들 vim Syntax hightlight 사용하기

개발/vim 2008/08/28 11:27
FreeBSD에서 apache 2.2를 설치하고 httpd.conf 가 아닌... extra/httpd-vhost.conf 등을 vim 으로 열게 되면 Syntax highlight가 되지 않습니다.

이것은 filetype.vim 에 등록된 내용하고 맞지 않기 때문인데요.
아래 처럼 수정해주시면 문법 강조가 잘 될 것입니다.

/usr/local/share/vim/vim72/filetype.vim 을 열어서 114 줄로 이동 또는 httpd.conf 로 검색하여 해당 부분을 찾아서 아래 내용 처럼 수정합니다. ※ vim72는 설치된 vim의 버전에 따라서 다릅니다. /usr/local/share/vim 으로 가서 확인해보세요~
일반적인 설정
au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/ap     ache2/*.conf* call s:StarSetf('apache')
#1 apache22 디렉토리를 몽땅 설정
au BufNewFile,BufRead httpd.conf*,/usr/local/etc/apache22/*.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/ap     ache2/*.conf* call s:StarSetf('apache')
#2 httpd-*.conf 를 인식하도록 설정
au BufNewFile,BufRead httpd.conf*,httpd-*.conf,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/ap     ache2/*.conf* call s:StarSetf('apache')
그리고 :wq! 후에 vim /usr/local/etc/apache22/extra/httpd-vhost.conf 등을 열어봅시다~



크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

vim 에서 인코딩 자동으로 설정하기

개발/vim 2008/08/28 10:29
.vimrc 파일에 아래 내용을 추가 해 놓으면 문서을 열때 자동으로 cp949, utf8 등을 선택해서 보여줍니다.
gvim이라면 편집→StartupSettings 에 추가하세요~

" vim 에서 UTF-8, euc-kr 한글문서 그냥 열기.
" {{{ Locale settings
" Try to come up with some nice sane GUI fonts. Also try to set a sensible
" value for fileencodings based upon locale. These can all be overridden in
" the user vimrc file.
if v:lang =~? "^ko"
set fileencodings=euc-kr
set fileencoding=euc-kr
set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
elseif v:lang =~? "^ja_JP"
set fileencodings=euc-jp
set fileencoding=euc-jp
set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
elseif v:lang =~? "^zh_TW"
set fileencodings=big5
set fileencoding=big5
set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
elseif v:lang =~? "^zh_CN"
set fileencodings=gb2312
set fileencoding=gb2312
set guifontset=*-r-*
endif

" If we have a BOM, always honour that rather than trying to guess.
if &fileencodings !~? "ucs-bom"
set fileencodings^=ucs-bom
set fileencoding=ucs-bom
else
set fileencodings+=ucs-bom
endif

" Always check for UTF-8 when trying to determine encodings.
if &fileencodings !~? "utf-8"
set fileencodings^=utf-8
set fileencoding=utf-8
else
set fileencodings+=utf-8
endif
" }}}

크리에이티브 커먼즈 라이선스
Creative Commons License
tags : cp949, UTF8, VIM, 인코딩
Trackback 0 : Comment 0

PHP 한글 메뉴얼 페이지

개발/PHP 2008/08/22 17:40
전 주로 php 개발을 하면서 온라인 레퍼런스를 자주보는 편인데..
어느날 Korean이 사라졌더라구요.. 그런데 오늘 알았습니다.;
삭제된건 아니고 메뉴에서 안보이고... 언어 옵션에서 Others에 보면 한국어가 있더군요..[망할]

자! 아래 링크로 가시면 한글 메뉴얼이 나옵니다. "쨔잔!"

http://docs.php.net/manual/kr/
크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

PHP에서의 BIG5 문자열 처리

개발/PHP 2008/05/06 19:44
대만에서쓰는 중국어 번체자를 처리하기 위해서 작업을 하는 중에

php의 strtoupper() 함수에서 오작동을 하는 것을 발견하였습니다.

그래서 구글링을 해서 아래와 같은 소스로 처리할 수 있었습니다.

mbstring api을 쓴다면 아마 필요 없을 것입니다. :-)


<?php
/*
  php에서의 big5 문자열 함수 모음

  파일: big5_func.php
  출처: Pigo Chu<pigo@ms5.url.com.tw>
  수정: J. Seo <dino412@gmail.com>
 

  string big5_addslashes(string str) : addslashes 함수와 같음.
  string big5_stripslashes(string str) : stripslashes 함수와 같음.
  int big5_strlen(string str) : 문자열의 길이를 반환
  string big5_substr(string str,int start , int length) : 문자열 일부를 반환
  string big5_strtolower(string str) : BIG5 문자를 제외한 소문자 전환
  string big5_strtoupper(string str) : BIG5 문자를 제외환 대문자 전환
 
*/

define("BIG5_FILE_DIR" , DIR_FS_CATALOG . DIR_WS_INCLUDES . "tchinese");

define("BIG5_HB_MIN" , 0x81);
define("BIG5_HB_MAX" , 0xfe);
define("BIG5_LB1_MIN" , 0x40);
define("BIG5_LB1_MAX" , 0x7e);
define("BIG5_LB2_MIN" , 0xa1);
define("BIG5_LB2_MAX" , 0xfe);

function big5_isHB($c) {
  $asc = Ord($c);
  if($asc>=BIG5_HB_MIN && $asc<=BIG5_HB_MAX) return true;
  return false;
}

function big5_isLB($c) {
  $asc = Ord($c);
  if(($asc>=BIG5_LB1_MIN && $asc<=BIG5_LB1_MAX)  || ($asc>=BIG5_LB2_MIN && $asc<=BIG5_LB2_MAX))
      return true;
  return false;
}

function big5_global_func($str,$func)
{
   $return_str = "";
   for($i=0; $i
   {
       $isHB = 0;              // BIG5 시작바이트
       $isLB = 0;              // BIG5 끝바이트
       $s1 = substr($str,$i,1);
       if(!$isHB && big5_isHB($s1)) // 시작바이트인지 검사
       {
           $isHB = 1;
           $s2 = substr($str,$i+1,1);
           if( big5_isLB($s2) )  // 끝바이트도 맞는지 검사
             $isLB = 1; 
       }
       if($isLB && $isHB) {
           $return_str.= $s1.$s2;
           $i++;
       }
       else
       {
           switch($func)
           {
               case "addslashes":
                   $return_str.= addslashes($s1);
                   break;
               case "stripslashes":
             
                   if($s1 == "\\")
                   {
                       $s2 = substr($str,$i+1,1);
                       if($s2  == "\\")
                           $return_str .= "\\";
                       else
                           $return_str .=$s2 ;
                       $i++;

                   }
                   else $return_str .=$s1;
                   break;
             
               case "strtolower":
                   $return_str.= strtolower($s1);
                   break;
               case "strtoupper":
                   $return_str.= strtoupper($s1);         
                   break;
           }
       }
   }
 

   return $return_str;
}

function big5_addslashes($str) {
   return big5_global_func($str,"addslashes");
}
function big5_stripslashes($str) {
   return big5_global_func($str,"stripslashes");
}
function big5_strtolower($str) {
   return big5_global_func($str,"strtolower");
}
function big5_strtoupper($str) {
   return big5_global_func($str,"strtoupper");
}
function big5_str_replace($search , $replace, $subject)
{
   for($i=0; $i
   {
       $isHB = 0;              // BIG5 시작바이트
       $isLB = 0;              // BIG5 끝바이트
       $s1 = substr($subject,$i,1);
       if(!$isHB && big5_isHB($s1))
       {
           $isHB = 1;
           $s2 = substr($subject,$i+1,1);
           if( big5_isLB($s2) )
             $isLB = 1; 
       }
       if($isLB && $isHB)
       {
           $first_str = $s1.$s2;
           if($first_str == substr($search,0,2))
           {
               if( substr($subject,$i,strlen($search)) == $search )
               {

                   $return_str .= $replace;
                   $i+=strlen($search)-1;
               }
               else
               {
                   $return_str .= $first_str;
                   $i++;
               }
           }
           else
           {
               $return_str .= $first_str;
               $i++;
           }
       }
       else
       {
           $first_str = $s1;
           if($first_str == substr($search,0,1))
           {
               if( substr($subject,$i,strlen($search)) == $search )
               {

                   $return_str .=  $replace;
                   $i+=strlen($search)-1;
               }
               else $return_str .= $first_str;
           }
           else $return_str .= $first_str;
       }
   }
   return $return_str;
}


function big5_strlen($str)
{
   $return_len = 0;
   for($i=0; $i
   {
       $isHB = 0;
       $isLB = 0;
       $s1 = $str[$i];
       if(!$isHB && big5_isHB($s1))
       {
           $isHB = 1;
           $s2 = $str[($i+1)];
           if( big5_isLB($s2) )
             $isLB = 1; 
       }
       if($isLB && $isHB) $i++;
       $return_len++;
   }
   return $return_len;
}

function big5_substr($str,$start,$len=0)
{
   $offset = 0;
   if(!$len) $len = strlen($str);
   $str_len =  strlen($str);
   $start = $start-1;
   for($i=0; $i< $str_len; $i++)
   {
     if($offset>$start)
     {
       if(big5_isHB($str[$i]) && big5_isLB($str[($i+1)]))
       {
               $return_str .= $str[$i].$str[$i+1];
               $i++;
       }
       else $return_str .= $str[$i];
       if($offset-$start >= $len) break;
     }
     else if(big5_isHB($str[$i]) && big5_isLB($str[($i+1)]))
         $i++;
     $offset ++;
   }
   return $return_str;
}

 

function big5_strpos($haystack ,$needle ,$offset=0)
{
    $needle_len = big5_strlen($needle);
    $len =big5_strlen($haystack);
    for($i=$offset ; $i<$len ; $i++)
    {
        if(big5_substr($haystack,$offset+$i,$needle_len) == $needle)
            return $i;
    }
    return false;
}

function big5_chunk_split($str, $chunklen=76 , $end="\r\n")
{
   for($i=0 ; $i      return big5_substr($str,$i,$chunklen) .$end;
}


function big5_stroke($str)
{
    $tab=@File(BIG5_FILE_DIR  ."/big5_stroke.tab");
    if(!$tab)
    {
            echo "Can't Open file big5_stroke.tab, plz check define BIG5_FILE_DIR is valid";
            exit;
    }
    /* $StrokeMapping */
    $i=0;
    while(list($key,$val)=Each($tab))
    {
        $StrokeMapping[$i] = split(" ",$val);
        $StrokeMapping[$i][1] = HexDec($StrokeMapping[$i][1]);
        $StrokeMapping[$i][2] = HexDec($StrokeMapping[$i][2]);
        $i++;
    }

    $s1 = substr($str,0,1);
    $s2 = substr($str,1,1);
    $s  = Hexdec(Bin2hex($s1.$s2));
  
    if( big5_isHB($s1) && big5_isLB($s2) )
    {
        for($i=0;$i
             if($StrokeMapping[$i][1] <= $s && $StrokeMapping[$i][2] >= $s)
                 return $StrokeMapping[$i][0];
    }
    else
        return false;
}

function big5_unicode($str)
{
    $tab=@File(BIG5_FILE_DIR  ."/big5_uni.tab");
  
    if(!$tab)
    {
            echo "Can't Open file big5_uni.tab, plz check define BIG5_FILE_DIR is valid";
            exit;
    }
    /* $UNICODE */
    while(list($key,$val)=Each($tab))
        $UNICODE[substr($val,0,4)] = substr($val,5,4);
    // unset($tab);
    $str_len =  strlen($str);

    for($i=0; $i< $str_len; $i++)
    {
      if(big5_isHB($str[$i]) && big5_isLB($str[($i+1)]))
      {
          $s = $str[$i].$str[$i+1];
          $i++;
      }
      else $s = $str[$i];

        if(strlen($s) == 1)
           $ret_str .= "&#" . Hexdec(bin2hex($s)) . ";";
        else
           $ret_str .= "&#" . hexdec($UNICODE[bin2hex($s)]) . ";";
    }

    return $ret_str;
}

 

function big5_utf8_encode($str)
{
    // big5 to utf8
    $tab = unserialize(@fread(@fopen(BIG5_FILE_DIR  ."/big5_utf8.tab" , "r"),fileSize(BIG5_FILE_DIR  ."/big5_utf8.tab")));

    if(!is_array($tab))
    {
            echo "Can't Open file big5_utf8.tab, plz check define BIG5_FILE_DIR is valid";
            exit;
    }
   $str_len =  strlen($str);
   for($i=0; $i< $str_len; $i++)
   {
      if(big5_isHB($str[$i]) && big5_isLB($str[($i+1)]))
      {
          $s = $str[$i].$str[$i+1];
          $i++;
      }
      else $s = $str[$i];
      $ret_str.= $tab[bin2hex($s)];
   }
   return $ret_str;
}

function big5_utf8_decode($str)
{
    // utf8 to big5
    $tab = unserialize(@fread(@fopen(BIG5_FILE_DIR  ."/utf8_big5.tab" , "r"),fileSize(BIG5_FILE_DIR  ."/utf8_big5.tab")));

    if(!$tab)
    {
            echo "Can't Open file utf8_big5.tab, plz check define BIG5_FILE_DIR is valid";
            exit;
    }

    $len = strlen($str);
    for($i=0 ; $i<$len ; $i++)
    {
           $check = Ord($str[$i]);
        if( $check >> 7 == 0)
            $ret_str .= chr($check);

        else if ( $check>>5 == 6 ) // AscII > 127
        {
            $ret_str .= $tab[bin2hex($str[$i].$str[$i+1])];
            $i++;
        }
        else if ( $check>> 4 == 0xe)
        {
             $ret_str .= $tab[bin2hex($str[$i].$str[$i+1].$str[$i+2])];
            $i+=2;
        }

    }
   return $ret_str;
}

?>


크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

CString to Hex

개발/C & C++ 2008/03/11 16:22

// CString 문자열의 값을 HEX 값(16진수)로 리턴하는 함수입니다.
// 조금 응용하면 다르게 표현도 가능하겠죠 ㅎㅎ

CString ConvertToHex(CString data)
{
     CString returnvalue;
     for (int x = 0; x < data.GetLength(); x++)
     {
          CString temporary;
          int value = (int)(data[x]);
          returnvalue.format("%02X ", value);
          returnvalue += temporary;
     }
     return returnvalue;
}

크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

Keep your Window Always On Top

개발/C & C++ 2008/03/06 19:14

윈도우를 항상 위에 보여주는 소스입니다.


Introduction

This article show you how to keep a window always on top.
A friend asked me about this question,I searched it on the internet and found
some codes but none of them works well,so I think it is necessary to write a
article about to help the beginners.


To keep a window always on top,you should do as flowing:
1.Create a Dialog based project(Similarly,you can create other projects).
2.Add flowing declare in *Dlg.h between "{{AFX_MSG" and "AFX_MSG}}"

afx_msg int OnCreate(LPCREATESTRUCT lpRes);


3.Add flowing function in *Dlg.cpp:


int *Dlg::OnCreate(LPCREATESTRUCT lpRes)
{
this->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
return CDialog::OnCreate(lpRes);
}


4.Modify Message map codes,add flowing sentence between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP():


ON_WM_CREATE()


After doing above,compile and build you project,you will find that your window will
keep always on top!That's it ,thank you!


출처 : http://www.codeproject.com/KB/cpp/KeepWindowAlwaysOnTop.aspx


크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0