반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리


반응형

새로 아파트에 들어왔습니다.
그동안 Holiday Inn 에서 출퇴근하다 10일에 이사를 했어요.

새로 인터넷을 신청했는데 17일에나 설치를 해 준다네요.

인터넷 쓸 일이 있어서 집 근처 스타벅스에 와서 인터넷 사용하고 있습니다.


==========================

My Favorite Corona App - Twitter Contest

by ANSCA Inc on Tuesday, May 8, 2012 at 2:15pm ·


We couldn't get enough of all the Twitter love from last week's contest, and this week we're going to up the ante!


지난주 열화와 같은 참여와 성원에 감사드립니다. 이번주도 금주의 콘테스트로 여러분을 찾아 뵙습니다.

 

Tweet us your FAVORITE Corona-built app for a chance to win a 3-month subscription to (or extension of) a Corona Pro license. We'll select two (2) lucky winners at random. If you need some inspiration for great Corona-made apps, check out our showcase: http://developer.anscamobile.com/showcase/Browse_All


Corona로 만든 앱 중에 여러분이 가장 좋아하는 앱을 저희에게 트윗해 주세요. 당첨되신 분께는 코로나 SDK 3개월 무료 이용 권한을 드립니다. (기존 회원은 3개월 연장 시켜 드릴거구요.) 랜덤하게 두분을 추첨할 겁니다. 코로나로 만든 앱이 어떤 것이 있는지 알고 싶으신 분들은 저의 홈페이지의 showcase를 들러 주세요.

http://developer.anscamobile.com/showcase/Browse_All

 





The rules are simple:


규칙은 간단합니다.

  1. Follow @ansca on Twitter.  트위터에서 @ansca를 팔로우하세요.
  2. Like us on Facebook: www.facebook.com/ansca . Facebook에서도 등록해 주세요.
  3. Tweet us your very favorite Corona-made app . 여러분이 좋아하는 코로나로 만든 앱을 트윗해 주세요.

Last day to enter the contest is Sunday, May 13 at 11:59pm PT.


마감일은 미국 태평양 시간(PT)으로 5월 13일 11:59PM 까지 입니다.


Happy tweeting and good luck!


===============================================


여러분들도 많이 참여하시고 행운도 얻으세요...




반응형

Kurogo Tutorial 09 - MAP Module -

2012. 5. 12. 04:06 | Posted by 솔웅


반응형

Kurogo Documentation 을 순서대로 진행을 했는데요. 오늘은 좀 건너 뛰어서 해야겠습니다.

회사에서 갑자기 MAP 과 관련되서 일이 주어져서요.

아직 제대로 파악도 못했는데... 빨리 공부해서 빨리 해결해야 겠습니다.

맵 말고도 한두가지 더 일을 맡았는데 그 중 하나는 Drupal 로 하는 일이예요.

Drupal 도 배워야겠네요...


Map Module TutorialIncluded Modules 안의 Map Module 부분에 있습니다.


===============================


Map Module

이 맵 모듈은 맵에서 여러분들이 찾고 싶은 곳을 찾고 볼 수 있도록 해 줍니다. 장소들은 feed groups, category, subcategory 등에 의해 group 화 될 수 있습니다.




Basic Configuration

Feed Groups

각 feed group 은 center location과 appearance에 의해 base map, characterized 와 연관 돼 있습니다. 여러개의 캠버스들과 feed group들로 구성된 조직을 캠퍼스가 맵을 지역적으로 분리합니다.

Group은 SITE_DIR/config/map/feedgroups.ini file 안에서 configured 돼 있습니다. 거기에는 아래와 같이 적어도 한개의 entry 가 있어야 합니다.

[groupID]
title                = "Title of my map"
subtitle             = "Subtitle of my map"
center               = "42.3584308,-71.0597732"
DEFAULT_ZOOM_LEVEL   = 10


[groupID] 는 짧게 알파벳으로 그룹의 이름을 지어주면 됩니다. 예) “boston”, “newyork”, “daytime”, etc.
title (required) - 이 그룹에 대한 짧은 설명 e.g. “Boston Campus”
subtitle (optional) - title로 부족할 경우 좀 더 길게 설명을 추가할 수 있음
center (required) - latitude, longitude point (위도, 경도). 이 그룹의 center를 나타냄. 쉼표 전 후로 빈공간이 들어가면 안 됨.
DEFAULT_ZOOM_LEVEL (recommended) - 맵을 표시할 초기 zoom 레벨. 대개 0~21 사이의 값을 넣으면 됨. 각 숫자는 아래의 크기를 보여 줍니다.

0: earth
1: hemisphere (반구)
2: multiple continents
3: one continent
4: large country
5: medium-sized country
6: small country or large state
7: small state
8: tiny state
9: metropolitan area + vicinity
10: metropolitan area
11: large city
12: small city
13: town
14: several neighborhoods
15: a few neighborhood
16: neighborhood
17: several blocks
18: a few blocks
19: several buildings
20: a few buildings
21: a building

compliant/tablet 디바이스에서는 디폴트로 구글 맵을 사용합니다. 그리고 basic/touch 디바이스에서는 Google Static Map을 사용합니다. 쿠로고는 또한 compliant/tablet 디바이스에서 ArcGIS JavaScript를 지원합니다. 그리고 basic 디바이스에서 ArcGIS static map 을 지원합니다. 좀 더 자세한 사항은 Advanced Configuration section을 참조하세요.

Data Feeds

각 data feed는 홈스크린이나 캠퍼스에서 유저가 browse 하는 category로서 표현됩니다.

현재 아무 mapping infrastructure를 가지고 있지 않은 사람들을 위해 우리는 Google Earth를 사용해서 feeds를 생성하라고 권장합니다. Google Earth는 맵에 pin을 사용할 수 있도록 하고 결과값을 KML 파일로 export 할 수 있도록 합니다.

feed group에 feed를 add 하기 위해 SITE_DIR/config/map/feeds-GROUP.ini 파일 안에 entry를 생성합니다. (Group은 feedgroups.ini로부터 가져온 그 그룹의 id 입니다.). 각각의 entry들은 다음과 같이 만들어 집니다.

[index]
TITLE            = "Fun Places in Washington"
SUBTITLE         = "These are places I like to check out on vacation"
BASE_URL         = DATA_DIR"/washington.kml"
SEARCHABLE       = 1

index 는 숫자입니다. (0서부터 시작) 이 인덱스는 이 feed의 sort order(정렬순서)를 나타냅니다.
TITLE 은 카테고리 리스트에 보이는 카테고리의 desctiptive name 입니다.
SUBTITLE (optional) 은 title 옆에 붙는 간략한 description 입니다.
BASE_URL (required) 은 데이터 소스의 URL이나 파일의 위치입니다.
SEARCHABLE - 그냥 1로 세팅하세요.
Note: .kml 포맷이 아니라 .kmz 을 사용한다면 엔트리 안에 다음의 것들을 지정하셔야 합니다.

RETRIEVER_CLASS       = "KMZDataRetriever"

쿠로고는 또한 ArcGIS RES API와 ESRI Shapefile 포맷으로 데이터를 지원합니다. 만약 이 포맷을 사용한다면 혹은 data feeds와 base maps를 다른 것으로 바꾸기를 원한다면 Advanced Configuration section을 참조하세요.

User Interface Options

The following options appear by default in SITE_DIR/config/map/module.ini:
아래 옵션들은 SITE_DIR/config/map/module.ini 에서 디폴트로 설정돼 있는 값들입니다.

BOOKMARKS_ENABLED          = 1
MAP_SHOWS_USER_LOCATION    = 1
SHOW_DISTANCES             = 1
DISTANCE_MEASUREMENT_UNITS = "Imperial"
SHOW_LISTVIEW_BY_DEFAULT   = 0

BOOKMARKS_ENABLED - 유저가 위치를 즐겨찾기 하게할 지 말지를 정함
MAP_SHOWS_USER_LOCATION - 유저가 지도에 location marker를 display 하게 할지 말지를 정함. This does not turn off geolocation in general.
SHOW_DISTANCES - 검색된 위치로부터의 거리를 표시할 지 여부를 정함.
DISTANCE_MEASUREMENT_UNITS - either “Metric” or “Imperial”. Metric 이나 Imperial 중에 하나를 선택하면 됨
SHOW_LISTVIEW_BY_DEFAULT - 만약에 단 하나의 캠퍼스만 있다면 map module의 index page는 compliant devices에서 지도를 full screen으로 보여 줄겁니다. 만약 이 값이 1로 세팅돼 있다면 맵 모듈의 index page 는 list view를 보여줄 겁니다. 또한 멀티 캠퍼스라면 파라미터에 상관없이 index page는 list view를 보여 줄 겁니다.   multip

Advanced Configuration

Feed Groups

title, subtitle, center 이외에 각 그룹은 다음과 같은 것들을 지정해 줍니다.

- JS_MAP_CLASS (optional) - JavaScript map을 지원하는 디바이스를 사용하기 위한 base map의 type . Base Maps를 보세요.
- DYNAMIC_MAP_BASE_URL (required if JS_MAP_CLASS is ArcGISJSMap) - base map JavaScript API 가 host 돼 있는 base URL
- STATIC_MAP_CLASS (optional) - JavaScript map을 지원하지 않는 디바이스를 사용하기 위한 base map의 type . Base Maps를 보세요.
- STATIC_MAP_BASE_URL (required if STATIC_MAP_CLASS is ArcGISStaticMap or WMSStaticMap) - static base map service가 호스트 돼 있는 base URL
- NEARBY_THRESHOLD (optional, defaults to 1000) -인근 위치를 검색할 때 사용하는 meter로 된 거리
- NEARBY_ITEMS (optional, defaults to 0) - 인근 검색할 떄 return 되는 item들의 maximum number.값이 0이면 제한이 없음.

Example configuration:

[honolulu]
title                = "Honolulu Campus"
subtitle             = "Our new satellite office that nobody knows about"
center               = "21.3069444,-157.8583333"
JS_MAP_CLASS         = "ArcGISJSMap"
DYNAMIC_MAP_BASE_URL = "http://myhost/MapServer"
STATIC_MAP_CLASS     = ArcGISStaticMap
STATIC_MAP_BASE_URL  = "http://myhost/MapServer"
NEARBY_THRESHOLD     = 1609
NEARBY_ITEMS         = 12



Data Feeds

TITLE, SUBTITLE, BASE_URL 이외에 각 feed 는 아래와 같은 값들을 정해 줍니다.

- MODEL_CLASS - 데이터 소스 타입과 관련된 데이타 모델 클래스. 디폴트는 MapDataModel 임.
- RETRIEVER_CLASS - feed를 위해 사용되는 data retriever class (디폴트가 아니라면). 디폴트는 MODEL_CLASS에 따라 다름. 만약 custom model class를 사용하지 않는다면 이것은 KMZ 파일에만 필요할 것임 (which need KMZDataRetriever).
- SEARCHABLE - 이 데이타 소스가 internal search result에 포함되어야 하는지의 여부를 나타내는 boolean 값. 이 값은 external search engine을 사용한다면 관계가 없음. 디폴트는 false임.
- HIDDEN (optional) - true이면 이 feed는 browsable category의 리스트에 나타나지 않음. 이 기능은 site가 user가 browse 할 수 있는 search results에 표시될 서로 다른 placemarks의 세트를 갖기를 원할 경우 사용될 수 있을 겁니다. 그 placemark의 set는 user가 browse 할 수 있는 search results에 표시될 겁니다.

