ラベル tech note の投稿を表示しています。 すべての投稿を表示
ラベル tech note の投稿を表示しています。 すべての投稿を表示

12.31.2013

Facebook OAuth Error on Django 1.6

【症状】 Django を 1.5.1 から 1.6 へアップグレードしたところ Facebook の OAuth ログインに失敗するようになってしまった。
TypeError: datetime.datetime(2014, 2, 28, 14, 1, 2, 167758, tzinfo=) is not JSON serializable
【原因】 Django 1.5.3 よりデフォルトの serializrer が変更されたことが原因のようだ. cf. https://docs.djangoproject.com/en/1.5/ref/settings/#std:setting-SESSION_SERIALIZER cf. https://github.com/ggcarrots/django-carrots/commit/17e9d77affa7681123cf0dc73af2edbd4c428c71 【解決策】 settings.py にて serializer を JSONSerializer から PickleSerializer へ変更する.
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
[symptoms]
Django can't use Facebook OAuth after upgrading from 1.5.1 to 1.6.
TypeError: datetime.datetime(2014, 2, 28, 14, 1, 2, 167758, tzinfo=) is not JSON serializable
[cause]
A default serializer is changed from Django 1.5.3. cf. https://docs.djangoproject.com/en/1.5/ref/settings/#std:setting-SESSION_SERIALIZER cf. https://github.com/ggcarrots/django-carrots/commit/17e9d77affa7681123cf0dc73af2edbd4c428c71 [solution]
Change the serializer from JSONserializer to PickleSerializer in "settings.py."
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

10.19.2013

第 9 回 UQ WiMAX お客様の会で WiMAX 2+ について聞いてきた

初回からお邪魔している UQ WiMAX お客様の会に参加してきた.もう第 9 回ということで結構感慨深い.忙しくてきっちりまとめてる暇も無いので聞いてきたことの簡単なメモ.

野坂社長「WiMAX の近況について」

WiMAX 2+ 実現までの歩みなど


政権交代やら電波割当のルール変更等あったが,タイミングよく JD Power を受賞するなど帯域割当を得られるように事が進んだ.
電波割当からサービスインまで異様に期間が短いが,これは社員一同かなり頑張ったため実現できた.

WiMAX 2+ の制限について


4,405 円の価値があると思ってるところを 2 年間 3,880 円で提供する.
その間は WiMAX 2+ も無制限で利用が可能.
その後に設ける予定の 7 GB 制限については市場の動向等を見て変更する可能性あり.
(制限の余地を残しておくのは,電波が有限な資源であることを明示する姿勢)

ハイスピードプラスエリアモード(LTE 併用)は利用した月だけ追加料金を払えば良い.
地方に行った時に使う等を想定している.

秋からの新広告紹介


WiMAX 2+ のスピード感と満足度 No.1 をアピール
なぜか宇宙がテーマのような感じ

要海技術部門長兼ネットワーク技術部長
「WiMAX 2+ のチャレンジングなところ」

今後の高速化の展望


  • 4x2 MIMO(WiMAX 2+)
  • 4x4 MIMO へのアップデートにより倍速(2014 年予定)
  • WiMAX 2+ ユーザが順調に増えれば,現行 WiMAX の 20 MHz を WiMAX 2+ に割当て,既存の 20 MHz と併用することで更に倍速.(キャリアアグリゲーション)
  • 8x8 MIMO, 256 QAM 等のシステム拡張による更なる高速化(Gbps の領域へ)

TD-LTE 互換のメリット


端末のバリエーション増加,低価格化

WiMAX/WiMAX 2+ のハンドオーバについて


WiMAX 2+ が使えるエリアではそちらにハンドオーバする
WiMAX から WiMAX 2+ へのハンドオーバをハンドアップ,逆をハンドダウンと呼ぶ
この際 IP アドレスは変わらないのでシームレスに利用可能.

ハンドアップ時はエリア入った直後ではなく WiMAX の通信が途切れたタイミングで行うため,ハンドアップはユーザに対して透明.
ハンドダウンについても説明があったが忘れた.
とりあえず,一般的にユーザがハンドアップ/ダウンに気付くことはほとんど無さそう.

WiMAX 2+ のアンテナについて


