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

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Virtual Events 알아보기

2012. 9. 30. 22:54 | Posted by 솔웅


반응형

Virtual Events


virtual event들을 사용하는 이유는 HTML element를 trigger 할 수 있는 손가락이나 mouse 와 관련된 이벤트들을 표준화 하기 위해서 입니다. 이러한 이벤트들은 서로 다른 이름들을 가지고 있습니다. (eg touchstart and click for click type events, or touchmove and mousemove to move type events) jQuery Mobile 은 virtual events라고  하는 것을 만들어서 이러한 이벤트들의 이름을 표준화 했습니다.


Virtual events

Name

Signification

vclick

Idem click. Warning: jQuery Mobile developers recommend not to use the vclick event when it produces a change in the display (eg click on a link that shows a new window), because the vclick event is sometimes triggered two times - instead of one - when set on a particular element. In these cases, they recommend using click instead. Apart from these elements that can cause problems, we will use vclick.

vmousemove

Idem mousemove.

vmouseover

Idem mouseover.

vmousedown

Idem mousedown.

vmouseup

Idem mouseup.

vmouseout

Idem mouseout.

vmousecancel

Idem mousecancel.


아래 예제는 윈도우에서 어떤 이벤트가 발생 했을 때 그 이벤트의 이름을 화면에 보여 줍니다.


Detect and display the virtual events


<!DOCTYPE html>

<html> 

<head> 

  <meta name=viewport content="user-scalable=no,width=device-width" />

  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />

  <script src=jquery.js></script>

  <script src=jquery.mobile/jquery.mobile.js></script>

</head> 


<body> 


<div id=home data-role=page id=home>

  <div data-role=header>

    <h1>Home</h1>

  </div>


  <div data-role=content>

    <p> Events </p>

  </div>

</div>


</body>

</html>


<script>


var $content = $("#home div:jqmData(role=content)");


$("#home").bind ("vmouseover", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vmousedown", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vmousemove", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vmouseup", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vclick", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vmouseout", function (event)

{

  $content.append (event.type + ", ");

});


$("#home").bind ("vmousecancel", function (event)

{

  $content.append (event.type + ", ");

});


</script>







convention04.html



반응형

네임 스페이스 사용하기

2012. 9. 30. 22:40 | Posted by 솔웅


반응형

Using NameSpace


jQuery Mobile 은 data 라는 글로 시작하는 수 많은 attributes 를 사용합니다. 예를 들어 data-role, data-icon, 등이 있습니다. 이러한 attributes들은 jQuery Mobile에서는 아주 의미 있는 것들입니다. 이러한 attribute들이 original HTML 코드를 좀 더 enhance 된  display 를 보여 주도록 합니다.


그런데 이렇게 jQuery Mobile 이 사용하고 있는 attribute들을 다른 library 도 한 두개 사용하고 있다면 어떻게 될까요? 그러면 OS에서는 혼동스럽겠죠.


이러한 문제를 해결하기 위해 jQuery Mobile은 namespaces를 사용합니다. 대부분 data 글자 다음에 추가 됩니다. 아마 data라는 글자로 시작하는 attributes를 가지고 있는 library들은 많을 겁니다. jQuery Mobile을 포함해서요. 하지만 data 뒤에 특별한 name space를 붙이면 같아지지 않겠죠. 예를 들어 data-role 이라는 이름이 중복되지 않게 하기 위해 data-my-role를  사용할 수 있겠죠. 여기서 가 나름대로의 namespace "my-"가 될 수 있을 겁니다.


Indicate the namespace in the HTML page


$.mobile.ns가 namespace로 사용됩니다.  만약 namespace 가 사용되지 않으면 jQuery Mobile은 "" 을 사용합니다. 즉 classic 한 data-role, data-icon, 등을 사용하게 되는거죠.


"ns1-" namespace를 사용하도록 할 수 있습니다.  namespace 끝에 "-"가  붙은것을 잘 봐 두세요. attributes에 space를 사용하지 않고 이것을 많이들 사용하죠.


Using the "ns1-" namespace

<!DOCTYPE html>

<html> 

<head> 

  <meta name=viewport content="user-scalable=no,width=device-width" />

  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />

  <script src=jquery.js></script>

  <script>

    $(document).bind ("mobileinit", function ()

    {

      $.mobile.ns = "ns1-";

    });

  </script>  

  <script src=jquery.mobile/jquery.mobile.js></script>

</head> 


<body> 


<div id=home data-ns1-role=page id=home data-ns1-theme=e>

  <div data-ns1-role=header>

    <h1>Home</h1>

  </div>


  <div data-ns1-role=content>

    <p> Window content </p>

  </div>

</div>


</body>

</html>



$.mobile.ns
의 값을 바꾸기 위해 mobileinit event를 사용했습니다. 그리고 그 값을 jQuery Mobile에서 사용하도록 만들었죠.


그리고 나서  data-ns1-role (instead of data-role) 과 data-ns1-theme (rather than data-theme) attributes 들을 사용합니다. 만약 여기서 data-roledata-theme attributes들을 사용하면 작동되지 않을 겁니다.





Access to the attribute in JavaScript code


data-role attribute 가 namespace "ns1-"를 사용해서 data-ns1-role로 사용되는 것을 위에서 보셨습니다. 그렇게 하면 자바스크립트 안에서 data-ns1-role attribute name을 사용할 수 있게 되는 건데요.  아래와 같이도 사용할 수 있습니다.


First form of writing (to be avoided)

alert ($("div#home").attr ("data-ns1-role"));

위와 같이 namespace를 사용할 수도 있고,


