Syntax Highlighter for Xquared test page

2008/10/13 14:04 ,개발

     

    import sys 

    import csv 

    import cStringIO

    import codecs

    import MySQLdb

     

     

    class Database:

        def __init__(self, hostname, user, password, database_name):

            self.hostname = hostname

            self.user     = user

            self.password = password

            self.name     = database_name

     

        def connect(self):

            self.connection = MySQLdb.connect(self.hostname, self.user, self.password, self.name)

            self.cursor = self.connection.cursor(MySQLdb.cursors.DictCursor)

     

        def query(self, query):

            return self.cursor.execute(query)

     

    class Field:

        def __init__(self):

            self.value = ""

     

        def __call__(self, name):

            print name

        def __repr__(self):

            return repr(self.value)

 

 

     

    #include <unistd.h>

    #include <utmp.h>

    #include <stdio.h>

    #include <sys/types.h>

    #include <time.h>

    #include <fcntl.h>

    #include <string.h>

     

    int main(int argc, char **argv) {

        struct utmp *fp;

        struct tm *current_time;

     

        printf("-------------------------------------------------\n");

        printf("Current Login User Listing (by malltb.com juniac)\n");

        printf("-------------------------------------------------\n");

        printf("WHEN\t\t WHO\t\tLogin from\n");

        while((fp = getutent()) != NULL) {

            if(fp->ut_type == USER_PROCESS) {

                current_time = localtime(&fp->ut_time);

                printf("%d-%02d-%02d %02d:%02d %-10s\t%s\n",

                        current_time->tm_year + 1900,

                        current_time->tm_mon + 1,

                        current_time->tm_mday,

                        current_time->tm_hour,

                        current_time->tm_min,

                        fp->ut_user,

                        fp->ut_host);

            }

        }

    }

 

 

     

    FUNCTION=`echo $1 | sed -e 's/_/-/g'`

    w3m -o confirm_qq=false http://kr.php.net/manual/en/function.${FUNCTION}.php

 

 

     

    CREATE TABLE `banners` (

      `id` int(10) unsigned NOT NULL auto_increment,

      `type` enum('TEXT','BOLDTEXT','IMAGE','FLASH','VIDEO') NOT NULL default 'TEXT',

      `title` char(100) NOT NULL,

      `filename` varchar(50) default NULL,

      `filesize` varchar(50) default NULL,

      `location` enum('main','mainL','mainR','topCH','topKEY','channel','video','search') NOT NULL,

      `url` char(200) NOT NULL,

      `description` char(100) NOT NULL,

      `state` enum('SHOW','HIDDEN') NOT NULL default 'HIDDEN',

      `created` datetime NOT NULL default '0000-00-00 00:00:00',

      PRIMARY KEY  (`id`),

      KEY `state` (`state`)

    ) ENGINE=MyISAM AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;

 

     

    $tmp = "/home/storage/tmp/";

    $video_id = 5188801;

    $target_dir = $tmp . $video_id . '/'; 

     

    $source_file = $target_dir . $video_id;

     

    $movie = new ffmpeg_movie($source_file);

    $total_frames = $movie->getFrameCount();

    $per_frame = round($total_frames / 6); 

    $start_frame = $per_frame / 2;

     

    for ($i = $start_frame; $i < $total_frames; $i = $i + $per_frame) {

        $count++;

        if ($count > 6) {

            break;

        }   

        $frame = $movie->getFrame($i);

        $frame->resize(400, 300);

        $GDimage = $frame->toGDImage();

        $filename = $target_dir . sprintf("%04d", $count) . '.png';

        imagepng($GDimage, $filename);

    }

 

 

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

        "http://www.w3.org/TR/html4/strict.dtd">

    <html>

    <head>

        <title>juniac.aqua.kakaka.org</title>

        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <script type="text/javascript" src="http://www.juniac.net/js/prototype.js"></script>

        <script type="text/javascript" src="http://www.juniac.net/js/scriptaculous.js"></script>

        <script type="text/javascript" src="http://www.juniac.net/js/html_object.js"></script>

    <script type="text/javascript">

     

    </script>

    </head>

     

    <body>

 

 

     

        if (token.indexOf('#') > -1) {

          // Token is an ID selector

          var bits = token.split('#');

          var tagName = bits[0];

          var id = bits[1];

          var element = document.getElementById(id);

          if (tagName && element.nodeName.toLowerCase() != tagName) {

            // tag with that ID not found, return false

            return new Array();

          }   

          // Set currentContext to contain just this element

          currentContext = new Array(element);

          continue; // Skip to next token

        }   

 

 

 

 

2008/10/13 14:04 2008/10/13 14:04