4x4 MIMO 用のアンテナが場所を取って賃料が増えてしまうので,新しいアンテナを開発した.
アンテナ集約の関連でエレメントの向いてる方向が WiMAX と WiMAX 2+ で異なる.
どちらも真上から見てエレメントが正三角形に並んでいるが,真北にエレメントがあるのは WiMAX 2+ 対応,南にあるのは現行 WiMAX のアンテナ.

基地局間干渉について


隣接する複数の基地局を集中管理することにより解消する.(Central Scheduler)
複数の基地から電波が到達する端末に対し,時分割スケジューリングすることで通信に関係ない電波が端末に到達することによる品質低下を防ぐ.

基地局設備について


基地局をモジュール毎にわけてパッケージングしている
将来的な WiMAX の巻取り等による構成変更が容易

実地テストについて


TPC/IP 実地テストでは安定して約 100 Mbps を記録した.
墨田区の街なかでテスト
アンテナ端末間は直線距離で約 200 m
その間に建物が多く直接は見えない.
200 m の距離はおおよそセルの端に当たる.

出席者への事前アンケートについて

質問 「現在お持ちの端末から WiMAX 2+ 端末への変更をお考えですか?」


変更したい 52%, 検討中 34%, 変更したくない 14%
FAQ: 速度制限どうなるの?,エリア展開は?,既存契約者の 2+ 乗り換えは?

UQ からの回答


速度制限は気にする必要ない.
少なくとも 15 年 3 月までは絞ることはしないし,3 年目以降はこれからの様子を見て決めるので,その時に判断してくれれば良い.
一部の少数ユーザが帯域を大量消費するような事態には対応する必要が出てくるかもしれない.

エリア展開は公式発表通り.
早く進められる分は前倒ししたい.

ユーザ管理の仕組みが異なるため現行 WiMAX とは別契約となる.

本会出席者への特典・おみやげ

WiMAX 2+ のモニター


期間: 2013 年 11 月 1 日~ 2013 年 12 月 31 日
内容: UQ Flat ツープラス (LTE オプション込)を無料で利用できる.期間終了後継続契約する場合は端末プレゼント.

ブルーガチャムクぬいぐるみスピーカー


ぬいぐるみストラップからイヤホンプラグが生えていて,音楽機器に挿すと音が出る.
スピーカーがぬいぐるまれているので当然だが音が異常に小さくこもるため,残念ながらスピーカーとしての実用性はほぼ無い.

お菓子: C3 (シーキューブ)焼きティラミス


自分ではなかなか買う機会の無さそうな上品なお菓子.
美味しくいただきました.

その他個人的な感想等

Wi-Fi WALKER WiMAX2+ HWD14 について


実機を触ってきた.
現在使っている Aterm WM3600R よりは厚み重量感ともにアップするが,個人的には特に苦になるほどではない.

  • HWD14: 100 mm * 62 mm * 15.5 mm, 140 g
  • WM3600R: 72.5 mm * 56 mm * 47 mm, 70 g

電波の掴みや電池持ちについては不明.まぁ 7, 8 時間持てば上々か.
ルータにディスプレイとかタッチパネルなんて (゚⊿゚)イラネ と思ってたが,実機を触ってみたら印象が変わった.
PC 等を介さずに設定を色々いじれるのはなかなか便利だ.
(マニアックな設定をするには PC 等から管理画面にアクセスする必要があるとのこと)


通信遅延について


きっちり計測出来てはいないが,現行 WiMAX の半分以下程度の通信遅延に抑えられているようだ.
(現行 WiMAX は 100 msec 前後の場合が多い)
自分はネットゲームはやらないが,インタラクティブな作業の機会は多いためこれは嬉しい.


WiMAX 2+ に乗り換えるべきか


WiMAX 2+ への移行にあたって契約周りが障壁になり得るが,それが平気なら乗り換えたら良いのではと思う.
というのも SIM によるユーザ管理が入る等の都合上,現行 WiMAX とは契約が別扱い(?)になるらしい.
これにより,WiMAX 2+ 向けのプラン「UQ Flat ツープラス」はファミ割(2 回線目が安く使える家族割的なやつ)が併用できない等の課題がある.
こういった問題が特に当てはまらない人は,少なくとも 2 年間は料金が上がるわけでも無いので WiMAX 2+ に乗り換えても良いのではと思う.

9.18.2013

Can't install RMagick 2.13.1. Can't find MagickWand.h.

gem で rmagick をインストールしようとした際に以下のエラーが出た.
# gem install rmagick
...
Can't install RMagick 2.13.1. Can't find MagickWand.h.
...
このとき,システム内に MagickWand.h は存在しなかった.


色々なパッケージを入れてみたのでどれが根本原因かわからなかったが,恐らく以下が正解だったようだ.
これを入れたら /usr/include/ImageMagick/wand/MagickWand.h が作成され rmagick のインストールが正常に完了した.
# apt-get install libmagick++-dev
I got the below error during install "rmagick".
# gem install rmagick
...
Can't install RMagick 2.13.1. Can't find MagickWand.h.
...
And, there was no MagickWand.h in my system.


When I installed the below package, the file was created in /usr/include/ImageMagick/wand/MagickWand.h and installing "rmagick" was correctly completed.
# apt-get install libmagick++-dev

8.20.2013

Solve Cell Standby Power Drain Issue for HTC One (m7) + Data-Only SIM + Android 4.3

この記事は以前の記事とほぼ同じですが,以下の点で異なります.
  • 対象 OS:4.2.2 (CyanogenMod 10.1-20130526-NIGHTLY-m7) -> 4.3 (CyanogenMod 10.2-20130819-NIGHTLY-m7ul)
  • 修正箇所の行数


注意:
システムの改変は端末を動作不能にする危険性があります(e.g., 文鎮化). 必ず自己責任でお願いします.

【症状】
HTC One (m7) に IIJmio のデータ専用 SIM(docomo MVNO)を挿した際, 通信は可能だがアンテナピクトが常時ゼロになっており, セルスタンバイによる電池消耗が激しい.

【環境】

【解決方法】
流れは下記の通り. 適当なディレクトリに端末から pull してきた telephony-common.jar を展開し, 含まれる classes.dex をディスアセンブルする. 電波状況に関連する部分を書き換えた上で再度 jar に固め,端末の元の場所に push する.

> mkdir workspace
> cd workspace
> adb pull /system/framework/telephony-common.jar
> mv telephony-common.jar telephony-common.orig.jar
> unzip telephony-common.jar
> 7za.exe e -so telephony-common.jar telephony-common\classes.dex > classes.dex.tmp
> java -jar baksmali.jar -x classes.dex.tmp -o out
(Modify: out\com\android\internal\telephony\gsm\GsmServiceStateTracker.smali)
> Java -jar Somali. jar -o classes.dex out
> zip telephony-common.jar META-INF classes.dex
> adb push telephony-common.jar /system/framework/telephony-common.jar
(Reboot into Recovery)
(Wipe cache partition and Dalvik cache)
下記コードの少し後にある定数値に関する記述を修正する. 私の環境では GsmServiceStateTracker.smali の 4,000 行目周辺だった.
.method private regCodeToServiceState(I)I
BeforeAfter
    .line 1251
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
    .end packed-switch
    .line 1251
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
    .end packed-switch

【参考】

  1. Android + b-mobile データ専用 SIM で電界強度を表示する http://bl.oov.ch/2012/01/b-mobile-sim.html
  2. Android + データ専用 SIM での動作修正パッチ http://bl.oov.ch/2012/01/android-sim.html
  3. Android 4.2.1 からの MVNO データ専用SIM http://bl.oov.ch/2012/12/android-421-mvno-sim.html

This post is almost same as previous one except for the below points.
  • Target OS:4.2.2 (CyanogenMod 10.1-20130526-NIGHTLY-m7) -> 4.3 (CyanogenMod 10.2-20130819-NIGHTLY-m7ul)
  • Line number of revised part


Attention:
Modifying system may cause system failures (e.g., Bricked). Please take full responsibility for your actions.

[symptoms]
Although HTC One (m7) with a Data-Only SIM can communicate over 3G well, it shows no signal and drains power.

[Environment]

[solution]
Below methods. Pull "telephony-common.jar" from the device and put it into a working directory. Disassenmble "classes.dex" in the JAR file. Modified constants about radio status and re-assemble "classes.dex" and compress as a new JAR file. Push the JAR file into the device (overwrite).

