2012/02/19

Twitterのつぶやきをfacebookへ自動投稿する

ここを参考にして設定。
facebookの検索欄に「twitter」と入力してTwitterアプリで設定するだけ。

2012/01/18

Lenovo G570 購入

最近、ディスクトップPCの調子が悪いし、寒いのでコタツでぬくぬくネットサーフィンしたいのでノートPCを購入。

Lenovo G570 433497J
CPU:Core i5 2430M
HDD:320G
MEMORY:2G
モニタ:15.6インチ(1366x768)

で、なんと38,456円。安くなったものだ!
メモリを8Gに交換。これが3,480円
合計:41,936円

日本語キーボードなのだが、メーカサイトや量販店サイトには英語キーボードの写真をそのまま使っている事が多く購入前に少し不安だったのでアップしておきます。
購入を検討中の方のお役にたてれば幸いです。

2011/10/28

twtr2src⇛twilog乗り換え

「twtr2src」の自動投稿機能を使って「taku1974のTweet日記」を作成していたが、自動投稿が全然配信されなくなって来たので、
に乗り換え。
これに伴い、「taku1974のTweet日記」は削除、、、twilogをそのまま使い「taku1974(@taku1974_guger)のtwilog」として公開することに。
twilogの設定は簡単で、「twilog」にアクセスしてtwitterのアカウントで新規登録・ログインするだけ。
後は、管理画面でツイートの並び順を「古→新」(朝→夜)に変更。
「taku1974のTweet日記」では、リプライを表示していなかったけど「twilog」では表示されてしまう。
「Replyを除く」をデフォルトに設定できればいいのだが、、、
とりあえず、リンクを貼るときには「Replyを除く」オプションを付けて「http://twilog.org/taku1974_guger/norep」をリンク先とすればよさそう。



2011/05/16

GmailのContentProviderから添付ファイル取得

GmailのContentProviderから添付ファイルを取得しようとしたが、イマイチうまくいかない。
とりあえず、画像の添付ファイルは取得できたのでその方法。
getAttachmentUriの第4,5引数にGmail.AttachmentRendition.SIMPLE, falseと指定すると画像の添付ファイル(jpegやgif)は取得できたが、エクセルファイルやPDFファイルは取得できない。
誰か分かる人教えてください、、、
MessageCursor mc = gmail.getMessageCursorForMessageId(account, messageId);
if(mc.next()){
    ArrayList<Attachment> attInfos = mc.getAttachmentInfos();
    if(!attInfos.isEmpty()){        // 添付があるなら
        for(Iterator<Attachment> ir = attInfos.iterator(); ir.hasNext();){
            Attachment attment = ir.next();
            Log.d(LOGTAG, "attment=" + attment);
            Uri uri = Gmail.getAttachmentUri(account, messageId, attment,Gmail.AttachmentRendition.SIMPLE, false);
            try {
                // 画像を読み込む
                InputStream in = getContentResolver().openInputStream(uri);
                BitmapFactory.Options sBitmapOptions = new BitmapFactory.Options();
                Bitmap bm = BitmapFactory.decodeStream(in, null, sBitmapOptions);
                Log.d(LOGTAG, "Bitmap size=" + bm.getWidth() + " x " + bm.getHeight());    // 画像サイズ
                int dispWidth = this.getWindowManager().getDefaultDisplay().getWidth();    // 画面サイズ(幅)
                if(bm.getWidth()> dispWidth){    // 画面幅より大きい時、縮小する
                    bm = Bitmap.createScaledBitmap(bm, dispWidth, bm.getHeight()*dispWidth/bm.getWidth(), false);
                }
                // 画像をファイルに書き込む
                String sdPash = Environment.getExternalStorageDirectory().getPath();    // SDカードのパス
                File sdDir = new File(sdPash + "/android/data/" + getPackageName() + "/cache/");
                sdDir.mkdirs();    //書き込みディレクトリ作成
                String fname = sdDir.getPath() + "/" + mc.getMessageId() + "_" + attment.name;    // 書き込みファイル名
                Log.d(LOGTAG, "fname=" + fname);
                FileOutputStream out = new FileOutputStream(fname);
                bm.compress(CompressFormat.JPEG, 100, out);
                out.flush();
                out.close();
            } catch (FileNotFoundException e) {    // InputStreamエラー処理
                Log.d(LOGTAG, "InputStream ERR! " + e.getMessage());
            } catch (IOException e) {            // FileOutputStreamエラー処理
                Log.d(LOGTAG, "FileOutputStream ERR! " + e.getMessage());
            }
        }
    }
}