Monday, September 28, 2015

Android Studio logcat 색깔 변경

이클립스와 달리 Android Studio는 디버깅시 logcat의 색깔이 하이라이팅 지정되지 않아서 여간 불편한게 아니었다.
하지만 다음과 같이 설정하면 logcat의 색깔을 지정할 수 있게 된다. 이클립스와 똑같은 환경을 만들자.


Tuesday, September 22, 2015

MySQL 초기 root 패스워드 설정하기

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=password('password') where user='root';
Query OK, 4 rows affected (0.07 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.21 sec)

mysql> select host, user, password from user;
+----------------------+------------------+-------------------------------------------+
| host                 | user             | password                                  |
+----------------------+------------------+-------------------------------------------+
| localhost            | root             | *78D22DFB85972182BE20A883D8B5021FD8B5FCCA |
| yegam400.vps.phps.kr | root             | *78D22DFB85972182BE20A883D8B5021FD8B5FCCA |
| 127.0.0.1            | root             | *78D22DFB85972182BE20A883D8B5021FD8B5FCCA |
| ::1                  | root             | *78D22DFB85972182BE20A883D8B5021FD8B5FCCA |
| localhost            | debian-sys-maint | *E54187CB3AF30C421C5063781FEE02F787E6842F |
+----------------------+------------------+-------------------------------------------+

Wednesday, September 16, 2015

Android Studio auto import 설정하기

Eclipse에서는 Cmd+Shift+M을 하면 auto import가 되었는데 Android Studio에서는 찾기가 쉽지 않았다. 그런데 드디어 찾아내서 방법을 공유한다.

Preferences - Editor - Auto Import에 가서 가운데에 있는 3가지 항목을 전부 checked한다.


Wednesday, September 9, 2015

iOS Failed to locate or generate maching signing assets


https://developer.apple.com/library/ios/recipes/xcode_help-accounts_preferences/articles/import_signing_assets.html#//apple_ref/doc/uid/TP40013306-CH9-SW1

Sunday, September 6, 2015

Android Studio ViewPager PageTabStrip titles are initialy not shown problem

Eclipse에서 Android Studio로 마이그레이션 했는데, ViewPager에서 PageTabStrip의 타이틀이 초기로딩시에 렌더링이 되지 않았다. ViewPager가 다른 페이지로 한번 페이징 된 후에는 PageTabStrip의 타이틀이 정상적으로 나왔다.

이 문제에 대해서 하루종일 고민하다가 결론을 얻었다. Android Studio에서는 appcompat v4라이브러리를 직접적으로 링크하면 안되고, 대신에 design library를 링크해야한다는 것이다.

dependencies {
...
compile 'com.android.support:design:22.2.0'
...
}

Thursday, September 3, 2015

iOS 개발시 스토리보드 제거하기

iOS 프로젝트에서 스토리보드를 제거하는 방법을 알아보자. 스토리보드가 있으면, 대형 프로젝트에서 여러사람이 협업시에 불편한점이 있고 수동으로 뷰를 컨트롤 하는게 명확하므로 제거하는 것이 좋다.

1. main.plist에서 "Main storyboard base file name"을 삭제해준다.

2. 기존 뷰 컨트롤러를 삭제해 준다. 예제에서는 ViewController.h/m이다.

3. 뷰 컨트롤러를 새로 생성한다. 생성하는 방법은 New file - iOS - Source - Cocoa Touch Class이다.

그리고 반드시 XIB를 생성하는 옵션을 선택하여야 한다.

4. AppDelegate.m에 다음과 같은 코드를 추가 한다.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    // 스토리보드 없이 사용하는 방법
    self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    
    ViewController *viewController = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = viewController;    
    [self.window makeKeyAndVisible];

    return YES;

}

iOS ARC 프로젝트에서 non-ARC 소스 컴파일하기(-fno-objc-arc)

iOS 프로그램을 개발하다보면 ARC(Auto Reference Counting) 프로젝트에서 non-ARC 소스를 컴파일 해야 할 때가 있다.

그럴때는 다음과 같이 Build Phases에서 해당하는 .m(ObjC) 파일의 옵션에다가 '-fno-objc-arc'를 하게 되면 해당 .m 파일만 non-ARC 방식으로 컴파일할 수 있다.

최신 프로젝트에 구형 SDK를 연동할때 많이 쓰는 방식이다. 나는 이걸 몰라서 C#에 Native C++을 연동할때 Managed C++ 프로젝트를 만드는 것처럼 프로젝트를 ARC/non-ARC 분리를 했는데 그렇게 하면 더 많은 문제가 생긴다. iOS에서는 이 방식을 추천한다.


Wednesday, September 2, 2015

HTML5 아이폰 채팅 말풍선



<style>
body {
  font-family: "Helvetica Neue";
  font-size: 20px;
  font-weight: normal;
}

section {
  max-width: 450px;
  margin: 50px auto;
}
section div {
  max-width: 255px;
  word-wrap: break-word;
  margin-bottom: 20px;
  line-height: 24px;
}

.clear {
  clear: both;
}

.from-me {
  position: relative;
  padding: 10px 20px;
  color: white;
  background: #0B93F6;
  border-radius: 25px;
  float: right;
}
.from-me:before {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: -2px;
  right: -7px;
  height: 20px;
  border-right: 20px solid #0B93F6;
  border-bottom-left-radius: 16px 14px;
  -webkit-transform: translate(0, -2px);
}
.from-me:after {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: -2px;
  right: -56px;
  width: 26px;
  height: 20px;
  background: white;
  border-bottom-left-radius: 10px;
  -webkit-transform: translate(-30px, -2px);
}

.from-them {
  position: relative;
  padding: 10px 20px;
  background: #E5E5EA;
  border-radius: 25px;
  color: black;
  float: left;
}
.from-them:before {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: -2px;
  left: -7px;
  height: 20px;
  border-left: 20px solid #E5E5EA;
  border-bottom-right-radius: 16px 14px;
  -webkit-transform: translate(0, -2px);
}
.from-them:after {
  content: "";
  position: absolute;
  z-index: 3;
  bottom: -2px;
  left: 4px;
  width: 26px;
  height: 20px;
  background: white;
  border-bottom-right-radius: 10px;
  -webkit-transform: translate(-30px, -2px);
}
</style>
<section>
<div class="from-me">
 <p>Hey there! What's up?</p>
</div>
<div class="clear"></div>
<div class="from-them">
 <p>Checking out iOS7 you know..</p>
</div>
<div class="clear"></div>
<div class="from-me">
 <p>Check out this bubble!</p>
</div>
<div class="clear"></div>
<div class="from-them">
 <p>It's pretty cool!</p>
</div>
<div class="clear"></div>
<div class="from-me">
 <p>Yeah it's pure CSS &amp; HTML</p>
</div>
<div class="clear"></div>
<div class="from-them">
 <p>Wow that's impressive. But what's even more impressive is that this bubble is really high.</p>
</div>
</section>