> mkdir workspace
> cd workspace
> adb pull /system/framework/telephony-common.jar
> mv telephony-common.jar telephony-common.orig.jar
> unzip telephony-common.jar
> 7za.exe e -so telephony-common.jar telephony-common\classes.dex > classes.dex.tmp
> java -jar baksmali.jar -x classes.dex.tmp -o out
(Modify: out\com\android\internal\telephony\gsm\GsmServiceStateTracker.smali)
> java -jar smali.jar -o classes.dex out
> zip telephony-common.jar META-INF classes.dex
> adb push telephony-common.jar /system/framework/telephony-common.jar
(Reboot into Recovery)
(Wipe cache partition and Dalvik cache)
Modify constants after below code. In my environment, the code is around 4,000L of GsmServiceStateTracker.smali.
.method private regCodeToServiceState(I)I
BeforeAfter
    .line 1251
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
    .end packed-switch
    .line 1251
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
    .end packed-switch

[reference](In Japanese)

  1. Android + b-mobile データ専用 SIM で電界強度を表示する http://bl.oov.ch/2012/01/b-mobile-sim.html
  2. Android + データ専用 SIM での動作修正パッチ http://bl.oov.ch/2012/01/android-sim.html
  3. Android 4.2.1 からの MVNO データ専用SIM http://bl.oov.ch/2012/12/android-421-mvno-sim.html

5.28.2013

Solve Cell Standby Power Drain Issue for HTC One (m7) + Data-Only SIM + Android 4.2.2

2013/08/20 追記:
Android 4.3 についての記事をポストしました.


注意:
システムの改変は端末を動作不能にする危険性があります(e.g., 文鎮化). 必ず自己責任でお願いします.

【症状】
HTC One (m7) に IIJmio のデータ専用 SIM(docomo MVNO)を挿した際, 通信は可能だがアンテナピクトが常時ゼロになっており, セルスタンバイによる電池消耗が激しい.

【環境】

【解決方法】
流れは下記の通り. 適当なディレクトリに端末から pull してきた telephony-common.jar を展開し, 含まれる classes.dex をディスアセンブルする. 電波状況に関連する部分を書き換えた上で再度 jar に固め,端末の元の場所に push する.

> mkdir workspace
> cd workspace
> adb pull /system/framework/telephony-common.jar
> mv telephony-common.jar telephony-common.orig.jar
> unzip telephony-common.jar
> 7za.exe e -so telephony-common.jar telephony-common\classes.dex > classes.dex.tmp
> java -jar baksmali.jar -x classes.dex.tmp -o out
(Modify: out\com\android\internal\telephony\gsm\GsmServiceStateTracker.smali)
> Java -jar Somali. jar -o classes.dex out
> zip telephony-common.jar META-INF classes.dex
> adb push telephony-common.jar /system/framework/telephony-common.jar
(Reboot into Recovery)
(Wipe cache partition and Dalvik cache)
下記コードの少し後にある定数値に関する記述を修正する. 私の環境では GsmServiceStateTracker.smali の 4,000 行目周辺だった.
.method private regCodeToServiceState(I)I
BeforeAfter
    .line 1225
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
    .end packed-switch
    .line 1225
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
    .end packed-switch

【参考】

  1. Android + b-mobile データ専用 SIM で電界強度を表示する http://bl.oov.ch/2012/01/b-mobile-sim.html
  2. Android + データ専用 SIM での動作修正パッチ http://bl.oov.ch/2012/01/android-sim.html
  3. Android 4.2.1 からの MVNO データ専用SIM http://bl.oov.ch/2012/12/android-421-mvno-sim.html

Added 20 Aug. 2013:
Posted about Android 4.3


Attention:
Modifying system may cause system failures (e.g., Bricked). Please take full responsibility for your actions.

[symptoms]
Although HTC One (m7) with a Data-Only SIM can communicate over 3G well, it shows no signal and drains power.

[Environment]

[solution]
Below methods. Pull "telephony-common.jar" from the device and put it into a working directory. Disassenmble "classes.dex" in the JAR file. Modified constants about radio status and re-assemble "classes.dex" and compress as a new JAR file. Push the JAR file into the device (overwrite).

