Archive for the ‘Technique’ Category

Terminal Apache/PHP/MySql

Sunday, August 8th, 2010

Terminal.

Check the version of Apache : https – v

Apache restart : sudo apachectl graceful

Apache stop : sudo apachectl stop

Apache start : sudo apachectl start

PHP

Check the version of PHP : php -v

Check this post when php doesn’t work properly.

MySql

Check  MySql version : mysql –version (usr/local/mysql/bin/mysql)

Export Path : echo ‘export PATH=$PATH:/usr/local/mysql/bin’ >> ~/.bash_profile

Export Path Check : cat .bash_profile

Setup Root Password : sudo mysql_secure_installation

Reminding…Statements, Keywords & Directives

Saturday, March 13th, 2010
명령문
break 루프(forfor..infor each..indo..while 또는 while) 내에 나타나거나 switch 문 내의 특정 case와 연관된 명령문 블록 내에 나타납니다.
case switch 문의 이동 대상을 정의합니다.
continue 가장 안쪽의 루프에 남아 있는 명령문을 모두 건너뛰고 제어가 정상적으로 루프의 끝에 전달된 것처럼 루프의 다음 반복을 시작합니다.
default switch 문에 대한 기본 case를 정의합니다.
do..while 조건을 처음 평가하기 전에 명령문이 한 번 실행된다는 점을 제외하고는 while 루프와 유사합니다.
else if 문의 조건이 false를 반환하는 경우 실행할 명령문을 지정합니다.
for init(초기화) 표현식을 한 번 평가한 다음 루핑 시퀀스를 시작합니다.
for..in 객체의 동적 속성이나 배열 요소를 반복 실행하고 각 속성이나 요소에 대해 statement를 실행합니다.
for each..in 컬렉션의 항목을 반복하고 각 항목에 대해 statement를 실행합니다.
if 조건을 평가하여 다음에 실행할 명령문을 결정합니다.
label 명령문을 break 또는 continue로 참조할 수 있는 식별자와 연결합니다.
return 실행 시에 호출하는 함수에 즉시 반환됩니다.
super 메서드나 생성자의 수퍼 클래스 또는 부모 버전을 호출합니다.
switch 표현식의 값에 따라 여러 명령문 중 하나에 제어가 전달됩니다.
throw catch 코드 블록이 처리할 수 있거나 catch할 수 있는 오류를 생성하거나 throw합니다.
try..catch..finally 오류가 발생할 수 있는 코드 블록을 포함하고 오류에 대응합니다.
while 조건을 평가하고 조건이 true로 평가되면 하나 이상의 명령문을 실행한 후 루프로 돌아가서 조건을 다시 평가합니다.
with 명령문을 실행하는 데 사용할 기본 객체를 만듭니다. 이 객체를 사용하면 작성해야 하는 코드의 양을 줄일 수 있습니다.
특성 키워드
dynamic 클래스의 인스턴스가 런타임에 추가되는 동적 속성을 가질 수 있도록 지정합니다.
final 메서드 재정의 또는 클래스 확장을 수행할 수 없도록 지정합니다.
internal 클래스, 변수, 상수 또는 함수를 동일한 패키지 내의 모든 호출자에서 사용할 수 있도록 지정합니다.
native 함수 또는 메서드가 Flash Player에 의해 기본 코드로 구현되도록 지정합니다.
override 메서드가 상속된 메서드를 대체하도록 지정합니다.
private 변수, 상수, 메서드 또는 네임스페이스를 정의하는 클래스에서만 변수, 상수, 메서드 또는 네임스페이스를 사용할 수 있도록 지정합니다.
protected 변수, 상수, 메서드 또는 네임스페이스를 정의하는 클래스 또는 해당 클래스의 하위 클래스에서만 변수, 상수, 메서드 또는 네임스페이스를 사용할 수 있도록 지정합니다.
public 모든 호출자가 클래스, 변수, 상수 또는 메서드를 사용할 수 있도록 지정합니다.
static 변수, 상수 또는 메서드가 클래스의 인스턴스가 아니라 클래스에 속한 것으로 지정합니다.
정의 키워드
… (rest) parameter 함수가 쉼표로 구분된 인수를 무제한으로 받도록 지정합니다.
class 사용자가 정의한 메서드와 속성을 공유하는 객체를 인스턴스화하는 데 사용할 수 있는 클래스를 정의합니다.
const 값을 한 번만 대입할 수 있는 변수인 상수를 지정합니다.
extends 다른 클래스의 하위 클래스인 클래스를 정의합니다.
function 특정 작업을 수행하기 위해 정의하는 일련의 명령문을 구성합니다.
get 속성처럼 읽을 수 있는 메서드인 getter를 정의합니다.
implements 클래스가 하나 이상의 인터페이스를 구현하도록 지정합니다.
interface 인터페이스를 정의합니다.
namespace 정의의 가시성을 제어할 수 있습니다.
package 다른 스크립트에서 가져올 수 있도록 코드를 여러 그룹으로 분할해서 구성할 수 있습니다.
set 공용 인터페이스에 속성으로 표시되는 메서드인 setter를 정의합니다.
var 변수를 지정합니다.
지시문
default xml namespace default xml namespace 지시문은 XML 객체에 사용할 기본 네임스페이스를 설정합니다.
import 외부적으로 정의된 클래스 및 패키지를 코드에서 사용할 수 있도록 만듭니다.
include 지정된 파일의 내용을 포함합니다. 파일 내의 명령은 호출하는 스크립트의 일부인 것처럼 사용됩니다.
use namespace 지정된 네임스페이스가 열려 있는 네임스페이스 세트에 추가되도록 합니다.
네임스페이스
AS3 프로토타입 속성 대신 고정된 속성인 기본 ActionScript 클래스의 메서드와 속성을 정의합니다.
flash_proxy Proxy 클래스의 메서드를 정의합니다.
object_proxy ObjectProxy 클래스의 메서드를 정의합니다.
기본 표현식 키워드
false false를 나타내는 부울 값입니다.
null 데이터가 제공되지 않은 경우 변수에 지정하거나 함수에서 반환할 수 있는 특수한 값입니다.
this 메서드의 포함 객체에 대한 참조입니다.
true true를 나타내는 부울 값입니다.

