안드로이드 개발에서 많은 비중을 차지하는 UI패턴은 ListView에서 여러 이미지를 보여주는 Activity입니다. 전형적인 흐름을 정리하면 아래와 같습니다.
1. 목록조회 API호출
2. API를 파싱하고 ListView에 데이터를 보여 줌.
3. 각 아이템마다의 이미지 주소로 다시 서버를 호출
4. 이미지를 디코딩하고 ImageView에서 보여줌.
| import cv2 | |
| import time | |
| CONFIDENCE_THRESHOLD = 0.2 | |
| NMS_THRESHOLD = 0.4 | |
| COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)] | |
| class_names = [] | |
| with open("classes.txt", "r") as f: | |
| class_names = [cname.strip() for cname in f.readlines()] |
| .cm-s-oceanic.CodeMirror { | |
| font-family: 'Source Code Pro', monospace; | |
| background: #1C2022; | |
| color: #e0e0e0; | |
| height: 100%; | |
| font-size: 14px; | |
| font-weight: 500; | |
| } | |
| .cm-s-oceanic div.CodeMirror-selected { background: #374140; } |
| # Make sure you grab the latest version | |
| curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip | |
| # Unzip | |
| unzip protoc-3.2.0-linux-x86_64.zip -d protoc3 | |
| # Move protoc to /usr/local/bin/ | |
| sudo mv protoc3/bin/* /usr/local/bin/ | |
| # Move protoc3/include to /usr/local/include/ |
| import android.Manifest; | |
| import android.annotation.TargetApi; | |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.content.pm.PackageManager; | |
| import android.os.Build; | |
| import android.support.annotation.NonNull; |
| package testjava; | |
| import java.util.HashMap; | |
| import java.util.Random; | |
| /* | |
| * URL Shortener | |
| */ | |
| public class URLShortener { | |
| // storage for generated keys |
| server { | |
| listen 443 ssl; | |
| server_name xxx.xx.io | |
| ssl on; | |
| ssl_certificate /etc/asterisk/certs/xxx.io.pem; | |
| ssl_certificate_key /etc/asterisk/certs/xxx.io.key; | |
| ssl_session_timeout 5m; |
| <?xml version="1.0" encoding="utf-8"?> | |
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <rotate | |
| android:duration="70" | |
| android:fromDegrees="-5" | |
| android:pivotX="50%" | |
| android:pivotY="50%" | |
| android:repeatCount="5" | |
| android:repeatMode="reverse" |
안드로이드 개발에서 많은 비중을 차지하는 UI패턴은 ListView에서 여러 이미지를 보여주는 Activity입니다. 전형적인 흐름을 정리하면 아래와 같습니다.
1. 목록조회 API호출
2. API를 파싱하고 ListView에 데이터를 보여 줌.
3. 각 아이템마다의 이미지 주소로 다시 서버를 호출
4. 이미지를 디코딩하고 ImageView에서 보여줌.
| import com.google.gson.Gson; | |
| import com.google.gson.JsonSyntaxException; | |
| import com.android.volley.AuthFailureError; | |
| import com.android.volley.NetworkResponse; | |
| import com.android.volley.ParseError; | |
| import com.android.volley.Request; | |
| import com.android.volley.Response; | |
| import com.android.volley.Response.ErrorListener; | |
| import com.android.volley.Response.Listener; |
| # Raw transaction API example work-through | |
| # Send coins to a 2-of-3 multisig, then spend them. | |
| # | |
| # For this example, I'm using these three keypairs (public/private) | |
| # 0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU | |
| # 04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk | |
| # 048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw | |
| # First: combine the three keys into a multisig address: | |
| ./bitcoind createmultisig 2 '["0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86","04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a9 |