Second form of writing (best)

alert ($("div#home").attr ("data-" + $.mobile.ns + "role"));

위와 같이 원래의 $.mobile.ns 를 사용할 수 있습니다.


두번째 것은 namespace 값을 사용하지 않은 거죠. 이렇게 하면 나중에 namespace를 한꺼번에 바꾸어야 될 때 유용하겠죠. 즉 유지, 관리가 용이하게 됩니다.


또한 jQuery Mobile 에서는 이 writing 을 좀 더 간편하게 사용하도록 하는 메소드를 제공하고 있습니다. jqmData (name) method가 그것입니다.


Third form of writing (optimal)

alert ($("div#home").jqmData ("role"));


jqmData (name) method는 "data-"name스트링과 함께 namespace의 연속성을 허용하고 해당 attribute의 값을 retrieve 합니다.  그 attribute 값의 retrieve를 위한 attr () jQuery method는 더이상 사용하지 않습니다.  jqmData () method로 교체 됐죠.


jqmData (name) and jqmData (name, value) methods


jqmData () methods를 사용하는 목적은 jQuery attr () method를 사용하지 않고 해당 attribute들을 관리할 수 있도록 하기 위함 입니다.


Methods managing attributes

Method

Signification

jqmData (name)

Get the value of the data-xxx-name attribute, for example data-ns1-role.

jqmData (name, value)

Set the value of the data-xxx-name attribute, for example data-ns1-role.


Get the theme associated with the window

alert ($("div#home").jqmData ("theme"));


Set the theme associated with the window

$("div#home").jqmData ("theme", "a");


Access to the attribute in selectors


attribute들의 관리를 제대로 하기 위해 jQuery Mobile은 selector들을 사용할 때 이것을 manage 할 수 있도록 방법을 제공하고 있습니다. 여기에 jqmData (value) pseudo-class를 생성하는 이유입니다.


First form of writing (to be avoided)

alert ($("div[data-ns1-role=page]").html ());

위와 같이 하는 대신에 아래와 같이 할 수 있습니다.


Second form of writing (best)

alert ($("div[data-" + $.mobile.ns + "role=page]").html ());


jqmData (value) pseudo class와 같이 사용하면 아래와 같이 됩니다.


Third form of writing (optimal)

alert ($("div:jqmData(role=page)").html ());


여기서 value parameter는 "role=page" 입니다. data-role attribute (including any namespace)가 "page"<div> elements 를 get 하기 위함이죠.


만약 "role" string 만 사용한다면 data-role attribute가 있는 모든 <div> elements 들을 retrieve 할 겁니다.


All <div> elements with the data-role attribute set to any value

alert ($("div:jqmData(role)").length); // 3 elements: page, header, content


All <div> elements with the data-role attribute set to "page"

alert ($("div:jqmData(role=page)").length); // 1 element: page


반응형

Configuration Options

2012. 9. 29. 05:43 | Posted by 솔웅


반응형

Configuration Options



mobileinit event는 jQuery Mobile configuration options를 바꿀 수 있는 마지막 instant 입니다. 대부분의 옵션들에 대해 이 때 수정할 수 있습니다. 일부 이벤트들은 이 mobileinit event가 지나도 바꿀 수 있는 것들이 있습니다면 어쨌든 그 값들을 바꾸기 위해서는 항상 mobileinit event를 사용합니다. 만약 이 기간동안에 어떤 option의 값이 바뀌지 않으면 jQuery Mobile은 디폴트 값을 할당 합니다.


대부분의 이 option들은 jQuery Mobile에 의해 attribute들로 정의 됩니다.  예를 들어 data-icon, data-transition, data-back-btn-text, etc.. 같은 것 들이죠. HTML 코드에 이 attribute 값들이 정의되어 있지 않다면 디폴트 값이 할당 됩니다. 이 디폴트 값들이 mobileinit event이 진행되는 동안에 수정되어 질 수 있는 값들입니다.


General options


이 option들은 $.mobile object의 프로퍼티들입니다. 예를 들어 ns option은 $.mobile.ns 로 연결 되는 식이죠.


General options


Option

Signification

ns

Defines the namespace (see next section). Default "" (no namespace).

activePageClass

CSS class added to the <div> defining the window when it becomes active. Default "ui-page-active".

ajaxEnabled

Boolean indicating whether the HTML pages are retrieved by Ajax (if true) or not (if false). Default true. If the pages are not retrieved by Ajax, the previous windows are removed from the DOM.

defaultPageTransition

Default transition between two windows. Default "slide".

defaultDialogTransition

Default transition between two windows, one of which is superimposed. Default "pop".

loadingMessage

Message displayed to indicate that a HTML page is being loaded. Default "loading". This option can be changed outside the mobileinit event processing.

pageLoadErrorMessage

Message displayed to indicate an HTML page could not be loaded successfully. Default "Error Loading Page".

autoInitializePage

Boolean indicating if we let jQuery Mobile make himself the first window display. If true (default) the $.mobile.initializePage () is automatically called by jQuery Mobile allowing to display the first window. If false, it will be in our program to do this first viewing (calling ourselves the $.mobile.initializePage ()).


Options managing windows


이 옵션들은  $.mobile.page.prototype.options의 프로퍼티 들입니다. 예를 들어 backBtnText option은  $.mobile.page.prototype.options.backBtnText로 연결 되는 식이죠


Options managing windows


Option

Signification

backBtnText

Sets the text displayed on the Back button. Default "Back".

addBackBtn

Boolean indicating whether the Back button will be displayed in the window. Default false (not displayed).

