Tuesday, October 30, 2012

regexp regular expression
php 5:
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )

JS:

/\d{4}-\d{2}-\d{2}/.test('2007-01-25');     // true
'2007-01-25'.match(/\d{4}-\d{2}-\d{2}/);    // true

DHTMLX 在使用treegrid的方式宣告出grid表格會造成一些原有的onclick事件失效,例如checkbox在裡面他是用自己的方式寫,事用onclick事件去驅動BOX改變,在onclick事件失效後,checkbox變成只能固定不能更改。
CSS special use

shadow

      -webkit-box-shadow: 2px 2px 3px #222222;
      -moz-box-shadow: 2px 2px 3px #222222;
      box-shadow: 2px 2px 3px #222222;

radius
/* support Safari, Chrome */
-webkit-border-radius: 5px;
/* support firefox */
-moz-border-radius: 5px;
border-radius: 5px;

http://www.cbflabs.com/book/cce/cce.htm

Monday, October 22, 2012


Q1.
1.1me = $('#win_content_copy').find('#categoryname');
alert(me.value).text();

[ans:]its worng. text() alert-method response undefined.

1.2alert(me.text());
[ans:]its working

1.3alert(me.val());
[ans:]when we use input marksigned ,have to

Q2.time control

//sleep(4000);
//setInterval("categoryname_keydown();", 3000);
//event.timeStamp;
//setTimeout("alert ('called from setTimeout()');",4000);
Q3.when you clone a DOM element

window_content_copy = $('#window_content').clone();
window_content_copy.attr('id','win_content_copy');
window_content_copy.appendTo('#body');

is html inside script syntax
onclick='function(this)'  (<---wrong)
onclick='function($(this))'   (<---right)



Thursday, October 18, 2012


PDO使用時要注意
使用prepare
在execute若有LIKE條件時
%必須放到excute參數內
放在原始$sql會出錯

 $sql = "SELECT id,full_xxxx_name
                       FROM xxxx
                       WHERE full_xxxx_name LIKE :xxxx_name;";

        $statement = $connection->prepare($sql);

        $statement->execute(array(':xxxx_name' => $inputname."%"));

取消表單輸入時的自動完成


<form>
    <input type="password" name="Password" autocomplete="off">
</form>


or

<form autocomplete="off">
    <input type="password" name="Password" >
</form>


//JavaScript
//HTML
//function onchange() test

<input type="text" onkeydown="myFunction()">


Tuesday, October 16, 2012


black ground:

  <div id="mask" style="filter: Alpha(opacity=30); -moz-opacity: 0.3; -khtml-opacity: 0.3;
  opacity: 0.3; background-color: #000; width: 100%; height: 100%; z-index: 5px;
  position: absolute; left: 0; top: 0; display: none; overflow: hidden;">
  </div>

jqurey
 $('#blackmask').show("slow") ;


Wednesday, July 18, 2012

GRAFIC libraries

2012/07/19
做一個匯入3D模型之簡易動畫。

GRAFIC is a set of libraries of C and C++ callable routines for programming interactive
graphics applications on workstations and personal computers. Versions of the GRAFIC library are
available for workstations running X Windows™, Apple Macintosh™ PowerPC personal
computers, and Intel compatible personal computers running Microsoft Windows 95, 98 and NT.
Except for minor differences, the same source code will function as expected for these platforms
simply by re-compiling and linking with the appropriate GRAFIC library. The GRAFIC package
was developed to provide basic, cross-platform, multi-language support for programming windowbased
raster graphics applications without the complexities and language dependencies typical of
window graphics systems. The libraries can be accessed at URL www.cadlab.ecn.purdue.edu.
The next sections introduce the basic concepts for GRAFIC programming, followed by
descriptions of the routines. Information specific to programming using the Windows and
Macintosh versions of GRAFIC is provided in the closing sections.

1.
http://hungming.ct.ntust.edu.tw/
GRAFIC 是用來控制視窗,
利用GLUT需要設定步驟,
GLUT現在已經改為freeglut因此以前教學中glut32.lib全部要改為freeglut.lib,一些相關的連結檔案也要注意。

2.
已經可以跑出畫面,現在開始找功能強大以及可以匯入3DS模組的函式庫,
http://code.google.com/p/lib3ds/
可惜lib3DS說明文件太少,本身也未附帶函式之說明文件。