개별적인 feed 들에 대한 어떤 config 값들의 세트는 서로 연관된 feed group 에서 그 값을 override 할 수 있습니다. 예를 들어 'honlulu' feed group은 검색할 때 인근 1000미터 반경을 찾아 볼 겁니다. 하지만 밀집한 feed 가 있어서 반경 200미터에서만 검색하기를 원합니다. 이럴 경우 NEARBY_THRESHOLD 를 개별적인 feed로 세팅할 수 있습니다. override 할 수 있는 config 파라미터들은 DEFAULT_ZOOM_LEVEL, JS_MAP_CLASS, DYNAMIC_MAP_BASE_URL, STATIC_MAP_CLASS, STATIC_MAP_BASE_URL, NEARBY_THRESHOLD, NEARBY_ITEMS 가 있습니다.


KML/KMZ

KML은 맵 모듈의 디폴트 feed type 입니다. 다른말로 feed config 가 MODEL_CLASS 나 RETRIEVER_CLASS 로 정해주지 않았다면 코로고는 이 feed를 KML 포맷으로 처리할 겁니다.

쿠로고는 KML tags의 subset 만 지원합니다. 쿠로고는 <MultiGeometry>, <Model>, <gx:Track>, <gx:Multitrack>를 제외한 모든 지원하지 않는 tags를 무시할 겁니다. 이럴 경우 Kurogo는 exception을 throw 합니다. 또한 몇개의 태그들은 parse 되지만 UI에서는 보이지 않습니다.

아래 tags 들은 parse 되고 UI에도 나타납니다.

<Folder>
    <name>
    <description>
<StyleMap>
    <Pair>
        <key>
        <styleURL>
<Style>
    <iconStyle>
        <href>
        <w>
        <h>
    <balloonStyle>
        <bgColor>
        <textColor>
    <lineStyle>
        <color>
        <weight>
    <polyStyle>
        <fill>
        <color>
<Placemark>
    <address>
    <name>
    <description>
    <Snippet>
    <Point>
        <coordinates>
    <Polygon>
        <outerBoundaryIs>
        <innerBoundaryIs>
    <LineString>
        <coordinates>
    <LinearRing>


   
아래 tags 들은 parse 되지만 UI에 영향을 주지는 않습니다.   

<Document>
    <name>
    <description>

    <scale> (under iconStyle)


   
좀 더 자세한 사항은 구글의 KML documentation을 참조하세요.

ArcGIS Server

ArcGIS 서버를 사용하려면 feeds-<group>.ini 안의 아래 사항들을 설정하셔야 합니다.

MODEL_CLASS = "ArcGISDataModel"

만약에 service 가 여러 layer를 가지고 있다면 Kurogo는 한번에 한 layer 만 사용합니다. 여러분은 feed 별로 다른 layer 를 할당하셔야 됩니다.

ARCGIS_LAYER_ID = <number>


<number> 는 layer를 나타내는 숫자로 된 ID 입니다. 이 ID를 할당함으로서 feed 별 layer를 지정합니다. sublayer는 현재 지원되지 않습니다.

좀 더 자세한 사항을 보시려면 Esri의 ArcGIS server documentation을 보세요.

Shapefile

To use shapefiles, specify the following in feeds-<group>.ini:
shapefile을 이용하려면 feeds-<group>.ini 안에 있는 아래 내용을 사용하세요.

MODEL_CLASS = "ShapefileDataModel"

network 상에 위치한 Shapefile들은 directory들을 포함하고 있지 않은 sip 폴더에 있어야 합니다. (예: contents 들은 모두 .shp, .dbf, .shx, and .prj 파일들입니다). zipped 된 shapefile들을 사용하려면 ZipArchive 확장자가 PHP에서 사용 가능해야 합니다.

큰 shapefile들은 unzip 되 있고 DATA_DIR의 subdirectory에 locally 저장돼 있을 겁니다. 이런 경우에 BASE_URL은 반드시 확장자 없이 지정되어야 합니다. 예) DATA_DIR”/myshapefile.shp” 와 DATA_DIR”/myshapefile.dbf” 로 구성된 shapefile은 반드시 다음과 같이 지정돼야 합니다.

BASE_URL = DATA_DIR"/myshapefile"

좀 더 자세한 사항을 아시려면 Wikipedia의 Shapefile specification 부분을 보세요.

Configuring Display Options

SHOW_DISTANCES - (optional, defaults to true) item 까지의 거리를 보여줄지 여부
DISTANCE_MEASUREMENT_UNITS - (optional, defaults to ‘Metric’) Imperial (인치, 야드, 마일 등) 이나 Metric (미터 단위) 로 거리를 보여줄 지 여부.
MAP_SHOWS_USER_LOCATION - (optional, defaults to false) 지도에 user의 위치를 보여줄 지 여부.
BOOKMARKS_ENABLED - (optional, defaults to true) true로 세팅돼 있으면, bookmarked 된 entry로의 link 가 나타남. 만약 아무 entry 도 bookmark 돼 있지 않다면 entry 가 bookmark 될 때까지 이 링크는 나타나지 않을 겁니다.

Base Maps

Kurogo의 base 맵은 아래의 configuration과 default rules 를 따릅니다. :

JS_MAP_CLASS 와 STATIC_MAP_CLASS 가 따로 명시돼 있지 않다면 Kurogo는 디폴트로 basic/touch device에 대해서는 Goggle Static Maps를 그리고 compliant/tablet device에 대해서는 Google Maps를 사용할 겁니다.

만약 TATIC_MAP_CLASS 만이 명시돼 있다면 compliant/tablet 와 basic/touch devices 모두 STATIC_MAP_CLASS 가 명시되서 base map 을 사용할 겁니다. JS_MAP_CLASS 만 명시됐다면 basic/touch devices 에도 Google Static Maps 가 적용될 겁니다.

JavaScript base maps (compliant and tablet only)

JS_MAP_CLASS 에 적용 가능한 옵션은 아래와 같습니다. .

Google Maps

Google Map을 (디폴트를 그냥 사용하지 않고) 명시적으로 사용하려면 아래 configuration을 참조하세요.

JS_MAP_CLASS = "GoogleJSMap"



좀 더 자세한 사항은 Google’s Maps documentation을 참조하세요.

ArcGIS Tiled Service Maps

ArcGIS tile server 로부터 tiles 를 얻어서 사용하려면 아래 configuration을 참조하세요.

JS_MAP_CLASS = "ArcGISJSMap"
DYNAMIC_MAP_BASE_URL = "http://..."



ArcGIS Dynamic Service Map으로부터 얻어 사용할 수 있는 추가적인 dynamic layer는 DYNAMIC_MAP_BASE_URL에 배열로 명시해서 base map 의 윗부분에 추가할 수 있습니다.

DYNAMIC_MAP_BASE_URL[] = "http://my.tiled.service/MapServer" DYNAMIC_MAP_BASE_URL[] = "http://my.dynamic.service/MapServer"


DYNAMIC_MAP_BASE_URL의 첫번째 element 는 반드시 tiled service 라야 합니다. 1개만 지정되고 단 1개만 tiled service 라야 합니다.

좀 더 자세한 사항은 Esri’s ArcGIS JavaScript documentation 을 참조하세요.

Static image base maps

STATIC_MAP_CLASS에 사용될 수 있는 옵션은 아래와 같습니다.

Google Static Maps

디폴트를 그냥 사용하지 않고 Google Static Maps를 명시적으로 사용하려면 아래 configuration을 사용하세요.

STATIC_MAP_CLASS = "GoogleStaticMap"



Google Static Maps는 현재 polygon overlay를 지원하지 않습니다.

좀 더 자세한 사항은 Google’s Static Maps documentation을 보세요.

Web Map Service (WMS)

WMS service 에서 images를 사용하시려면 아래 configuration을 이용하세요.

STATIC_MAP_CLASS = "WMSStaticMap"
STATIC_MAP_BASE_URL = "http://..."



overlays를 WMS map에 추가하는 것은 가능하지 않습니다.

좀 더 자세한 사항은 Open Geospatial Consortium’s WMS documentation 을 참조하세요.

ArcGIS exported images

ArcGIS로부터 export된 이미지를 사용하려면 아래 configuration을 이용하시면 됩니다.

STATIC_MAP_CLASS = "ArcGISStaticMap"
STATIC_MAP_BASE_URL = "http://..."



export된 image에 overlay를 추가하는 것은 가능하지 않습니다.

좀 더 자세한 사항은 Esri’s export API documentation 을 참조 하세요.

Map Search

Map search 는 module.ini에서 설정합니다. 만약 이게 설정돼 있지 않으면 Kurogo는 디폴트로 MapSearch 클래스를 사용합니다. 이 클래스는 선택된 feed group 전체를 보게 될 겁니다.

옵션으로 아래 파라미터들이 설정될 수 있습니다.

MAP_SEARCH_CLASS          = "MyMapSearchSubclass"
MAP_EXTERNAL_SEARCH_CLASS = "GoogleMapSearch"



MAP_SEARCH_CLASS 를 사용해서 map module 안에 Searches 를 initiate 할 수 있습니다. MAP_SEARCH_CLASS의 디폴트는 MapSearch 입니다. Search는 modules에 의해 initiate 됩니다. 만약 optional config parameter MAP_EXTERNAL_SEARCH_CLASS 가 다른 클래스로 configure 됐다면 map module은 다른 search class를 사용할 겁니다.

기본적으로 제공되는 GoogleMapSearch 클래스는 Google Places 나 the Google Geocoding service를 사용합니다. Geocoding가 디폴트 입니다. Places를 사용하려면 (구글로부터 API key 를 받았다는 것을 가정하고..) SITE_DIR/config/maps.ini 파일에 아래 configuration을 하세요.

[maps]
USE_GOOGLE_PLACES     = 1
GOOGLE_PLACES_API_KEY = AbCDeFGH123789zzzzzzzzzzzzzzzzzzzxwycbA



Terms of Use for External Providers

Google Maps 유저나 그과 관계된 제품(Kurogo installation에 주요하게 포함돼 있는 제품)을 사용하는 유저들은 이 모든 제품들에 대한 usage 제한에 대해 염두에 두셔야 합니다.

Google Maps/Earth API terms 는 여기에 있습니다.

사용량이 많은 site의 경우 embedded Google Maps 의 최근 변경된 usage limit에 대해 주의하실 필요가 있습니다.


반응형

Kurogo Tutorial 08 - Configuration-

2012. 5. 11. 01:08 | Posted by 솔웅


반응형

Configuration

Kurogo 프레임워크는 조금만 셋업해도 동작할 수 있도록 만들어 졌습니다. 어쨌든 파일위치, 디버깅 정보 그리고 모듈의 기능에 영향을 미치는 모듈 옵션들이나 다른 기능들에 익숙해 지셔야 프레임워크를 잘 활용하실 수 있습니다.

모든 confituration은 .ini 파일들에서 이루어 집니다. 직접 이 파일을 수정하셔도 되고 어드민 모듈에서 수정하셔도 됩니다.

Structure of .ini Files

대부분의 개발자들이나 administrator들은 .ini 파일 구조에 익숙해지셔야 합니다. ini 파일들에 대한 깊은 정보는 PHP 매뉴얼의 parse_ini_file() 함수 부분을 보시면 도움이 되실 겁니다.


Properties

ini 파일에 있는 기본적인 요소는 property 입니다 모든 프로퍼티는 name과 value를 가지고 있습니다. 그리고 그 관계는 = 으로 설정합니다. name은 = 기호 왼쪽에 위치합니다. String 은 큰 따옴표 "" 로 감싸져야 합니다. Constants(상수) 들은 큰 따옴표 바깥쪽에 있을 수 있습니다. Kurogo에서 사용하는 별도의 방법은 {} 를 key name에 사용할 수 있게 한 겁니다.