backBtnTheme

Theme ("a", ..., "e") associated with the Back button. Default null, indicating to use the theme of the enclosing element.

keepNative

Selector specifying the HTML elements that should not be changed by jQuery Mobile into another HTML code. By default those whose data-role attribute is "none" or "nojs".

domCache

Boolean indicating whether the window should be stored in the DOM tree after it is no longer visible. This option only manages the windows that are not already present in the HTML page, ie those recovered by jQuery Mobile via Ajax. Default false (the windows loaded later are removed from the DOM when they become hidden).

theme

Theme ("a", ..., "e") associated with the window. Default "c".

headerTheme

Theme ("a", ..., "e") associated with the title bar. Default "a".

footerTheme

Theme ("a", ..., "e") associated with the bar at the bottom of page. Default "a".

contentTheme

Theme ("a", ..., "e") associated with the contents of the window. Default "".


Options managing lists


이 옵션들은 $.mobile.listview.prototype.options의 프로퍼티들입니다. theme option 같은 경우엔 $.mobile.listview.prototype.options.theme 이런 식으로 사용하시면 됩니다.


Options managing lists


Option

Signification

initSelector

Selector for finding lists in the HTML page. Default "jqmData (role='listview')".

theme

Theme ("a", ..., "e") associated with list items. Default "c".

countTheme

Theme ("a", ..., "e") associated with HTML elements with "ui-li-count" CSS class. Default "c".

dividerTheme

Theme ("a", ..., "e") associated to list items with the data-role="list-divider" attribute. Default "b".

filterTheme

Theme ("a", ..., "e") associated with the search field in the list.

inset

Boolean indicating whether the lists should be displayed with rounded edges. Default false.

filter

Boolean indicating whether to display a search field for list items. Default false.

filterPlaceHolder

String displayed in the search field of a list with the attribute data-filter="true". Default "Filter items ...".


Options managing navigation bars


이 옵션들은 $.mobile.navbar.prototype.options의 프로퍼티 들입니다. iconpos option 같은 경우엔 $.mobile.navbar.prototype.options.iconpos 이런 식으로 사용하시면 됩니다.


Options managing navigation bars


Option

Signification

initSelector

Selector for finding navigation bars in the HTML page. Default "jqmData (role='navbar')".

iconpos

Indicates the position of the icon ("top", "right ","bottom","left") when present in the buttons on the navigation bar. By default "top".

grid

