안드로이드 앱을 만들면서 많은 오류가 있었고 앞으로도 있겠지만 이건 진짜 이유조차 모르겠기에 너무 힘들었다.어찌됐던지 간에 이유를 찾고 조치를 취한 상황을 정리해 보고 싶었다.■ 증상 : 앱이 죽는다.흔한 일이다. 보통 logcat에 붉은 줄을 남기고 죽는다.그러나 이번은 아니다. 길을 보여주는 붉은 log가 없다.대신 노란 log가 계속 생긴다. scudo oom.처음 들어보고 무슨 말인지 모르겠다.■ 조사scudo - android 에서 메모리 할당하는 어떤 것oom - out of memory란다.profiler에서 heap dump를 떠서 보란다.해본다. 스튜디오에 있는건 잘 모르겠다. MAT가 좋단다.설치했다. 덤프파일이 안 열린다. 컨버팅을 해야 한단다. 열었다.그래도 모르겠다.■ 대응계속 덤..
var ans = Array(n) { i -> 0 }
2018년 카카오 Blind Recruitment에 출제된 문제다. https://programmers.co.kr/learn/courses/30/lessons/42891?language=kotlin class Solution { fun solution(food_times: IntArray, k: Long): Int { var list = mutableListOf() for(i in 1..food_times.size) list.add(Pair(i,food_times[i-1])) list.sortBy {it.second} var size = food_times.size var remain = k var answer = -1 var food_time1 = 0 var food_time2 = 0 var it = ..
Kotlin에서 MutableMap을 정렬하기 위해서는 toSortedMap 함수를 사용하는데 이 경우 key를 기준으로 정렬하게 된다. value를 기준으로 정렬하기 위해서는 보다 복잡한 단계를 거쳐야 한다. 아래 코드가 하나의 예다.var map = mutableMapOf() var sortedByValue = map.toList().sortedWith(compareBy({it.second})).toMap()먼저 MutableMap을 List로 변환한다. 이 때 List 항목은 Pair로 구성된다. 다음 sortedWith 함수를 이용하여 정렬한다. sortedWith 함수의 인자로 Comparator를 생성하여 전달하는데 compareBy 함수를 이용하여 Pair 의 second 요소를 정렬 기준으..
Summury •Adafruit library v1 do not support the Intel Curie system, so I have coded it myself. •Even if pin 13 of the shift register is set low, the shield will not work. Therefore it need to connect to GND of the hardware. Contents I purchased a Chinese OEM motor shield to drive dc motor with arduino 101. I used a library compatible with a adafruit v1, but it was not compiled. Library v1 does n..
개요 Genuino101에는 IMU 센서가 내장되어 있어서 별도의 board를 구매할 필요가 없다. 센서의 검출방향은 아래와 같다. 코드 raw 데이터를 읽는 코드는 다음과 같다. #include "CurieIMU.h" float gx,gy,gz; // gyroscope's value float ax,ay,az; // accelerometer's value void setup() { Serial.begin(19200); initIMU(); // IMU initialize } void loop() { CurieIMU.readGyroScaled(gx, gy, gz); CurieIMU.readAccelerometerScaled(ax, ay, az); } void initIMU() { Serial.println..
개요 Arduino101은 Bluetooth LE(Low Energy) 통신 모듈을 내장하고 있다. 말 그대로 Bluetooth를 저전력으로 지원하는 것으로 배터리를 사용하는 모바일 기기 등에 활용하기 위함이다. CurieBLE 라이브러리를 제공한다. 코드 #include CurieBLE.h // service와 characteristic 선언 BLEService genuinoService1("BBB0"); BLEIntCharacteristic char1("BBB1", BLERead | BLENotify, 30); // arduino에서는 읽기 BLEService genuinoService2("0174"); BLEIntCharacteristic char2("0175", BLEWrite); // ardui..
- Total
- Today
- Yesterday
- 렌즈
- 나현이
- 제주도
- 아소
- 중문해수욕장
- 함덕
- 규슈
- 꽃전시회
- 노자
- Android Studio
- 풍림콘도
- 뽀로로
- 까꿍이
- 유아동요
- L293D
- 봄
- Genuino101
- 덴파레
- Kotlin
- 74HC565
- 꽃
- ble
- shift register
- 민성이
- 도덕경
- 에코랜드
- Arduino101
- 동탄
- 한화우림
- 휴애리
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |