機械音痴な情報系

そしてエンジニアに…。

GPSの情報をTerminalで取得する

 作成しているアプリケーションでGPSを使うようなのでメモっておく。  うちの研究室ではこれを買った。 

 マニュアル通りやろうとしてCD-ROM入れようとしたけどWindowsのみだったので断念。  どうやらTerminalでGPSの情報は取得できるらしいのでメモ。

  • 実行方法

    || ~$ su - Password: su: Authentication failure ~$ sudo su

    stty -F /dev/ttyUSB0 ispeed 4800 && cat < /dev/ttyUSB0

    ||<

 su -だとエラー出たけどなんでだろう。。今度調べてみよう。

  • 実行結果
     f:id:inami_173:20140924135644p:plain

UbuntuのTerminalの紫色の色コード

UbuntuのTerminalの紫色いいな〜と思い、MacのTerminalやその他色々なところで設定したいと思い始めた。 そこで「Ubuntu 色 コード」とかでググってもなかなか出てこないので画像から色コードを抽出してくれるサイトを利用して調べてみた。利用したのは以下のサイト。 iromiru (イロミル) - 画像からカラーコード抽出便利サービス

適当に拾ったこの画像で調べてみたところどうやら #300a24 ということが発覚。 http://smashingtips.techgeeks.netdna-cdn.com/wp-content/uploads/2012/09/yes-ubuntu-terminal-theme.png

因みに上のバーの灰色のところは、 #484742 でした。

Ubuntu14.04にndnSIMをダウンロード

|| ~$ sudo aptitude install libboost-all-dev ~$ sudo apt-get install python-dev python-pygraphviz python-kiwi ~$ sudo apt-get install python-pygoocanvas python-gnome2 ~$ sudo apt-get install python-gnomedesktop python-rsvg ipython ~$ mkdir ndnSIM ~$ cd ndnSIM ~/ndnSIM$ git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 ~/ndnSIM$ git clone git://github.com/cawka/pybindgen.git pybindgen ~/ndnSIM$ git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM ~/ndnSIM/ns-3$ cd ns-3/ ~/ndnSIM/ns-3$ ./waf configure --enable-examples ||<

赤いのが出ても気にしない。

|| ~/ndnSIM/ns-3$ ./waf ||< ちょっと時間が掛かる。

|| ~/ndnSIM/ns-3$ ./waf --run=ndn-simple --vis ||< 図が出てくればおk。

f:id:inami_173:20141001155122p:plain

Ubuntu14.04でEmacsキーバインドを使うために、CapsLockにCtrlを割り当てる

*

DeleteはCapsLock+Hで行うものである
現在研究室ではUbuntu+JISキーを使っているけど、  ・BackSpaceが遠すぎてイライラする  ・自分のMBAではEmacsキーバインドを使っててCapsLock押すくせあるから日本語入力の途中で英語に変わる ということでかなりストレスなので、CapsLockキーを追加のCtrlキーとして使う。

|| $ dconf reset /org/gnome/settings-daemon/plugins/keyboard/active $ dconf write /org/gnome/desktop/input-sources/xkb-options "['ctrl:nocaps']" ||< 快適快適!!

【ndnSIM】scenarioで「./waf configure」を実行してもエラーが返ってくるのでndnSIMを再インストールしてみた

  • エラー分でググって出てきたサイトを参考にパッケージがインストールされてることを確認
    indicationの日記 | スラド

    || ~$ sudo aptitude install libboost-all-dev [sudo] password for ccn-disaster: No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.

~$ sudo aptitude install libboost1.48-all-dev Couldn't find any package whose name or description matched "libboost1.48-all-dev" Couldn't find any package whose name or description matched "libboost1.48-all-dev" No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.