Ubuntu 에서 FFMPEG-PHP 설치하기

2008/10/09 21:53 ,개발

일단 gusty 기준으로 설치법

 

(hardy 에는 http://packages.ubuntu.com/source/hardy/ffmpeg-php 패키지가 있는모양이다)

 

 

ffmpeg-php 홈페이지 http://ffmpeg-php.sourceforge.net/

 

API document http://ffmpeg-php.sourceforge.net/doc/api/

 

php는 dev버젼으로 설치되어있어야하고 (php5-dev)

 

ffmpeg은 설치되어있다는 가정하에

 

 

    apt-get install ffmpeg libavformat-dev  libavcodev-dev liblame-dev

등등 필요한 라이브러리를 설치하고

 

    phpize5

    ./configure

    make

    make install

 

 

 

php.ini 끝에

extension=ffmpeg.so

 

    apache2ctl restart

 

 

 

 

    $destination = 'video.avi'; $movie = new ffmpeg_movie($destination); $total_frames = $movie->getFrameCount(); $per_frame = round($total_frames / 6); $start_frame = $per_frame / 2; $count = 0; for ($i = $start_frame; $i < $total_frames; $i = $i + $per_frame) {       if ($count > 5) {         break;     }        $frame = $movie->getFrame($i);     if ($frame) {         $frame->resize(400, 300);         $GDimage = $frame->toGDImage();         $filename = sprintf("%04d", $count) . '.png';         imagepng($GDimage, $filename);             $count++;     }    }

뭐 대충 이렇게 해서 6장의 동영상 썸네일을 뽑아보기.

 

 

 

 

 

 

 

2008/10/09 21:53 2008/10/09 21:53

iPhone App 개발 screencast

2008/09/22 16:04 ,개발

python 같이 Unix shell에서 바로 개발을 할 수 있는 언어들은 상관이 없는데 IDE를 사용해야 되는 언어들은 IDE사용법조차 익숙하지 않아서 새 언어를 시작할때 스크린캐스트를 먼저 챙겨보고 있다. 개인적으로 바퀴 다음으로 나에게 가장 도움이 되는 기술이 스크린캐스트다. 바로 옆에서 짝프로그래밍으로 새 언어를 배우는 느낌.

iPhone SDK같은 경우는 나온지도 얼마 안되서 책조차도 없고 해서 고생좀 하다가 아주 좋은 사이트 발견.

iphone app개발을 위해서 알기쉽고 다양한 스크린캐스트가 준비되어있다.

 

http://www.iphonedevcentral.org

 

 

빼먹어서 추가 http://cocoadevcentral.com/

 

 

2008/09/22 16:04 2008/09/22 16:04

새로시작하기

2008/09/19 10:57 ,개발

 

프로그래머가 항상 코드를 버리고 새로 시작하기를 원하는 미묘한 이유가 있습니다. 이런 이유는 예전 코드가 엉망진창이라는 생각 때문입니다. 그런데 이런 생각은 거의 틀리다는 흥미로운 관찰 결과가 있습니다. 예전 코드가 엉망진창이라는 생각은 다음과 같이 기본적이며 근원적인 프로그래밍 법칙 때문에 생깁니다.
"코드 쓰는 작업보다 읽는 작업이 더 어렵다"

- 조엘 온 소프트웨어에서

2008/09/19 10:57 2008/09/19 10:57

몇가지 링크

2008/09/18 10:18 ,개발

Google Chrome Debugger 관련

http://www.pascarello.com/lessons/browsers/ChromeDebugHelp.html

 

 

Apatana Studio Download 

https://www.aptana.com/studio/download/

 

PHP FEST Korea

http://phpkorea.org

 

 

2008/09/18 10:18 2008/09/18 10:18

Xquared WYSIWYG Editor For Textcube

2008/08/12 18:21 ,개발

 Xquared WYSIWYG Editor For Textcube

사용자 삽입 이미지

 http://www.springnote.com 에서 사용되는 WYSIWYG에디터의 오픈소스 버젼 Xquared 를 Textcube WISYWIG에디터로 사용하게 합니다.

스프링노트 UI에 익숙한 사용자들에게 기존 에디터보다 익숙하게 사용할 수 있어서 빠른 포스팅을 가능하게 합니다.

다양한 단축키를 수정해서도 편하게 쓰실수 있고요.

plugins 디렉토리 안에서 압축 풀면 xquared_wysiwyg 디렉토리 안에 풀립니다.

 

 

첨부파일은 POD cast이외에는 모두 가능하고. Textcube의 WYSIWYG에디터와 다르게 에디터의 View부분을 그대로 TEXTAREA로 옮기기 때문에 첨부파일 삽입시 TTML코드가 삽입될 수 있습니다.

기타 WYSIWYG관련 플러그인이 작동하지 않을 수 있습니다.

피드백은 여기 남겨주시면 됩니다.

 


변경내역

 

  • 2008/08/12 Ver 1.0

    • 특이사항 없음
  • 2008/08/14 Ver 1.10

    • 플러그인 환경설정 추가

      • wysiwyg 에디트 창 CSS선택 가능 (없음, Xquared기본CSS, SKin CSS)
      • skin디렉토리안의 wysiwyg.css 가 없을 경우에 Xquared 기본 CSS로 대체

 

 


 

다운로드 (하단의 zip파일)

xquared_wysiwyg_v1.10.zip


Textcube 1.8에 기본 에디터로 xquared 내장 한다고 하니 업데이트는 접습니다

2008/08/12 18:21 2008/08/12 18:21

VIM 256 color 쓰기

2008/08/09 02:32 ,개발

vimrc 파일에서

 

  1. t_Co=256

 

 

 

    http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html

 

참고해서 컬러설정파일을 수정한다.

 

 

 

 

사용자 삽입 이미지

이런식으로 256 color를 표현할 수 있다.

 

2008/08/09 02:32 2008/08/09 02:32

Python insert_id()

2008/07/29 13:38 ,개발

PHP의 mysql_insert_id() 와 같은 역할을 하는 python의 메쏘드나 프로퍼티

 

 

    import MySQLdb db = Mysql.connect('db.db.com', 'test', 'test', 'test')

    cursor = db.connection.cursor(MySQLdb.cursors.DictCursor)

    cursor.excute("INSERT INTO table SET 'field' = 'value'")

    print db.connection.insert_id()

 


cursor의 메쏘드가 아니라 db의 connection의 메쏘드 임을 유의



2008/07/29 13:38 2008/07/29 13:38

Flash Movieclip Handcursor

2008/07/17 13:47 ,개발

플래시 무비클립에서 손모양 커서를 사용하려 할 때

보통

    mc = new MovieClip();

    mc.buttonMode = true;

 

을 이용하는데

    mc.buttonMode = true;

만으로 손모양커서로 변하지 않는 경우가 있다

무비클립안에 다이나믹텍스트 필드가 있을 경우가 그런데.

예를 들면 이런경우

 

    mc = new MovieClip();

    txt = new TextField();

    txt.text = 'test';

    mc.addChild(txt);

    mc.handcursor = true;

     

해도 손모양으로 변경되지 않는데

이럴때

    mc.mouseChildren = false;

를 추가하면 손모양으로 바뀐다.

 

2008/07/17 13:47 2008/07/17 13:47

Flash Tracer

2008/07/03 17:09 ,개발
Firefox에서 사용가능한 Flash Tracer

ActionScript 에 기술한 trace 함수로 출력해 output 창으로 출력해서 디버깅을 하는것을
웹 브라우져에서도 가능하게 해준다.

http://www.sephiroth.it/firefox/flashtracer/


사용자 삽입 이미지

2008/07/03 17:09 2008/07/03 17:09

IE, FF Safari 등 브라우져 호환 테이블

2008/05/21 10:50 ,개발
이런 좋은 곳이!!
여기를 클릭 후 (http://www.quirksmode.org/sitemap.html)

Compatibility Tables

을 참조




2008/05/21 10:50 2008/05/21 10:50

IE, FF innerHTML 문제

2008/04/24 17:14 ,개발
<div id="recommand_tags">
	<ul> 
		<?php foreach($recommand_tags as $t => $v) : ?>
			<li><?=$v->name?></li>
		<?php endforeach; ?>
	 </ul>
</div>
위와 같은 코드가 추천태그로 들어가는 페이지에서였다
사용자 삽입 이미지
하단의 추천 태그를 클릭시에 태그가 등록되는 UI인데
클릭시마다 빈 공간이 하나씩 들어가는 현상이 발생
IE7에서 클릭 이벤트 발생시에 해당 event.target.innerHTML 을 가져오는 부분에서 항상 뒷부분에 공백이 하나
들어갔다.
<div id="recommand_tags"><ul><?php foreach($recommand_tags as $t => $v) : ?><li><?=$v->name?></li><?php endforeach; ?></ul></div>
이렇게 한줄로 코딩을 해야
사용자 삽입 이미지
제대로 이벤트가 발생
관련문서 : http://developer.mozilla.org/ko/docs/Migrate_apps_from_Internet_Explorer_to_Mozilla
asd
asd
asd
asd
asd
ㅁㄴㅇ
2008/04/24 17:14 2008/04/24 17:14