twitter.com が「This webpage is not available」となり見えなくなった場合の対処法

なぜか見えなくなった.

パソコン上の Chrome だけ.

ughughugh

Twitter側が落ちてるのかと思ったが, そうでもない.

API_Status___Twitter_Developers

API Status | Twitter Developers

対処法は, twitter.com の cookie を消すときれいに治る.

Settings_-_Cookies_and_site_data

結構, そんな状況の人多いみたいですわ.

きもい.


Android と iPhone 間のデータ移行の説明をながめる

Google, Apple ともに公式から説明している.

Switch to Android
http://www.android.com/switch/

Android 携帯から iPhone にコンテンツを移動する
http://support.apple.com/kb/HT6407?viewlocale=ja_JP&locale=ja_JP

「データ」といっても,いろいろあるけどもおおまかには,

Google (iPhone → Android) :
「GoogleのアプリはiPhoneにもあるのでそれを使えばいい」

Apple (Android → iPhone) :
「そんなアプリがあるのでそれを使う」
「PC上で iTunes/iCloud に取り込めば簡単」

という雰囲気.

図にしてみた.

Android-iPhone_データ移行

青色の矢印: Google の説明している方法
灰色の矢印: Apple の説明している方法
赤色の矢印: Google/Apple 共に説明している方法
桃色の四角: アプリやブラウザで利用するサービス

Google Play Music 関連のサービスは
日本国内で自在に使えないのが寂しいところです.

音楽はアップルは死守しなければならないコンテンツなのです。

2015-09-16:「Move to iOS」で iPhone に何がどんだけ移行できるのか

「音楽」を変えたアップルが、自らも音楽ビジネスを失う危機に


マテリアル・デザインのアイコンセットを使いやすい配置に変える

たくさんの画像リソースが公開されています.

Material_Icons_Index

【使える! 即保存】 github で公開されている Material design icons 一覧

どれもいいかんじです.

で, これ一覧で好きなアイコンを選んだあと,

zipをダウンロード/展開したあとどれを使ったらいいのか.

たとえば, 一覧で「error」アイコンを使おうとすると

こんなにある.

./alert/drawable-hdpi/ic_error_black_18dp.png
./alert/drawable-hdpi/ic_error_black_24dp.png
./alert/drawable-hdpi/ic_error_black_36dp.png
./alert/drawable-hdpi/ic_error_black_48dp.png
./alert/drawable-hdpi/ic_error_grey600_18dp.png
...(略)...
./alert/drawable-xxxhdpi/ic_error_red_48dp.png
./alert/drawable-xxxhdpi/ic_error_white_18dp.png
./alert/drawable-xxxhdpi/ic_error_white_24dp.png
./alert/drawable-xxxhdpi/ic_error_white_36dp.png
./alert/drawable-xxxhdpi/ic_error_white_48dp.png

ディレクトリの構造はこんなかんじになってる.

material-design-icons-master
├── action
│   ├── drawable-hdpi
│   │   ├── ic_error_red_18dp.png
│   │   ├── ic_error_red_24dp.png
│   │   ├── ic_error_red_36dp.png
│   │   ├── ic_error_red_48dp.png
│   ├── drawable-mdpi
│   ├── drawable-xhdpi
│   ├── drawable-xxhdpi
│   ├── drawable-xxxhdpi

アイコンファイルを選択する他に

いくつか決めなければならないことがあったりします.

・dpi
・color
・dip

「色」は見て決めれるけども...

以下を見ながら, dip(サイズ/スケール) と

対象ファイル, 新しいファイル名を決める.

Launcher ic_launcher_***.png 48dp
Action Bar ic_menu_***.png 32dp
Small/Contextual ic_***.png 16dp
Notification ic_stat_notify_***.png 24dp

Iconography | Android Developers

細かくいろいろ区別できるのだろうけど,

Android Studioのプロジェクトデフォルトdpiの構成に

drawableディレクトリはとりあえず合わせよう.

res
├── drawable-hdpi
│   └── ic_error.png
├── drawable-mdpi
│   └── ic_error.png
├── drawable-xhdpi
│   └── ic_error.png
├── drawable-xxhdpi
│   └── ic_error.png

などとシコシコ手動でやってみたがめんどうなので

zip の展開後のディレクトリ構成とファイル名を

あらかじめ変更しておけば, フォルダごと上書きできそうなので

一括でスクリプトで以下に変更しておく.

