This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vim .bashrc | |
export PATH=$HOME/local:$PATH | |
export PYTHONPATH=$HOME/local/lib/python2.7/site-packages | |
$ mkdir ~/src ; cd src | |
$ mkdir ~/local | |
$ wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name="com.sample.MainActivity" | |
android:configChanges="orientation|screenSize" | |
android:icon="@drawable/ic_launcher_folder" | |
android:label="@string/main_activity_name" | |
android:theme="@style/MainActivityTheme" > | |
</activity> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends FragmentActivity { | |
@Override | |
protected void onCreate(Bundle bundle) { | |
super.onCreate(bundle); | |
setContentView(R.layout.main); | |
setTimer(); | |
} | |
public class MyTimer extends TimerTask { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum MyEnumList { | |
ONE, TWO, THREE; | |
@Override | |
public String toString() { | |
return name(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 渡し側 | |
@Override | |
protected void onCreate(Bundle bundle) { | |
super.onCreate(bundle); | |
setContentView(R.layout.main); | |
Intent intent = new Intent(this, SubActivity.class); | |
intent.putExtra("path", "/path/to/file"); | |
startActivity(intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onActivityCreated(Bundle savedInstanceState) { | |
super.onActivityCreated(savedInstanceState); | |
Dialog dialog = getDialog(); | |
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); | |
DisplayMetrics metrics = getResources().getDisplayMetrics(); | |
// 画面サイズの0.8倍の大きさに指定 | |
int dialogWidth = (int) (metrics.widthPixels * 0.8); | |
int dialogHeight = (int) (metrics.heightPixels * 0.8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% mysqladmin status -u username -p | |
% mysqladmin extended-status -u username -p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<View | |
android:id="@+id/emptyView" | |
android:layout_width="match_parent" | |
android:layout_height="0dp" | |
android:layout_alignParentBottom="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void hashMapSample() { | |
File file1 = new File("sample1.txt"); | |
File file2 = new File("sample2.txt"); | |
HashMap<File, String> maps = new HashMap<File, String>(); | |
maps.put(file1, "hello"); | |
maps.put(file2, "bye"); | |
Iterator<File> it = maps.keySet().iterator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
・setRequestPropertyを何度コールしても、最初のコール以外は無視される。 | |
・setRequestPropertyで、キーが必ず小文字になる。 | |
・POSTリクエストにおいて、Authenticator.setDefaultでBasic認証でリクエストすると、POSTした内容が消える。 | |
String username = "username"; | |
String password = "pass"; | |
Authenticator.setDefault(new Authenticator() { | |
protected PasswordAuthentication getPasswordAuthentication() { | |
return new PasswordAuthentication(username, password.toCharArray()); | |
} |