~$ aptitude search libboost-all-dec ~$ aptitude search libboost-all-dev i libboost-all-dev - Boost C++ Libraries development files (ALL) p libboost-all-dev:i386 - Boost C++ Libraries development files (ALL) ~$ aptitude show libboost-all-dev Package: libboost-all-dev
State: installed Automatically installed: no Version: 1.54.0.1ubuntu1 Priority: optional Section: universe/libdevel Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Architecture: amd64 Uncompressed Size: 26.6 k Depends: libboost-dev, libboost-tools-dev, libboost-atomic-dev, libboost-chrono-dev, libboost-context-dev, libboost-coroutine-dev, libboost-date-time-dev, libboost-exception-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-graph-parallel-dev, libboost-iostreams-dev, libboost-locale-dev, libboost-log-dev, libboost-math-dev, libboost-mpi-dev, libboost-mpi-python-dev, libboost-program-options-dev, libboost-python-dev, libboost-random-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libboost-system-dev, libboost-test-dev, libboost-thread-dev, libboost-timer-dev, libboost-wave-dev Conflicts: libboost-all-dev Description: Boost C++ Libraries development files (ALL) (default version) The Boost web site provides free, peer-reviewed, portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish "existing practice" and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report.

This metapackage provides the complete Boost development environment, including all separately-packaged libraries.

This package is a dependency package, which depends on Debian's default Boost version (currently 1.54). Homepage: http://www.boost.org/ nnn||<~$ sudo aptitude install libboost-all-dev [sudo] password for ccn-disaster: No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.

~$ sudo aptitude install libboost1.48-all-dev Couldn't find any package whose name or description matched "libboost1.48-all-dev" Couldn't find any package whose name or description matched "libboost1.48-all-dev" No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used.

~$ aptitude search libboost-all-dec ~$ aptitude search libboost-all-dev i libboost-all-dev - Boost C++ Libraries development files (ALL) p libboost-all-dev:i386 - Boost C++ Libraries development files (ALL) ~$ aptitude show libboost-all-dev Package: libboost-all-dev
State: installed Automatically installed: no Version: 1.54.0.1ubuntu1 Priority: optional Section: universe/libdevel Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Architecture: amd64 Uncompressed Size: 26.6 k Depends: libboost-dev, libboost-tools-dev, libboost-atomic-dev, libboost-chrono-dev, libboost-context-dev, libboost-coroutine-dev, libboost-date-time-dev, libboost-exception-dev, libboost-filesystem-dev, libboost-graph-dev, libboost-graph-parallel-dev, libboost-iostreams-dev, libboost-locale-dev, libboost-log-dev, libboost-math-dev, libboost-mpi-dev, libboost-mpi-python-dev, libboost-program-options-dev, libboost-python-dev, libboost-random-dev, libboost-regex-dev, libboost-serialization-dev, libboost-signals-dev, libboost-system-dev, libboost-test-dev, libboost-thread-dev, libboost-timer-dev, libboost-wave-dev Conflicts: libboost-all-dev Description: Boost C++ Libraries development files (ALL) (default version) The Boost web site provides free, peer-reviewed, portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish "existing practice" and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report.

This metapackage provides the complete Boost development environment, including all separately-packaged libraries.

This package is a dependency package, which depends on Debian's default Boost version (currently 1.54). Homepage: http://www.boost.org/ ||<

|| ~$ sudo apt-get install python-dev python-pygraphviz python-kiwi Reading package lists... Done Building dependency tree
Reading state information... Done python-dev is already the newest version. python-kiwi is already the newest version. python-pygraphviz is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~$ sudo apt-get install python-pygoocanvas python-gnome2 Reading package lists... Done Building dependency tree
Reading state information... Done python-gnome2 is already the newest version. python-pygoocanvas is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~$ sudo apt-get install python-gnomedesktop python-rsvg ipython Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package python-gnomedesktop ||<

最後だけ発見出来ないと…。