{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png

{category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png

<?php
/**
 Restructure dirs/files tree.
 
https://github.com/google/material-design-icons
 
Usage:
 
$ curl -LO https://github.com/google/material-design-icons/archive/master.zip
$ unzip material-design-icons-master.zip
$ ls
... material-design-icons-master ... 
$ php restructure.php
 
{category}/drawable-{dpi}/ic_{name}_{color}_{dip}.png
-> {category}/{name}/{color}/{dip}/drawable-{dpi}/ic_{name}.png
 
 
~/material-design-icons-master_new $ tree . 
.
├── action
│   ├── 3d_rotation
│   │   ├── black
│   │   │   ├── 18dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xxhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   └── drawable-xxxhdpi
│   │   │   │       └── ic_3d_rotation.png
│   │   │   ├── 24dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
...
*/
 
foreach (glob('material-design-icons-master/*/*/*.png') as $file) {
  if (is_file($file) && preg_match('@/drawable@', $file)) {
    $path_parts = pathinfo($file);
    $filename = $path_parts['filename'];
    $dirs = explode('/', $path_parts['dirname']);
    $category   = $dirs[1];
    $dip        = substr($filename, strrpos($filename, '_') + 1);
    $dpi        = substr($dirs[2], strpos($dirs[2], '-') + 1);
    $filename   = substr($filename, 0, strpos($filename, '_' . $dip));
    $name_color = substr($filename, strpos($filename, '_') + 1);
    $color      = substr($name_color, strrpos($name_color, '_') + 1);
    $name       = substr($name_color, 0, strpos($name_color, '_' . $color));
    $path = sprintf('%s_new/%s/%s/%s/%s/drawable-%s/ic_%s.png',
                    $dirs[0], $category, $name, $color, $dip, $dpi, $name);
    mkdir(dirname($path), 0777, true);
    copy($file, $path);
    echo $file . "\n";
    echo '-> ' . $path . "\n";
  }
}

ディレクトリ構成を変更 - gist

構成変更後はこんなかんじに.

~/material-design-icons-master_new $ tree . 
.
├── action
│   ├── 3d_rotation
│   │   ├── black
│   │   │   ├── 18dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-xxhdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   └── drawable-xxxhdpi
│   │   │   │       └── ic_3d_rotation.png
│   │   │   ├── 24dp
│   │   │   │   ├── drawable-hdpi
│   │   │   │   │   └── ic_3d_rotation.png
│   │   │   │   ├── drawable-mdpi
│   │   │   │   │   └── ic_3d_rotation.png
...

こうしておけば,

使いたいアイコンの色, 利用場所(dip) を考えながら,

GUI上でディレクトリごと上書きで,

IDE上の res ディレクトリ以下にコピーすればよい.

icon_copy

よくみると, IDE側の drawable-*** のディレクトリ名は微妙に違ってたりするが(笑)


日本語版「Stack Overflow」がしれっと公開されているが

半年前の記事だけども.

Cecconi氏に詳細を尋ねたところ、日本語版の開始時期は未定で、コミュニティマネージャが決まり次第、できるだけ早く立ち上げたいとのこと。

Stack Overflow日本語版開設へ、バイリンガルのコミュニティマネージャ募集中! - Publickey

探してみるとどうやらここで公開されそう.

20141012-132857

ログイン_-_スタック・オーバーフロー 2

ログイン_-_スタック・オーバーフロー

トップ画面のみでログイン等できませぬ.

もう少しか...

https://ja.stackoverflow.com/ - スタック・オーバーフロー

カタカナで「スタック・オーバーフロー」とか微妙っちゃ微妙.


gradle なら AndroidManifest.xml 内 <uses-sdk> が不要だった件

_uses-sdk____Android_Developers

Android Studio が警告なフキダシを出してる.

main_AndroidManifest

記述が2箇所あってきもちが悪かったのですが.

build.gradle

android {
    ...
    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
    ...
}

AndroidManifest.xml

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="19"/>

Android Studio の設定で「バージョン」の記述してるとこありすぎね?

で, AndroidManifest.xml側の記述は不要らしい.

Gradle overrides the manifest values, and I prefer to update build.gradle file rather than manifest. And probably this is the right way using Gradle. Gradle supports product flavours which can be controled via IDE and those product flavors can change many things in our Manifest like package name, version code, version name, target SDK and many other. Then by one click in Android Studio You can change many properties and generate another apk.

You can left the manifest as it is and do all configuration in build.gradle. You can safely remove

<uses-sdk></uses-sdk>

from manifest as well as version codes.

Android studio: why are minSdkVersion and targetSdkVersion specified both in AndroidManifest.xml and build.gradle? - Stack Overflow

Gradle が自動埋め込んでくれるっぽい.

apk化後, バラしてみてみると確認できます.

android-apktool - A tool for reverse engineering Android apk files - Google Project Hosting