MacVim
Install url:https://code.google.com/p/macvim/
2013年4月15日 星期一
dotfiles
經過學長提點
他推薦我一個dotfiles
至於dotfiles我還不清楚是什麼(如果有人知道跟我說一下)
似乎是一個基礎設定,像是.vimrc, .vim, .bashrc, etc.
最明顯的狀況就是MacVim, command line 都有顏色的改變!!
在安裝之前需要先安裝 git
https://github.com/mathiasbynens/dotfiles在安裝之前需要先安裝 git
git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh
2013年4月11日 星期四
關閉自動完成輸入
在HTML的INPUG有的時候會出現曾經key過的List
可以透過
去關閉!!
範例如下
參考資料:
http://css-tricks.com/snippets/html/autocomplete-off/
http://www.htmlcodetutorial.com/forms/_INPUT_AUTOCOMPLETE.html
可以透過
autocomplete="off"
去關閉!!
範例如下
參考資料:
http://css-tricks.com/snippets/html/autocomplete-off/
http://www.htmlcodetutorial.com/forms/_INPUT_AUTOCOMPLETE.html
2013年4月1日 星期一
在其他的Service讀取PreferenceActivity所設定的值
經過上次 http://jiun-blog.blogspot.tw/2013/03/preference.html
發現到如果要在其他Service同步偵測,發現在PreferenceActivity所設計的值會有錯誤或抓不到
搜尋後找到了這個方法
這樣當在PreferenceActivity做了改變,這邊就會偵測到
參考資料:
http://stackoverflow.com/questions/2542938/sharedpreferences-onsharedpreferencechangelistener-not-being-called-consistently
發現到如果要在其他Service同步偵測,發現在PreferenceActivity所設計的值會有錯誤或抓不到
搜尋後找到了這個方法
public class BackgroundService extends Service {
SharedPreferences.OnSharedPreferenceChangeListener listener;
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onStart(Intent intent, int startId) {
EnableSharedPreferences();
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
private void EnableSharedPreferences() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
}
};
prefs.registerOnSharedPreferenceChangeListener(listener);
}
}
這樣當在PreferenceActivity做了改變,這邊就會偵測到
參考資料:
http://stackoverflow.com/questions/2542938/sharedpreferences-onsharedpreferencechangelistener-not-being-called-consistently
eclipse 無法copy
在Eclipse有時會遇到無法copy的問題
雖然找不到比較直接的問題,但有解決方法可以
Window > Preferences > Java > Editor > Typing
取消勾選 Update imports
參考資料:
http://rocking5566.blogspot.tw/2013/03/eclipse.html
雖然找不到比較直接的問題,但有解決方法可以
Window > Preferences > Java > Editor > Typing
取消勾選 Update imports
參考資料:
http://rocking5566.blogspot.tw/2013/03/eclipse.html
2013年3月31日 星期日
GPS 範圍的計算
最近在開發Android的GPS,在使用Google Map API(JS)看過可以在畫面上畫出一個範圍
就像下面這張
但今天我不是要說Google Map API的使用,至於要怎麼使用就請參考
Google Maps JavaScript API 第 3 版
從上面那張圖的座標點都是從資料庫下來的,但是如果是只要在藍色範圍的座標,就可以參考下面SQL Query
找出你資料庫內有小於這個範圍的資料
這邊的 $lat, $lon為你所要設定的中點GPS(經瑋度),$dist為你所要找的範圍(單位:公里)
比較圖
參考資料:
http://zcentric.com/2010/03/11/calculate-distance-in-mysql-with-latitude-and-longitude/
http://www.marketingtechblog.com/calculate-distance/
http://zh.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
就像下面這張
但今天我不是要說Google Map API的使用,至於要怎麼使用就請參考
Google Maps JavaScript API 第 3 版
從上面那張圖的座標點都是從資料庫下來的,但是如果是只要在藍色範圍的座標,就可以參考下面SQL Query
$query = "SELECT ((ACOS(SIN($lat * PI() / 180) * SIN(gps_lat * PI() / 180) + COS($lat * PI() / 180) * COS(gps_lat * PI() / 180) * COS(($lon - gps_long) * PI() / 180)) * 180 / PI()) * 60 * 1.1515 * 1.609344) AS distance, gps_lat, gps_long FROM `mytable` HAVING distance<=$dist ORDER BY distance ASC"
找出你資料庫內有小於這個範圍的資料
這邊的 $lat, $lon為你所要設定的中點GPS(經瑋度),$dist為你所要找的範圍(單位:公里)
參考資料:
http://zcentric.com/2010/03/11/calculate-distance-in-mysql-with-latitude-and-longitude/
http://www.marketingtechblog.com/calculate-distance/
http://zh.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
訂閱:
文章 (Atom)


