原创 iOS開發 第一次進入app滾動頁思路

每一個app都應該有一個初始頁來指示app的功能或者本次更新的新功能,也可以是廣告等等; 這個初始頁需要一個控制器嗎?不需要,只要一個scrollview,在appdelegate中 [self.window.rootViewContro

原创 機器學習筆記:kNN算法

k-近鄰算法 優點:精度高、對異常值不敏感、無數據輸入假定。 缺點:計算複雜度高、空間複雜度高 適用數據範圍:數值型和標稱型 k的含義:我們只選擇樣本數據集中前k個最相似的數據,通常不大於20,在這k個數據集中選擇出現次數最多的分類作爲新

原创 iOS開發 數組中保存frame

一下子要init很多控件,有些情況把控件的frame放在nsarray數組裏會方便很多,遍歷着init;也會有很多情況用到。 那麼如何把frame裝入nsarray呢 [_array addObject:[NSValue valueWi

原创 iOS開發 從下往上彈出提醒視圖或日期選擇視圖等等背景爲半透明

從下往上彈出提醒視圖或日期選擇視圖等等,背景爲半透明,彈下去時半透明慢慢消失,最後隱藏 先是背景與日期選擇的初始化-(void)initTimeView{ //時間 背景 提醒視圖 //背景透明黑 _bla

原创 iOS開發 利用cell上的view獲得這個cell以及他的indexpath和row

這類問題經常會遇到,方法也很簡單暴力 UITableViewCell *cell = (UITableViewCell*)[[sender superview] superview]; NSIndexPath *indexPath

原创 Mac下Hadoop 出現問題(一)

Mac下的Hadoop,和網上別人的教程以及官方文檔差別好像很大,我的是2.7.1版本,也可能是版本問題。 出了問題研究了很久,網上也找了很久。 1.tcd-pc$ hdfs dfs -put 2.7.1/tcd.docx input

原创 iOS開發 通知中心傳值以及僅通知

利用通知中心傳遞信息在一個控制器傳給上一個控制器的情況經常用到 不傳值時常用於觸發某種action:        在發送方: [[NSNotificationCenter defaultCenter]postNotificationNa

原创 UVa-227 - Puzzle

這題真是搞了很久,輸出格式一直有錯,僅供參考,代碼很臃腫。 #include <stdio.h> #include <string.h> char a[1001]; char s[5][5]; int main() {

原创 UVa-232 Crossword Answers

A crossword puzzle consists of a rectangular grid of black and white squar

原创 UVa-1586 - Molar mass

An organic compound is any member of a large class of chemical compounds w

原创 iOS開發 圖標大小不合適時重繪圖標大小

有時會遇到得到的圖片/圖標的大小不是很貼合需求,這時最好找美工,也可以自行重繪 UIImage *icon = [UIImage imageNamed:@"rili.png"]; CGSize itemSize = CGS

原创 UVa-1585-Score

There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problemand an ‘X’ means a wr

原创 iOS開發 常用宏定義

#ifndef Public_h#define Public_h// 1.判斷是否爲iOS7#define iOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0

原创 iOS開發 多個cell在初始化時注意重用池

多個cell在 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowA

原创 UVa-455 - Periodic Strings

A character string is said to have period k if it can be formed by concate