Android/Application2011. 7. 27. 15:51
Android application 중에

한국에서 정식(?)의 경로로 다운로드 받을 수 없는 app들이 많다.

근래 설치한 것 두개를 공유.

    Android Market App : 


      http://android-developers.blogspot.com/2011/07/new-android-market-for-phones.html

    Google + App :  


      https://plus.google.com/

혹시 google + 초대가 필요하신 분은 말씀하시면 됩니다.

초대 방식이 바뀌었네요.
아래 링크를 통해서 들어오시면 자동으로 초대가 됩니다.

google plus invitation link
https://plus.google.com/_/notifications/ngemlink?path=/?gpinv=v5CVOHwOJ_0:uttHM5Ayyyg


Posted by ekwang
Linux/Ubuntu2011. 7. 25. 23:42
10.10 upgrade 후에 갑자기 네트워크 연결이 안된다.
무지하다 보니 알 수가 없다. 부끄럽다.
방치..
언 9개월이 지난후 갑자기 컴터를 켜서 좀 찾아보고 해결했다.

ifconfig -a 를 해봐도 eth0에 address가 없다. dhcp가 동작을 안한다.

~$sudo vi /etc/network/interfaces

auto lo

iface lo inet loopback


auto eth0

iface eth0 inet dhcp


eth0에 대한 내용이 없어서 추가 후
~$sudo /etc/init.d/networking restart

정상적으로 연결이 된다.

이제 다시 11.04로 업그레이드 하라네..

Posted by ekwang
Linux/Ubuntu2011. 3. 1. 19:47
eclipse의 바로 가기 메뉴를 생성해 보자.


$ sudo gedit /usr/share/applications/eclipse.desktop

gedit 가 열리면 아래 내용을 복사 후 저장.

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

프로그램 - 개발 - Eclipse 가 있음을 확인 할 수 있다.
Posted by ekwang
Android/Platform2011. 2. 10. 10:59

Error generating final archive: Debug certificate expired

어느날 갑자기 eclipse console에 위와 같이 "Debug certificate expired" 라는 문구가 뜬다면
사용하고 있던 debug.keystore 파일이 만료가 된 것이다. 파일 수명은 1년이다.

debug.keystore는 .android 폴더에 존재하고 있는데 다음과 같이 경로를 확인할 수 있다.
Eclipse - Window - Preferences



확인 하였으면 파일을 과감하게 삭제한다

파일을 삭제했는데도 왜 빌드가 안되냐..이러는 분들이 있는데,
eclipse의 Package Explore(workspace) 에 등록되어 있는 프로젝트들을 삭제하고 
다시 import를 하니 잘 되었다.

아래는 원문 참고..

Expiry of the Debug Certificate

The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 365 days from its creation date.

When the certificate expires, you will get a build error. On Ant builds, the error looks like this:

debug:
[echo] Packaging bin/samples-debug.apk, and signing it with a debug key...
[exec] Debug Certificate expired on 8/4/08 3:43 PM

In Eclipse/ADT, you will see a similar error in the Android console.

To fix this problem, simply delete the debug.keystore file. The default storage location for AVDs is in ~/.android/ on OS X and Linux, in C:\Documents and Settings\\.android\ on Windows XP, and in C:\Users\\.android\ on Windows Vista.

The next time you build, the build tools will regenerate a new keystore and debug key.

Note that, if your development machine is using a non-Gregorian locale, the build tools may erroneously generate an already-expired debug certificate, so that you get an error when trying to compile your application. For workaround information, see the troubleshooting topic I can't compile my app because the build tools generated an expired debug certificate.



I can't compile my app because the build tools generated an expired debug certificate

If your development machine uses a locale that has a non-Gregorian calendar, you may encounter problems when first trying to compile and run your application. Specifically, you may find that the Android build tools won't compile your application because the debug key is expired.

The problem occurs because the Keytool utility — included in the JDK and used by the Android build tools — fails to properly handle non-Gregorian locales and may create validity dates that are in the past. That is, it may generate a debug key that is already expired, which results in the compile error.

If you encounter this problem, follow these steps to work around it:

  1. First, delete the debug keystore/key already generated by the Android build tools. Specifically, delete thedebug.keystore file. On Linux/Mac OSX, the file is stored in ~/.android. On Windows XP, the file is stored inC:\Documents and Settings\<user>\.android. On Windows Vista, the file is stored in C:\Users\<user>\.android
  2. Next, you can either
    • Temporarily change your development machine's locale (date and time) to one that uses a Gregorian calendar, for example, United States. Once the locale is changed, use the Android build tools to compile and install your app. The build tools will regenerate a new keystore and debug key with valid dates. Once the new debug key is generated, you can reset your development machine to the original locale.
    • Alternatively, if you do not want to change your machine's locale settings, you can generate the keystore/key on any machine using the Gregorian calendar, then copy the debug.keystore file from that computer to the proper location on your development machine.