key1="value"
key2=CONSTANT
key3=ANOTHER_CONSTANT "value"
key4="Using value {key3}"


Sections

Properties may be grouped into arbitrarily named sections. The section name appears on a line by itself, in square brackets ([ and ]). All properties after the section declaration are associated with that section. There is no explicit “end of section” delimiter; sections end at the next section declaration, or the end of the file. Sections may not be nested.

프로퍼티는 임의로 명명된 섹션들의 group 화 될 수 있습니다. 섹션 이름은 해당 라인에 [] (square brackets) 안에 있게 됩니다. 섹션 정의 이후의 모든 프로퍼티들은 해당 세션과 연관이 있는 것들입니다. 그 섹션의 끝을 나타내는 특별한 기호(구분자)는 없습니다. 해당 섹션은 그 다음 섹션 정의 부분 에서 끝납니다. 섹션은 nested 되지 않습니다.

[section]


Comments

세미콜른은 주석의 시작을 의미합니다. 주석은 그 줄의 끝까지 해당 됩니다. 세미콜른이 있는 라인의 내용은 엔진이 무시하고 넘어 갑니다.

; comment text


Configuration files


모듈이 작동할 때 아래 config 파일들이 자동으로 로딩 됩니다.;

- config/kurogo.ini : framework config file. 주요 기능은 active site와 configuration mode를 알려줌
- SITE_DIR/config/site.ini : site configuration file. 모든 모듈이 공유하는 프로퍼티가 있고 기본 환경을 세팅해 줌
- SITE_DIR/config/strings.ini : Strings table. 사이트에서 사용하는 다양한 string들을 포함
- SITE_DIR/config/MODULEID/module.ini : 현재 모듈에 대한 Basic configuration file. disabled status, protected, secure and authorization 을 포함한 모듈과 관련된 프로퍼티들이 있음. 또한 다른 unique 한 다른 module configurable parameters 들도 있음
- SITE_DIR/config/MODULEID/pages.ini : 현재 모듈에 대한 Title/navigation configuration

다른 모듈들은 external data configuration 과 모듈 output 과 formatting을 위한 특정 configuration을 위해 SITE_DIR/config/MODULEID 폴도로부터 파일들을 로드할 겁니다.

Local Files

쿠로고 프레임워크는 로컬 서버 customization을 위해 configuration 파일을 overrid 할 수 있도록 지원합니다. config/kurogo.ini 안에 있는 CONFIG_IGNORE_LOCAL 이 1로 설정되지 않는 한 프레임워크는 각 configuration file이 로드될 때 파일이름이 -local로 된 파일도 같이 로드합니다. 예를 들어 SITE_DIR/config/site.ini 은 SITE_DIR/config/site-local.ini 로 override 될 수 있습니다. ITE_DIR/config/home/module.ini는 SITE_DIR/config/home/module-local.ini로 오버라이드 될 수 있구요. 전체 파일읠 duplicate 할 필요는 없습니다. 오직 -local에서 다르게 작동해야만 하는 부분이 있으면 그 부분만 넣어 주시면 됩니다. 그리고 기본 config에 없는 내용을 -local 에 추가할 수도 있습니다.

These files are ignored by the git version control system and are an excellent place to put sensitive file paths or credentials that should not be part of a public source code repository. It can also aid in deployment since your development machine may use different settings than a production server.

If CONFIG_IGNORE_LOCAL is set to 1, then -local files will be ignored. This is useful if you do not use them and may slightly improve performance.
Configuration Mode

In addition to -local files. There is also an option to include configuration override files by specifying a mode string. This string is like -local but can be set to any value. This will allow you to create multiple versions of configuration files, with slightly different versions of certain values and instantly switch between them. This option is set in the CONFIG_MODE value of config/kurogo.ini These files are not ignored by git.

One use of this would be to create development and production versions of some of your configuration files. You can have SITE_DIR/site-development.ini and SITE_DIR/site-production.ini with differing values for debugging. Then you can set CONFIG_MODE to development or production. If CONFIG_MODE is empty (the default), than no files will be searched. Another example would be to include authorization values for certain modules in a production environment.

Keep in mind that this setting is independent of -local files. -local files will override any option presuming CONFIG_IGNORE_LOCAL is not enabled.

Kurogo has included a series of example -production.ini files to indicate recommended values for production servers
Retrieving Configuration Values

There are a variety of methods that are used to retrieve values from the configuration files. Please see Module Configuration for more information on how to retrieve these values in your module.
Site Configuration

The SITE_DIR/config/site.ini file configures the basic site configuration. It is broken up into several sections
Error handling and debugging

The properties in this section are used during development. Most of them are boolean values (0 is off, 1 is on)

    DEFAULT_LOGGING_LEVEL - See Logging in Kurogo for more information.
    LOGGING_LEVEL[area] - See Logging in Kurogo for more information.
    DISPLAY_ERRORS - Display PHP errors. This can make discovering bugs more easy. You should turn this off on a production site.
    DEVICE_DEBUG - When the framework is running in device debugging mode, you can prepend any framework url with device/[PAGETYPE]-[PLATFORM]/ or device/[PAGETYPE]/ to see that version of the page in your browser. So for example “/device/basic/about/” will show the basic version of the About module’s index page.
    MODULE_DEBUG - Enables debugging information provided by each module. The type of information will vary by module. An example of this is showing the LDAP server used by the People module
    MINIFY_DEBUG - When Minify debugging is turned on, Minify adds comments to help with locating the actual file associated with a given line.
    DATA_DEBUG - Data debugging enables logging and certain output to debug data connections. When turned on, it will log url requests in the error log.
    DEVICE_DETECTION_DEBUG - Show the device detection info in the footer
    PRODUCTION_ERROR_HANDLER_ENABLED - The production error handler will email exceptions to the DEVELOPER_EMAIL address. You should treat exceptions as extraordinary situations that should normally not occur in production environments.
    DEVELOPER_EMAIL - an email address to send exception notices. At this time, it uses the php mail() function so it may not be compatible with all environments.

You should turn the _DEBUG options to off in a production environment and enable the Production Error Handler with an appropriate developer email address.
Site settings

    SITE_DISABLED - When set to 1 this site is disabled. Useful for MultiSite
    SECURE_REQUIRED - When set to 1 then the site will require a secure (https) connection
    SECURE_HOST - Alternate hostname to use for secure (https) connections. If not included it will use the same host name.
    SECURE_PORT - Alternate port to use for secure connections. Typically you should leave it at the default of 443
    LOCALE - Locales are used for date/time formatting. If you wish to use a locale other than the server default, then you should set this. Note that valid values are dependent on the operating system of the server.
    LANGUAGES[] - A list of language priorities. See Localization for more info.
    LOCAL_TIMEZONE - Set this to your environment’s time zone. See http://php.net/manual/en/timezones.php for a list of valid time zones
    LOCAL_AREA_CODE - Set this to your environment’s primary area code
    AUTODETECT_PHONE_NUMBERS - Turn this off to prevent the auto detection of telephone numbers in content. This is primarily only supported in iOS devices at this time.

Modules

    DYNAMIC_MODULE_NAV_DATA - This value determines whether modules can present dynamic data on the navigation home screen. This could include dynamic titles, images or other information. If you are not providing dynamic data, then you should turn off this option. It is off by default. See Dynamic Home Screen Information for more information
    CREATE_DEFAULT_CONFIG - This value determines whether config folders will be automatically created if they don’t exist. This can be convienient for development when you want to populate a config folder with the default values, but should be turned off for production to ensure modules that you don’t use don’t create configuration folders.

Cache

    MINIFY_CACHE_TIMEOUT - The timeout for saving the minify cache. This determines how often to look for new templates or css/js files. It should be set high for production sites.

Analytics

    GOOGLE_ANALYTICS_ID - set this to your google analytics id and the framework will utilize the google analytics server
    GOOGLE_ANALYTICS_DOMAIN - If you use subdomains in your google analytics reporting, set this to the appropriate domain
    PERCENT_MOBILE_ID - set this to your percent mobile analytics id and the framework will utilize the percent mobile analytics server
    STATS_ENABLED - if set to 0 then the internal statistics engine will be disabled
    KUROGO_STATS_TABLE (kurogo_stats_v1) - The name of the table to use for internal statistics gathering
    KUROGO_VISIT_LIFESPAN (1800) - The timeout (in seconds) for tracking visits

Temp Directory

    TMP_DIR - This should be set to your a writable temporary directory. If this entry is blank, it will use the system default temporary directory.

Themes

    ACTIVE_THEME - This is set to the active theme. It should be a valid folder inside the SITE_DIR/themes directory.
    TABLET_ENABLED - If set to 0 then the tablet devices will receive the compliant page type templates.

URL Rewriting and the default page

In the [urls] section you can put a series of values that allow you to map a url to another. Typically this would be if you want to map a module’s url to several possible values, perhaps to maintain historical bookmarks. The entered url will be redirected to the value you specify. For example:

    directory = people would map the url /directory to /people (i.e. the people module)

Take care that you do not create infinite redirect loops.

There is a special case for the DEFAULT url. This is the module that is loaded when users enter your site without a module name (i.e. the root of your site). You can configure this to show a different module depending on the type of device/platform. In the initial setting, users browsing your site from a computer will be presented with the info module and users browsing your site from a mobile device will be shown the home module.

The default option will look for the most specific value when determining which default page to show. You can create entries like such (in uppercase)

        DEFAULT-PAGETYPE-PLATFORM - matches the specific pagetype/platform combination. like DEFAULT-COMPLIANT-COMPUTER or DEFAULT-TOUCH-BLACKBERRY.
        DEFAULT-PAGETYPE - matches all the devices from a particular pagetype. Like DEFAULT-COMPLIANT or DEFAULT-BASIC
        DEFAULT will match any device if a more specific entry is not found

This allows you to customize the front door experience for your users.
Device Detection

See Device Detection for more information on configuration values.
Cookies

    MODULE_ORDER_COOKIE_LIFESPAN - How long (in seconds) to remember the module order customization. In production sites this should be set to a long time, like 15552000 (180 days)
    LAYOUT_COOKIE_LIFESPAN - How long to remember the device detection results for pagetype and platform. In production sites this should be set to a long time, like 1209600 (14 days)
    BOOKMARK_COOKIE_LIFESPAN - How long to remember the saved bookmarks for a user. In production sites this should be set to a long time, like 15552000 (180 days)

Database

The main database connection can be used by a variety of modules for storing and retrieving values. See the database section for specific information on configuration values.
Authentication

    AUTHENTICATION_ENABLED - Set to 1 to enable authentication
    AUTHENTICATION_IDLE_TIMEOUT - Idle Timeout in seconds before users are logged off Use 0 to disable
    AUTHENTICATION_USE_SESSION_DB - If 1 then session data will be saved to the site database
    AUTHENTICATION_REMAIN_LOGGED_IN_TIME - Time in seconds where users can choose to remain logged in even if closing their browser. If this is set to 0 then user’s cannot remain logged in. Typical times are 604800 (7 days) or 1209600 (14 days).

Log Files

    KUROGO_LOG_FILE - The location of the Kurogo log file. This is where all Kurogo log statements will be placed depending on the value of DEFAULT_LOG_LEVEL
    LOG_DATE_FORMAT - Date format for log files
    LOG_DATE_PATTERN - regex pattern of log dates, should match output from LOG_DATE_FORMAT