> mkdir workspace
> cd workspace
> adb pull /system/framework/telephony-common.jar
> mv telephony-common.jar telephony-common.orig.jar
> unzip telephony-common.jar
> 7za.exe e -so telephony-common.jar telephony-common\classes.dex > classes.dex.tmp
> java -jar baksmali.jar -x classes.dex.tmp -o out
(Modify: out\com\android\internal\telephony\gsm\GsmServiceStateTracker.smali)
> java -jar smali.jar -o classes.dex out
> zip telephony-common.jar META-INF classes.dex
> adb push telephony-common.jar /system/framework/telephony-common.jar
(Reboot into Recovery)
(Wipe cache partition and Dalvik cache)
Modify constants after below code. In my environment, the code is around 4,000L of GsmServiceStateTracker.smali.
.method private regCodeToServiceState(I)I
BeforeAfter
    .line 1225
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1b
        :pswitch_1b
        :pswitch_1b
    .end packed-switch
    .line 1225
    :pswitch_data_20
    .packed-switch 0x0
        :pswitch_1b
        :pswitch_1c
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
        :pswitch_1e
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_5
        :pswitch_1b
        :pswitch_5
        :pswitch_1c // modified
        :pswitch_1c // modified
        :pswitch_1b
    .end packed-switch

[reference](In Japanese)

  1. Android + b-mobile データ専用 SIM で電界強度を表示する http://bl.oov.ch/2012/01/b-mobile-sim.html
  2. Android + データ専用 SIM での動作修正パッチ http://bl.oov.ch/2012/01/android-sim.html
  3. Android 4.2.1 からの MVNO データ専用SIM http://bl.oov.ch/2012/12/android-421-mvno-sim.html

6.13.2012

Make CapsLock into an Additional Ctrl in Windows 8 Release Preview

[demand]
Using CapsLock key as Ctrl key in Windows 8 Release Preview.

[method]
Modifying registries may cause system failures. Please take full responsibility for your actions.
  1. Invoke RegistryEditor
  2. Create a new binary entry named "Scancode Map" in "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout"
  3. Input following binary code and close RegistryEditor
    00 00 00 00 00 00 00 00
    03 00 00 00 1D 00 3A 00
    00 00 00 00 00 00 00 00
    
  4. Do signout and signin

[result]
CapsLock key works as Ctrl key.

[appendix]
Following binary data swaps CapsLock for Ctrl.
00 00 00 00 00 00 00 00
03 00 00 00 1D 00 3A 00
3A 00 1D 00 00 00 00 00
【要望】
Windows 8 Release Preview において CapsLock キーを Ctrl キーに割り当てたい.

【方法】
レジストリの編集はシステム障害を引き起こす可能性がありますので自己責任でお願いします.
  1. レジストリエディタを起動
  2. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout" に "Scancode Map" という名前で新規バイナリ値を作成する.
  3. バイナリデータを入力してレジストリエディタを閉じる
    00 00 00 00 00 00 00 00
    03 00 00 00 1D 00 3A 00
    00 00 00 00 00 00 00 00
    
  4. サインアウト → サインイン

【結果】
CapsLock キーが Ctrl キーとして利用可能になる.

【おまけ】
以下のように書くと CapsLock と Ctrl が入れ替わる.
00 00 00 00 00 00 00 00
03 00 00 00 1D 00 3A 00
3A 00 1D 00 00 00 00 00

11.24.2011

Cannot Install Windows 8 Developer Preview into A Virtual Machine on VMware Workstation 8

[symptoms]
Abort installing "Windows 8 Developer Preview" into a virtual machine on VMware Workstation 8 with below error message.

"Windows cannot read the setting from the unattend answer file."


[cause]
The VM tried to load a product key from "autoinst.flp" automatically and failed.


[solution]
Remove or disconnect the virtual floppy device.
【症状】
Windows 8 Developer Preview を VMware Workstation 8 上の仮想マシンにインストールしようとしたが,以下のメッセージと共に中断してしまう.

"Windows cannot read the setting from the unattend answer file."


【原因】
VM がプロダクトキーを "autoinst.flp" から読み出そうとして失敗していた.


【対策】
VM の設定画面で,フロッピーを削除か接続解除する.

11.20.2011

Git Error: insufficient permission for adding an object to repository database ./objects