This problem has been verified on Windows and may apply to other platforms.

For general information about signing Android applications, see Signing Your Applications.



-끝-
Posted by ekwang
TwitterAPI2011. 2. 10. 10:41



Twitter4J 특정 버젼부터(잘 모르겠음..) userid/password를 통해서 로긴하는 방식이 사라지고 Oauth 인증 방식만 남아 있다.
OAuth 인증을 위해서는 제일 먼저 consumer key와 secret 정보를 twitter.com 으로부터 획득해야 한다.
그리고 나서 consumer key를 사용하여 Request Token, Access Token 등의 과정을 거쳐 twitter.com을 이용할 수 있다.

먼저 consumer key, secret 정보를 얻는 방법을 알아보자.
http://twitter.com/oauth_clients/new 에서 개발 중인 application 의 정보를 입력하여 consumer key, secret를 획득하여야 한다.
요구하는 정보를 입력 하면 아래와 같은 정보를 얻게 된다.

ekwangtwit by ekwang

easy twitter in development

created by Kwang Hee Lee – read and write access by default


  • XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • http://twitter.com/oauth/request_token

  • http://twitter.com/oauth/access_token

  • http://twitter.com/oauth/authorize

성공했다면 Consumer key, Consumer secret 값을 꼭 저장 한다.

application name에 이미 존재한다는 경고를 계속 받을 것이다! 이미 많은 개발자들이 대부분의 twitter application 이름을 사용하였으니 자신의 application naming을 하도록 하자. (주의! "twitter" 라는 string이 포함되면 안된다.)

-끝- 
Posted by ekwang
Windows2010. 10. 1. 09:30

위의 사이트를 참고하여 인터넷 익스플로러의 임시저장 폴더를 램디스크의 위치로 지정을 해 둔 상태였다.

램디스크를 삭제 후 Outlook 을 실행하자 아래와 같은 문제가 발생하였다.


해결 방법은 아래 경로의 레지스터 값을 수정해 주는 것이다.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache

다음과 같이 되어 있는 것을 볼 수 있다.
(H:\ 가 램디스크였음)


Cache 값이 아직 램디스크의 경로로 되어 있는 것을 볼 수 있다.

이를 
C:\Documents and Settings\ekwange\Local Settings\Temp\Temporary Internet Files
와 같이 본인 계정 아래의 기본 경로로 수정을 하도록 한다.

Outlook을 종료 후 다시 실행하면 정상 동작 한다.

Posted by ekwang
사용기2010. 2. 6. 16:13

Chrome사용 중 ActiveX를 사용하는 은행이나 공공기관 사이트 접근에 어려움이 있다는 건 다들 알고 있을 것이다.
그래서 아직도 IE를 버리지 못하는 분들이 계시는데..

이런 문제를 해결하기 위해 Chrome extension 인 IE Tab을 소개한다.

우선 당연히 Chrome을 설치해야 하고
다음으로 아래의 사이트에서 IE Tab을 설치하자.
https://chrome.google.com/extensions/detail/hehijbfgiekmjfkfjpbkbammjbdenadd?hl=ko

설치가 완료되면 오른쪽 빨간 박스와 같이 IE Tab icon이 표시가 될 것이다.

그림 1. 


IE Tab을 클릭하게 되면 아래와 같이 IE의 Address 입력창이 다시 보인다

그림 2. 

그곳에 주소를 입력하게 되면 IE Tab내부에서 원하는 주소로 이동을 할 수 있다.
은행, 관공서등의 사이트도 별다른(?) 불편함 없이 사용을 할 수 있게 된다.

그리고 하나 중요한 것이 IE Tab의 주소들에 대한 bookmark관리는 따로 해야 된다는 것이다.
그림 2. 에서 오른쪽 구석에 잘보면 빨간색 네모안의 아이콘을 선택하면 된다. 

"Bookmark this page in the IE Tab folder"
 페이지를 IE Tab 폴더로 북마크 한다.

Bookmark 아이콘을 선택하게 되면 그림 1.의 왼쪽 구석에 빨간 네모안의 IE Tab의 폴더로 주소가 북마크 된다.

그림 3. 

사실 몇몇 사이트에서는 IE Tab에서도 완벽히 동작을 하지 않는 것을 보긴 하였다.
하지만 이정도만 해도 Microsoft의 IE를 점점 멀리 할 수 있게 될 것이다.