Module Visibility and protection

Each module contains an configuration file in SITE_DIR/config/moduleID/module.ini. This file contains values common to all modules, as well as module specific values.

    id - The module id to use. By default this will be the same name as the moduleID. You can change this to create a copied module or to use another module’s code at this url.
    title - The module title. Used in the title bar and other locations
    disabled - Whether or not the module is disabled. A disabled module cannot be used by anyone. Use this value for temporarily disabling modules.
    search - Whether or not the module provides search in the federated search feature.
    secure - Whether or not the module requires a secure (https) connection. Configuring secure sites is beyond the scope of this document.

Permanently disabling modules

When CREATE_DEFAULT_CONFIG is set to 0, if you remove a module’s config folder it will be permanently disabled and will not be accessible.
Optional Common Module Settings

    SHOW_LOGIN - By default the login link only appears on the home module. If you wish for it to show up on other modules, you can set this value to 1 on any module you wish to see it. You could also set this to 0 on the home module to suppress its showing.

Home Screen

See Home Module for information on configuring the look and layout of the home screen.
Strings

There are a number of strings that are used throughout the framework to identify the site name the organization it is a part of. These include:

    SITE_NAME - The name of the site. Used in the footer and other places.
    COPYRIGHT_LINK - Link to copyright notice (optional)
    COPYRIGHT_NOTICE - Copyright notice
    FEEDBACK_EMAIL - email address where users can send feedback.

Administration Module

In addition to editing these files, you can use the administration module to manage the configuration. The admin module is located at /admin and does not have an icon on the home screen.

반응형

FAQ Wednesday #4 - Corona SDK -

2012. 5. 10. 08:51 | Posted by 솔웅


반응형

FAQ Wednesday #4

수요일입니다. FAQ 시간이죠. 아래에 자주 질문되는 5가지 문답이 있습니다. (FAQ)

Question 1

함수를 만들 때 가끔 함수 이름이 nil 이라는 에러 메세지를 가끔 보게 됩니다. 그것을 바로잡기 위해 이렇게 저렇게 코딩을 바꾸는데요. 함수 생성과 관련해서 올바른 방법은 뭔가요?

Answer

일반적으로 Lua 는 변수가 Local 일 경우에 변수에 forward references 를 요구합니다. 이 의미는 변수가 사용될 수 있게 하기 전에 변수가 정의 될 필요가 있습니다. 아래 예제를 보세요.


local function getTax( num )
    return num * 0.0825
end


print( getTax( 99.95 ) )

위의 코드는 정상적으로 동작할 겁니다. 왜냐하면 getTax가 먼저 정의 됐기 때문이죠.

print( getTax( 99.95 ) )

local function getTax( num )

    return num * 0.0825
end


The above doesn’t work because getTax is unknown and returns with a “nil” error. If you always define your variables or functions first (before being called), you won’t have any problems, but sometimes you can’t avoid it. Here is how you can fix 

위와 같이 하면 에러가 날겁니다. 왜냐하면 getTax가 아직 정의 되지 않았는데 print를 하니까 nil 에러가 날겁니다. 먼저 변수나 함수를 정의하면 (call 되기 전에) 문제는 없을겁니다. 그런데 좀 예외적인 경우도 있습니다.

local getTax -- forward reference

local function printTax()

    print( getTax( 99.95 ) )
end

function getTax( num )

    return num * 0.0825
end

printTax()

이 경우에는 작동합니다. 우선 변수 getTx가 먼저 정의 됐구요. 그 다음에 getTax 함수가 정의 되기 전에 이 getTax 함수를 call 했습니다. 그리고 나서 getTax 함수를 만들었습니다. 이 경우는 getTax는 함수이기 때문에 printTax 함수 안에서 이 getTax를 call 하는 경우는 getTax 함수가 이미 정의되고 값이 할당 된 후이기 때문에 제대로 작동합니다.

자주 하는 실수는 아래와 같은 경우가 있습니다.

local getTax -- forward reference

local function printTax()

    print( getTax( 99.95 ) )
end

local function getTax( num )

    return num * 0.0825
end

printTax()

이렇게 하면 nil 에러가 발생합니다. 그 이유는 getTax 함수가 local 로 선언됐기 때문입니다. 이미 getTax 변수를 local로 선언했습니다. 그러고 나서 함수 앞에 또 한번 local 을 붙인다면 Lua 는 새로운 local 변수를 정의하게 됩니다. 그래서 원래의 getTax 변수는 nil이 되 버리는 거죠. 직접 이 코드에 local을 붙였다 뺐다 하고 함수 선언의 위치를 여기 저기 바꾸면서 한번 테스트 해 보시면 많은 도움이 될 겁니다.

모든 변수를 global로 선언하면 이런 문제는 발생하지 않겠죠. global로 선언하려면 그냥 local 글자를 빼면 됩니다. 이렇게 global로 몇개의 변수를 선언하는 건 괜찮을 겁니다. 하지만 변수가 무수히 많거나 퍼포먼스가 문제가 된다면 이 방법은 추천하고 싶지 않습니다. 그리고 많은 변수들과 함께 모듈을 로딩하는 경우에도 추천하지 않습니다.

변수와 관련되서는 더 많은 부분을 보실 수 있습니다. Lua 5.1 Reference Manual을 보시기 바랍니다.

Question 2

native.webPopup으로 웹사이트에 접근 했을 때 어떻게 HTTP status code를 얻을 수 있을까요?

Answer

HTTP Status Code 는 웹서버에서 return 되구요 이것은 HTTP request가 성공적으로 동작했는지 아닌지를 알 수 있도록 해 줍니다. 아래 흔히 받을 수 있는 status code들이 있습니다.

  • 200 OK
  • 301 Moved Permanenly
  • 404 Not Found
  • 500 Internal Server Error

이것과 관련된 좀 더 많은 정보는 여기로 가서 확인하세요.

코로나에서는 native.wevPopupnative.webView은 HTTP status code를 제공하지 않습니다. 다만 network.request에서는 제공합니다. (현재까지의 버전에서는요.). wepPopup이나 webView 의 event.isError는 서버에 연결되지 않았을 때 발생하는 겁니다. 서버에는 접속했는데 404에러 (page not found) 가 났다면 isError는 발생하지 않습니다. 이 HTTP Status Code를 받으시려면 웹페이지에 처음 접속할 때 network.request를 사용하셔야 합니다.

아래 그 예제가 있습니다.

local function loadWebPage()
    native.showWebPopup(10, 10, 300, 300, url )
end

local function networkListener( event )

    if( event.isError ) then
        print( "Network error: ", event.response )
    else
        print( "Status Code: " .. event.status )
        if event.status == 200 then
            print( "Loading web page ..." )
            loadWebPage()
        else
            print( "Web page not loaded!" )
        end
    end
end

network.request( url, "GET", networkListener )

이 코드는 웹 페이지에 접근할 때 먼저 network.request를 call 합니다. status가 200이라면 loadWebPage가 call 될 겁니다. 그리고 페이지는 native.webPopup을 이용해 로드 될 겁니다.

Note: native.webBiew는 iOS에서 native.webPopup 대신에 사용하려고 만든 겁니다. 이 메소드가 웹페이지를 표시할 때 사용하시기를 추천합니다. 이 API도 조만간에 안드로이드, 맥, 윈도우에서도 사용할 수 있도록 하겠습니다.

Question 3

내가 빌드 할 때 Ansca가 저의 소스를 보나요? 제 소스를 빌드하기 위해 정보가 당신의 서버에 전달할 때 어떻게 보안이 유지 되나요?

Answer

온라인 빌드가 일어날 때 우리의 서버는 절대 여러분의 raw source code를 보지 않습니다. 마찬가지로 여러분의 프로젝트 이미지, 사운드 또는 다른 asset들도 보지를 않습니다. Lua script는 우리 서버로 보내지기 전에 미리 bytecodes로 컴파일 됩니다. 서버에는 이 컴파일된 데이터를 처리할 코로나 엔진이 있습니다. 이 서버에서도 그 컴파일 된 파일을 절대 저장하거나 모아두지 않습니다.

Question 4

제가 API 페이지 (댓글란)에 버그 report를 했습니다. 그런데 왜 고쳐지지가 않죠?

Answer

API 페이지의 댓글란은 버그를 report 하거나 질문을 하는 곳이 아닙니다. 이 부분은 API documentation의 에러나 빠진 정보에 대해 report 하는 부분입니다.

만약에 API의 버그를 발견하셨다고 생각하시면 bug report를 해 주세요. 링크는 Forum과 Documentation 페이지의 윗쪽에 링크가 있습니다. 그리고 보내실 때는 되도록 자세히 적어서 보내 주세요. build number, 디바이스, OS 정보까지 포함해서요.

그리고 버그가 발생하는 경우의 전체 코드(config 파일등을 포함해서) 를 보내주시는 것이 중요합니다. 단지 코드 몇줄만 넣고 이 부분이 잘 안 된다고 설명만 하신다면 우리의 to do 리스트의 우선 순위에서 멀리 밀려날 겁니다. 저희는 아주 많은 버그 레포트를 받습니다. 이것을 가지고 샘플 테스트 케이스를 만들어서 문제점을 테스트 하는 것은 시간이 걸리는 일 입니다. 가끔 config.lua 파일이나 build.settings가 없어서 문제점을 찾지 못할 때도 있습니다. 버그가 여러분 문제를 해결하는데 중요한 부분이라면 그 전체 파일을 보내주시고 그 버그를 보려면 어떻게 해야 하는지에 대한 설명을 같이 보내 주세요.

저희는 지금 새로운 documentation system 을 만들고 있습니다. 그리고 곧 발표하게 될 겁니다. 이 새로운 시스템은 댓글란이 없습니다. 그 때는 API 관련 질문은 포럼이나 bug report를 이용하셔야 됩니다.

Question 5

제 코드를 디버그 하려고 print 구문을 넣었습니다. 그런데 nil 에러가 많이 나요. 이 에러를 피할 수 있는 방법이 있나요?

Answer

아마 아래 코드처럼 해서 그런 문제가 발생할 겁니다.

print( "lineNumber = " .. lineNumber )

scoping problem이나 이전에 set  때문에 lineNumber가 nil 이라면  print 구문은 이렇게 나올 겁니다. “attempt to concatenate ‘lineNumber’ (a nil value)”.

이걸 해결 하려면 두 변수를 분리하기 위해 , 를 사용하실 수 있습니다.

print( "lineNumber = " , lineNumber )

이 경우에 concatenation error를 피할 수 있습니다. 그런데 이렇게 하면 lineNumber 값을 print 하기 전에 원하지 않는 공간이 생길 겁니다.

“tostring”. 또 다른 방법으로는 tostring을 사용하는 방법이 있습니다.

print( "lineNumber = " .. tostring( lineNumber ) )

이렇게 하면 해당 값이 string으로 변환 됩니다. number, string , table, display object 등을 가리지 않고 심지어 그 값이 nil이라도 string으로 변환되죠.  이렇게 하면 print error 없이 print 구문을 사용할 수 있도록 해 줍니다.

여기까지가 오늘의 질문들 입니다. 여러분께 많은 도움이 됐기를 바랍니다.


반응형

Kurogo Tutorial 07 - Device Detection -

2012. 5. 9. 05:12 | Posted by 솔웅


반응형

Device Detection

Kurogo 프레임워크의 파워풀한 기능 중 하나가 다양한 디바이스를 감별해 내고 다양한 디바이스의 capabilities를 근거로 format content를 분류하는 기능입니다. 디바이스별 분류를 지우너하기 위해 프레임워크는 Device Detection Server를 사용합니다. 이 서버는 디바이스들과 nomalized 된 프로퍼티 세트 output들에 대한 데이터베이스가 있습니다.

 