3.
嘗試使用開放源碼之3D引擎ORGE作為匯入3DS及建置場景之工具。
參考此篇網路文章所得ORGE之訊息
http://www.programmer-club.com/showSameTitleN/game/3494.html
以下ORGE首頁
http://www.ogre3d.org/
一篇中文教學網誌
http://chia0418.wordpress.com/2009/03/11/%E8%88%87ogre%E5%85%B1%E8%88%9E%EF%BC%9A%E7%AC%AC%E4%B8%80%E6%AD%A5%EF%BC%8C%E5%AE%89%E8%A3%9D-ogre-161-%E4%BD%BF%E7%94%A8-vc-20052008/

4.
授權分為BSD、MIT、GNU、GPL等等,ORGE是較為寬鬆的MIT license可以用

5.
匯入3DS失敗了,改成匯入OBJ檔案,先將3DS轉檔成OBJ
WINGS3D
匯入方法有以下教學
http://www.programmer-club.com/showsametitlen/opengl/1144.html
http://www.gamelife.idv.tw/viewtopic.php?t=211
http://lawlietmoon.pixnet.net/blog/post/27177462-%E8%AE%80obj%E6%AA%94(opengl,visual-c%2B%2B6.0)
貼出匯入範例程式檔如下

/////////////////////////
// glutTest08.cpp
//
// Created by Gary Ho, ma_hty@hotmail.com, 2005
//


#include <stdio.h>
#include <math.h>

#include "glut.h"

#include "glm.h"

#define G_PI 3.14159265358979323846f

void prepare_lighting();
void display();
void keyboard(unsigned char key, int x, int y);

float theta, phi;

GLuint list_id;

void main()
{
  theta = G_PI/2;
  phi = -G_PI/2;

  glutInitDisplayMode( GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB );
  glutInitWindowSize( 640, 640 );
  glutCreateWindow( "glutTest08" );

  glutDisplayFunc(display);
  glutKeyboardFunc( keyboard );

  {
    GLMmodel *glm_model;
     glm_model= glmReadOBJ( "castle.obj" );
     glmUnitize( glm_model );
     glmScale( glm_model, .1 );
     glmFacetNormals( glm_model );
     glmVertexNormals( glm_model, 90 );

     list_id = glmList( glm_model, GLM_MATERIAL | GLM_SMOOTH );

     glmDelete( glm_model );
  }

  prepare_lighting();

  glutMainLoop();
}

void keyboard(unsigned char key, int x, int y)
{
  switch( key )
  {
    case 'w':
     theta -= .05;
     prepare_lighting();
     glutPostRedisplay();
    break;

    case 's':
     theta += .05;
     prepare_lighting();
     glutPostRedisplay();
    break;

    case 'a':
     phi -= .05;
     prepare_lighting();
     glutPostRedisplay();
    break;

    case 'd':
     phi += .05;
     prepare_lighting();
     glutPostRedisplay();
    break;
  };
}


void display()
{
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluPerspective( 20, 1, 0.1, 10 );

    glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     gluLookAt(
     0,0,1,
     0,0,0,
     0,1,0 );

    glEnable( GL_LIGHTING );
    glEnable( GL_DEPTH_TEST );
 
    glCallList( list_id );

  glutSwapBuffers();
}

void prepare_lighting()
{
  theta = fmodf( theta, 2*G_PI );
  phi = fmodf( phi, 2*G_PI );

  float light_diffuse[4] = {1.0, 1.0, 1.0, 1.0};
  float mat_diffuse[4] = {1.0, 1.0, 1.0, 1.0};
  float light_position[4] = { sinf(theta) * cosf(phi), cosf(theta), -sinf(theta) * sinf(phi), 0 };

  //glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  glEnable( GL_LIGHT0 );
}

6.弳度或弧度




單位弧度定義為圓弧長度等於半徑時的圓心角

7.發現一個很容易查GLUT函式的網站
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318369(v=vs.85).aspx

8.

Saturday, September 24, 2011

管理資訊系統 周宣光譯
資訊科技與管理 Mclean 、Turban 等人合著,政大苑守慈老師審譯
資料庫:
Elmarsi and Navathe,Fundamentals of Database Systems

Sunday, September 18, 2011

[食玩]義大利麵食館-達文郡
好吃推薦,我自己去覺得很棒,異國情調的氣氛,吃個餐點跟朋友休憩聊天非常好。
這家店位於高雄市新興區民權街31號
電話:07226936

原文網址




Tuesday, August 23, 2011

繞送演算法大致有三種分類方法
第一種分類方法:以整體或分散分類
整體性繞送演算法(global routing algorithm)
分散式繞送演算法(decentralized)

第二種分類方法:以靜態或動態分類
靜態繞送演算法(static routing algorithm)
動態繞送算法(dynamic routing algorithm)

第三種分類方法:以負載敏感或非負載敏感分類
負載敏感演算法
非負載敏感演算法