왜 자꾸 Microsoft IE를 멀리 하라 할까..? 단지 MS를 미워해서가 아닌다..(왜 미워할까 --)
Chrome 이나 Firefox, Opera등을 한번 사용해보시면 알게 될것이다!!

마지막으로, 본인은 사용해보지 않았지만
Chrome Plus를 설치하면 IE Tab 의 기능이 기본적으로 설치되어 있다고 한다.

[R]
Posted by ekwang
TwitterAPI2010. 2. 5. 18:19
블로그를 방문해 주신 한 개발자 분으로 부터 아래와 같은 질문을 받았다.

twitter = new TwitterFactory().getInstance("아이디", "비밀번호");
Status status;
try {
status = twitter.updateStatus("Test msg1");
Log.e("Test","Successfully updated the status to [Test msg1].");
status = twitter.updateStatus("Test msg2");
Log.e("Test","Successfully updated the status to [Test msg2].");
} catch (TwitterException e) {
e.printStackTrace();
}

위와 같이 코드를 작성하고 updateStatus를 하고나서 메시지를 바꿔서 바로 다른 updateStatus를 하면 TwitterException : -1 이 발생합니다. (만약 3번째 updateStatus를 실행하면 잘 됩니다. 그러나 4번째는 문제발생...)
같은 소스를 일반 Java App로 만들어서 실행하면 문제가 없이 잘 돌아갑니다.

왜 안드로이드에서만 이런 문제가 발생할까요?

물론 답변을 할 수 없는 상태다. 나도 모르기 때문에;;

하지만 한가하던 터라 위와 관련된 내용을 좀 찾아보았다.
그전에, 내가 쓰고 있는 것은 Twitter4J-2.0.10 의 버젼 이었고 
위의 코드는 문제 없이 잘 동작 하였다.
Twitter4J-2.1.0 부터 문제가 발생한 것이다.

