Top/article
English | Japanese
English | Japanese

Menu

  • Top
  • Akihiko Yamaguchi 山口 明彦
  • Project プロジェクト
  • Text テキスト
  • Recent articles 最近の記事
  • Articles 記事一覧 (a to z)
  • Search 検索

Tags タグ †

  • [c++][bash][python][latex][php]
  • [linux][windows][mac][android]
  • [math][algorithm][idea][trick]
  • [liboctave][opencv][git][ros]
  • [setting][bug][general]
↑

Recent articles 最近の記事 †

2019-07-02
  • article/Display-Unix-Time
  • article/Synchronize-Linux-Time-to-Remote
2018-09-27
  • article/python-multimode-singleton
2018-09-02
  • article/rosinstall-git-default-remote
2017-07-28
  • article/SubMenu
2017-03-05
  • article/Import-a-different-version-of-OpenCV-in-Python
2015-08-17
  • article/DRC-finals-2015
2015-01-05
  • article/Upgrade-Android-to-Lollipop
2015-01-01
  • article/Kernel-panic-of-Linux-when-using-Xtion
  • article/Do-not-skip-freeing-data-when-using-tri-mesh-in-ODE
Access: 1/10510 - Admin

List of articles (a to z)

記事一覧 (a to z)

< Previous 20 pages | 21 to 40 | Next 20 pages >
article/Counting-different-lines-of-two-text-files

Counting different lines of two text files

2つのテキストファイルで異なる部分の行数をカウントするには

[idea][linux][trick]
2012-12-12

diffを取って,>で始まる行だけ抜き出して,その数を数えればいいのだろうか?

diff -bB FILE1.txt FILE2.txt | sed '/^[^>].*/d'

これで,> で始まる行だけ抜き出せるので,wc でカウントする.

... read more (article/Counting-different-lines-of-two-text-files)
article/Define-inline-function-after-use

Can we define an inline function after where it is used

inline 関数を使用場所より後で定義してもいいか?

[c++]
2009-01-26

すぐ忘れるので,メモ. inline 関数は,先行宣言しておくことで,定義が使用場所より後にある場合でも問題なく使える.

... read more (article/Define-inline-function-after-use)
article/Display-Unix-Time

Display Unix Time

Unix時間を表示

[linux]
2019-07-02

Can be done by combining watch and date commands.

watchとdateコマンドを組み合わせればできる.

... read more (article/Display-Unix-Time)
article/Do-not-skip-freeing-data-when-using-tri-mesh-in-ODE

Don't skip freeing data when using tri-mesh in ODE

ODE で tri-mesh を使うときはデータの解放を忘れずに

[c++]
2013-11-21

ODE (Open Dynamics Engine) で tri-mesh (三角形メッシュ) を使うとき,dGeomTriMeshDataCreate で確保したデータを,dGeomTriMeshDataDestroy で破棄するのを忘れてはならない.破棄しなければ,メモリリークの原因となる(特に,シミュレーションのリセットを何度も繰り返す場合).

... read more (article/Do-not-skip-freeing-data-when-using-tri-mesh-in-ODE)
article/Do-not-skip-initialization-use-Wshadow-option

Do not skip initializing variables, use -Wshadow gcc option

変数の初期化をサボるな,それから -Wshadow オプションを使え

[c++]
2013-07-18

という自戒.前にも似たような話を書いたのだが,懲りずにまたやった.

今回は,未初期化の変数と未発見のバグを含んだプログラムを使っていて,まったく関係のないコードを加えたタイミングで変数の初期値変動によってバグが顕在化した場合に,新しく加えたコードがバグの原因のように見えてしまって,デバッグに苦労する,という話.で,この手のトラブルを避けるには,変数を必ず初期化し,gccなら -Wshadow オプションを使おう,という内容.

... read more (article/Do-not-skip-initialization-use-Wshadow-option)
article/Draw-Koch-curve-with-Python

Draw Koch curves with Python

Pythonでコッホ曲線を描く

[python]
2013-10-26

土曜日なので,コッホ曲線を描いて遊んでみた.

20131026123542.png
... read more (article/Draw-Koch-curve-with-Python)
article/DRC-finals-2015

DARPA Robotics Challenge Finals 2015

DARPA ロボティクスチャレンジ Finals 2015