Specifies the maximum number of buttons that may appear in a line of the navigation bar ("a" for 2 buttons max, "b" for 3, "c" for 4 and "d" for 5. By default null, indicating the place buttons at best.


Options managing buttons


이 옵션들은 $.mobile.button.prototype.options의 프로퍼티 들입니다. theme option 같은 경우엔 $.mobile.button.prototype.options.theme이런식으로 사용하

Warning: 이 옵션들은 button() method 를 사용해서 버튼을 생성하면 해당 account 에 적용 됩니다.


Options managing buttons


Option

Signification

initSelector

Selector for finding buttons in the HTML page. Default "button, [type='button'], [type='submit'], [type='reset'], [type='image']".

theme

Theme ("a", ..., "e") associated with buttons. Default null, indicating to use the theme associated with the enclosing element.

icon

Icon associated with buttons. Default null (no icon).

iconpos

Position of the icon in buttons, when present. Default "left".

inline

Boolean indicating whether the width of the button adapts to its contents (if true), or falls of the width of the window (if false). Default false.

corners

Defines if the buttons have rounded edges (if true) or rectangular (if false). Default true (rounded edges).

shadow

Boolean indicating whether a shadow is associated with buttons. Default true (shaded buttons).

iconshadow

Boolean indicating whether a shadow is associated with the icons on the buttons. Default true (has shadow).


Options managing input fields


이 옵션들은 $.mobile.textinput.prototype.options의 프로퍼티 들입니다. theme option의 경우 $.mobile.textinput.prototype.options.theme이렇게 사용하시면 됩니다.


Options managing input fields


Option

Signification

initSelector

Selector for finding input fields in the HTML page. Default "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea".

theme

Theme ("a", ..., "e") associated with input fields. Default null, indicating to use the theme associated with the enclosing element.


Options managing checkboxes and radio buttons


이 옵션들은 $.mobile.checkboxradio.prototype.options의 프로퍼티 들입니다. theme option의 경우 $.mobile.checkboxradio.prototype.options.theme 이렇게 사용하시면 됩니다.


Options managing checkboxes and radio buttons


Option

Signification

initSelector

Selector for finding checkboxes and radio buttons in the HTML page. Default "input[type='checkbox'], input[type='radio']".

theme

Theme ("a", ..., "e") associated with checkboxes and radio buttons. Default null, indicating to use the theme associated with the enclosing element.



Options managing selection list



이 옵션들은 $.mobile.selectmenu.prototype.options의 프로퍼티 들입니다. theme option의 경우 $.mobile.selectmenu.prototype.options.theme 이렇게 사용하시면 됩니다.


Options managing selection lists


Option

Signification

initSelector

Selector for finding selection lists in the HTML page. Default "select:not(:jqmData( role='slider'))".

theme

Theme ("a", ..., "e") associated with elements of the selection list. Default null, indicating to use the theme associated with the enclosing element.

icon

Icon in the button associated with the selection list. Default "arrow-d" (arrow down).

iconpos

Position of the icon in the button associated with the selection list ("top", "rght", "bottom", "left"). Default "right".

inline

Boolean indicating whether the button for the selection list adjusts in width to its contents (if true) or spreads over the width of the window (if false). Default false.

corners

Defines if the buttons associated with the selection lists have rounded edges (if true) or rectangular (if false). Default true (rounded edges).

shadow

Boolean indicating whether a shadow is associated with the buttons associated with selection lists. Default true (shaded buttons).

overlayTheme

Theme ("a", ..., "e") associated with the border around the elements of the selection list. Default "a".

nativeMenu

Boolean indicating whether the selection list is displayed natively (if true) or so improved by jQuery Mobile (if false). Default true (selection list displayed natively).


Options managing sliders


이 옵션들은 $.mobile.slider.prototype.options의 프로퍼티 들입니다. theme option의 경우 $.mobile.slider.prototype.options.theme 이렇게 사용하시면 됩니다.


Options managing sliders


Option

Signification

initSelector

Selector for finding sliders in the HTML page. Default "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')".

theme

Theme ("a", ..., "e") associated with the cursor moves on the slider. Default null, indicating to use the theme associated with the enclosing element.

trackTheme

Theme ("a", ..., "e") associated with the axis on which the cursor moves. Default null, indicating to use the theme associated with the enclosing element.


Options managing accordion menus


이 옵션들은 $.mobile.collapsible.prototype.options의 프로퍼티 들입니다. theme option 의 경우 $.mobile.collapsible.prototype.options.theme 이렇게 사용하시면 됩니다.


Options managing accordion menus


Option

Signification

initSelector

Selector for finding accordion menus in the HTML page. Default ":jqmData(role='collapsible')".

theme

Theme ("a", ..., "e") associated with the accordion menu. Default null, indicating to use the theme associated with the enclosing element.

iconTheme

Theme ("a", ..., "e") associated with the icons in the accordion menu. Default "d".

collapsed

Boolean indicating whether the menu should be closed or open at startup. Default true (closed menu).


반응형


반응형


jQuery Mobile initialisation



자바스크립트로 jQuery Mobile file을 include 하면 in it 이 실행 됩니다.  그리고 $.mobile object 가 생성되죠. $.mobile object 는 이전 글에서 보셨듯이 method들과 프로퍼티들을 가지고 있습니다. 그리고 다양한 객체들에 디폴트 값들이 할당되게 되죠. 예를 들어

  • The text on the Back button.

  • The CSS theme associated with this button ("a" to "e").

  • The icon displayed by default in the selection lists (ie set to arrow-d by default).

  • Etc..


이 옵션들에 대한 디폴트 값들은 바꿀 수 있습니다. 그런데 아무때나 바꿀 수 있는 것은 아니고 처음 시작될 때 특정 기간 안에 바꾸도록 해야 합니다. 그 기간을 놓쳐 버리면 그 디폴트 값들을 바꿀 수 있는 시간을 놓쳐 버리게 됩니다. 그 한정된 기간은 document object에 의해 mobileinit 이벤트가 reveived 될 때 시작합니다. 그러니까 우리는 이 이벤트의 treatment 내에 jQuery Mobile configuration option들의 디폴트 값을 바꿀 수가 있ㅅ브니다. 이 configuration option들에 대해서는 다음 글에서 다루겠습니다.

Let's see how to handle the mobileinit event:

그럼 어떻게 이 mobileinit 이벤트를 다루는지 볼까요?


Processing mobileinit event


<!DOCTYPE html>

<html> 

<head> 

  <meta name=viewport content="user-scalable=no,width=device-width" />

  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />

  <script src=jquery.js></script>

  <script>

    $(document).bind ("mobileinit", function ()

    {

      alert ("mobileinit");

    });

  </script>  

  <script src=jquery.mobile/jquery.mobile.js></script>

</head> 


<body> 


<div data-role=page id=home>

  <div data-role=header>

    <h1>Home</h1>

  </div>


  <div data-role=content>

    <p> Window content </p>

  </div>

</div>


</body>

</html>


<script>


$(document).ready (function ()

{

  alert ("DOM ready");

});


</script>



mobileinit 이벤트를 핸들링하는 코드 블럭의 위치를 잘 보세요. 이 코드는 반드시 jQuery Mobile Javascript 소스 (jquery.mobile-1.1.1.min.js, jquery.mobile.js ...) 를 넣기 전에 있어야 합니다. 만약 이 소스 다음에 mobileinit을 넣으면 jQuery Mobile은 mobileinit을 trigger는 하지만 그 코드를 위치한 그곳에서 그 trigger 가 일어나지 않습니다.

즉 위 코드에서 보면 alert 가 일어나지 않게 됩니다.



convention02.html



위 파일을 실행시켜 보면 mobileinit alert 가 먼저 뜨고 그 다음에 DOM ready alert 가 뜰 겁니다. 즉 mobileinit 이벤트가 먼저 실행 되고 나서 DOM 이 준비 된다는 얘기죠.






반응형


반응형
Posted on . Written by



아이폰 5, iOS6, 구글 맵 등등 화제거리가 많았죠? 일반적으로 잘 모르는 것 중 하나가 구글은 standard Android device에만 구글 맵을 제공하지 customized 된 Android 에는 구글 맵을 제공하지 않고 있습니다. 그래서 결국은 iPhone 5, Kindle Fire, Nook  같은 디바이스에서는 built-in 구글 맵을 서비스 받을 수가 없는 것이죠.



애플의 경우 구글 맵을 버리고 자체 개발한 맵을 사용하게 됐죠? 그런데 아마존이나 Barnes & Noble 같은 경우는 구글의 지배를 받고 있습니다. 그러니까 구글 맵을 사용할 수 없는거죠.(customization 하지 않을 경우)





(Incidentally, in the case of Apple, I think Google made a strategic blunder, perhaps suffering from some foresight. How magical would it have been for a Google Maps app for iOS to be formally announced a week after the iPhone 5 launch? Everyone would have cheered.)



Corona in daily build 903에서 Native Map view를 사용 가능하도록 했는데요, 킨들 파이어와 NOOK 까지 포함해서 모든 안드로이드 디바이스에서 구글 맵을 제공할 수 있는 방법을 찾았습니다. 저희가 standard Android API를 사용한다면 Kindle 과 NOOK은 구글의 정책에 따라서 native map view나 구글 맵을 사용하지 못할 겁니다. 저희는 안드로이드 기기에서 좀 더 native map view를 제대로 사용할 수 있는 방법을 찾기로 작정 했었죠. 그래서 저의만의 implementation을 개발했습니다. 이렇게 함으로서 단지 plain-vanilla Android device 뿐만이 아니라 Kindle 과 NOOK에서도 그 기능을 사용할 수 있게 됐습니다.



그리고 좋은 소식 하나 더 있는데요.




몇주전에 새로운 Kindle Fire HDs 가 나왔습니다. 성능대비 굉장히 매력적인 가격이죠. 이 Kindle Fire HDs는 customized 된 Android 4.x를 사용합니다. 그래서 저희들은 최근에 Android 4.x 버전에 대한 많은 이슈들을 해결했습니다. 그리고 daily build 909부터 시뮬레이터에 두개의 새로운 Kindle Fire HD 스킨을 추가했습니다. (하나는 7 인치짜리고 다른 하나는 9인치 짜리입니다.)  이제 코로나로 좀 더 많은 디바이스를 위한 앱을 개발 하실 수 있습니다.







Barnes & Noble 도 두개의 새로운 NOOK HD 모델들을 오늘 발표했습니다. 두달 전 저희들은 이 device들에 대해 짧게 경험할 기회가 있었습니다. 이제 실제 제품을 볼 수 있게 되서 아주 기쁩니다.



저희들은 이 새 NOOK에서도 잘 작동하는 코로나 앱을 만들 수 있도록 해야 되겠다고 생각했습니다. 저희가 처음 이 기기들에 대해 들었을 때 Barns & Noble 팀에게 저희들이 그 기기에 맞는 기능을 넣기 위해 그 쪽에서 준비해야 할 사항들을 알려 줬었습니다. 이러한 내용들이 다 적용되고 기존의 앱들이 별 일 없이 이들 기기에서 잘 돌아가기를 바랍니다. 만약 제대로 작동 되지 않는 경우가 있다면 저희들 쪽에서 기존의 코로나 앱들이 새로운 NOOK에서도 잘 돌아가도록 작업을 할 겁니다. 그래서 개발자 여러분들이 기존의 앱을 굳이 re-build 할 필요가 없도록 할 계획입니다.



이 기기들은 11월에 출시 됩니다. 아마 이번 겨울에는 아주 많은 HD 태블릿들이 나올 것 같습니다.

반응형


반응형

Posted on . Written by


다시 수요일의 FAQ 시간이 왔습니다. 이번주는 iOS builds, API documentation 과 안드로이드에 대해 자주 질문 되는 것들을 추려봤습니다.



1. I’m using build 922 and I’m getting a code signing error after an iOS build. What’s wrong?


build 922 부터 코로나는 iOS 6 SDK 에 대해 빌드 할 수 있도록 했습니다. 여기에는 Xcode 4.5 가 필요합니다. Xcode 가 4.5 이전 버전일 경우 이 에러메세지를 보시게 됩니다.



2. I see new APIs added to Corona but the API docs are not being updated.


web 상의 API documentation은 현재 릴리즈 된 버전 (2012.894) 에 대한 documentation 입니다. 이 API에 대한 documentation은 Daily Builds page의 zip 파일로 압축돼 있는 Daily Build 안에 추가되거나 수정 된 내용이 들어갑니다.



3. I’m trying to use File I/O on Android to read files and it’s not working. It does work in the Simulator and on iOS. Is this a bug?


Android APK 는 zip 파일 입니다. 리소스 디렉토리에 있는 파일들은 APK 파일 안에 들어가게 됩니다. 즉 zip 파일로 압축된다는 얘기죠. io.open() 같은 Lua I/O API는 zip 파일 안에 있는 파일들을 압축을 풀어서 오픈할 수가 없습니다. 그러니까 APK 안에 있는 파일을 오픈하지 못하는 겁니다.





그래서 저희들은 안드로이드와 관련해서 특별하게 동작할 수 있는 기능을 구현했습니다. system.pathForFile() 이라는 건데요. 특정 파일 타입에서 이 메소드는 자동으로 그 파일의 압축을 풀어서 outside 디렉토리에 copy를 합니다. 일종의 해킹이랄 수 있는데요. 좋은 방법은 아닙니다. 왜냐하면 storage 공간을 낭비하는 일이거든요. 어쨌든 이 방법으로 Lua I/O API들이 특정 파일 타입들에 access 할 수 있습니다.


system.pathForFile()은 다음과 같은 파일 형식을 제외한 파일 타입들을 자동 압축 해제 합니다. : 
 *.html
 *.htm
 *.3gp
 *.m4v
 *.mp4
 *.png
 *.jpg
 *.ttf


무슨 의미냐 하면요 위의 파일들은 Lua I/O API로 access 할 수 없다는 의미입니다. 다른 모든 파일들은 system.pathForFile()을 call 하면 자동적으로 압축을 풉니다. 이런 이유로 여러분은 여러분의 HTML file에 access 할 수 없는거죠. HTML 파일이 auto-extracted 되지 않는 이유는 HTML 파일에는 이미지들도 링크가 돼 있기 때문에 Corona 가 이 웹 페이지를 보이도록 하려면 이미지들 까지 auto-extract  해야 되기 때문입니다. 만약 그렇게 되면 이미지들은 아주 많은 저장공간을 차지하게 될 겁니다. 그래서 이 기능을 넣지 않는 겁니다.


위의 파일들에 access 하는 한 방법은 (e.g. png, jpg) file.png.txt 같이 rename 하는 겁니다. 그러면 특정 파일을 Documents나 Temporary 디렉토리에 copy 할 수 있을 겁니다. 그리고 나서 다시 원래대로 이름을 되돌리면 되겠죠. 용량이 큰 파일이라면 메모리 공간을 아주 많이 소비할 거라는 것을 명심해 두세요.



4. I’m displaying an image and trying to update it with a new image and it’s not updating. What’s wrong?


코로나는 파일 이름을 근거로 해서 이미지 데이터를 캐싱합니다. 똑 같은 이름으로 이미지를 로드하려고 한다면 그리고 이전 이미지가 현재 active 상황이라면 코로나는 이것을 같은 이미지로 생각할 겁니다. 그러면 이전 이미지를 사용하겠죠. 이런 상황은 서버에서 이미지를 가져오는데 실제 이미지는 바뀌었는데 이름은 바뀌지 않은 경우에 발생합니다. 해결 방법은 로딩하기 전에 새 이미지의 이름을 바꾸거나 새로운 이미지를 로딩하기 이전에 이전의 이미지를 지우는 겁니다. 이전 이미지 객체에 removeSelf를 call 하세요. 그러면 이미지 데이터와 파일 이름 사이의 관계까지도 remove 될 겁니다.



5. How to get a cleaner ADB Logcat debug display


이건 질문은 아니고 그냥 제가 코로나 포럼에서 찾아내서 알려드리는 팁입니다. (그 글을 올린 분 성함이 없어서 밝히지를 못합니다. 죄송합니다.) 그 팁은 Android OS 가 보내는 다른 busy 메세지들은 보이지 않고 그냥 print 메세지만 보이게 하는 방법입니다. Android SDK를 인스톨 하신분들은 코드를 디버깅할 때 ADB 프로그램을 사용 하실 겁니다.


안드로이드 SDK 에서 아래와 같이 adb를 실행하세요.

adb logcat Corona:v *:s

만약 제대로 작동하지 않으면 파라미터들을 없애고 다시 시도해 보세요.



여기까지고 오늘의 FAQ 들이었습니다. 감사합니다.

반응형


반응형

나꼼수 듣고 검색해 봤는데...


정우택 대만

김태호 터널 디도스...


실시간 급 상승어로 잡히네요.





정말로 말 많고 탈 많은 새누리당.....

이런 세력들이 다시 정권을 잡는다면......


정말 생각만 해도 끔찍하다...


이번 선거는 반드시 참여해서 더러운 세력 재집권을 막아야겠어요.

저도 한시간 넘게 차타고 보스톤 가서 투표할 거예요.

이미 재외선거인 등록 했구요.


한국에 계신분들도 꼭 투표 합시다...




반응형


반응형

$.mobile object



오늘은 단순히 JQM을만이 아니라 Javascript로 동적으로 프로그래밍 하는 부분을 간단히 공부해 보겠습니다.


우선 기본 <html> 소스부터 봅니다.


<!DOCTYPE html>
<html>
<head>
  <meta name=viewport content="user-scalable=no,width=device-width" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
  <style type=text/css>
    p {
      font-style : italic;
      margin-bottom : 0px;
      text-align : center;
      text-transform : uppercase;
    }
  </style>
</head>

<body>
<div data-role=page id=home>
  <div data-role=header>
    <h1>Home</h1>
  </div>
  <div data-role=content>
  </div>
</div>
</body>

</html>


보면 헤더에 Home 이라는 글자가 있고 content는 있는데 그 안에는 아무런 내용이 없죠.

그리고 body 안에 보면 <p> 태그는 하나도 없는데 위에 <p> 태그에 적용되는 스타일링이 정의 돼 있습니다.


딱 보면 content 부분에 뭘 넣을 건데 거기에 <p> 태그가 들어가나 보네요.

하여간 위의 소스로 html을 만들어서 실행시키면 아래 화면을 보실 수 있습니다.




그럼 이제 자바 스크립트 부분을 볼까요?

이 JavaScript 는  </html> 다음에 붙여 넣습니다.


<script>

var $content = $("[data-role=content]");
var obj = $.mobile;

$content.append ("<p> Properties </p>");
for (var prop in obj)
  if (!$.isFunction (obj[prop])) $content.append (
          "<b>" + prop + "</b>  = " + obj[prop] + "<br />");

$content.append ("<p> Methods </p>");
for (var prop in obj)
  if ($.isFunction (obj[prop])) $content.append (
          "<b>" + prop + "</b>  () " + "<br />");

</script>


불까요? 변수 $content에 data-role=content를 넣었습니다.

그리고 obj라는 변수에는 $.mobile; JQM 함수를 넣었습니다.


그 다음을 보면 $content 에 문자를 append 하죠?

즉 data-role=content에 문자를 append 하는 겁니다.


그리고 $.mobile 에 있는 prop 들을 화면에 출력하는 for 문이 있습니다.


그 다음에는 $content에 Methods 라는 문자를 추가 합니다.


그리고 $.mobile에 있는 메소드들을 출력합니다.


그러면 아래와 같은 화면을 보실 수 있을 겁니다.



화면에 보시는 것들이 바로 $.mobile object에 세팅돼 있는 프로퍼티들 입니다.


저 프로퍼티들과 메소드들을 다 알 필요는 없지만 그래도 자주 쓰이는 것들은 눈에 익어야 될 텐데요.


꾸준히 그리고 많이 Practice를 하는 방법밖에는 없겠죠?



convention01.html


반응형

가끔 시를 보내오는 선배

2012. 9. 22. 22:40 | Posted by 솔웅


반응형

가끔 시를 보내오는 선배가 있어서 너무 좋다......


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


바람이 몹시도 불던 날

바닷가에 홀로 서 있었다네.

 

누군가 쉼 없이 몰아치는 파도도 실상은

바다 속 깊은 고요 속에서 잉태되었다고 말하지.

 

그럼에도 난 항상 흔들리는 파도에만 시선이 머물고

바다 속 깊이에서 울리는 침묵의 소리에 귀 기울이지 못하고

살아온 날들이 많았음을 새삼 고백하며...

 

그렇게 내 삶을 허락한 곳에 들어가 깊이 잠기면

새 삶을 시작하는 또 다른 나를 만날 수 있을까...

 

오늘은 그 아이를 만나러 다시

바다에 가고 싶다.

 

 


 

바다에 가고 싶다

 

 

바람이 분다

흔들리는 파도처럼

내 부푼 설렘과

두려움 펼쳐놓았던

그리운

나의 바다

 

두 눈 감는다

내 어릴 적 꿈을 잉태하고

삶의 근원 일러주던

그 태초의 고요 속으로

내려가

깊이 잠긴다

 

웃음 짖던 한 아이

나를 바라본다.


반응형

FAQ Wednesday: iPhone 5 와 iOS 6

2012. 9. 21. 11:28 | Posted by 솔웅


반응형
Posted on . Written by


FAQ 시간인 수요일입니다. iOS 6 가 오늘 릴리즈 됐고 아이폰 5 는 금요일에 릴리즈 될 겁니다. 요즘 이슈가 되는 이 두가지의 릴리즈와 관련되서 많이 질문되는 것들을 오늘 다루겠습니다. 아직 Walter가 올린 iPhone 5와 iOS 6를 지원하는 것과 관련된 글을 보지 못하신 분들은 여기를 들러서 먼저 봐 주세요.


1. Will my existing apps working on the new iPhone 5?


예 여러분의 기존 앱은 iPhone 5나 iOS 6로 업데이트 된 디바이스에서도 지금처럼 작동될 겁니다. iPhone 5와 관련된 이슈는 여러분의 unmodified app 이 Retina device (640 X 960) 에서 작동되는 걸로 생각할 거라는 겁니다. iPhone 5는 640 X 1136 입니다. 여러분의 기존 앱은 iPhone 5에서 아래 위가 검정색으로 나타나는 letterbox 모드로 표시 될 겁니다. (아래 위로 길 경우)





2. Do I have to resubmit my app for iPhone 5?


위에서 얘기한 것처럼 여러분의 기존 앱이 iPhone에서 아래위로 검은처리 된 상태로 작동되는게 문제가 없으시다면 굳이 여러분 앱을 iPhone 5로 업그레이드 하실 필요는 없을 겁니다. 여러분이 iPhone 5를 가지고 있지 않더라도 iOS Simulator에서 확인하실 수 있으니 한번 확인해 보세요. 이 iOS 시뮬레이터를 이용하시려면 Xcode 4.5를 다운 받으셔야 한다는 것 알고 계시죠? 만약 여러분의 기존 앱을 iPhone 5용으로 업그레이드 하고 싶으시다면 iOS 6에 맞게 다시 빌드 하셔야 됩니다.


한가지 유념하실 부분이 있는데요. 만약 여러분의 앱이 애플의 GameCenter를 사용한다면 아래 Question #4 를 꼭 읽어 보세요.



3. How can I make my app use the full iPhone 5 screen?


기존의 여러분 앱이 iPhone 5에서 좀 더 잘 보이게 하는 방법이 몇가지 있습니다.


첫번째는 new splash 파일을 여러분의 프로젝트에 추가하는 겁니다 : Default–568@2x.png. 이것은 640 X1136  크기의 이미지 입니다. 이 이미지는 여러분 앱이 iPhone 5 device에서 로딩이 시작될 때 보여질 이미지 입니다. 이 파일은 iOS6에게 여러분의 앱이 full iPhone 5 screen을 지원한다고 통보할 겁니다. ("tall" mode). 그래도 여러분 앱은 letterbox로 보일겁니다. 하지만 status bar는 맨 위에 제위치로 가게 될 겁니다.


display.pixelWidth and display.pixelHeight. 이 API들은 스크린의 실제 가로 세로 값을 보여줄 텐데요. 이 new splash screen을 사용한 후의 화면을 보세요. iOS 6가 Corona에게 이것은 640 X 1136 디바이스라고 얘기합니다. 이 splash screen 이 없으면 그 값은 640 X 960 (iPhone 4 mode)가 표시 될 겁니다.




이 새로운 디폴트 splash file을 추가한 후에 여러분은 display.setDefault API를 사용하실 수 있습니다. 배경색을 넣을 수 있는 겁니다. 이 API로 시꺼먼 letterbox area를 다른 색으로 채우실 수 있습니다.


display.setDefault( "background", 200 )





또 다른 옵션은 배경 이미지를 로드 하는 방법입니다. 이 이미지는 letterbox area 까지 extend 될 겁니다. 여러분 앱이 iPhone 과 iPhone 5만을 타게팅 한다면 이 이미지는 320 X 568 이 될 겁니다. 이 이미지의 y 포지션을 offset 하셔야 이 이미지가 스크린의 맨 위에서부터 시작할 겁니다. y 포지션을 지정하실 때는 display.screenOriginY를 사용하셔야 합니다.


display.newImage( "background568.png", 0, display.screenOriginY )




(저는 스크린에 가득차게 보이도록 이미지 둘레에 yellow/green border를 추가했습니다.)

config.lua file 에서 zoomEven scaling mode를 사용해 보세요. 이 zoomEven은 여러분 앱의 크기를 가로 세로 똑 같은 비율로 화면에 꽉 찰 때까지 늘릴겁니다. iPhone 5의 portrait 모드에서는 여러분 앱이 아래위로 늘어나는 만큼 좌우도 늘어나기 때문에 일부가 화면 밖으로 사라질 겁니다. (아래 screen shot을 보세요.)





위 예제는 dynamic scaling 이 320 X 480 이고 target을 iPhone, iPhone4, iPhone 5 디바이스로 했을 경우를 가정해서 얘기한 겁니다. 만약 안드로이드도 지원할 필요가 있다면 안드로이드 디바이스의 크기도 같이 고려해서 이러한 것들을 정해야 할 겁니다. (최신 CoronaSDK builds는 여러분의 content 가 제대로 표시되도록 도와주는 새로운 시뮬레이터 스크린 사이즈를 제공하고 있습니다.)


4. Why does my GameCenter crash when running on iOS 6?


만약 여러분 앱이 Apple’s GameCenter를 사용한다면 그리고 그 앱이 오직 landscape mode로만 작동이 된다면 그 상황에서 발생하는 bug 가 있습니다. 뭐냐하면 여러분 앱은 landscape 인데 GameCenter의 Sign-on Screen 은 portrait mode로 표시하려고 하기 때문에 충돌이 일어납니다. 이 상황은 여러분 앱을 iOS 6 용으로 빌드하고 그 앱을 iOS 6 device에서 작동할 때 발생합니다.


한 유저가 그 해결책을 Corona의 Forums에 올리셨는데요. content를 landscape로 세팅하고 앱은 landscape와 Portrait 모두를 지원한다고 세팅 해 놓는게 그 해결방법 입니다. 이렇게 하면 GameCenter sign-on 화면은 portrait으로 뜨고 여러분 앱은 landscape 모두에서 작동하도록 할 겁니다. 폰이 rotate 될 때 status bar 도 자동으로 rotate 될 텐데요. 대부분의 게임에서 status bar를 표시하지 않으니까 이 부분은 그리 크게 신경쓰지 않으셔도 될 것 같습니다.

아래 처럼 build.settings 파일에 코딩을 해 넣으시면 됩니다.


orientation =
{
default = "landscapeRight",
content = "landscapeRight",
supported = { "landscapeLeft", "landscapeRight", "portrait" },
},



Note: 이 이슈가 iOS 6에서 빌드하고 iOS6 device에서 앱을 구동시킬때 발생하는 유일한 이슈 입니다. 만약 여러분의 기존 앱이 iOS 5.1용으로 만들었다면 이 부분은 신경 안 쓰셔도 됩니다.


5. Why don’t I see any of my print messages in the Xcode Console?


iOS 6에서 애플은 Lua print message가 보여지지 않거나 internal Corona runtime 에러가 표시되도록 바꾸었습니다. iOS 6 에서는 Xcode Console과 맥 콘솔 앱에 여러분의 iOS 6나 iOS 6 시뮬레이터로부터 더이상 메세지를 받지 않습니다.


build 915에서 코로나 런타임 에러를 메세지로 restore 하도록 바꾸었습니다. 하지만 Lua print API 관련해서는 아직 해결책을 마련하지 못했습니다. 지금으로서는 런타임 에러 메세지는 보일것이지만 print로 출력하는 디버그 메세지는 표시되지 않을 겁니다. print 함수를 임시파일에 저장하도록 redirect 해서 나중에 확인하실 수 있을 겁니다. 이게 좋은 solution은 못 되지만 여러분이 현재로서는 여러분이 device에서 테스팅하면서 디버깅할 때 사용할 수 있는 방법중의 하나입니다.

iOS 6의 변화로 인해서 저희도 맥 시뮬레이터에 에러와 메세지를 표시하는 방법을 바꾸어야 했습니다. 메세지 앞에 date/time 을 추가하는 메세지를 표시하기 위해 지금은 NSLog를 사용합니다. 이 방법이나 혹은 다른 방법으로 iOS 6 print issue를 해결해야만 합니다. 또한 맥 시뮬레이터 콘솔에 어떻게 정보를 출력할 것인지도 영향을 받을것입니다.  또한 우리의 콘솔과 에러메세지를 이용하는 3rd party 코로나 프로그램도 영향을 받을 겁니다. 이 변화의 잇점으로는 이제 맥 콘솔 앱이 코로나 시뮬레이터와 iOS 시뮬레이터 모두로부터 Corona runtime data를 받는다는 것입니다. (조만간 print 도 가능할 겁니다.) 코로나 시뮬레이터와 빌드 메세지를 보기 위해 터미널 윈도우를 ipen 해야 하는 수고를 안해도 되게 됐죠.



That’s it for today’s questions. I hope you enjoyed it and even learned a few things.

반응형