A user guest:devgroup could not push to a git repository specified by user:devgroup /var/git/foo.git. A git client of guestdev got below error.
$ git push (original master)
error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://guestdev@foo.com/var/git/foo.git
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://guestdev@foo.com/var/git/foo.git'
Fixed the git daemon's settings with below commands. They made the daemon to use the group file permissions when writing to foo.git/objects.
cd /var/git/foo.git
sudo chmod -R g+ws *
sudo chgrp -R devgroup *
git repo-config core.sharedRepository true
cf. stackoverflow: Error pushing to GitHub - insufficient permission for adding an object to repository database
user:devgroup /var/git/foo.git という Git レポジトリに guestdev:devgroup が push しようとした際に以下のようなパーミッションエラーが出た.
$ git push (original master)
error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://guestdev@foo.com/var/git/foo.git
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://guestdev@foo.com/var/git/foo.git'
以下のようにして解決した.
cd /var/git/foo.git
sudo chmod -R g+ws *
sudo chgrp -R devgroup *
git repo-config core.sharedRepository true
参考にした URL:
stackoverflow: Error pushing to GitHub - insufficient permission for adding an object to repository database

10.13.2011

Specify a Directory to Include JAR files in Ant XML



I failed to specify JAR files which should be included when Ant execute javac. I took for granted that below description was correct to include all JAR files in a directory specified by "./jar".

Incorrect example
<property name="jar.dir" value="./jar" />
<target name="compile" description="compile all sources">
    <javac srcdir="${src.dir}" destdir="${bin.dir}" classpath="${jar.dir}" deprecation="on" />
</target>


It seems "classpath" element of "javac" tag should not point to paths of directories but paths of JAR files. One of correct description is below.

Correct example
<property name="jar.dir" value="./jar" />
<path id="jar.classpath">
    <fileset dir="${jar.dir}">
        <include name="*.jar" />
    </include></fileset>
</path>
<target name="compile" description="comile all sources">
    <javac classpathref="jar.classpath" deprecation="on" destdir="${bin.dir}" srcdir="${src.dir}" />
</target>

Ant の XML で javac の classpath を指定するときにハマったのでメモ. あるディレクトリ(./jar)内の JAR ファイルをまとめて指定しようとした際に以下のように書いたら import エラーが多発.

間違いの例
<property name="jar.dir" value="./jar" />
<target name="compile" description="compile all sources">
    <javac srcdir="${src.dir}" destdir="${bin.dir}" classpathref="${jar.dir}" deprecation="on" />
</target>


javac タグの classpath エレメントではディレクトリではなく JAR ファイルを直接指定しなければならないようだ. JAR ファイルをひとつひとつ指定する代わりに指定ディレクトリ下の JAR ファイルを全部読みたいときは, 以下のようにしないとまずかったらしい.

正しい例
<property name="jar.dir" value="./jar" />
<path id="jar.classpath">
    <fileset dir="${jar.dir}">
        <include name="*.jar" />
    </include></fileset>
</path>
<target name="compile" description="comile all sources">
    <javac classpathref="jar.classpath" deprecation="on" destdir="${bin.dir}" srcdir="${src.dir}" />
</target>

7.20.2011

Change SVN Eclipse-plugin from Subclipse to Subversive


I read some articles says "Subversive better than Subclipse." So, I changed SVN plugin from Subclipse to Subversive.

Uninstall Subclipse and install Sebversive in Eclipse Market Place.
Althogh existent checked out projects are not recognized as SVN projects, you do not have to checked them out again. Delete the projects from workspace (DO NOT DELETE FROM YOUR DISK!!) and import the projects again.

Eclipse の SVN プラグインにはこれまで Subclipse を使っていましたが,
Subversive の方が何となく評判良さそうなので乗り換えてみることに.

Eclipse Market Place にて Subclipse を uninstall し, Subversive を install.
このままだとチェックアウト済みプロジェクトが認識されませんが,
一旦 workspace からプロジェクトを削除し(ディスクから消さないように!),
再度インポートすると SVN のプロジェクトとして認識されます.
再度チェックアウトするのもアレなのでこれが楽かと.

4.08.2011

Ubuntu で日本語ロケールにした際に,日本語になったディレクトリ名を英語に戻す

