기본 콘텐츠로 건너뛰기

2013의 게시물 표시

isequence library: sequence diagram drawing library for iOS

내 첫 번째 오픈 소스 iOS 프로젝트로 만들어본 isequence를 소개한다. Sequence 다이어그램을 iOS 애플리케이션에서 동적으로 생성할 수 있는 라이브러리이다. 예를 들면 아래와 같은 다이어그램을 그릴 수 있다. 모든 소스코드는 Github에 public 프로젝트 로 등록해두었으니 관심 있으신 분들은 참고하시길.

LTE-A CA, 광대역 차이는 무엇인가?

SKT, LG U+, KT. 이 3개 회사가 없다면 아마도 TV 광고 수익이 많이 줄 것이다. 3개 회사가 경쟁적으로 LTE, HD Voice 등의 광고를 쏟아내더니 요즘에는 LTE-A, 광대역 LTE 등 자사의 네트워크 속도가 가장 빠르다고 엄청 광고중이다. 오늘 신문기사를 읽어보니 실제 소비자의 40%정도는 LTE-A가 뭔지 광대역이 뭔지 알지못하고 있다. 사실 사용자 입장에서야 전화 잘 되고 인터넷 속도 빵빵하게 잘 나오면 그만이지 LTE-A냐 광대역이냐 따지는 것은 별반 필요하지 않을 수도 있다. 하지만! 이 두 용어의 차이점이 소비자에게도 중요한 차이가 될 수 있어 이 블로그에서 굳이 설명해보고자 한다. 두 용어가 지칭하는 기술의 차이점을 최대한 쉽게 설명해보겠다. LTE-A라고 광고를 하고 있는 CA (Carrier Aggeregation)의 경우를 먼저 알아보자. 당신의 집 근처에 10M 폭의 도로가 하나 있다고 생각해보라. 이 도로에서는 아침이면 출근 차량들 때문에 자주 혼잡해지고 속도가 느려진다. 이를 해결하기 위해서 길을 넓히고 싶은데 도로 주변에는 이미 다른 건물들이 들어차있어 그럴 수 없다. 방법은 한가지. 또 다른 10M 폭의 도로를 근처에 만들어주면 차량의 흐름이 분산될 수 있다. 정체가 해소되고 속도가 빨라질 수 있을 것이다. 이처럼 서로 다른 2개의 주파수 대역에서 각각 10Mhz 대역폭을 동시에 이용하여 속도를 향상시키는 기술을 LTE-A CA라고 한다. Aggregation => 합치다. 즉, 주파수 2개를 합쳐서 사용한다는 의미이다. 그렇다면 광대역의 경우는 어떤 기술이 사용되는 것일까? 동일한 원리로 설명하자면 위와 같은 경우에서 원래 길 자체를 20M 넓이로 확장공사를 하는 것이다. 당연히 길의 폭이 넓어졌으니 차량 통행 속도가 빨라진다. 무선 주파수의 개념으로도 동일하다. 10Mhz 주파수 대역 하나를 20Mhz 대역폭으로 키우는 것이다. 10 + 10 == 20 흠... 그렇다면 위와 같은 공식에

TIP - Check ambiguous layout in Xcode debugger

How can I check auto layout issue of iOS application from Xcode? Easy. Run your application Pause by debugger Type the following command from debug console: (lldb) po [[UIWindow keyWindow] _autolayoutTrace] You can see the trace from debug console such as: *<UIWindow:0x9980df0> |   *<UIView:0x8eb2fd0> |   |   *<UISwitch:0x8eb31b0> |   |   |   <_UISwitchInternalViewNeueStyle1:0x8eb3540> |   |   |   |   <UIView:0x8eb3ac0> |   |   |   |   |   <UIView:0x8eb3840> |   |   |   |   <UIView:0x8eb3a10> |   |   |   |   |   <UIView:0x8eb38f0> |   |   |   |   <UIImageView:0x8eb3da0> |   |   *<UISlider:0x8eb61d0> - AMBIGUOUS LAYOUT |   |   |   <UIView:0x8eb9290> |   |   |   |   <UIView:0x8eb9af0> |   |   |   |   |   <UIView:0x8eb9bc0> |   |   |   |   <UIView:0x8eba490> |   |   |   <UIImageView:0x8eba6a0> |   |   |   |   <UIImageView:0x8eba540> If you think

WWDC 2013 - Advances in Objective-C (404) Summary

Using a Framework #import model issue Header fragility Non-scalable compile time pre-compiled headers help significantly - maintenance burden / namespace pollution Modules solve these issues @import iAd; Doesn't need to parse headers Local macro definitions have no effect on framework API  Autolinking - don't need to "link binary with libraries" Selective import @import iAd.ADBannerView; Using Modules #import and #include automatically mapped to @import No source changes required Mac OS X Mail shows 40% faster compile time with modules - didn't manage pre-compiled headers well  For old project, enables it manually through the GUI Build Settings / Apple LLVM 5.0 - Language - Modules / Enable Modules Modules are not available for user framework Tools support for modernisation Edit / Refactor / Convert to Modern Objective-C Syntax … Explicit Enums NS_ENUM, NS_OPTIONS Tagged Pointers Added to 64 bit Cocoa For

