Posts

[IOS] 學習記錄(三)-TBA

:如何引入 cocoapods 自己建一個 Podfile 後 pod install 即可 另外先前遇到 /usr/bin/xcodeproj  permission denied 的問題,  似乎是 gem 的路徑問題, 先忽略了. :如何引入存在的 projects/library (あ)直接將 folder 以「拖曳」的方式新增到 project, 然後選擇   added folder: create groups   這是因為 xcode 是以 group 抽象化的形式做 hierarchy 而非實際的 folder (い)enable 「Defines Module」 到 project > Build Settings > Packaging >  Defines Modules 切換為 Yes (う)另外要注意的是,  swift projects import to swift project 是 「no import statement」的,  可以參考 這篇說明 。

git 刪除 commit (before/after push), 刪除 remote folder, 強制 push

早上用 swift 寫了個 new feature, 想要放到 github 上, 但是遇到幾個老問題, 這裡記錄一下。 1. 上傳時忽略不必要或者敏感的 files, folder 利用 .gitignore (但他似乎沒能達到需求) 2. 步驟 1 失敗了時, 該怎麼辦 git rm -r --cached NOT_UPLOAD_FOLDER 3. 如何利用 rebase 移除不必要的 commit ***  等等,先記得備份檔案到別處!  *** >git log  先查詢想要移除的 commits 的前一個 commit_code >git rebase -i [commit_code] 這指令會列出想要修正的 commit, 直接刪除不需要的commits >git rebase --continue 運氣好的話(沒有conflict)可以直接做 rebase >git status 這表示發生 conflict 了, 查一下需要修改哪些檔案 How-to-resolve-conflict 這連結給了解決的一些方式, 我是直接 git add 解決... lol 4. 如何強制更新 remote branch 這裡是因為 3 是 local 的 rebase,  github 上仍是存在  commit, 導致 push 失敗。 *** 等等,你真的知道這在幹嘛嗎 *** >git push origin master --force

一週一記事

Image
ELM, 另一種 functional language, 是說一直沒能有機會接觸這語言,今天看到 meetup 有人開團,可惜時間是一般日,還是先上網做點功課,有興趣再去好了。 quora 上有人分享心得可以參考。 jupyter, 這是在更新 ipython 到 4.0 時因為缺少這元件, 才發現 iPython 在 2015年8月時有了重大的更新, 除了讓 iPython 脫離 python-centric 的刻板印象外,亦支援其他語顏,做到更 language-agnostic 的 interactive programming。 【原文】  Exclusive – Bloomberg Head of Data Science Gideon Mann Talks Machine Learning and Financial Data Gideon Mann, Head of Data Scientist at BloomBerg. incrunchdata News 對他的採訪, 有兩個方向    what they are focusing on in their current roles    what their interest are outside of data. 1. which of your skills do you find most relevant for success as Head of Data Science?  要成為 effective data scientist 必須具備三項   a. skill to apply techniques to utilize data   b. deep knowledge of mathematics   c. ability to listen (most important since the solution to problem is often deeply rooted in the question itself) 2. what does the first hour of your work day usually lo...

git 時不同帳戶,不同專案的管理

【緣由】原先 laptop 上都是自己的 github account, 可因為前陣子也因為需要開新 account 用來 clone 了公司的 project, 於是修改了設定。導致早上要 submit 自己的東西到自己的 github 時卻發現 account 是公司的. 這花了不少時間理解,決定還是筆記一下。 Host work.github.com HostName github.com User WORK_GITHUB_USERNAME PreferredAuthentications publickey IdentityFile ~/.ssh/id_work_rsa IdentitiesOnly yes Host personal.github.com HostName github.com User PERSONAL_GITHUB_USERNAME PreferredAuthentications publickey IdentityFile ~/.ssh/id_personal_rsa IdentitiesOnly yes (1) 首先,修改 ~/.ssh/config, 增加各自的設定 (參考上例). HOST 的 [url] 只是接下來幫你找到該設定,怎麼填並無太大關係。 $ git config user.name "John Doe" $ git config user.email johndoe@example.com (2) 接著, 設定 local repository 的帳號密碼 。很重要!因為我就耗在這裡... orz  之前就是沒改這個部分,直接跳 (3)  後,submit 的仍是公司 account... [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@personal.github.com:PERSONAL_GITHUB_USERNAME/project.git (3) 修改 .git/config 的 url,...

[IOS] 如何更新 UITableview/UICollectionView 的 cell

[更新 2016/02/10 ] 不知道為什麼,在刪除 cell 時時常會遇到問題 (out of index). 目前找到下面最可靠的解法 /* ref: 自己的 github */ self.TAGS.removeAtIndex((self.collectView.indexPathForCell(cell)?.row)!) self.collectView.deleteItemsAtIndexPaths([self.collectView.indexPathForCell(cell)!]) 由於需要透過使用者 scroll up/down 時添加 UITableView/UICollectionView 中的 cell,昨晚找了些方法,這裡整理一下。 1: (1) 2: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 3: { 4: // Classic start method 5: } 6: (2) 7: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell, forRowAtIndexPath:(NSIndexPath *)indexPath 8: { 9: // check if indexPath.row is last row 10: // Perform operation to load new Cell's. 11: } 12: (3) 13: var refreshControl:UIRefreshControl! 14: override func viewDidLoad() 15: { 16: super.viewDidLoad() 17: self.refreshControl = UIRefreshControl() 18: self.refreshControl.attrib...

[IOS] 如何在一個 UILabel 上擺不同的 font type. How to put multiple fonts on one single UILabel at a time

今天本來切好的 label 被設計師說要把字串分開,心裡只有三條線。 上網找解法,果然還真的可以。這裡就貼上解法,因為還挺簡單的。( 解法 ) 另外一個問題是 如何上傳一個 customized font 到 app上 。How to include new fonts to IOS App. 寫 app 跟解算法邏輯果然差很大。

[IOS] 學習記錄(二)

這兩週開發 iOS APP 可以說是一團糟,主要是不熟悉 IB (Interface Builder) 介面,constraint 設定以及 storyboard 跟 segue, xib 三者之間的曖昧情仇(咦?)搞的我每天都在把 view 砍掉重練(馬的),就當作是練功了.這裡記錄一些經驗跟教訓. (參考一)是關於 performance issues, memory leak, reference cycles, etc 的教學文件 1. how to determine hot-spots using time profiler instrument 2. how to detect and fix memory management issues such as strong memory reference cycles using allocations 3. TL;RL :P (參考二)也是關於 memory management 雖說 swift 也有類似 java, python 提供 garbage recycling 跟 ARC (automatic reference counting) 的機制,但是仍是有機會發生 memory issues. 1. retain cycles, 這應該是在說 strong/weak reference, 不知道 swift 能否指定. 2. unnecessary caching, 檢查代碼中的 cache 使用時機. (作者使用 library 去trace, 但不知道是哪個) note:  swift 有些 libraries的底層仍有些是用 objective-c, 所以仍需要小心 (參考三)主要是xib 跟 storyboard 之間元件跟設計上如何互動的教學,雖然我最後決定放棄了 xib ,主因是他在 segue 跟 元件的 event 上增加太多程式邏輯,本來在 storyboard 上可以輕鬆解決的事情卻搞得很累. (參考四)這篇我也忘了當初找他的目的,大概是遇到要動態更新 CHTCollectionViewWaterfallLayout 的 layout 吧,但這文章提到點我覺得很值得一提,就是他 coding 的流程: i. calculate ...