要搬去 Logdown 歡迎大家有問題可以Email
Email: quietmes@gmail.com
Facebook: doublejiun
Github: jiunjiun
mkdir libraries cp -r ~/Desktop/JakeWharton-ActionBarSherlock-071a61c/actionbarsherlock libraries/
include ':libraries:actionbarsherlock'
dependencies { compile project(':libraries:actionbarsherlock') }
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4' } } apply plugin: 'android-library' dependencies { compile files('libs/android-support-v4.jar') compile files('libs/android-support-v13.jar') } android { compileSdkVersion 17 buildToolsVersion "17" defaultConfig { minSdkVersion 7 targetSdkVersion 16 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } instrumentTest.setRoot('tests') } }
./gradlew build
./gradlew.bat build
client.print("GET /");要設在client起始接著GET /斜線後面接你的目標網址
client.print("GET /save.php?a=123&b=456");
brew tap djl/homebrew-apache2 brew install djl/apache2/apache24
vi /usr/local/Cellar/apache24/2.4.4/conf/httpd.conf增加下面
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so AddType application/x-httpd-php .php
brew tap homebrew/dupes brew tap josegonzalez/homebrew-php brew options php54 brew install php54 --homebrew-apxs
brew install mysql
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enable rvm get stable --autolibs=enable
rvm install 2.0
rvm list rubies
rvm use 2.0.0 --default
brew install android
android
/usr/local/Cellar/android-sdk/r21.1/
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
printf '\n## Homebrew bin path address\nexport PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
gem install guard-livereload
guard init livereload
Guardfile
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'livereload' do watch(%r{.+\.(css|js|html?|php|inc|module|info)$}) end
guard
:split
:vsplit
ctrl+w w ctrl+w <方向鍵>
ctrl+w shift+w
brew install mysql
mysql.server start
2,cc
2,cu
<C-X><C-O>
mvim ~/{存放路徑}/eclipse/Eclipse.app/Contents/Info.plist
NSHighResolutionCapable
git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh
autocomplete="off"
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); } }
$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"
android:descendantFocusability="blocksDescendants"
......
freebsd-update fetch freebsd-update install
freebsd-update upgrade -r 9.1-RELEASE
freebsd-update install
sync;sync;reboot
freebsd-update install
freebsd-update install
uname -rs
<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:title="@string/wifi_setting" > <CheckBoxPreference android:key="@string/test1_key" android:defaultValue="true" android:title="@string/title1" android:summary="@string/summary1" /> <CheckBoxPreference android:key="@string/test2_key" android:dependency="@string/test1_key" android:defaultValue="false" android:title="@string/title2" android:summary="@string/summary2" /> <ListPreference android:key="@string/test3_key" android:dependency="@string/test1_key" android:entries="@array/interval" android:entryValues="@array/intervalValues" android:defaultValue="30" android:title="@string/title3" android:summary="@string/summary3" /> </PreferenceCategory> </PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="wifi_update_interval"> <item name="10">10 秒鐘</item> <item name="30">30 秒鐘</item> <item name="60">1 分鐘</item> <item name="300">5 分鐘</item> </string-array> <string-array name="wifi_update_intervalValues"> <item name="10">10</item> <item name="30">30</item> <item name="60">60</item> <item name="300">300</item> </string-array> </resources>
public class option extends PreferenceActivity implements OnPreferenceChangeListener { /*** Debugging ***/ private static final String TAG = "option"; private static final boolean D = true; String test1_key, test2_key, test3_key; CheckBoxPreference test1, test2; ListPreference test3; @Override @SuppressWarnings("deprecation") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.setting); getSupportActionBar().setDisplayHomeAsUpEnabled(true); test1_key = getResources().getString(R.string.test1_key); test2_key = getResources().getString(R.string.test2_key); test3_key = getResources().getString(R.string.test3_key); test1 = (CheckBoxPreference) findPreference(test1_key); test2 = (CheckBoxPreference) findPreference(test2_key); test3 = (ListPreference) findPreference(test3_key); test1.setOnPreferenceChangeListener(this); test2.setOnPreferenceChangeListener(this); test3.setOnPreferenceChangeListener(this); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; default: return super.onOptionsItemSelected(item); } } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { // TODO Auto-generated method stub if(D) Log.e(TAG, "Change preference.key: " preference.getKey().toString()); if(D) Log.e(TAG, "Change preference.key: " newValue.toString()); if(preference.getKey().equals(test1_key)) { } else if(preference.getKey().equals(test2_key)) { } else if(preference.getKey().equals(test3_key)) { } return true; } }
public class MainActivity extends Activity { /*** Debugging ***/ private static final String TAG = "MainActivity"; private static final boolean D = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onOptionsItemSelected(MenuItem item) { if(D) Log.e(TAG, "item.getItemId() " item.getItemId()); switch(item.getItemId()) { case R.id.menu_settings: startActivity(new Intent().setClass(this , option.class)); break; } return false; } private void init_option() { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mContext); test1 = pref.getBoolean("test1_key", true); test2 = pref.getBoolean("test2_key", false); test3 = Integer.parseInt(pref.getString("test3_key", "30")); } }
# 抓出手機號碼 phone = "123-456-7890" if phone =~ /(\d{3})-(\d{3})-(\d{4})/ ext = $1 city = $2 num = $3 end
# 抓出手機號碼 match_phone = /(?<ext>\d{3})-(?<city>\d{3})-(?<num>\d{4})/.match(phone) puts match_phone[:ext] puts match_phone[:city] puts match_phone[:num]