Project site(http://twitter4j.org/jira/browse/TFJ)를 검색해보니
많은 Android 개발자들이 Twitter4J 사용시 위와 같은 문제로 고민하고 있음을 알게 되었다.

다음은 검색 결과 중 주요 내용만 뽑아보았다.
31.  Yusuke Yamamoto   1월29일, 오후3시10분
Hi, 
I haven't managed to look into it yet. 
I have no idea why adding "Connection: close" to the request header doesn't work for the issue. 
http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html 
This can be a Dalvik/Harmony side issue as Miyuuu indicated. 
http://stackoverflow.com/questions/1440957/httpurlconnection-getrespo... 
Does any have any idea how to workaround the problem? 
I've just filed an Jira issue to track the problem. 
http://twitter4j.org/jira/browse/TFJ-296 
Thanks, 
-- 
Yusuke Yamamoto 
yus...@mac.com 

그렇다..
결론은 아직 해결이 되지 않았다 --;;

http client를 이용해서 server와 connection을 한 후 두번째 connection을 할 경우 fail이 발생을 한다.
android 의 경우 성능을 높이기 위해서 최초 연결이 된 경우 connection을 계속해서 유지하고 있도록 동작을 하고
이것 또한 Twitter4J가 위와 같은 exception이 발생하게 한다고 한다.
그래서 Twitter4J를 그냥 JVM에서 돌아가도록 하면 이런 문제는 또 발생하지 않는다.
DALVIK 에서 구동 될때만 문제가 생긴다는 것이다. (http://code.google.com/p/android/issues/detail?id=2800)


문제를 해결하기 위해서 여러 곳에서 움직임이 있는데
그중 하나만 관심을 가지고 지켜본다면 해결 된 때를 알 수 있을 것 같다.

Stackoverflow

Twitter4J

Twitter4J Group
http://groups.google.com/group/twitter4j/browse_frm/thread/4319a99a2a656275?tvc=1
Posted by ekwang
Android/Tools2009. 12. 15. 13:48
2009년 12월 10일 android blog에 새로운 글이 포스팅 되었다.

Optimize your layouts

Android application 은 xml 파일을 작성하여 UI layout을 생성할 수 있다.
이 UI layout을 위한 xml파일이 효율적으로 작성이 되어 있는지를 검사해주는 툴이 layoutopt 이다.

사용 법은 간단하다.
usage: layoutopt <directories/files to analyze>

$ layoutopt samples/samples/compound.xml
  7:23 The root-level <FrameLayout/> can be replaced with <merge/>
  11:21 This LinearLayout layout or its FrameLayout parent is useless samples/simple.xml
  7:7 The root-level <FrameLayout/> can be replaced with <merge/>
samples/too_deep.xml
  -1:-1 This layout has too many nested layouts: 13 levels, it should have <= 10!
  20:81 This LinearLayout layout or its LinearLayout parent is useless
  24:79 This LinearLayout layout or its LinearLayout parent is useless
  28:77 This LinearLayout layout or its LinearLayout parent is useless
  32:75 This LinearLayout layout or its LinearLayout parent is useless
  36:73 This LinearLayout layout or its LinearLayout parent is useless
  40:71 This LinearLayout layout or its LinearLayout parent is useless
  44:69 This LinearLayout layout or its LinearLayout parent is useless
  48:67 This LinearLayout layout or its LinearLayout parent is useless
  52:65 This LinearLayout layout or its LinearLayout parent is useless
  56:63 This LinearLayout layout or its LinearLayout parent is useless
samples/too_many.xml
  7:413 The root-level <FrameLayout/> can be replaced with <merge/>
  -1:-1 This layout has too many views: 81 views, it should have <= 80! samples/useless.xml
  7:19 The root-level <FrameLayout/> can be replaced with <merge/>
  11:17 This LinearLayout layout or its FrameLayout parent is useless

하지만 Window 환경에서 layoutopt를 수정없이 사용하게 되면 아래와 같은 에러를 보게 될 것이다.

Exception in thread "main" java.lang.NoClassDefFoundError: lib\layoutopt/jar
Caused by: java.lang.ClassNotFoundException: lib\layoutopt.jar
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: lib\layoutopt.jar.  Program will exit.

포스팅된 글을 끝까지 잘 읽어보면 해결책이 나와있다.

Windows users: to start layoutopt, open the file called layoutopt.bat in the tools directory of the SDK and on the last line, replace %jarpath% with -jar %jarpath


쉽게 이해가 안되면 아래와 같이 따라하자.

1. \sdk\android-sdk-windows\tools\layoutopt.bat 파일을 편집기로 연다.

2. 파일의 제일 마지막을 다음과 같이 수정한다.

수정 전  call java %java_debug% -Djava.ext.dirs=%javaextdirs% %jarpath% %*
수정 후  call java %java_debug% -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %*

3. 파일을 저장 후 layoutopt를 사용한다.
파일명을 직접 입력 하거나, xml 파일이 있는 폴더명을 입력해주면 해당 폴더 내의 모든 xml 파일을 분석한다.

분석 내용이 길어질 경우를 대비에 > 를 사용해 출력을 analyze.txt에 담아도 좋다.

> layoutopt main.xml > analyze.txt
> layoutopt ./res/layout/

만약 분석을 요청한 파일에 특별한 내용이 없을 경우에는 
입력한 parameter만 출력이 되고 동작을 멈춘다.

[U]
Posted by ekwang
사용기2009. 12. 9. 15:10
"Use mouse strokes to accelerate your operations."

크롬 익스텐션 중 마우스 제스쳐를 인식하여 기능을 수행하게 해주는 것이 있다.

위의 사이트에서 설치하고,

옵션 - 확장 프로그램 - Mouse Stroke - Option을 선택하면 아래 화면을 볼 수 있다.


설정 Option 화면을 보면 위와 같다.

개인적으로 수정하여 사용하는 것도 좋지만, 기본 제스쳐 만으로도 충분히 편리하게 사용이 가능하다.
기본설정에서 모든 제스쳐는 마우슨 오른쪽 버튼을 누른 상태에서 동작을 해야 인식이 된다.
정상동작시 아래 캡쳐화면과 같이 화면에 마우스 괘적을 따라 선이 그려지고 chrome 왼쪽 구석에는 U,D,R,L를 이용하여 인식 상태가 표시된다.

예상하다시피 
  U : 아래에서 위로 선을 긋는 동작
  D : 위에서 아래로 선을 긋는 동작
  R : 왼쪽에서 오른쪽으로 선을 긋는 동작
  L : 오른쪽에서 왼쪽으로 선을 긋는 동작
을 말한다.


아래는 R D L 을 인식한 모습이다.


간단히 자주 쓸만한 몇가지 제스쳐를 그려보자.

Navigation 동작
  U : 페이지의 제일 위로 이동
  D : 페이지의 제일 아래로 이동
  L : 히스토리의 Backword 사이트로 이동
  R : 하스토리의 Foward 사이트로 이동

Window 제어 관련 동작 
  U D R U : 새로운 chrome을 실행 한다.
  L U R : 현재 chrome 을 종료한다.

Tab 관련 동작
  R D : 새로운 탭을 생성
  L U R : 현재 탭을 닫는다.
  
기타 동작들
  U D : 화면을 다시 로드 한다.
  R L R L : 화면을 캡쳐한다.

그 외 자신이 자주 쓰는 제스쳐를 기억해두거나, 자신만의 제스쳐를 등록해서
chrome을 사용하면 훨씬더 빠르고 편한 탐색이 될 것이다.
Posted by ekwang