[general]
2015-07-08
2015-07-10
2015-08-02
2015-08-17

Regarding DARPA Robotics Challenge (DRC) Finals held in California US June 2015, I put some notes for exploring the reason of failures of Japan's teams. For the details of DRC, refer to the following articles.

2015年6月に米国カリフォルニアで行われた災害ロボットコンテスト DARPA Robotics Challenge (DRC) Finalsに関して,日本勢の失敗要因を探るためのメモを公開する.DRCについては,以下の記事を参考.

  • How South Korea's DRC-HUBO Robot Won the DARPA Robotics Challenge
  • THE DARPA ROBOTICS CHALLENGE WAS A BUST
... read more (article/DRC-finals-2015)
article/Dual-ostream

C++: Simultaneous output to double ostream

C++で2つの ostream に同時出力する

[c++]
2008-06-30

C++で std::cout と std::ofstream のインスタンスに同じ内容を出力するとき,ほぼ同じコードを2回書かないとダメだ.

ofstream os ("tmp.dat");
dout(cout, os) << "x= " << x << endl;

こんな感じで,一文で書けるようにしたい.

... read more (article/Dual-ostream)
article/Encode-H.264-videos-with-ffmpeg

Encode H.264 videos with ffmpeg

ffmpeg で H.264 エンコーディングの動画を作る

[linux][trick]
2010-12-01

HTML5 のvideo要素で使えたり使えなかったりするH.264だが,使えるにこしたことはないと思い,ffmpegでエンコーディングしようとしてみた.少しコツが必要なので,メモしておく.

... read more (article/Encode-H.264-videos-with-ffmpeg)
article/Enlarge-font-size-of-Gmail

Enlarge font size of Gmail

Gmailの文字を大きくする

[trick]
2010-05-11

Gmailの文字が小さくて見にくい(英文は特に).ズームすると,全体のバランスが崩れてださい.Chrome や Firefox 限定だと思われるが,Stylish という拡張機能(アドオン)をインストールすれば,メッセージだけ文字を大きくできる.

... read more (article/Enlarge-font-size-of-Gmail)
article/Error-handler-of-liboctave

Defining the error handler of liboctave for efficient debug

liboctave のエラーハンドラを自分で定義して,デバッグを効率化

[c++][liboctave]
2009-01-10

liboctave を使っていると,例えば要素数の異なる列ベクトルを足そうとしたときに

fatal: operator +: nonconformant arguments (op1 len: 2, op2 len: 5)

というエラーが発生し,プログラムが正常終了する.正常終了とは exit(1) による終了で,

  • コアファイル (core) がダンプされないのでバックトレースできない
  • このためどの関数が operator+ を呼び出してエラーを発生させたのかわからない

という問題があり,デバッグしにくい.そこで, liboctave のエラーハンドラを自分で定義して,エラーが発生したときの振舞いを自分で決められるようにしよう.

... read more (article/Error-handler-of-liboctave)
article/Estimating-dereferenced-type

Estimating dereferenced type by partial specialization of template

テンプレートの部分特殊化を利用した間接参照型推定

[c++][trick]
2008-11-09

C++の機能,テンプレートの部分特殊化 (Wikipedia)を使って,あるポインタ型orイテレータ型から,それを間接参照した(or逆参照した,orポインタをとっぱらった)型を推定する方法を紹介する.

... read more (article/Estimating-dereferenced-type)
article/Explicit-instantiation-of-template-functions

Explicit instantiation of template functions

テンプレート関数の明示的インスタンス生成

[c++][trick]
2008-11-29

通常,C++のテンプレート関数(orクラス)をライブラリ化するとき,それを利用するソースから,そのテンプレート関数の実装(定義)も含めてインクルードしなければならない.そうしないと,特定の型に対してテンプレート関数のインスタンスを生成できないからだ.しかし,この仕様には

  • ヘッダファイルの肥大化(コンパイル速度の低下)
  • 望ましくない実装の公開

などの問題がある.これを回避するために,特定の型に対してテンプレートのインスタンスを明示的に生成する explicit instantiation という方法がある.

... read more (article/Explicit-instantiation-of-template-functions)
article/Find-correct-mathematical-notations

How to find correct mathematical notations

正しい数式表現の探し方

[math]
2009-05-26