WWDC 2013 - Advanced debugging with LLDB Summary

Finding problems Debug-only assertions NSAssert NS_BLOCK_ASSERTIONS disables assertions in release builds Log effectively with ASL (Apple System Log) ASL_LEVEL_EMERG ASL_LEVEL_DEBUG Use hash tags like #web in log messages Have switches for the heaviest logging (e.g. NSUserDefaults) Validate your program with Xcode WWDC 2010 Advanced memory analysis with instruments WWDC 2013 What's new in the LLVM compiler Stopping before problems occur Breakpoints Stop at a source line: b MyView.m:4 Stop at a method: b "-[MyViewA drawRect:]" Stop whenever any object receives a selector: b drawRect: Breakpoint commands run each time a breakpoint is hit (e.g. backtrace and continue) br co a > bt > c > DONE Can be done also from GUI Find when a method is called on a specific instance (lldb) p id $myModel = self   --> create a persistent variable (lldb) b "-[MyModel dealloc]" (lldb) br m -c "self == $myMo

LLDB features and WWDC sessions

Let's check interesting LLDB (Xcode debugger) features maybe you don't know until yet. Please find full documentation about LLDB from  here . Alias You can make a few alias for commonly used commands. for example, (lldb) command alias bfl breakpoint set -f %1 -l %2 (lldb) bfl Test.m 15 You can store all aliases to  ~/.lldbinit  file. LLDB will read this file at startup. Regular expression alias You can use regex to make alias (lldb) command regex f "s/^([0-9]+)/frame select %1/" (lldb) f 12  --> frame select 12 Type summary If you want to display summary for custom classes or structures, you can add type summary (lldb) type summary add --summary-string "x=${var.x} y=${var.y}" MyPoint You also can write a Python script that returns the string to be used as summary. Please see   LLDB documentation Expression Evaluating generalized expression in the current frame (lldb) expr (int) printf("Print nine: %d", 5 + 4) Python

Java path from Mac OS X

Where is my Java SDK from Mac OS X with Oracle's JVM installing. Easy way to find out it is running the below command from the terminal. /usr/libexec/java_home Can be a good idea to add JAVA_HOME to your .bash_profile file. such as > vim ~/.bash_profile Add the below line from vim. export JAVA_HOME=`/usr/libexec/java_home` Save file. Done.

Xcode 5 - comment for documentation

New feature of Xcode 5. You can document your own code as like the below: /*! Add new message between source to destination timeline as empty name string  * \param sourceId Source timeline entity ID  * \param destId Destination timeline entity ID  * \returns A newly created message instance  */ - ( ISMessage *)messageFromTimeline:( NSInteger )sourceId toTimeline:( NSInteger )destId; You can use Doxygen format for documentation.  Then you can see the documentation of this function from Xcode 5 UI (by using Quick Help or Option-Click).  Very easy! The following comment styles are also possible. /**   * Add new message between source to destination timeline as empty name string  * @author Wonil Kim  *  * @param sourceId Source timeline entity ID  * @param destId Destination timeline entity ID  * @return A newly created message instance  */ - ( ISMessage *)messageFromTimeline:( NSInteger )sourceId toTimeline:( NSInteger )destId; /// Add new m

Linux kernel v3.9 ARM에서 KVM 지원

