이번 주 zdnet을 통해서 기사가 나왔습니다.

http://www.zdnet.com/how-replacing-java-with-javascript-is-paying-off-for-paypal-7000023697/

Paypal이 Java를 버리고, node.js로 서버를 변경했다고 합니다. 기사에 링크된 페이팔 블로그 링크에 옮겨간 이유가 나옵니다. 여러 이유가 있겠지만, 서버에서 프론트까지 같은 언어로 커뮤니케이션하는 것이 좋다고 판단했다는 이유가 눈에 띕니다.


"It unifies our engineering specialties into one team which allows us to understand and react to our users’ needs at any level in the technology stack."

from: https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/


오래 전부터 프로토타이핑을 해왔고, 올해부터 서비스에 적용했다고 합니다. 웹 애플리케이션 프레임워크로 express를 쓰고, Grunt 작업 실행기와 설정을 위해서 nconf를 사용했다고 zdnet이 전합니다.


개발 생산성 향상은 다음과 같습니다.


2배 더 빨라졌고, 더 적은 인원으로 Built almost twice as fast with fewer people

33%라인 수가 줄었으며 Written in 33% fewer lines of code

40%의 파일 갯수로 만들어 집니다 Constructed with 40% fewer files


자바가 파일이 많기는 하죠. 스프링이나 EJB 모두 말이죠.


성능에 대한 그래프도 응답시간이 줄어서 node.js 쪽이 나은 데이터가 공개되었습니다. 고객의 대기시간이 줄었다는 얘기죠.





java 시장이 현재 크지만, node.js로 인해 많이 잠식될 것 같습니다. 당장은 아니라도 말이죠.


ps. Douglas Crockford님이 야후에서 Paypal로 간 까닭은?http://techcrunch.com/2012/05/13/paypal-gets-its-own-share-of-the-yahoo-diaspora-hires-java-icon-douglas-crockford/


백그라운드 컬러

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mLayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/bg"
>
...
</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">샘플</string>
    <color name="bg">#FFFFFF</color>
</resources>


화면 전환 애니메이션
<?xml version="1.0" encoding="utf-8"?>

<alpha xmlns:android="http://schemas.android.com/apk/res/android"
       android:interpolator="@android:anim/accelerate_interpolator"
       android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="100" />

code from: http://developerlife.com/tutorials/?p=343


related: http://developer.android.com/guide/topics/resources/available-resources.html#tweenedanimation


재밌는 서비스입니다. GitHub의 활동을 기준으로 재밌는 리포트를 생성해주는 서비스입니다.

http://osrc.dfm.io/kenu





// 이미지 롤링

idx = ++idx % 8;
image.setImageResource(R.drawable.sample_0 + idx);


// 이미지 파일명으로 세팅

idx = ++idx % 8;
int resID = getResources().getIdentifier("sample_" + idx , "drawable", getPackageName());
image.setImageResource(resID);


sample:


참고: 


DHCP 관련 에러를 만났을 때 대처법입니다.

"Unable to start the Genymotion virtual device. 

The Genymotion Virtual device could not obtain an IP address.

For an unknown reason, VirtualBox DHCP has not assigned an IP address to virtual device. Run the VirtualBox software to check for issues."

먼저 설치되어 있던 VirtualBox의 글로벌 환경설정(cmd+,)에서 네트워크 > 호스트 전용 네트워크의 DHCP 서버를 체크해야 합니다.

vboxnet0 항목을 선택하고 우측에 드라이버 아이콘을 클릭합니다.


DHCP 서버를 체크해서 올려야 Genymotion 가상 디바이스가 IP를 획득할 수 있게 됩니다.




참고: https://cloud.genymotion.com/page/faq/#collapse-nostart

맥에서 기존에 설정된 것 때문에 삽질하다가 연결을 드디어 했습니다.

첫 사용 소감.

"개빠르다"

개- 접두사가 붙은 것은 강조입니다. 정말 빠르네요. 실행만 빠른 것이 아니라 apk옮겨가는 속도도 굉장합니다.


40만 다운로드가 나올 수 밖에 없습니다.

http://www.genymotion.com/


만약 본격적으로 안드로이드 개발을 한다면 정말 연단위 99유로 라이선스를 결제해 버릴만한 품질입니다.

블로그를 살펴보면 버그가 있다고 하지만, 디바이스를 사용하는 것 이상의 개발 속도가 나올 것 같습니다.


Galaxy Nexus 4.1.1 API 16 720x1280 이미지를 실행한 에뮬입니다. 우측에 부가 기능 버튼이 있습니다. 아이폰의 시뮬레이터 이상의 속도로 느껴집니다.

AVD 이제 Bye Bye!!!!!!!

http://www.genymotion.com/


1. 회원가입 필요, 무료 가능



