본문 바로가기
[ruby] download and parse to json [ruby] download and parse to json require "rubygems"require "json"require "net/http"require "uri" uri = URI.parse("http://address") http = Net::HTTP.new(uri.host, uri.port)request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) if response.code == "200" result = JSON.parse(response.body) result.each do |doc| puts doc["id"] #reference properties like this puts doc # this is.. 2018. 4. 3.
[android] Notification 에 meta data 를 추가하자 https://plus.google.com/+AndroidDevelopers/posts/7QBWvNXs2mD -기존 안드로이드의 Notification 은 importance 와 timestamp 만 보고 ordering 을 했다. -Android 5.0 ( LOS ) 부터는 ordering 을 결정하는 데 영향을 미치는 meta data 들이 추가되었다. -ordering 에 영향을 미치는 녀석 중 하나는 addPerson 을 통한 사람의 추가이다. -addPerson 은 CONTENT_LOOKUP_URI, tel:, mailto: 이 셋 중의 하나의 scheme 을 Uri 형태로 받는다. 이 정보를 기반으로 연락처 정보를 찾는다.이 찾은 결과는 not found, match found, starred.. 2017. 8. 24.
[android] 추가된 유용한 annotations [android] 추가된 유용한 annotations http://tools.android.com/tech-docs/support-annotationshttps://developer.android.com/reference/android/support/annotation/package-summary.html -Android support library 19.1 version 에서 annotation 들을 추가했다. -이 녀석을 사용하려면 gradle 에 다음을 추가해야 한다. compile ‘com.android.support:support-annotations:20.0.0’ 여기서는 크게 3가지 형태의 annotation 을 제공한다. 1. Nullness annotattions2. Resource ty.. 2017. 8. 2.
[android] Uri.getQueryParameter 에 # 들어가면 제대로 파싱 못합니다. [android] Uri.getQueryParameter 에 # 들어가면 제대로 파싱 못합니다. #안쪽 소스를 들여다보면 어떻게 작동하는지 알 수 있다. #static String parsePath(String uriString, int ssi) { int length = uriString.length(); // Find start of path. int pathStart; if (length > ssi + 2 && uriString.charAt(ssi + 1) == '/' && uriString.charAt(ssi + 2) == '/') { // Skip over authority to path. pathStart = ssi + 3; LOOP: while (pathStart < length) { swi.. 2017. 5. 15.
[Django] 파이썬 웹 프로그래밍 - 웹 프로그래밍의 이해 [Django] 파이썬 웹 프로그래밍 - 웹 프로그래밍의 이해 -책을 읽으며 Remind 하는 내용, 핵심 내용, 모르던 내용을 정리한 것입니다. 예문 및 자세한 설명은 책을 구매하여 보세요~ * 1.2.1. 웹 브라우저를 사용하여 요청 * 1.2.2. 리눅스 curl 명령을 사용하여 요청 -curl 명령은 HTTP/HTTPS/FTP 등 여러 가지의 프로토콜을 사용하여 데이터를 송 수신할 수 있는 명령이다. * 1.2.3. Telnet 을 사용하여 요청 -telnet 명령은 터미널 창에서 입력하는 내용을 그대로 웹 서버에 전송한다.telnet 명령모드에서 나가려면 아래 두 라인을 입력해야 한다. ^] ( Ctrl + ] )quit .. 2016. 12. 6.
[android] video recording duration limit setting. android, video recording duration limit setting. From API level 8 ( Froyo ) it works fine. Intent intent = new Intent( MediaStore.ACTION_VIDEO_CAPTURE );intent.putExtra( "android.intent.extra.durationLimit" , 5 ); // max 5 sec recording available. startActivityForResult( intent, 234 ); activity result 의 data 에는 저장된 동영상의 uri 가 전달된다. ACTION_VIDEO_CAPTURE, activity result, Android, android.intent.e.. 2014. 4. 3.
[Android] 제대로 된 REST API 를 구축해보자. [Android] 제대로 된 REST API 를 구축해보자. reference : http://mytechaddiction.blogspot.kr/2014/02/rest-interaction-in-android.html?utm_source=Android+Weekly&utm_campaign=4254f212fb-Android_Weekly_91&utm_medium=email&utm_term=0_4eb677ad19-4254f212fb-337262377 Anti-Patterns 1. UI Thread 에서 API Call. 2. Activity 나 Fragment 등에서 Thread 를 만들어 요청 3. 결과를 Memory 에만 저장하여 사용. Decouple the UI from the http call. Act.. 2014. 3. 18.
[android] Linkify 를 이용하여 TextView 에 link 주기 android, Linkify 를 이용하여 TextView 에 link 주기 HashTag 예제 // Hash Tag 패턴Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b"); // TextView 의 Link 를 눌렀을 때 연결할 uri 혹은 url base 주소String uri = "content://com.cklee.hashtags/"; // textview 에서 tagMatcher 에 matching 되는 녀석을 link 로 만들고, // 이녀석을 클릭하면 ACTION_VIEW 를 호출하면서 MIME type 을 uri + tag 로 생성된 scheme 으로부터 받아온다.Linkify.addLinks(textView, tagMatcher,.. 2014. 2. 20.
[android] 생성한 image file media scanner 등록 [android] 생성한 image file media scanner 등록 Stack overflow 를 참조했을 때 아래와 같은 2가지 안정적인 방법이 있다. 방법 1은 SD Card 가 Mount 된 것처럼 broadcast를 날려서 해당 uri 를 scan 하도록 하는 것이고. private void registerToMediaScanner( Uri uri ){Intent intent = new Intent( Intent.ACTION_MEDIA_MOUNTED, uri );sendBroadcast( intent );} 방법 2는 새로 생성한 file 을 MediaScanner 에게 전달하여 해당 내용만 scan 하는 것이다. private void registerToMediaScanner( File .. 2014. 2. 9.
반응형