##分布式系统(Distributed System)资料
介绍:这是一篇介绍在动态网络里面实现分布式系统重构的paper.论文的作者(导师)是MIT读博的时候是做分布式系统的研究的,现在在NUS带学生,不仅仅是分布式系统,还有无线网络.如果感兴趣可以去他的主页了解.
| public static float convertPixelsToDp(float px){ | |
| DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); | |
| float dp = px / (metrics.densityDpi / 160f); | |
| return Math.round(dp); | |
| } | |
| public static float convertDpToPixel(float dp){ | |
| DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); | |
| float px = dp * (metrics.densityDpi / 160f); | |
| return Math.round(px); |
| import android.content.res.Resources; | |
| import android.graphics.drawable.Drawable; | |
| import android.text.Spannable; | |
| import android.text.SpannableStringBuilder; | |
| import android.text.style.ImageSpan; | |
| import android.view.View; | |
| import android.widget.ImageView; | |
| import android.widget.LinearLayout; | |
| import android.widget.SearchView; | |
| import android.widget.TextView; |
| /** | |
| * Class connecting the Realm lifecycle to that of LiveData objects. | |
| * Realm will remain open for as long as any LiveData objects are being observed. | |
| */ | |
| abstract class LiveRealmData<T: RealmModel>(val config: RealmConfiguration) : LiveData<RealmResults<T>>() { | |
| private val listener = RealmChangeListener<RealmResults<T>> { results -> value = results } | |
| private lateinit var realm: Realm | |
| private var results: RealmResults<T>? = null |
| # 0 is too far from ` ;) | |
| set -g base-index 1 | |
| # Automatically set window title | |
| set-window-option -g automatic-rename on | |
| set-option -g set-titles on | |
| #set -g default-terminal screen-256color | |
| set -g status-keys vi | |
| set -g history-limit 10000 |
##分布式系统(Distributed System)资料
介绍:这是一篇介绍在动态网络里面实现分布式系统重构的paper.论文的作者(导师)是MIT读博的时候是做分布式系统的研究的,现在在NUS带学生,不仅仅是分布式系统,还有无线网络.如果感兴趣可以去他的主页了解.
| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
| A good commit message looks like this: | |
| Header line: explaining the commit in one line | |
| Body of commit message is a few lines of text, explaining things | |
| in more detail, possibly giving some background about the issue | |
| being fixed, etc etc. | |
| The body of the commit message can be several paragraphs, and | |
| please do proper word-wrap and keep columns shorter than about |
| <!-- You can change the parent around to whatever you normally use --> | |
| <style name="DebugColors" parent="Theme.AppCompat"> | |
| <!-- System colors --> | |
| <item name="android:windowBackground">@color/__debugWindowBackground</item> | |
| <item name="android:colorPressedHighlight">#FF4400</item> | |
| <item name="android:colorLongPressedHighlight">#FF0044</item> | |
| <item name="android:colorFocusedHighlight">#44FF00</item> | |
| <item name="android:colorActivatedHighlight">#00FF44</item> |
| fun getData() = produce<List<Data>>(LooperThread) { | |
| var results = realm.where(Data::class.java).findAll() | |
| send(map(results)) | |
| results.addChangeListener { results -> | |
| run { | |
| launch(LooperThread) { | |
| send(map(results)) | |
| } | |
| } | |
| } |
| import android.util.Log; | |
| import com.squareup.leakcanary.AnalysisResult; | |
| import com.squareup.leakcanary.DisplayLeakService; | |
| import com.squareup.leakcanary.HeapDump; | |
| import retrofit.RestAdapter; | |
| import retrofit.RetrofitError; | |
| import retrofit.http.Multipart; | |
| import retrofit.http.POST; | |
| import retrofit.http.Part; | |
| import retrofit.mime.TypedFile; |