출처 : Adobe ActionScript 3.0 언어 및 구성 요소 참조 설명서.

Email check function

Friday, March 12th, 2010

note : Checking valid email address.

private function isItEmail(email:String):Boolean {
	var emailExp:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i;
	return emailExp.test(email);
}

Add GetBundle to TextMate and using WordPress Bundles

Tuesday, March 2nd, 2010

Related Link :

Additional Report :

If you don’t have TextMate folder, Just make under Library/Application Support/TextMate/Bundles
ex : mkdir -p /Library/Application\ Support/TextMate/Bundles

How to Move Local WordPress blog to Actual Server.

Sunday, February 28th, 2010

The tricky part when moving WordPress blog data from my local server to actual server is using absolute path in URL link location when stores some parameters in database. The URLs of local WordPress are usually started with http://localhost. All these values in the database will need to be changed when WordPress is moved.

To update WordPress with the new blog location after backup and restore your old database, have to use SQL command.

UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://localhost:8888','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost:8888', 'http://newdomain.com');

Additional Notice : To move just data without user information, backup all tables from your database except wp_usermeta, wp_users.

Using Google Maps API for Flash

Friday, February 26th, 2010

Requirement

1. Google Maps API for Flash : API reference
2. Flex or Flash

Basic : Latitudes and Longitudes (위도와 경도)

var position:LatLng = new LatLng(LatitudeNum, myLongitudeNum);

Understanding 3D camera

test file
related value type : com.google.maps.geom.Attitude
constructor : Attitude(yaw:Number, pitch:Number, roll:Number)

original resource : code.google
original resource : code.google

Useful Function of Map Class

getLatLngBounds(): LatLngBounds

Returns the the visible rectangular region of the map view in geographical coordinates.
This is a proper function to use query sentences in php for searching database.

Error note
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.google.maps::MapType$/get DEFAULT_MAP_TYPES()

>> I think if I want to access MapType, I should trigger MapEvent before use.

Class Notice : MapOption

MapOptions specifies a set of parameters for initialization of the map. Please note that there is a very specific time when you should use MapOptions and that is whilst handling a MapEvent.MAP_PREINITIALIZE event.

HTML5 Tags Reference

Thursday, February 18th, 2010

Ordered Alphabetically

New : New tags in HTML 5.