Types of Device Detection Servers

 

Kurogo는 유저 디바이스의 user agent를 parse 하고 상응한 값 목록들을 return 하는  internal device detection server 가 포함돼 있습니다. 여기에는 lib/deviceData.json에 위치한 json dataset을 포함됍니다. 이것은 각 패턴들의 series를 포함하고 있고 해당 패턴에 맞는 값을 return 하게 됩니다. 또한 여러분은 여러분 나름대로의 custom dataset file을 정의하실 수 있습니다. 이 custom file은 canonical dataset보다 먼저 검색돼 여러분 필요에 따라 control 할 수 있도록 도와 줍니다.

external device detection service 도 가능합니다. 이 service의 장점은 좀 더 최신이 디바이스 정보까지 포함하고 있다는 겁니다. 이를 위해서는 2개의 url들이 제공됩니다. 하나는 개발용이고 다른 하나는 production 용입니다.

좀 더 자세한 사항은 Device Detection Configuration  를 보세요.

 

Data Format

 

Kurogo 프레임워크는 유저 브라우저의 user agent를 사용해서 device detection service를 진행합니다. 이 service는 그 디바이스를 근거로한 프로퍼티들을 return 할 겁니다.

  • pagetype - String. device buckets 중의 하나, 그 디바이스가 어떤 major HTML 소스 를 receive 할 것인지를 정하게 됨. 리턴값으로는 basic, touch, compliant and tablet 등이 있음
  • platform - 디바이스의 특정 타입. 값으로는  ANDROID, BBPLUS, BLACKBERRY, COMPUTER, FEATUREPHONE, IPHONE, IPAD, PALMOS, SPIDER, SYMBIAN, WEBOS, WINMO, WINPHONE7 등이 있음
  • description - 디바이스에 대한 설명 
  • supports_certificates - Boolean. 이 프로퍼티는 더 이상 사용하지 않음

The pagetype 와 platform properties 들은 module object 의 프로퍼티로서 assign 됩니다.

 

Configuration

 

device detection service에 영향을 미치는 몇가지 configuration 값들이 있습니다. 이 값을은 SITE_DIR/config/site.ini에서 설정 하실 수 있습니다.  

  • MOBI_SERVICE_VERSION - 디바이스 버전을 포함. compatibility를 위해 제공 됨
  • MOBI_SERVICE_USE_EXTERNAL - Boolean. 0 이면, Kurogo 는 internal device detection server를 사용함. 1이면 external server를 사용함
  • MOBI_SERVICE_SITE_FILE - internal detection을 사용할 경우 site-specific device detection data 의 위치.  (DATA_DIR/deviceData.json 에 있음)
  • MOBI_SERVICE_URL - external detection을 사용할 경우 device detection server 의 URL 
  • MOBI_SERVICE_CACHE_LIFETIME - Time (in seconds), external device detection service 로부터 받아 cache 된 값을 keep 하고 있는 시간

Debugging Options

 

  • DEVICE_DETECTION_DEBUG - on으로 할 경우 홈 스크린의 밑에서 device detection 정보를 보실 수 있습니다. 특정 디바이스를 다룰 경우 유용하게 사용하실 수 있습니다. 디바이스가 정확하게 분류되 있지 않다고 느끼시면 device/browser 의 user agent 정보와 함께 kurogo-dev@googlegroups.com 로 알려 주세요.
  • DEVICE_DEBUG - on으로 할 경우, 주어진 요청을 행하기 위해 device pagetype과 platform 을 변경하실 수 있는 권한을 갖게 됩니다. 이 기능은 특정 디바이스를 가지고 있지 않거나 데스크탑에서 테스트를 할 때 유용하게 사용하실 수 있습니다.  심플하게 /device/pagetype-platform/에 사전 정의 해 주세요. 

 

Customizing your Device Detection

 

Kurogo 1.3 에서는 device detection files에 어떻게 access를 하는지에 대해 변경이 있습니다. 수정하거나 특정 device detections를 override 하는 것을 훨씬 쉽게 진행할 수 있도록 면서도 speed 손실이 없도록 했습니다.

쿠로고는 device detection 프로세스를 컨트롤 하기 위해 JSON 포맷을 사용합니다. 그럼으로서 빠르게 감지하고 쉽게 수정하거나 특정 디바이스를 추가할 수 있도록 했습니다. 이 파일에 대한 스키마 정의가 LIB_DIR/deviceDataSchema.json에 있습니다. JSON 스키마에 대한 좀 더 자세한 정보는 http://json-schema.org/를 참조하세요. 샘플 custom file은 DATA_DIR/sampleDeviceData.json 에서 보실 수 있습니다.

The sample deviceData.json file is reproduced below with comments added to help describe the format. Note that comments are not allowed in the actual file, in order to conform to json specifications:

deviceData.json 파일을 주석을 달아서 이해하기 쉽도록 한 샘플 파일이 아래에 있습니다. 실제로는 이 주석이 허용되지 않으니까 주의하세요.

 

{
    // All deviceData files consist of an object containing a single property, "devices".  devices is an array of device blocks.
    "devices" : [
        {
            // A device block contains several properties:

            // "groupName" : a machine readable identification of the device or device group.
            "groupName" : "exampleDevice",

            // "description" : a human readable identification of the device or device group.
            "description" : "Both revisions of the Example Device produced by Example Company, Inc.",

            // "classification" : a versioned set of identifications to be passed to kurogo once a device is matched
            "classification" : {
                // By convention, the highest version number is placed first in the file.
                "2" : {
                    // The full list of supported pagetypes and platforms are defined
                    // in the associated schema.
                    // Note: The schema defines a specified set of pagetypes and
                    //     platforms, in an attempt to catch misspelling and other user
                    //     input errors.  Kurogo, however, has no such restrictive list, and
                    //     you can actually specify any pagetype/platform assuming you also
                    //     have all the necessary template/configuration files defined.
                    "pagetype"     : "compliant",
                    "platform"     : "android",
                    "supports_certificate" : true
                },

                // In the event that a classification cannot be found for a given version
                // number, it attempts to search for the next lowest version.
                // So if you are requesting version 3, it first attempts to find version 3.
                // If it cannot find it, it attempts to find version 2.  If it cannot find
                // that either, it attempts to find version 1, etc.

                // Because of this, version numbers are a way to specify when this
                // definition last changed.  This also means that upgrading to a new
                // version of the detection engine does not require you to edit every single
                // entry just to continue to use your custom detection file.
                "1" : {
                    "pagetype"     : "webkit",
                    "platform"     : "android",
                    "supports_certificate" : true
                }
            },

            // "match" : an array of regex and/or string match blocks which should be matched against the user agent.
            "match" : [
                // You can specify any number of matcher blocks.
                {
                    // There are 4 types of matches.
                    // "prefix" attempts to match the specified string at the beginning of the user-agent.
                    "prefix" : "Mozilla/5.0 (exampleDevice-v1"
                },
                {
                    // "suffix" attempts to match the specified string at the end of the user-agent.
                    "suffix" : "exampleDevice-v2)"
                },
                {
                    // "partial" attempts to perform a literal string match somewhere in the user-agent string.
                    "partial" : "exampleDevice"
                },
                {
                    // "regex" allows you full preg_match syntax for matching any part of the user-agent string.
                    // Note: Do not include delimiters in your regex string or escape any potential delimiters.
                    // This is done automatically by Kurogo.
                    "regex" : "exampleDevice-v(1|2)",

                    // Each of the 4 different types of matches can also include an optional "options" object.
                    // This object can contain various modifiers for the match functions.  While useable on the
                    // basic string matching operations, it's most useful in regex, where you can specify case insensitivity and/or newline matching for the dot token.
                    "options" : {
                        "DOT_ALL" : true,
                        "CASE_INSENSITIVE" : true
                    }
                }
            ]
        }
    ]
}



반응형

'WEB_APP > Kurogo' 카테고리의 다른 글

Kurogo Tutorial 12 - Logging in Kurogo -  (0) 2012.05.21
Kurogo Tutorial 11 - News Module -  (0) 2012.05.17
Kurogo Tutorial 10 - Module 만들기 -  (0) 2012.05.13
Kurogo Tutorial 09 - MAP Module -  (0) 2012.05.12
Kurogo Tutorial 08 - Configuration-  (1) 2012.05.11
Kurogo Tutorial 06 - 소스 코드 여행 -  (0) 2012.05.08
Kurogo Tutorial 05 - 모듈 생성하기 -  (0) 2012.05.08
Kurogo Tutorial 04  (0) 2012.05.08
Kurogo Tutorial 03  (1) 2012.05.08
Kurogo Tutorial 02  (0) 2012.05.08

Kurogo Tutorial 06 - 소스 코드 여행 -

2012. 5. 8. 23:41 | Posted by 솔웅


반응형

Source code tour

이 섹션에서는 Kurogo 소스 코드 프로젝트에 있는 다양한 파일들과 디렉토리들을 여행해 볼겁니다. 프로젝트의 레이아웃을 안다는 것은 코딩 이전에 무엇인가를 결정할 때 그리고 여러분의 파일을 어디에 위치 시켜야 할지를 결정할 때 도움을 줄 겁니다.

Basic Layout

Kurogo 폴더의 루트는 몇개의 폴더가 있습니다.

add-ons
이 디렉토리에는 추가적인 scripts나 code들이 들어갑니다. 주로 다른 어플리케이션과  interact 하는데 사용될 수 있습니다.
app
이 대렉토리에는 Kurogo가 제공하는 각 모듈의 code 와 templates 이 들어 있습니다. 또한 각 모듈에 의해 사용되는 shared template도 있습니다. (including headers and footers). lib 폴더에 이런 파일을 add 하거나 altering 하지 말고 Site folder  안에 새로운 파일이나 altered 파일을 넣으세요.
config
이 디렉토리에는 전체 프로젝트에 대한 메인 configuration file들이 들어 있습니다. 가장 주목할 파일은 kurogo.ini file 입니다.
doc (only included in source distribution)
이 디렉토리에는 이 guide를 포함해서 다양한 documentation 파일들이 있습니다. 이 가이드는 Sphinx documentation system 을 사용해서 만들어 졌습니다.
lib
이 디렉토리는 Kurogo에서 제공하는 라이브러리가 있습니다. data retrieval, parsing, authentication, database access 라이브러리와 configuration 등이 있습니다. 일반적으로 Kurogo가 제공하는 라이브러리만 이 디렉토리에 있어야 합니다. 여러분의 라이브러리는 SITE_FOLDER/lib 폴더에 넣어야 나중에 프로젝트를 업데이터 할 때 혼동이 없습니다.
site
이 디렉토리에는 각 사이트의 entry 가 있습니다. 좀 더 자세항 사항은 다음을 보세요. Site folder
www
이 디렉토리에는 사이트의 DocumentRoot가 있습니다. 여기에는 모든 incoming request들을 핸들링하는 메인 스크립트인 index.php 가 있습니다. 여기에 또한 css와 javascript가 있게 됩니다. .htaccess 와 web.config 파일은 Apache와 IIS를 위한 URL redirection이 있습니다.


Case Sensitivity

여러분 사이트를 개발 하실 때 대소문자를 구분한다는 사실을 항상 염두에 두세요. 많은 개발자들이 대소문자 구분을 하지 않는 시스템에서 작업을 하십니다. 대부분의 서버에서는 대소문자 구분을 합니다. 그러니까 폴더위치나 url등을 정할 때 이 부분을 잘 염두에 두셔야 합니다.

