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 isInstalled(Context activityContext) { | |
PackageManager pm = activityContext.getPackageManager(); | |
List<ApplicationInfo> list = pm.getInstalledApplications(0); | |
for (ApplicationInfo info : list) { | |
Log.e("PackageName", info.packageName); | |
} | |
} |
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
$ sudo apt-get install xdg-user-dirs-gtk | |
$ LANG=C xdg-user-dirs-gtk-update | |
$ gsettings set org.gnome.desktop.interface gtk-key-theme Emacs | |
$ sudo apt-get install tmux | |
$ sudo apt-get install vim | |
$ sudo apt-get install xclip | |
$ sudo update-alternatives --config editor |
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
aptのは古い。 | |
バイナリはeclipse.orgからダウンロード。 | |
$ mv eclipse-juno-*.tar.gz /usr/local/lib | |
$ cd /usr/local/lib | |
$ sudo tar -xvzof eclipse-juno-*.tar.gz | |
$ cd /usr/local/lib/eclipse | |
$ ./eclipse | |
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
sudo vim /etc/default/keyboard | |
XKBOPTIONS="ctrl:nocaps" | |
を追加。 | |
$ sudo dpkg-reconfigure keyboard-configuration | |
キーボードショートカットの設定をすると無効になる。 |
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
# ディレクトリ内のphpファイルから「salt」を再帰的に検索。 | |
# タブで整列し行番号を出力するgrepオプション。 | |
$ find . -name "*.php" -exec grep -nTH "salt" {} \; | less | |
# ディレクトリ内のphpファイルのタブをスペースに置換。 | |
# findの検索結果が{} \;に入るのでそれを利用。 | |
$ find . -name "*.php" -exec sed "s/\t/ /g" {} \; | |
# ディレクトリ内のphpファイルの「hello」を「bye」に置換。 | |
# gは全部変換。iは大文字小文字無視。 |
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
String month = String.format("%1$02d", 9); | |
// 09と出力 | |
System.out.println("mouth", month); |
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()); | |
} |
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
<?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
% mysqladmin status -u username -p | |
% mysqladmin extended-status -u username -p |