論文やレポートなどで数式を書くとき,たまに正しい書式を忘れてしまうことがある. (例) 関数 \((( f_i(x) \))) (iは整数,xは実数ベクトル)の,iが \((( i=\arg\max_{j}(q_{j}(x))\))) で与えられるような場合を表したい.もちろん,

\$$$ f_{\arg\max_{j}(q_{j}(x))}(x) \$$$

と書けるのだが,ちょっと見にくいので

\$$$ f_i(x) \mid_{i=\arg\max_{j}(q_{j}(x))} \$$$

こんな感じの書式で書いてみよう.あれ,これって正しかったっけ?

... read more (article/Find-correct-mathematical-notations)
article/Formatting-CSV-in-command-line

Formatting CSV-like data in command line

コマンドラインでCSVなどのデータを整形して見るには

[linux][trick]
2013-06-11

column コマンドと less を組み合わせれば,CSVなどのデータファイルはすごく見やすくなる. ソース:[http://stackoverflow.com/questions/1875305/command-line-csv-viewer:title]

column -s, -t < INPUT.csv | less -#2 -N -S
... read more (article/Formatting-CSV-in-command-line)
article/Forward-declaration-of-STL-containers

Forward declaration of STL containers

How to make light header files?

STL コンテナの前方宣言

軽いヘッダファイルを作るには

[c++][trick]
2010-09-02

STL (standard template library) コンテナを include すると,それなりにコストが掛かる(参考).このコストは,場合によっては「前方宣言 (forward declaration)」によって大幅に軽減できる.STL コンテナの場合,前方宣言が少々ややこしいので,まとめておく.

... read more (article/Forward-declaration-of-STL-containers)
article/Git-pull-through-HTTP

Pull from Git remote repository through HTTP

Git のリモートリポジトリから HTTP で pull するためのメモ

[git]
2009-12-03

リモートサーバにある Git リポジトリから HTTP (WebDAV) 経由で pull したり clone を作ったりする場合の注意点について,おぼえがき.

... read more (article/Git-pull-through-HTTP)
article/Google-Calendar-API-for-todays-schedule

PHP script to see today's schedule using Google Calendar API

Google Calendar API を使って1日の予定を一覧するPHPスクリプトを作る

[php]
2009-11-04

そんなスクリプトをわざわざ作らなくても,Settings -> Calendars -> CALENDAR -> Notifications -> Daily agenda にチェックを入れておけば,5am(実際は4:30am頃?)にメールで予定一覧を送ってくれる.が,フォーマットが気に入らない(携帯メールに転送すると文字数制限をオーバーする),好きなメールアドレスに送れない(G-mailのフィルタで転送すればいいが)といった問題があるので, Google Calendar API を使って,1日の予定を一覧するPHPスクリプトを作ってみた.

... read more (article/Google-Calendar-API-for-todays-schedule)
article/Ignore-specific-directories-in-find

Ignore specific directories in find

findで特定のディレクトリを無視するには

[linux][trick]
2012-11-26

オプション -prune を -path などと組み合わせて使えばいいらしい.例えば build ディレクトリを無視しつつ CMakeLists.txt を検索するには,

find . -path './build' -prune -or -name CMakeLists.txt -print

と書く. -path './build' -prune -or のように書くのがポイント.最後の -print がないと,build ディレクトリも出力されてしまう.

... read more (article/Ignore-specific-directories-in-find)
article/Import-a-different-version-of-OpenCV-in-Python

Import a different version of OpenCV in Python

Pythonで異なるバージョンのOpenCVをimportするには

[python]
2017-03-05

When there are two versions of (e.g. OpenCV) libraries in a system, how to specify the imported version in Python?

ひとつのシステムに複数バージョンの(OpenCVなどの)ライブラリがインストールされているとき,Pythonから特定のバージョンをimportするにはどうすればいいのか.

... read more (article/Import-a-different-version-of-OpenCV-in-Python)
< Previous 20 pages | 21 to 40 | Next 20 pages >

Last-modified:2015-01-04 (Sun) 22:24:36 (3777d)
Link: MenuBar(2841d) Top(2841d) article/We-must-initialize-floating-point-variables(3780d) article/Include-cost-of-header-files(3781d)
Site admin: Akihiko Yamaguchi.
Written by: Akihiko Yamaguchi.
System: PukiWiki 1.5.0. PHP 5.2.17. HTML conversion time: 0.032 sec.