Provided vs. Site files

레이아웃 섹션에서 말했듯이 app,lib,www 같은 Kurogo에서 제공하는 파일들과 여러분이 사이트 작업을 위해 사용하시는 파일 등이 있습니다. 쿠로고는 오픈소스이기 때문에 여러분의 필요에 따라 소스를 고치셔도 됩니다. 만약 여러분이 프로젝트 디렉토리의 파일을 수정하거나 새 파일을 추가했다면 다음 버전에 업데이트 할 때 문제가 될 수 있습니다. 업그레이드 할 때 이런 부분을 도와주는 것으로 add additional functionality이 있습니다.

그리고 여러분이 좀 더 낫게 수정하면 여러분의 수정사항을  submit your changes 에 알려주시면 감사하겠습니다.

Libraries

이 프레임워크는 모듈라이즈와 특정 프로세스를 추상화하고 코드 재사용을 용이하게 하기 위해 많은 라이브러리를 사용하도록 하고 있습니다. 모든 라이브러리는 PHP 클래스로 돼 있습니다.

Packages

특정 클래스 파일들이나 클래스들을 하나의 패키지로 관리할 수 있습니다. 패키지로 관리함으로서 필요한 파일들을 하나로 묶어서 관리를 편하게 해 줍니다.(use: Kurogo::includePackage(‘PackageName’) in your module code) 현재 아래 패키지들이 사용 가능합니다.

  • Authentication (included automatically when authentication is enabled)
  • Authorization - for connecting to various OAuth based web services
  • Cache - classes dealing with in-memory and disk caching
  • Calendar - includes classes to deal with calendar data
  • Config - classes to deal with configuration files
  • DataController - legacy classes dealing with the pre 1.4 DataController class
  • DataModel - subclasses of the DataModel class
  • DataParser - subclasses of the DataParser class
  • DataResponse - subclasses of the DataResponse class
  • DataRetriever - subclasses of the DataRetriever class
  • DateTime - classes for handling date and time
  • db - used when you wish to interact with a database
  • Emergency - used by the emergency module
  • Maps - used by the map module
  • People - used by the people module
  • RSS - classes for handling RSS data
  • Session - Subclasses of the session object, used for session management
  • Video - used by the video module

Core / Support Files

  • compat - defines several functions that normalize behavior throughout PHP versions
  • exceptions - defines exception subclasses and sets up exception handling behavior
  • Kurogo - a singleton class used to consolidate common operations like initialization, site configuration, and administration. See more
  • minify - interface between the framework and the included open source minify library
  • DeviceClassifier - An interface between the framework and the Device Detection Service
  • deviceData.db - A SQLite database that contains browser entries used by the internal device detection system.
  • Validator - A utility class to validate certain types of data

Native API Functions

이 함수는 특정 모듈함수에 접근권한을 주는 API interface를 다루는 함수 입니다. 이 인터페이스들은 native application에 의해 주로 이용됩니다. 그리고 AJAX 를 위한 모듈에 의해서도 사용되어 집니다.

  • APIModule - The base class for API modules, inherits from Module
  • APIResponse - A class that encapsulates the common response message for API requests

더 자세한 사항은 The APIModule Object 를 보세요.

External Data Retrieval

더 자세한 사항은 Data Retrieval  를 보세요.

Database Access

Kurogo는 데이터베이스 연결관련 configuration을 위해 database connection abstraction library를 제공합니다.

  • db - A database access library based on PDO. It includes abstractions for MySQL, SQLite, PostgreSQL and MS SQL. This support is dependent on support in your PHP installation. The setting up and maintaining of databases and their associated extensions is beyond the scope of this document.
  • SiteDB - Uses the main database configuration for access.

더 자세한 사항은 Database Access  를 보세요.

User Access and Authentication

  • AuthenticationAuthority - 이것은 authenticating users 에 대한 루트 클래스 입니다. It is designed to be subclassed so each authority can provide the means of actually authenticating users, but still maintain a consistent interface for the login module. See Authentication for more information about the included authorities.
  • AccessControlList - A class used by the authorization system to restrict access to modules based on user or group membership. This is especially useful for the Administration Module.
  • User - The base class for identifying logged in users
  • UserGroup - The base class for identifying groups

더 자세한 사항은 Authentication 를 보세요.

Session Management

  • Session -  유저의 상태를 저장해서 관리합니다. 현재는 두 종류의 세션이 있습니다.

    • SessionFiles - Save and restore session data using the built in file handler
    • SessionDB - Save and restore session data using a database

Configuration

  • Config - An abstract class that stores key/value data and has logic for handling replacement values (i.e referencing other keys’ values within a value)
  • ConfigFile - Provides an interface for reading and writing an ini configuration file
  • ConfigGroup - Provides an interface for coalescing multiple configuration files to provide a single key/value store
  • ModuleConfigFile - A specific config file class to load module config files.
  • SiteConfig - A specific ConfigGroup that loads the critical site and project-wide configuration files.

configuring Kurogo에 대한 더 자세한 사항은 Configuration 를 보세요. 

Modules and Templates

  • Module - The core class that all modules inherit from. Provides a variety of necessary services and behavior to module subclasses. See Writing Modules.
  • WebModule - The core class that all web modules inherit from.
  • HTMLPager - A support class used to paginate content
  • smarty - The Smarty Template System
  • TemplateEngine - An subclass of the smarty object used by the framework

더 자세한 사항은 Writing Modules 를 보세요.

Other

  • ga - 자바스크립트를 지원하지 않는 브라우저를 위한 google analytics implementation 

Modules and Templates

app 폴더 안에 모듈과 탬플릿 파일들이 있습니다.

Common

common folder 안에는 모든 모듈에서 사용할 수 있는 template과 css 파일들이 있습니다. 이 각각의 탬플릿들은 다른 디바이스별로 몇가지 variant를 가지고 있습니다. (탬플릿 시스템과 파일 네이밍에 대한 좀 더 자세한 정보는 Templates을 보세요.) 이 탬플릿들은 아래와 같은 것들이있습니다.

  • footer.tpl content placed at the bottom of most pages
  • header.tpl content placed at the top of most pages
  • help.tpl template used for displaying help pages
  • formList.tpl template used for showing a list that enables input
    • formListItem.tpl template used for an individual form item in a list
  • navlist.tpl template used for showing items as a list
    • listitem.tpl template used for an individual item in a list
  • pager.tpl - template for providing pagination for long-form content
  • results.tpl - template for displaying results in a list
  • search.tpl - template for presenting a search box
  • share.tpl - template for presenting a sharing content via social networking
  • springboard - template for displaying content as a grid of icons
  • tabs.tpl - template for displaying content in tabs

Modules

modules 폴더에는 Kurogo와 같이 bundle 된 모든 모듈들이 들어 있습니다. 각 모듈들은 PHP 코드와 탬플릿 파일들이 있습니다. 또한 CSS와 Javascript 파일들도 있습니다. 모듈 디자인에 대한 좀 더 자세한 사항은 Writing Modules 를 보세요.

여기서 naming convention은 아주 중요합니다. (특히 대소문자를 구분하는 시스템에서는요.)

  • The folder must be lower case and be the same as the url of the module (/about, /home, /links). You can create modules at other urls by copying the module
  • The folder must contain a PHP file named ModulenameWebModule.php. If the module is located in the site folder and it extends an existing module then it should be called SiteModulenameWebModule.php.
  • The first (and ONLY) letter of the module must be capitalized and followed by WebModule.php.
    • AboutWebModule.php (NOT aboutwebmodule.php or AboutWebmodule.php)
    • FullwebWebModule.php (NOT FullWebModule.php or FullwebWebmodule.php)
    • SiteNewsWebModule.php (NOT siteNewsWebModule.php or Sitenewswebmodule.php)
  • Template files go into the templates folder. There should be a .tpl for each page of the module. At minimum there should be an index.tpl which represents the default page (unless the module alters that behavior). Each page should be in all lower case.
  • If you are overriding a project module you only need to include the pages that you are overriding.
  • You may choose to place additional css style sheets in a folder named css
  • You may choose to place additional javascript scripts in a folder named javascript
  • You can provide default configuration files in a folder named config

site folder에 다른 모듈을 생성함으로서 included된 모듈의 behavior를 override 하는 것이 가능합니다. 좀 더 자세한 사항은 Extending an existing module를 보세요. 

Site folder

site folder에는 각 site를 위한 폴더 모임들이 있습니다. 이렇게 함으로서 각 사이트들은 각각 다른 configuration, design, custom code 등을 가질 수 있습니다. 처음 제공되는 디폴트 파일에는 한개의 active site만 있습니다. root Kurogo directory의 config/kurogo.ini file에서 active site를 설정하실 수 있습니다. 여기서 폴더의 이름은 kurogo.ini 파일에 있는 ACTIVE_SITE와 일치해야 합니다.

Multiple site folder는 사이트를 각각 다른 버전으로 개발하고 싶은 경우에 유용하게 사용될 수 있습니다. 각각의 사이트에는 아래와 같은 디렉토리들이 있습니다.

  • app - Site specific templates and modules. Inside this folder you will find 2 folders
    • common - Site specific common templates and css
    • modules - Site specific modules. To promote ease when updating the framework to new versions, it is important that you keep site specific modules in this folder rather than in the root app/modules folder. If you wish to include your work in Kurogo, please see GitHub Repository. Also see Extending an existing module.
  • cache - Contains server generated files that are cached for performance. This folder is created as needed, but must be writable by the web server process.
  • config - Contains the site specific configuration files in .ini format. Many of these files can be managed using the Administration Module
    • site.ini - The general configuration file that affects all site behavior such as timezone, log file locations, database configuration, and more.
    • acls.ini - Site wide access control lists
    • authentication.ini - The configuration for user Authentication.
    • strings.ini - a configuration file containing strings used by the site
    • Each module’s configuration is contained a folder named by its module id. There are several standard files for each module:
      • module.ini - Settings for disabling, access control, search and module variables and strings
      • feeds.ini - Specifies external data connections
      • pages.ini - Titles for each page
      • Modules may have other config files as needed
  • data - a folder that contains data files meant to be used by the server. Unlike cache folders, these files cannot be safely deleted. Examples would include data that is not able to be generated from a web service, SQLite databases, or flat authentication files. It is also possible that certain deployments would have nothing in the data folder.
  • lib - an optional folder that contains code libraries used by site modules. The Kurogo autoloader will discover and find classes and packages in this folder.
  • logs - Log files
  • themes - Contains the themes available for this site. Each theme folder contains a common and modules folder that contains the CSS and image assets for the site. See Templates for more information.

WWW Folder

www폴더에 있는 파일과 폴더들은 사이트의 기본 위치인 DocumentRoot 에 있는 겁니다. 바로 대문 앞에 있는 것이죠. 이 구조를 잘 유지하시려면 모든 request,들은 index.php file을 통해서 전달되도록 하셔야 합니다. (예외인 경우는 min이나 minify url 처럼 이미 존재하는 path 나 폴더들일 경우입니다.)

index.php

이 index script 는 프레임워크의 메인 controller입니다. 모든 request들은 .htaccess를 override하고 아파치의 경우 mod_rewrite 를 그리고 IIS의 경우 URL Rewrite extension 사용해서 처리 됩니다. .htaccess file 은 모든 request들을 rewrite 합니다. request된 path를 포함한 $_GET variable _path 등을 rewrite 한느 것이죠. 예를 들어 http://server/module/pagehttp://server/index.php?_page=module/page가 됩니다. $_GET이나 $_POST 변수의 다른 추가적인 데이터도 가능합니다. 좀 더 자세한 사항은 Handling Requests 을 보세요


