2010/10/30

Ubuntu.Settings.Packages.update-alternatives

問題:
Ubuntuのパッケージ管理システムでopenjdkをインストールしたところ、
/usr/bin/javaがgijという意味不明なbinaryをポイントしてしまう。

解決方法:
update-alternativesコマンドを利用して、コマンドが参照するbinaryパス
を変更することで解決できることが判明。
# keypointはubuntuに採用されているalternatives機構だった模様。


作業内容:

yaboo@yabook:~$ sudo update-alternatives --config java
[sudo] password for yaboo:
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                  優        Status
------------------------------------------------------------
* 0            /usr/bin/gij-4.4                       1044      auto mode
  1            /usr/bin/gij-4.4                       1044      manual mode
  2            /usr/lib/jvm/java-6-sun/jre/bin/java   63        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java to provide /usr/bin/java (java) in manual mode.
yaboo@yabook:~$ sudo update-alternatives --config javac
There are 3 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                               優        Status
------------------------------------------------------------
* 0            /usr/bin/gcj-wrapper-4.4            1044      auto mode
  1            /usr/bin/ecj                        143       manual mode
  2            /usr/bin/gcj-wrapper-4.4            1044      manual mode
  3            /usr/lib/jvm/java-6-sun/bin/javac   63        manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/java-6-sun/bin/javac to provide /usr/bin/javac (javac) in manual mode.
yaboo@yabook:~$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
yaboo@yabook:~$ javac -version
javac 1.6.0_22
yaboo@yabook:~$


参考URL:
http://d.hatena.ne.jp/tkuro/20100312/1268371500
http://d.hatena.ne.jp/Yoshiori/20100505/1273040380

Ubuntu.Settings.System.Mouse."20-thinkpad.conf"

問題:
ThinkPad T400にUbuntu 10.10をインストールしたが、
トラックポイントのスクロール機能を有効にする方法がわからない。

解決方法:
1.ファイルを作成する
touch /usr/share/X11/xorg.conf.d/20-thinkpad.conf


2.ファイルを編集して保存する

Section "InputClass"
      Identifier "Trackpoint Wheel Emulation"
      MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"
      MatchDevicePath "/dev/input/event*"
      Option "EmulateWheel" "true"
      Option "EmulateWheelButton" "2"
      Option "Emulate3Buttons" "false"
      Option "XAxisMapping" "6 7"
      Option "YAxisMapping" "4 5"
EndSection


3. Ubuntuを再起動する

参考URL:
http://d.hatena.ne.jp/hiro_nemu/20101024/1287898287

2010/10/06

Java.Junit.ExecViaCommandLine

Junitの使い方を少しお勉強。
なるほど、こうやって実行するのか。

<実行方法>
java -cp .:/opt/junit/junit-4.8.2.jar org.junit.runner.JUnitCore SampleTest

<実行結果>
JUnit version 4.8.2
..E
Time: 0.006
There was 1 failure:
1) testMinus(SampleTest)
junit.framework.AssertionFailedError: expected:<1> but was:<-1>
    at junit.framework.Assert.fail(Assert.java:47)
    at junit.framework.Assert.failNotEquals(Assert.java:283)
    at junit.framework.Assert.assertEquals(Assert.java:64)
    at junit.framework.Assert.assertEquals(Assert.java:195)
    at junit.framework.Assert.assertEquals(Assert.java:201)
    at SampleTest.testMinus(SampleTest.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
    at org.junit.runner.JUnitCore.runMain(JUnitCore.java:98)
    at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53)
    at org.junit.runner.JUnitCore.main(JUnitCore.java:45)

FAILURES!!!
Tests run: 2,  Failures: 1

100