久々に Ubuntu をクリーンインストールして,何も考えずに日本語ロケールを選んだら
ホームディレクトリ下の各種ディレクトリが日本語になってしまってちょっと困った.
(ex. /home/hoge/デスクトップ/)
ディレクトリ移るのにいちいち IME 起動したりとかナンセンスなので英語に戻した.
ターミナルで以下のコマンドを実行すると,ディレクトリ名を英語に戻して良いか聞かれるので肯定すれば英語に置き換わる.

$ LANG=C xdg-user-dirs-gtk-update

4.07.2011

Make CapsLock into an Additional Ctrl in Ubuntu-10.10

  1. [System] -> [Preference] -> [Keyboard]
  2. [Layout]Tab -> [Option] -> [Ctrl key position]
  3. Check "Make CapsLock an additional Ctrl"

Ubuntu 10.10 で要らない子 CapsLock キーを Ctrl キーに変更する方法のメモ。
  1. [システム] -> [設定] -> [キーボード]
  2. [レイアウト]タブ -> [オプション] -> [Ctrlキーの位置]
  3. "Make CapsLock an additional Ctrl" を選択
※日本語版使ってないので,最後の選択肢の文言は違うかも知れません.
書いてある内容を読んで適宜判断して下さい.

1.13.2011

Making dvipdfmx's Output Landscape

I use platex and dvipdfmx to publish *.pdf from *.tex, and Texlipse to write *.tex. Texlipse is the Eclipse's plug-in for composing tex docs. In some cases, I have to publish *.pdf in a landscape style. When using command line, it can be achieved by "l" option.
$ platex foo.tex
$ platex foo.tex
$ divpdfmx -l foo.dvi
Of course, this option is available even if I use it through Texlipse. However, it is not so smart to change configure Texlipse's option for each *.tex. After exploring the web, I found how to include this option in *.tex. That is achieved by adding a following line into *.tex.
\AtBeginDvi{\special{landscape}}

Reference:
http://xtori.blogspot.com/2010/01/texlandscape.html
情報処理学会で指定されてる論文のフォーマットが用紙を横向きに使うものなんですが,
lscape パッケージを利用しても dvipdfmx で出力される PDF は縦向き….
コマンドラインから横向きに出力するには
$ platex hoge.tex
$ platex hoge.tex
$ divpdfmx -l hoge.dvi
とやればいいのですが,普段 Texlipse (Eclipse の tex 用プラグイン) からコンパイルをしているので
パラメータやらオプションやらを文書毎に指定するのは非常に面倒.
そこで調べてみたらドンピシャな記事を発見したのでメモ.

研究な日々: TexでLandscape
http://xtori.blogspot.com/2010/01/texlandscape.html

tex ファイルに以下の記述をすると,dvipdfmx の方で横向きに出力してくれるとのこと.
\AtBeginDvi{\special{landscape}}
実際に試したところ,l オプションを付けなくても横向きに出力されるようになりました.

10.13.2010

Moving A Blog from MovableType Services to Google's Blogger

Upload your MT formatted data and get XML formatted data.
I have one more blog on FC2 blog service, but I mainly use Google's blogger now. It's more convenient for me to manage my blog, because I use other Google's services like Picasa. So, I searched methods to import old blog's data into this blog.

Blogger requires XML formatted data to import, but FC2 blog service allows us to download the blog data in MovableType (MT) format. So, we have to convert MT formatted data into XML format. I found converting service on the web.
http://movabletype2blogger.appspot.com/

This service allows us to convert MT formatted data into XML format with few steps.
  1. Upload MT formatted data
  2. Download converted data
That's all. :)
Then, you can import the converted data into your blog on Blogger. We have to re-upload images or movies if your posts have links for them. "Post date" of imported articles are set to the time when you import the data. (not set to original "post date")



/*
I finally did not import my old blog's data because many posts of the data no longer useful information. I'm going to choose articles which may still useful and rewrite them into this blog one-bye-one.
*/

Dual-boot of Windows with Linux on Sony VAIO typeS

Abstraction of the method; closed/opened squares mean used/free blocks on the disk space.
This post describes how to install Linux into Windows PC without removing or reinstalling the existing Windows.



Please use this information at your own risk.
This method may break your system or important data.




