發表文章

191129 iOS Auto Layout

目標: a. 元件垂直橫向顯示時皆置中。 b. 元件尺寸保持比例。 c. 垂直顯示時,元件左右與螢幕邊緣保持一定距離。 d. 橫向顯示時,元件上下與螢幕邊緣保持一定距離。 e. 在 iPad 上元件不得太大。 條件限制設定如下: ------------------------- a 設定方法: a.i 點選右下角的 "Align" 圖示 a.ii 在彈出式小視窗中勾選 "Horizontally in Container" 與 "Vertically in Container";此兩個項目的右手邊有個輸入框,預設值為 ".0",目前不需更改;該值應該是偏移量,有空可以輸入看看其元件放置的效果。 a.iii 點按 [Add Constraints] 之後在 Constraints 中會出現以下兩項 a.1 [元件].centerX = centerX       水平置中的設定 a.2 [元件].centerY = centerY       垂直置中的設定  ------------------------- b. 設定方法: b.i 點選右下角的 "Add New Constraints" 圖示 b.ii 在彈出式小視窗中勾選 "Aspect Ratio" b.iii 點按 [Add Constraints] 之後在該元件的 Constraints 中會出現以下項目 b.1 aspect = 1:1 ------------------------- c. 設定方法: c.i 點選右下角的 "Add New Constraints" 圖示 c.ii 在彈出式小視窗上半部的左右輸入框中,輸入左右兩邊要保持的距離;在輸入框中的右邊會有個白色倒三角形,點選後會有選項,建議選擇 "Safe Area"。 c.iii 檢查左右輸入框與中間元件圖示間的紅色間距圖示是否已變為亮紅色實線。 c.iv 點按 [Add Constraints] c.v c.i~c.iv 再操作一次 c.vi 在 Constraints 中,點選第一個 [元件].l...

191127 Kotlin Coroutines

dependency kotlinx-coroutines-core dependencies { implementation ' org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2 ' }

191119 Collections shuffle

在 Kotlin 範例程式碼中看到以下 Code Collections.shuffle(list)   但 Android Studio 卻出現以下的 Warning   Call of java mutator shuffle on immutable Kotlin collection   ------------   找到的 Kotlin 文件如下。   fun   < T >   MutableList < T > . shuffle ( ) ------------ 於是把上面的程式碼改為 val mutableList = list. toMutableList () mutableList. shuffle () list = mutableList. toList ()

191029 Firebase Task continueWith

這幾天在看 Firebase 的 Call functions from your app https://firebase.google.com/docs/functions/callable 範例中,有一段程式碼如下 return functions .getHttpsCallable( "addNumbers" ) .call(data) .continueWith { task -> // This continuation runs on either success or failure, but if the task // has failed then task.result will throw an Exception which will be // propagated down. val result = task. result ?. data as Map<String, Any> result[ "operationResult" ] as Int }   functions com.google.firebase.functions.FirebaseFunctions https://firebase.google.com/docs/reference/android/com/google/firebase/functions/FirebaseFunctions  .getHttpsCallable( "addNumbers" )   "addNumbers" 為 Cloud Function 的名稱 getHttpsCallable 回傳的是 HttpsCallableReference https://firebase.google.com/docs/reference/android/com/google/firebase/functions/HttpsCallableReference.html .call(data) 傳入的是 addNumbers 可接受的...

190904 文件目錄與 iCloud

如果你在 Finder 中看不到 "文件" 目錄,那應該是你開啟了 iCloud 的同步功能。 如習慣把檔案放在 "文件" 資料夾中,那就至 iCloud 把該功能關掉。 [系統編好設定] > [iCloud] > iCloud 雲碟 - [選項...] 將 [桌面與文件檔案夾] 取消勾選 這樣在 Finder 中就可以看到 "文件" 目錄了

190823 ISO 27001 A.17

A.17.1 永續資訊安全 Information security continuity 目標:永續資訊安全應嵌入進組織的永續經營管理系統中。   Objective: Information security continuity shall be embedded in the organization’s business continuity management systems. A.17.1.1 永續資訊安全之計劃   Planning information security continuity 組織應決定在不利的情況下,例如危機或災難期間,資訊安全與永續資訊安全管理之需求。   The organization shall determine its requirements for information security and the continuity of information security management in adverse situations, e.g. during a crisis or disaster.

190823 ISO 27001 A.16

A.16.1 資訊安全事故與改進之管理   Management of information security incidents and improvements 目標:確保資訊安全事故的管理採用一致且有效的方法,包括安全事件與弱點之傳遞。   Objective: To ensure a consistent and effective approach to the management of information security incidents, including communication on security events and weaknesses. A.16.1.1 責任與程序 Responsibilities and procedures 管理責任與程序應加以建立,以確保對資訊安全事故做出迅速、有效且有條理的回應。   Management responsibilities and procedures shall be established to ensure a quick, effective and orderly response to information security incidents. A.16.1.2 資訊安全事件之通報 Reporting information security events 資訊安全事件應儘速地透過適當的管理管道通報。   Information security events shall be reported through appropriate management channels as quickly as possible. A.16.1.3 資訊安全弱點之通報   Reporting information security weaknesses 應要求使用組織的資訊系統與服務之員工與承包商,在系統或服務中觀察到或有可疑的資訊系統弱點時,必須記錄並回報。   Employees and contractors using the organization’s information systems and services shall be require...