2022年3月15日 星期二
LeetCode 13. Roman to Integer
LeetCode 1. Two Sum
https://leetcode.com/problems/two-sum/
LeetCode 14. Longest Common Prefix
https://leetcode.com/problems/longest-common-prefix/
題目:
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Example 2:
Input: strs = ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.
Constraints:
- 1 <= strs.length <= 200
- 0 <= strs[i].length <= 200
- strs[i] consists of only lower-case English letters.
2021年10月28日 星期四
Android Studio 聊天室下拉加載歷史訊息
一開始需求是每次有新的訊息要在最下面
然後就很突然的,將 RecyclerView 設置為倒序
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(),
LinearLayoutManager.VERTICAL, true); // 列表翻轉
linearLayoutManager.setStackFromEnd(true); // 列表在底部開始展示, 反轉後由上面開始展示
rvMessagesChat.setLayoutManager(linearLayoutManager);
rvMessagesChat.setHasFixedSize(true);
rvMessagesChat.setAnimation(null);
但是在加載新資料的時候,舊資料會被擠下去
int beforeSize = mList.size();
int afterSize = model.vModelRecord.size();
profileMessagesChatAdapter.addList(model.vModelRecord);
profileMessagesChatAdapter.notifyItemRangeInserted(beforeSize, afterSize);
所以需要新增這行,這樣就不會有擠壓的動畫
rvMessagesChat.setAnimation(null);
2021年9月15日 星期三
Samba - Ubunta 和 Windows 之間的橋樑
1. 先在 Ubunta 安裝 Samba
sudo apt-get install samba
2. 設定 Samba 工作群組,要和Windows 相同
vim /etc/samba/smb.conf
3. 設定要分享的資料夾,格式如下
[ShareName] 分享資料夾名稱
path = /var/usr/ 分享資料夾路徑
read only = no 是否唯讀
create mask = 777 檔案遮罩
directory mask = 777 資料夾遮至
writable = yes 是否可寫入
4. 將 Samba 加進防火牆白名單
sudo ufw status verbose → 確認防火牆狀態
sudo ufw allow samba → 將 Samba 加進防火牆白名單
sudo ufw reload → 重啟防火牆
5. 重啟 Samba 讓他吃修改後的設定檔
sudo service smbd restart
6. 完成
2021年8月25日 星期三
AppsFlyer 廣告追蹤
Apps Flyer 是一個多平台整合的廣告追蹤網站
Apps Flyer 相關
Facebook 相關
iOS 14.5 官方將廣告追蹤透明化
必須經過用戶同意方可進行追蹤
再設定 Facebook 追蹤時,
必須將事件管理工具 > 資料來源 > 設定 > 為 SKAdNetwork 設定應用程式事件 開啟
並編輯事件,才可以收到來自 iOS 的資料
Swift
AppEvents.logEvent(AppEvents.Name.completedRegistration)
Android Studio IDE 錯誤
:app:compile xxxxx JavaWithJavac FAILED An exception has occurred in the compiler (1.8.0_312). Please file a bug against the Java compiler ...
-
網址: https://registrationcenter.intel.com/en/products/ 先在此頁面新增您所購買 Intel 的產品型號 網址: https://shnintel31crm.intel.myshn.ne...
-
以下列enum與struct設計日期星期查詢程式。 須考慮閏年因素 已知條件為: 2019/3/12 TUE 實現功能: 1. 以日期查詢星期 2. 以某日往後及往前若干天推算日期 3. 以月曆型式輸出某給定年月