반응형

'WEB_APP > Kurogo' 카테고리의 다른 글

Kurogo Tutorial 11 - News Module -  (0) 2012.05.17
Kurogo Tutorial 10 - Module 만들기 -  (0) 2012.05.13
Kurogo Tutorial 09 - MAP Module -  (0) 2012.05.12
Kurogo Tutorial 08 - Configuration-  (1) 2012.05.11
Kurogo Tutorial 07 - Device Detection -  (0) 2012.05.09
Kurogo Tutorial 05 - 모듈 생성하기 -  (0) 2012.05.08
Kurogo Tutorial 04  (0) 2012.05.08
Kurogo Tutorial 03  (1) 2012.05.08
Kurogo Tutorial 02  (0) 2012.05.08
Kurogo Tutorial 01  (0) 2012.05.04

Kurogo Tutorial 05 - 모듈 생성하기 -

2012. 5. 8. 23:32 | Posted by 솔웅


반응형

Making Your First Module - Hello World


이 섹션에서는 모듈 생성 과정에 대한 overview를 보여 드릴 겁니다. 그냥 따라하시기만 하시면 됩니다. 좀 더 자세한 테크닉을 원하시면 Creating a new module  를 보세요.이 섹션에서 설명된 대부분의 내용은 좀 더 자세한 설명들이 Documentation 안에있습니다.

 

Case Sensitivity

일단 대소문자 구분을 한다는 것을 명심해 두세요. 많은 개발자들이 대소문자 구분을 하지 않는 파일 시스템을 사용하고 있습니다. 대부분의 서버들 특히 리눅스 베이스 서버들은 대소문자를 구분하는 파일 시스템을 사용하고 있습니다. 그렇기 때문에 폴더 위치나 url을 사용할 때 이 규칙을 따르는 것은 매우 중요합니다. 웬만하면 폴더나 url들은 소문자를 사용하시면 좋습니다.


Creating the module folder structure

Noteinstallation steps 을 따라서 설치하고 site folder도 생성한 상태여야 합니다. SITE_DIR 은  site/YOURSITE 로 돼 있어야 합니다. YOURSITE는 여러분이 생성한 사이트의 이름입니다.

Kurogo 프레임워크는 다양한 위치에 모듈 데이터를 생성할 수 있습니다. (see Source code tour) 일단 여러분의 모듈들을 여러분 사이트의 app/modules folder에 생성하세요. Kurogo 모듈로서 이미 사용되고 있는 폴더를 /app/modules 에 넣지 마세요.


 

  • SITE_DIR/app/moduleshello 라는 폴더를 만드세요. 
  • SITE_DIR/app/modules/hello folder 안에templates 라는 폴더를 만드세요.

Creating the module class file

hello directory 안에 HelloWebModule.php 라는 파일을 만드세요. 그리고 아래 내용을 그 파일안에 작성하세요.

<?php

class HelloWebModule extends WebModule
{
  protected $id='hello';
  protected function initializeForPage() {
    $this->assign('message', 'Hello World!');
  }
}

Creating the template file

hello/templates directory 안에 index.tpl 라는 파일을 만들고 아래 내용을 넣으세요. 

{include file="findInclude:common/templates/header.tpl"}

<h1 class="focal">{$message}</h1>

{include file="findInclude:common/templates/footer.tpl"}

이제 폴더 구조가 아래처럼 됐을 겁니다.



Creating the nav bar image

56 x 56 PNG file 을 만들고 title-hello.png 라고 이름을 넣어 주세요. 그리고 이 이미지 파일을 아래 폴더에 넣어주세요.  SITE_FOLDER/themes/default/common/images/compliant.

Creating the config folder

이 모듈을 로드하기 위해 configuration 폴더가 필요합니다.

  • SITE_FOLDER/config 안에 hello 폴더를 생성하세요
  • SITE_FOLDER/config/hello/module.ini 파일을 생성하시고 아래와 같이 내용을 넣으세요. 
[module]
title="Hello"
disabled = 0
protected = 0
search = 0
secure = 0

Viewing the module

여기까지만 하면 여러분의 웹 브라우저에서 여러분의 새로운 모듈을 보실 수 있을 겁니다. 여러분 사이트가 8888이라고 가정하고 여러분의 컴퓨터의 브라우저에 http://localhost:8888/hello 를 넣으세요. 성공했다면 아래와 같은 화면을 보실 수 있을 겁니다.

 




축하드립니다. 방금 아주 간단한 모듈을 직접 만드셨습니다.



반응형

'WEB_APP > Kurogo' 카테고리의 다른 글

Kurogo Tutorial 10 - Module 만들기 -  (0) 2012.05.13
Kurogo Tutorial 09 - MAP Module -  (0) 2012.05.12
Kurogo Tutorial 08 - Configuration-  (1) 2012.05.11
Kurogo Tutorial 07 - Device Detection -  (0) 2012.05.09
Kurogo Tutorial 06 - 소스 코드 여행 -  (0) 2012.05.08
Kurogo Tutorial 04  (0) 2012.05.08
Kurogo Tutorial 03  (1) 2012.05.08
Kurogo Tutorial 02  (0) 2012.05.08
Kurogo Tutorial 01  (0) 2012.05.04
Kurogo Platform Demo 체험기  (0) 2012.04.25

Kurogo Tutorial 04

2012. 5. 8. 23:03 | Posted by 솔웅


반응형

Upgrading from Previous Versions

Kurogo는 간단하고 쉽게 업그레이드를 할 수 있도록 디자인 됐습니다. 이전에 소개했던 대로 사이트를 생성하고 extension 했다면 여러분의 customizations를 overwrite 할 필요 없이 간단하게 Kurogo new version을 업데이트 할 수 있습니다.

If you have forked the git repository

Git은 새로운 변경사항을 쉽게 implement 하도록 해 줍니다. 여러분은 단지 master repository로부터 간단하게 변경된 사항들을 pull down 해서 여러분의 repository에 merge 하시면 됩니다.

  1. In your repository, set up an upstream remote:
    • git remote add upstream git://github.com/modolabs/Kurogo-Mobile-Web.git
    • git fetch upstream
  2. When new changes come down you can run:
    • git fetch upstream
    • git merge upstream/master Merge changes into your master branch

여러분의site folder에서만 작업이 이루어 졌다면 이 버전 업데이트 작업은 깨끗하게 완료 될 겁니다.

If you used a downloaded version

git을 사용하지 않는다면 새 버전을 다운로드 받으시고 여러분의 site folder에 복사해 넣으시면 됩니다. 주의하셔야 할 점은 여러분의 kurogo.ini file은 사용하시던 것을 그대로 유지 하셔야 합니다.




MultiSite

MultiSite는 Kurogo의 한 기능입니다. 이것을 사용하면 한 서버에서 여러개의 Kurogo site folder를 host 할 수 있도록 해 줍니다. 각각의 사이트는 나름대로의 configuration files, cache folders, themes, custom modules들을 가질 수 있습니다. 그리고 그 사이트들은 하나의 같은 Kurogo code를 공유를 합니다. 이 기능은 여러분의 사이트를 다국어로 서비스 할 때 유용하게 이용하실 수 있을 겁니다.

MultiSite는 각각의 site 를 subpath로서 관리하면서 구현됩니다. 예를 들어 2개의 en, es 사이트가 있다면 다음과 같은 방법으로 이 사이트들에 access 될 수 있습니다. (home 모듈에 access 하는 방법을 예로 들었습니다.)

Setting up MultiSite

multi site를 사용하시려면 Kurogo가 반드시 여러분 도메인의 root로서 설정 돼 있어야 합니다. 만약에 Kurogo를 subpath로 설정하면 MultiSite가 제대로 작동을 안 할 겁니다.

MultiSite를 셋업하려면 먼저 config/kurogo.ini file에서 이 부분을 세팅해야 합니다.

  • Open up config/kurogo.ini. If it does not exists, copy kurogo-default.ini to kurogo.ini
  • Set MULTI_SITE = 1 in the [kurogo] section
  • Set DEFAULT_SITE to the default site you want people to see when they visit your site. For example DEFAULT_SITE=”en”
  • For added security and performance, you can set a series of ACTIVE_SITES[] values for each site that you wish to expose.
ACTIVE_SITES[] = "en"
ACTIVE_SITES[] = "es"

이렇게 설정하면 이 서버에서는 en 과 es 로 이루어 지는 MultiSite를 사용하실 수 있게 됩니다. 




반응형

Kurogo Tutorial 03

2012. 5. 8. 10:45 | Posted by 솔웅


반응형

Setup and Installation

Kurogo는 PHP 웹 어플리케이션 입니다. 당연히 웹 서버에 인스톨 되어야 겠죠. 현재까지는 2 종류의 웹 서버를 지원하고 있습니다.

System Requirements

  • Web Servers supported
  • PHP 5.2 or higher with the following extensions:
    • zlib
    • xml
    • dom
    • json
    • PDO (Used for Database Access)
    • mbstring
    • Zip (needed if parsing KMZ files)
  • Some PHP modules are optional depending on whether you need their backend functionality
    • LDAP



Installation

이 튜토리얼은 여러분이 기본적인 시스템을 가지고 있고 웹 서버 관리에 대한 기본적인 지식을 가지고 있는 것을 상정하고 작성했습니다. 좀 더 자세한 사항은 여러분의 시스템과 웹 서버 설명서를 참조하세요.

  1. Kurogo 파일을 웹 서버가 접근 가능한 위치에 넣으세요.
  2. 웹서버의 루트 폴더를 Kurogo의 www 폴더로 잡아 주세요.(Using Kurogo in a subfolder of a domain 을 보세요.)
  3. (Apache Only) .htaccess files 이 사용 가능해야 합니다.  적어도 FileInfo 에는  AllowOverride 가 세팅되 있어야 합니다. (MAMP on OS X 에는 이 기능이 디폴트로 설정 돼 있습니다. )
  4. (IIS Only) 전체 프로젝트 폴더에 Application Pool 이 read access 가 가능해야 합니다.  In IIS 7.5 this is the IIS AppPoolDefaultAppPool user
  5. site directory에, make a copy of the Universitas folder 를 그 안의 파일들까지 모두 복사해서 하나 더 만드세요. 여러분의 site name으로 사용할 이름을 그 폴더이름으로 사용하세요. 이 폴더를 SITE_FOLDER 로 사용할 겁니다.

    • Critical: 웹서버 유저는 SITE_FOLDER 내의 모든 파일에 쓰기 가능으로 설정 돼 있어야 합니다. (Apache typically: apache or www, IUSR on IIS) 
  6. kurogo-default.ini file 을 kurogo.ini 라는 이름으로 하나 더 복사해 넣으세요.
  7. 그 kurogo.ini file 의 ACTIVE_SITE option 을 SITE_FOLDER 하고 같게 설정하세요.
  8. 웹서버를 restart 하고  http://yourhost/admin 를 브라우저에서 불러보세요.

Using Kurogo in a subfolder of a domain

특정 환경에서는 Kurogo 가 도메인의 root 가 아니라 URL로 install 되어야 필요가 있습니다. 이렇게 하기 위한 몇가지 방법이 있습니다.

  • Unix environment 에서는 symbolic links 사용하기
  • IIS 에서는 Virtual Folders 사용하기 (requires manual configuration change)
  • 윈도우에서는 Junctions 사용하기