2. virtualBox 설치 또는 OS별 Genymotion 다운로드

IntelliJ와 Eclipse 플러그인 지원


3. 안드로이드 이미지 선택 및 다운로드

4. 이클립스 genymotion 플러그인 설치 http://plugins.genymotion.com/eclipse

5. 빠른 안드로이드 에뮬 경험



참고: 

우분투에서 Genymotion : http://byneonkid.tistory.com/40

맥에서 Genymotion : http://www.kmshack.kr/347

버전업시 주의할 점: http://kingorihouse.tumblr.com/post/67355210627/genymotion-2-0-1

윈도우에서 http://huhspunk.tistory.com/archive/201310

윈도우의 경우 이슈가 참 많네요. 한글입력기도 수정해야 돌고,



코드 곳곳에 비슷한 패턴으로 들어가 있는 부가작업: 로깅, 트랜잭션, 등

이 코드를 한 클래스에 모아놓음 : Advice

그리고 남겨진 순수한 코드 : Core Concern



이제 Advice와 핵심코드를 엮어주는 일: Weaving

어떤 패턴으로 엮어줄 것인가: PointCut



엮어줄 시점을 정하는 것: JoinPoint

핵심코드 실행시점 전에 Advice를 실행 : before

핵심코드 실행시점 전과 후에 Advice를 실행 : around

핵심코드 실행시 예외 발생 Advice를 실행 : throw

...


XML

<bean id="adviceUsingXML" class="egovframework.rte.fdl.aop.sample.AdviceUsingXML" />

<bean id="concernSample" class="egovframework.rte.fdl.aop.sample.ConcernSample" /> 

<aop:config>
  <
aop:pointcut id="targetMethod" expression="execution(* egovframework.rte.fdl.aop.sample.*Sample.*(..))" /> 

  <aop:aspect ref="adviceUsingXML">

    <aop:before pointcut-ref="targetMethod" method="beforeTargetMethod" /> 

    <aop:after-returning pointcut-ref="targetMethod" method="afterReturningTargetMethod" returning="retVal" /> 

    <aop:after-throwing pointcut-ref="targetMethod" method="afterThrowingTargetMethod" throwing="exception" />

    <aop:after pointcut-ref="targetMethod" method="afterTargetMethod" /> 

    <aop:around pointcut-ref="targetMethod" method="aroundTargetMethod" />

  </aop:aspect>

</aop:config>

code from: egovframe textbook 


추천예제: 최범균님 스프링3.0 서적 chap01 예제

http://www.kame.co.kr/pds1.html?main=main_pds [G220] 링크




구글의 앱 엔진(http://appengine.appspot.com/)은 데이터를 저장할 때 비용이 발생합니다. SQL을 사용하려면 더 비쌉니다.

간단히 데이터를 저장하고 빼는 방법으로 DataStore API를 제공해줍니다. 그리고, 저장된 데이터는 관리자 웹 페이지를 통해서 확인할 수 있습니다.


저장하는 절차는 다음과 같습니다.

1. 환경에서 DatastoreService를 가져옵니다.

2. Key를 만듭니다. Key의 종류와 key 이름을 추가합니다.

3. 레코드는 Entity 클래스를 이용합니다.

4. entity에 key : value 형식으로 기록할 데이터를 입력합니다.

5. Datastore에 entity를 추가합니다.


private static final String KEY_KIND = "Game";

private static final String keyName = "games";


DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();


public void save(Game game) {

Key entityKey = KeyFactory.createKey(KEY_KIND, keyName);


Entity entity = new Entity(KEY_KIND, entityKey);


User firstUser = game.getFirstUser();

User secondUser = game.getSecondUser();


entity.setProperty("first", firstUser.getName());

entity.setProperty("firstchoice", firstUser.getChoice());

entity.setProperty("second", secondUser.getName());

entity.setProperty("secondchoice", secondUser.getChoice());


entity.setProperty("datetime", new Date());

entity.setProperty("ip", game.getIp());


datastore.put(entity);

}



관리자 페이지에서는 다음과 같이 화면이 제공됩니다.




데이터를 꺼내오는 방법은 다음과 같습니다.


1. Key를 만듭니다.

2. Query를 만들면서 정렬순서와 기준 항목을 정합니다.

3. Datastore에서 Query를 이용해서 데이터를 꺼냅니다.

4. Entity 목록을 처리합니다.

public List<Entity> fetchAll() {

Key entityKey = KeyFactory.createKey(KEY_KINDkeyName);

Query query = new Query(KEY_KIND, entityKey).addSort("datetime",

Query.SortDirection.DESCENDING);

List<Entity> games = datastore.prepare(query).asList(

FetchOptions.Builder.withLimit(5));


return games;

}




+ Recent posts