|| ~$ sudo apt-get install python-rsvg ipython python-pygccxml Reading package lists... Done Building dependency tree
Reading state information... Done python-pygccxml is already the newest version. The following extra packages will be installed: python-decorator python-simplegeneric Suggested packages: ipython-doc ipython-notebook ipython-qtconsole python-matplotlib python-numpy python-zmq The following NEW packages will be installed: ipython python-decorator python-rsvg python-simplegeneric 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 633 kB of archives. After this operation, 3,547 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-decorator all 3.4.0-2build1 [19.2 kB] Get:2 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-simplegeneric all 0.8.1-1 [11.5 kB] Get:3 http://jp.archive.ubuntu.com/ubuntu/ trusty/universe ipython all 1.2.1-2 [588 kB] Get:4 http://jp.archive.ubuntu.com/ubuntu/ trusty/main python-rsvg amd64 2.32.0+dfsg-3 [13.9 kB] Fetched 633 kB in 0s (1,043 kB/s)
Selecting previously unselected package python-decorator. (Reading database ... 360315 files and directories currently installed.) Preparing to unpack .../python-decorator_3.4.0-2build1_all.deb ... Unpacking python-decorator (3.4.0-2build1) ... Selecting previously unselected package python-simplegeneric. Preparing to unpack .../python-simplegeneric_0.8.1-1_all.deb ... Unpacking python-simplegeneric (0.8.1-1) ... Selecting previously unselected package ipython. Preparing to unpack .../ipython_1.2.1-2_all.deb ... Unpacking ipython (1.2.1-2) ... Selecting previously unselected package python-rsvg. Preparing to unpack .../python-rsvg_2.32.0+dfsg-3_amd64.deb ... Unpacking python-rsvg (2.32.0+dfsg-3) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1) ... Setting up python-decorator (3.4.0-2build1) ... Setting up python-simplegeneric (0.8.1-1) ... Setting up ipython (1.2.1-2) ... Setting up python-rsvg (2.32.0+dfsg-3) ... $ ||<

大丈夫なのかな?続ける。

|| ~$ mkdir ndnSIM ~$ cd ndnSIM ~/ndnSIM$ git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 Cloning into 'ns-3'... remote: Counting objects: 113588, done. remote: Compressing objects: 100% (30040/30040), done. remote: Total 113588 (delta 82727), reused 113588 (delta 82727) Receiving objects: 100% (113588/113588), 69.84 MiB | 4.92 MiB/s, done. Resolving deltas: 100% (82727/82727), done. Checking connectivity... done. ~/ndnSIM$ git clone git://github.com/cawka/pybindgen.git pybindgen Cloning into 'pybindgen'... remote: Counting objects: 5710, done. remote: Total 5710 (delta 0), reused 0 (delta 0) Receiving objects: 100% (5710/5710), 11.18 MiB | 3.67 MiB/s, done. Resolving deltas: 100% (3759/3759), done. Checking connectivity... done. ~/ndnSIM$ git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM Cloning into 'ns-3/src/ndnSIM'... remote: Counting objects: 7801, done. remote: Total 7801 (delta 0), reused 0 (delta 0) Receiving objects: 100% (7801/7801), 5.77 MiB | 1.39 MiB/s, done. Resolving deltas: 100% (3656/3656), done. Checking connectivity... done. ~/ndnSIM$ cd ns-3/ ~/ndnSIM$ cd ns-3/ ~/ndnSIM/ns-3$ ./waf configure --enable-examples

...

~/ndnSIM/ns-3$ ./waf

...

~/ndnSIM/ns-3$ ./waf --run=ndn-simple --vis Waf: Entering directory /home/ccn-disaster/ndnSIM/ns-3/build' Waf: Leaving directory/home/ccn-disaster/ndnSIM/ns-3/build' 'build' finished successfully (1.109s) Could not load icon applets-screenshooter due to missing gnomedesktop Python module Could not load icon gnome-terminal due to missing gnomedesktop Python module scanning topology: [0, 3) nodes... $ ||<

最後に図がでるか試してみたけど、ちゃんと図は出る。

  • 公式の方法で続きを行う
    公式に戻って「Simulating using ndnSIM」の「# Build and install NS-3 and ndnSIM」から実行。

|| ~/ndnSIM/ns-3$ ./waf configure -d optimized

...

~/ndnSIM/ns-3$ ./waf

...