Tag Description
<!–…–> Defines a comment
<!DOCTYPE> Defines the document type
<a> Defines a hyperlink
<abbr> Defines an abbreviation
<acronym> Not supported in HTML 5.
<address> Defines an address element
<applet> Not supported in HTML 5.
<area> Defines an area inside an image map
<article>New Defines an article
<aside>New Defines content aside from the page content
<audio>New Defines sound content
<b> Defines bold text
<base> Defines a base URL for all the links in a page
<basefont> Not supported in HTML 5.
<bdo> Defines the direction of text display
<big> Not supported in HTML 5.
<blockquote> Defines a long quotation
<body> Defines the body element
<br> Inserts a single line break
<button> Defines a push button
<canvas>New Defines graphics
<caption> Defines a table caption
<center> Not supported in HTML 5.
<cite> Defines a citation
<code> Defines computer code text
<col> Defines attributes for table columns
<colgroup> Defines groups of table columns
<command>New Defines a command button
<datalist>New Defines a dropdown list
<dd> Defines a definition description
<del> Defines deleted text
<details>New Defines details of an element
<dialog>New Defines a dialog (conversation)
<dfn> Defines a definition term
<dir> Not supported in HTML 5.
<div> Defines a section in a document
<dl> Defines a definition list
<dt> Defines a definition term
<em> Defines emphasized text
<embed>New Defines external interactive content or plugin
<fieldset> Defines a fieldset
<figure>New Defines a group of media content, and their caption
<font> Not supported in HTML 5.
<footer>New Defines a footer for a section or page
<form> Defines a form
<frame> Not supported in HTML 5.
<frameset> Not supported in HTML 5.
<h1> to <h6> Defines header 1 to header 6
<head> Defines information about the document
<header>New Defines a header for a section or page
<hgroup>New Defines information about a section in a document
<hr> Defines a horizontal rule
<html> Defines an html document
<i> Defines italic text
<iframe> Defines an inline sub window (frame)
<img> Defines an image
<input> Defines an input field
<ins> Defines inserted text
<keygen>New Defines a generated key in a form
<kbd> Defines keyboard text
<label> Defines a label for a form control
<legend> Defines a title in a fieldset
<li> Defines a list item
<link> Defines a resource reference
<map> Defines an image map
<mark>New Defines marked text
<menu> Defines a menu list
<meta> Defines meta information
<meter>New Defines measurement within a predefined range
<nav>New Defines navigation links
<noframes> Not supported in HTML 5.
<noscript> Defines a noscript section
<object> Defines an embedded object
<ol> Defines an ordered list
<optgroup> Defines an option group
<option> Defines an option in a drop-down list
<output>New Defines some types of output
<p> Defines a paragraph
<param> Defines a parameter for an object
<pre> Defines preformatted text
<progress>New Defines progress of a task of any kind
<q> Defines a short quotation
<rp>New Used in ruby annotations to define what to show browsers that to not support the ruby element.
<rt>New Defines explanation to ruby annotations.
<ruby>New Defines ruby annotations.
<s> Not supported in HTML 5.
<samp> Defines sample computer code
<script> Defines a script
<section>New Defines a section
<select> Defines a selectable list
<small> Defines small text
<source>New Defines media resources
<span> Defines a section in a document
<strike> Not supported in HTML 5.
<strong> Defines strong text
<style> Defines a style definition
<sub> Defines subscripted text
<sup> Defines superscripted text
<table> Defines a table
<tbody> Defines a table body
<td> Defines a table cell
<textarea> Defines a text area
<tfoot> Defines a table footer
<th> Defines a table header
<thead> Defines a table header
<time>New Defines a date/time
<title> Defines the document title
<tr> Defines a table row
<tt> Not supported in HTML 5.
<u> Not supported in HTML 5.
<ul> Defines an unordered list
<var> Defines a variable
<video>New Defines a video
<xmp> Not supported in HTML 5.

Original Soruce

Zend Debugger using MAMP Pro

Thursday, February 18th, 2010

1. Open MAMP Pro and go to File > Edit Template > PHP5 php.ini
2. add below : Make sure path is correct

[xdebug]
zend_extension=”/Application/Zend/Zend Studio for Eclipse – 6.1.1/
plugins/org.zend.php.debug.debugger.macosx_5.2.15.v20080907/
resources/php5/ZendDebugger.so”

3. Open Zend Studio and go to Preferences > PHP > PHP Executables

4. Add Executable path ex : /Applications/MAMP/bin/php5/bin/php

Original Document

Managing each layout using a contents on post

Thursday, February 18th, 2010

How can I manage the whole homepage layout using contents on post or page of wordpress? I don’t want to be showed my contents as a same theme everyday.

어떻게 하면 Post나 Page의 내용이 홈페이지 스킨 전반에 영향을 주게 할 수 있을까?

WordPress Theme Design.

Tuesday, February 16th, 2010

http://codex.wordpress.org/Theme_Development

WordPress Themes consist of three main types of files, in addition to images. One is the style sheet called style.css, which controls the presentation (look) of the web pages. The second is the optional functions file (functions.php). The other files are the template files which control the way the web page generates the information from the Database to be displayed as a web page. Let’s look at these individually.

Theme Style Sheet

In addition to CSS style information for your theme, the stylesheet, style.css must provide details about the Theme in the form of comments. No two Themes are allowed to have the same details listed in their comment headers, as this will lead to problems in the Theme selection dialog. If you make your own Theme by copying an existing one, make sure you change this information first.

Theme Functions File

A theme can optionally use a functions file, which resides in the theme subdirectory and is named functions.php. This file basically acts like a plugin, and if it is present in the theme you are using, it is automatically loaded during WordPress initialization (both for admin pages and external pages). Suggested uses for this file:

Theme Template Files

Templates are PHP source files used to generate the pages requested by visitors. Let’s look at the various templates that can be defined as part of a Theme.

WordPress allows you to define separate templates for the various aspects of your weblog; however, it is not essential to have all these different template files for your blog to function fully. Templates are chosen and generated based upon the Template Hierarchy, depending upon what templates are available in a particular Theme. As a Theme developer, you can choose the amount of customization you want to implement using templates. For example, as an extreme case, you can use only one template file, called index.php as the template for all pages generated and displayed by the weblog. A more common use is to have different template files generate different results, to allow maximum customization.