Environment of My Case
  • Sony VAIO typeS (VGN-S94PS)
    • OS: Windows XP Professional
    • CPU: PentiumM 2 GHz
    • RAM: 1GB
    • HDD: 60GB
      • Recovery partition: for recoverying Windows
      • System partition: for system and user data
  • Additional OS: Ubuntu


Method 
  1. Download ISO image of Ubuntu from its web site and burn it onto an optical disk. (Of course you can use other bootable devices.)
    http://www.ubuntu.com/desktop/get-ubuntu/download
  2. Defrag the system partition to protect the Windows data from following repartitioning. I'm not sure, however, this method is enough to protect your data. I strongly recommend you to copy your whole data for backup.
  3. Boot Ubuntu from the optical disk onto which you burn its ISO image.
  4. Repartition the system partition with gparted which the ISO image contains. You have to ensure an enough sized partition for Windows because this operation may drop necessary data.
    Format the data partition as fat32 because both of Windows XP and Ubuntu can use the format.
    /dev/sda1 ntfs recovery partition (by default)
    /dev/sda2 ntfs for Windows XP
    /dev/sda5 ext3 /
    /dev/sda6 ext3 swap
    /dev/sda4 fat32 data partition for Windows and Ubuntu
    
    /dev/sda1 was not touched. /dev/sda2 was shrinked to make space for /dev/sda4, /dev/sda5 and /dev/sda6. /dev/sda5 and /dev/sda6 are for Ubuntu, and /dev/sda4 is for user data which both of Windows and Ubuntu access.
  5. Mount the data partition and write out a bootsector image there.
    $ sudo mkdir /winD
    $ sudo mount -t vfat /dev/sda4 /winD
    $ sudo dd if=/dev/sda5 of=/winD/bootsector.img bs=512 count=1
    
    I gave the mount point the name of /winD because Windows treats the partition as D-drive.
  6. Remove the optical disk (or other boot devices) and reboot.
  7. Move bootsector.img from D-drive to root of C-drive (C:\bootsector.img).
  8. Modify C:\boot.ini as below.
    [boot loader]
    timeout=30
    default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
    C:\bootsector.img="Ubuntu"
    
  9. Reboot to confirm that you can select OS.
    If you can not find the display to select OS, you may fail to modify boot.ini. Check the file. Or, if Ubuntu does not boot after you select it, you may fail to create or move bootsector.img. Check the file or recreate it. (You need the optical disk or bootable devices again.)

10.08.2010

** ERROR ** Could not find encoding file "H".

Cygwin 上の日本語 LaTeX 環境で
** ERROR ** Could not find encoding file "H".
というエラーが出たときの対処についてのメモです.
おそらく Linux でも同様に対応可能だと思います.


状況
tex -> dvi -> pdf と生成するために platex, dvipdfmx を使って以下のようにしているのですが,
別件で ghostscript をアップデートしてから dvipdfmx 実行中に前述のエラーが出るようになりました.
% platex hoge.tex
% dvipdfmx hoge


対処
どうやら有名なエラーらしく,フォントの読み込みに失敗している模様.
ghostscript のアップデートにより,フォント関係のパスが変わったことが原因のようでした.
結論としては以下のコマンドで正常に動作するようになりました.
% ln -s /usr/share/ghostscript/8.50/Resource/ /usr/local/teTeX/share/texmf/dvipdfm/
% mktexlsr
このときフォントの位置は ghostscript のバージョンやインストール先によって異なります.また,リンクを配置すべき位置も tex をどこにインストールしたかによって異なりますが, mktexlsr 実行時に出力されるディレクトリがヒントになると思います.
当方の環境では以下のようになっていました.
% mktexlsr
mktexlsr: Updating /usr/local/teTeX/share/texmf/ls-R...
mktexlsr: Updating /usr/local/teTeX/share/texmf-config/ls-R...
mktexlsr: Updating /usr/local/teTeX/share/texmf-dist/ls-R...
mktexlsr: Updating /usr/local/teTeX/share/texmf-var/ls-R...
mktexlsr: Done.

以下の位置にシンボリックリンクを張っている例を多数見かけたので,そのまま同じようにしてまったく問題解決できなくてハマっていました.フォントへのリンクを張り直したのにうまくいかない方はリンクを置く位置をよく確認してみてください.
/usr/share/texmf/dvipdfm/