~/ndnSIM/ns-3$ sudo ./waf install ~/ndnSIM/ns-3$ cd .. ~/ndnSIM$ ~/ndnSIM$ git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario Cloning into 'scenario'... remote: Counting objects: 40, done. remote: Total 40 (delta 0), reused 0 (delta 0) Receiving objects: 100% (40/40), 97.41 KiB | 61.00 KiB/s, done. Resolving deltas: 100% (11/11), done. Checking connectivity... done. ~/ndnSIM$ cd scenario ~/ndnSIM/scenario$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ~/ndnSIM/scenario$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ~/ndnSIM/scenario$ ./waf configure Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : lib iostreams not found in /usr/local/lib (complete log in /home/ccn-disaster/ndnSIM/scenario/build/config.log)

||<

またダメだった。 Notes for ndnSIM Installation (Ubuntu 14.04) - IIS-NRL こっちのを試す。

|| ~/ndnSIM/scenario$ cd ../ ~/ndnSIM$ sudo apt-get install g++ Reading package lists... Done Building dependency tree
Reading state information... Done g++ is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install gccxml Reading package lists... Done Building dependency tree
Reading state information... Done gccxml is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install libboost-all-dev Reading package lists... Done Building dependency tree
Reading state information... Done libboost-all-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/ndnSIM$ sudo apt-get install libsqlite3-dev Reading package lists... Done Building dependency tree
Reading state information... Done libsqlite3-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

cd pybindgen ./waf configure ./waf sudo ./waf install cd ../

cd ns-3

./waf configure -d optimized --enable-examples ./waf sudo ./waf install

~/ndnSIM/ns-3$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : lib iostreams not found in /usr/local/lib (complete log in /home/ccn-disaster/ndnSIM/scenario/build/config.log) ~/ndnSIM/scenario$ ./waf --run=ndn-simple --vis The project was not configured: run "waf configure" first! ||<

https://sites.google.com/site/cclljj/resources/notes_ndnsim うーん。。。iostreamsが見つからないと。。。

|| ~/ndnSIM/bzip2-1.0.6$ ./b2 --prefix=$BOOSTDIR cxxflags=-I$BOOSTDIR/include linkflags=-L$BOOSTDIR/lib install bash: ./b2: No such file or directory ~/ndnSIM/bzip2-1.0.6$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure ||<

./b2はエラーが返ってきたので、この段階で./waf configureを実行してみる。

|| ~/ndnSIM/bzip2-1.0.6$ cd ../scenario/ ~/ndnSIM/scenario$ ./waf configure ^[[3~Setting top to : /home/ccn-disaster/ndnSIM/scenario Setting out to : /home/ccn-disaster/ndnSIM/scenario/build Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_54 Checking boost libs : ok Checking for boost linkage : ok ... ||<

なんか知らんが出来てる!! ndnSim/ns-3/exampleの中から適当に.ccファイルをコピーしてきてscenario直下にペースト。

|| ~/ndnSIM/scenario$ ./waf --run=tcp-star-server --vis Waf: Entering directory /home/ccn-disaster/ndnSIM/scenario/build' [1/2] cxx: scenarios/tcp-star-server.cc -> build/scenarios/tcp-star-server.cc.2.o [2/2] cxxprogram: build/scenarios/tcp-star-server.cc.2.o -> build/tcp-star-server Waf: Leaving directory/home/ccn-disaster/ndnSIM/scenario/build' 'build' finished successfully (1.686s) Could not load icon applets-screenshooter due to missing gnomedesktop Python module Could not load icon gnome-terminal due to missing gnomedesktop Python module scanning topology: [0, 9) nodes...

||< f:id:inami_173:20141002112611p:plain

出来たー! pcapファイルがめっちゃ作られてるけどそれはccファイルに出力するように書かれてるのかな?

バイトあるし台風来るしお腹減ったし帰りたいので今日はここまで。

Ubuntu & Mac - Terminalのプロンプトを設定

Rails - WEBrickでポートを指定する方法3つまとめ

|?| $ rails s -p3001 ||<

http://0.0.0.0:3001にアクセス。

|?| $ sudo rails server -p 80 ||<

http://0.0.0.0/にアクセス。

rails sを実行した際に3000以外のポートで起動したい場合、config/boot.rbなどに以下を書く。

|ruby| require 'rails/commands/server' module Rails class Server def default_options super.merge({ :Port => 4000 }) end end end ||<