Note. Apache aliases는 aliases 와 mod_rewrite 를 실행하는데에는 지원하지 않습니다.

Using Virtual Folders in IIS

윈도우즈 환경에서 IIS 웹서버를 사용하신다면 virtual folder에 Kurogo를 인스톨 해야 합니다. 이렇게 하면 document root가 아닌 경로에서도 Kurogo를 사용할 수 있습니다. 이렇게 사용하기 위해서는 아래와 같이 하시면 됩니다.

  • kurogo www folder를 가리키는 vitual folder를 생성하세요.
  • Kurogo project folder에서 config/kurogo.ini 를 오픈하세요. 이 파일이 없으면 kurogo-default.ini를 복사해서 사용하시면 됩니다.  
  • [kurogo] section 에서, URL_BASE option의 주석을 풀고 해당 경로를 세팅해 주세요. 예를 들어 여러분의 사이트가  /kurogo 에 인스톨 돼 있으면 다음과 같이 세팅하시면 됩니다.  URL_BASE=”/kurogo”

Using Junctions in Windows

The following procedure should work in either IIS or Apache, however it is recommended to use Virtual Folders in IIS

아래 절차들은 IIS나 아파치 모두에서 작동합니다. 어쨌든 IIS에서는 Virtual Folder를 사용할 것을 권장합니다.

  •  서버에 junction program이 인스톨 되어 있어야 합니다. 이것은 마이크로 소프트 (Microsoft) 에서 배포합니다. 그리고 이 글을 쓰는 시점에는 다음 링크에서 받으실 수 있습니다. http://technet.microsoft.com/en-us/sysinternals/bb896768
  • junction program이 PATH내에 위치해 있어야 합니다. 대부분의 경우 junction.exe 파일을 시스템 루트 폴더 (C:Windows)에 카피해서 넣으면 됩니다.
  • same NTFS filesystem. 의 2개 path들 사이에 junction들을 생성하실 수 있습니다. FAT32로 포맷된 volumes 나 on volumes 사이에 junctions를 생성하실 수 없습니다.

아래와 같이 명령창에서 실행해 보세요. (조건에 따라 약간씩 다를 수 있습니다.)

junction C:\path\to\documentroot\mobile C:\path\to\kurogo\www


여기서는 subfolder 이름이 mobile이라는 것으로 가정했습니다. 폴더 이름은 임으로 정하시면 됩니다.

Common Installation Problems

설치하는 과정에서 문제가 발생할 수 있습니다. 대부분의 문제는 셋업이 제대로 안 됐거나 다른 요건들이 충족되지 않아서 입니다.

Apache: Viewing any of the modules results in a 404 Not Found error

설치 후 브라우저에서 열어봤는데 404 에러가 나올 수 있습니다. 이것은 Kurogo가 작동하고 있지만 .htaccess 파일을 Kurogo가 제대로 읽을 수 없기 때문입니다.


  • mod_rewrite 가 enabled 되 있어야 합니다. 이것은 httpd.conf 파일에서 enableing mod_rewrite 의 주석을 제거해 주시면 됩니다. 이 httpd.conf 가 어디에 있는지 아시려면 설치한 서버에서 제공하는 instructin을 참조하세요.
  • AllowOverride를 FileInfo나 All로 세팅해야 합니다. AllowOverride는 아파치가 .htaccess 파일을 읽을 수 있도록 해 주는 옵션입니다. 어떤 경우에슨 디폴트로 이것이 disabled 된 경우가 있습니다. (NONE으로 세팅되 있음) httpd.conf나 virtual host configuration에서 이 부분을 확실하게 enabled 시켜야 합니다.

Kurogo Error messages are shown as an Apache error message

에러메세지가 아파치 Apache 메세지 처럼 보인다면 아마도 서버가 /error urls 로 trapping 되고 있기 때문일 겁니다.

  • httpd.conf 나 virtual host configuration 파일에서 Alias /error 라인을 제거해 주세요.


반응형

Kurogo Tutorial 02

2012. 5. 8. 09:27 | Posted by 솔웅


반응형

Version History

Kurogo는 꾸준히 개선되고 있습니다. 아래 내용은 각 버전별 개선된 사항들 입니다. release notes에 대해 좀 더 자세히 알고 싶으시면 CHANGELOG file을 보세요.

Version 1.4 (March 5, 2012)

  • NEW Module: Athletics
  • NEW Module: Photos
  • Updated Map module
  • SOAP과 Database retrieval 메소드, 복잡한 데이터 모델을 좀 더 지원하기 위해 Data Retrieval classe 들 개선
  • 클라이언트 사이드 caching headers 개선
  • Added support for in-memory caching of Kurogo data structures using Memcache or APC.
  • Added developer support for encrypting data on disk (requires mcrypt)
  • Added option to locally save user credentials so they can be passed on to external services
  • Added support for Google Analytics domain names
  • Added support to show emergency notifications on the home screen
  • Federated search queries will now happen asynchronously on compliant devices.
  • Added support to create copied modules from the admin console.
  • Added support to remove modules from the admin console

Version 1.3 (October 13, 2011)

Version 1.2 (July 19, 2011)

Version 1.1 (June 1, 2011)

Version 1.0 (April 8, 2011)

Initial Release


============ o ============= o ================ o ==============

Getting Support

Kurogo 는 오픈소스 프로젝트이기 때문에 특별히 공식적인 지원은 없습니다. 단지 여러 비공식적으로 질문을 받고 지원을 하는 통로들이 있을 뿐입니다. 개별적인 지원을 받으시려면 유료 지원 서비스를 이용하실 수 있습니다.

Kurogo Google Group

사용자들에 대한 지원을 위해 Kurogo-dev라는 구글 그룹을 만들었습니다. 이 그룹에는 사용자들이 질문과 답변을 공유할 수 있는 메일링 리스트가 포함되 있습니다. 이 리스트는 Modo Labs의 구성원들 (Kurogo code 유지 보수 인력)에 의해 모니터 되고 있습니다. 답변은 공식적인 것이 아니고 구성원들간 자유롭게 주고 받는 메세지 입니다.

http://groups.google.com/group/kurogo-dev
kurogo-dev@googlegroups.com


Github Issues


버그를 발견하시면 아래 github 페이지에 그 내용을 올려 주세요.

https://github.com/modolabs/Kurogo-Mobile-Web/issues

Training and Support Through Modo Labs

좀 더 공식적인 지원을 원하시는 사용자는 sales@modolabs.com 로 연락 주시기 바랍니다. 공식적인 지원 내용은 아래와 같습니다.

•Initial Developer Training. Learning the framework, module development, theme design.
•Ramp up/implementation support
•Production / incident support


Professional Services

Modo Labs는 새로운 모듈이나 integration , user experiencce 그리고 인터페이스 디자인 등 좀 더  기술적인 요구가 있는 분들을 도와드리기 위해 professional development와 design service를 제공해 드릴 수 있습니다. 좀 더 자세한 정보는 sales@modolabs.com 로 연락 주세요.

============ o ============= o ================ o ==============


GitHub Repository




Kurogo 는 오픈 소스 프로젝트 입니다. 공짜로 다운로드 받을 수 있고 마음대로 소스를 수정해서 사용하실 수도 있ㅅ브니다. 이 프로젝트는 Git distributed version control system을 사용하고 있습니다. Git repository는 GitHub에서 운영하는 겁니다. 아래 웹사이트에서 만나실 수 있습니다.
https://github.com/modolabs/Kurogo-Mobile-Web

Git이나 GitHub가 생소하신 분은 GitHub Help Site를 먼저 보시기 바랍니다.

Forking and Managing your repository


간단하게 코드만 다운로드 받고 싶으신 분은 git clone git://github.com/modolabs/Kurogo-Mobile-Web.git 을 사용한 repository를 clone 하시면 됩니다.

만약 당신의 프로젝트를 maintaining 하시는데 관심이 있으시다면 그 프로젝트를 fork 하셔야 합지다.

1. GitHub 에 로그인 하기
2. https://github.com/modolabs/Kurogo-Mobile-Web 로 가기
3. 우상단에 있는 fork icon을 클릭하기
4. (Optional) 여러분 프로젝트 이름을 바꿀 수도 있습니다.
5. 여러분 로컬 컴퓨터에 프로젝트 clone 하기
6. Set up an upstream remote:
   ◦ git remote add upstream git://github.com/modolabs/Kurogo-Mobile-Web.git
   ◦ git fetch upstream
7. 변경할 내용이 있으면 아래와 같이 하면 됩니다.
   ◦ git fetch upstream Get updates to the upstream remote
   ◦ git merge upstream/master Merge changes into your master branch


다른 방법으로 여러분의 repository를 관리하는 방법이 있을겁니다. 하지만 이 방법으로 하면 좀 더 유연성있게 운영할 수 있습니다.

Creating your site

여러분의 프로젝트에는 master project에 있지 않은 elements (i.e. 이미지들이나 CSS assets 같은 것들)이 포함되어 있기 때문에 별도의 upstream branch를 유지할 것을 권장합니다. 이 branch는 clean 하게 남아 있을것이고 여러분의 master branch에 merge 될수도 있을겁니다. upstream branch를 생성함으로서 변경 이전 버전으로 돌아가는 기능도 아주 깨끗하게 처리할 수 있게 됩니다.

여러분의 master branch로부터 site/universitas 폴더들의 copy를 만드세요. 이것은 teplate site입니다. 여러분 site에 걸맞는 이름으로 바꿔주세요. 대부분 이 폴더에서 여러분의 코딩이 이루어질 겁니다. 새로운 모듈을 생성한다던가 기존의 모듈을 extend 하고 여러분의 site를 theming 하는것에 대해 좀 더 알아 보시면 많은 도움이 될 겁니다. 여러분만의 특별한 필요가 있지 않는 한 여러분 site의 디렉토리 밖에 있는 file을 수정해야 될 필요는 없을 겁니다.

Submitting your changes

만약에 여러분이 프로젝트 내의 버그를 수정했거나 새로운 기능을 추가해서 공유하고 싶으시면 여러분은 pull request 를 submit 할 수 있습니다. 그러면 Kurogo의 project 유지보수 인력에게 그 사실이 통보 될 것이고 여러분은 이 Kurogo 프로젝트의 주요한 일 부분이 되시는 겁니다.

pull request를 initiate 할 때 아래 매너들을 따라 주실것을 간곡히 부탁드립니다.

1. 여러분의 upstream branch 가 최신버전이어야 합니다.
2. fixes/features 를 implements 해서 새로운 branchm를 만들어 주세요.
3. 여러분의 웹 브라우저로 여러분의 GitHub project를 browse 해 주세요.
4. 여러븐의 fix/feature가 있는 branch로 switch 해 주세요.
5. pull request icon을 클릭해 주세요.
6. 작업에 대한 description을 넣어 주세요. 자세한 사항이 기재돼 있지 않으면 여러분의 request 가 accept 되지 않을 수도 있습니다.
7. 만약 별도의 branch에서 pull request를 initiate 하지 않았다면 여러분은 change commits 버튼을 클릭하시고 여러분의 fix가 포함돼 있는 commit들을 선택하셔야 합니다.
8.변경이 다 완료 됐으면 send pull request 를 click 해 주세요.


request 할 때 꼭 프로젝트에서 변경된 부분과 관련된 사항만 request에 포함시켜 주세요. main branch 쪽 부분도 되도록 포함시키지 말아주시구요. 너무 광범위한 자료를 포함시키면 가끔 의도치 않게 코딩 스타일이나 여러분의 patch 등에 대한 부분만 논의 되다 끝날 수 있습니다.


반응형