Overview 2013년 4월 29일 Linux kernel 3.9 버전이 릴리즈 됨 - change log 참고 ARM 프로세서에서 KVM 가상화 지원 기능이 추가 됨  이 글에서는 KVM과 관련된 CPU 가상화 지원에 대한 정보들을 간추려 보고자 한다 KVM 이란 KVM (Kernel-based Virtual Machine) 은 VMware와 같은 가상화를 Linux 커널 모듈에서 제공 Intel VT나 AMD-V와 같은 가상화 H/W 지원하는 x86 CPU에서만 동작했으나 3.9 커널 부터는 ARM CPU에서도 동작 가능 그렇다면 ARM CPU도 Intel VT와 같은 가상화 지원을 제공한다는 의미? Intel VT란 Intel VT (Virtualization Technology) 는 가상화를 지원하기 위한 VMX (Virtual Machine Extensions)라는 명령어를 제공한다. VMXON - enter VMX operation VMXOFF - leave VMX operation VMREAD - read field from Virtual Machine control structure VMWRITE - write field to Virtual Machine control structure VMPTRLD - load pointer from Virtual Machine control structure VMPTRST - store pointer to Virtual Machine control structure VMLAUNCH - Launch Virtual Machine VMRESUME - Resume Virtual Machine VMCALL - Call to VM Monitor 이 명령어를 이용하여 VMM (Virtual Machine Monitor) S/W 는 더 빠른 성능의 가상화 솔루션을 구현할 수 있다.  Intel CPU는 가상화 지원을 위해 EPT (Extended Pag

Android QEMU용 Kernel을 (Mac에서) 빌드하는 법

http://source.android.com/source/building-kernels.html Google 문서를 참고하였으나 오늘 날짜 상태와 맞지않는 부분이 있고 또한, Mac OS X Mountain Lion에서 빌드하다보니 다른 점이 있어 정리해본다. 다른점 1. QEMU 에뮬을 위한 커널 소스코드 가져오기 1) git clone https://android.googlesource.com/kernel/goldfish.git kernel-goldfish 2) cd kernel-goldfish/ 3) git checkout origin/android-goldfish-3.4 3번 과정은 오늘 날짜 기준이므로 나중에 더 최신 버전의 Kernel로 바뀔 수 있다. 이 경우 git branch -a로 가능한 branch 목록을 확인해서 원하는 것으로 고르자. 다른점 2. Cross compile을 위한 toolchain path android-build/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7/bin 를 PATH에 지정해준다. 다른점 3. libelf 설치 필요 MacPort를 이용하여 libelf를 설치한다. 또한,  http://plattanimattan.blogspot.kr/2010/04/cross-compiling-linux-on-mac-osx.html 문서를 참고해서 elf.h 파일을 만든다. 참고로 libelf를 설치하면 헤더 파일은 /opt/local/include/libelf 폴더안에 있다. 다른점 4. 위 libelf 관련 문서에서 알려준 것 외에 아래 #define을 elf.h 파일 맨 처음에 추가해준다. #define __LIBELF64 1 #define __LIBELF_INTERNAL__ 1 UPDATE:  make ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-linux-androideabi- menuconfi

Google App Engine의 Database 비용 줄이기

얼마전 iOS 개발자로 일하고 있는 친구와 함께 사진 공유 App을 런칭했다. ( App Store Link ). 어차피 돈 벌기 위한 작업이 아니었으므로 서버 비용을 최소화하는 방법으로 구현했다. 1. 사진 데이터는 Facebook에 올린다. 2. 우리 App에서 보여주기 위한 데이터(순위, 투표 현황 등)는 Google App Engine에 저장한다. 1 GB까지 무료이므로 어느정도 수준까지 무료로 서비스 가능. 이 이상이면 소액 지출로 해결한다. 1GB 이상의 데이터가 쌓일 정도면 일정 수준 성공한 서비스이므로 광고 등으로 유지 비용을 벌 수 있을 것이라 판단. 3. iOS App에서 cache를 적절히 활용하여 Google App Engine에 조회를 최소화한다. 위와 같은 방식으로 하면 초기 비용 없이 서비스를 한동안 제공할 수 있을 것이라 생각하고 App을 한달전 쯤 런칭하였는데... 딱 일주일만에 Google App Engine의 DB read 동작이 무료로 제공되는 한계치를 넘을려 하고 있었다. 어쩔 수 없이 유료화로 전환하여 약간의 비용을 지출하게 되었는데. 실제 사용자 수에 비해 DB read 횟수가 많아 보여 이를 감소하는 방법을 찾아 적용하였다. 혹시, Google App Engine을 사용하여 서비스를 구축하려는 분들에게 도움이 될 듯 싶어 공유한다. DB read 동작 횟수에 대한 정확한 이해가 필요 Entity를 읽으면 무조건 1회의 read 동작 Query를 실행하면 1회, Query에서 얻어지는 모든 Entity에 대해 1회의 read 동작 (read는 100k 당 0.07 USD) Key만 조회하는 Query의 경우는 read 1회에 Query에서 얻어지는 모든 Entity Key에 대해 1회의 small 동작 (small은 100k 당 0.01 USD) 즉, Entity를 얻어오는 동작을 최소화하고 Query를 실행 시 Key 값만으로도 충분하다면 언제나 Key only 조

Books of the Week - BBC 100 books to read

Books of the Week란 간단한 Web Site를 Google App Engine으로 운영하고 있습니다. New York Times의 베스트셀러 목록을 주 단위로 보여주는 초 단순 사이트인데요. 요즘 제가 개인적으로 좋아하는 기능을 하나 추가하였습니다. BBC 100 best books. 영국의 BBC 방송국이 추천한 100개의 책 목록을 보여주는 페이지 입니다. ( http://www.booksweek.com/bbc100.html ) 이 페이지의 DB를 만들면서 이 책들 중에 거의 읽어본 것이 없다는 것을 발견하곤 좀 창피해지더군요. 스스로 독서를 독려하기 위해 이 웹페이지에 읽어 본 책 확인 기능을 추가하려고 합니다. 시간되시면 웹 페이지 한번 들러주세요. 주소는 www.booksweek.com 입니다. 감사합니다.