Today I found it's nice to work with ctags, which is a source code analysis tool.
Although it doesn't have a nice front-end gui interface, ctags works nicely with vi and vi's brothers, e.g., vim, gvim.
The source navigator is also nice to try, but it looks much complicated when you just want to have a look at the classes or functions in your code. The other important thing is I am used to program in GVIM.
The way to use ctags is very simple, first go to your source directory, and type following command in your terminal:
ctags -R *
this command will generate a tags file which you can find in your source directory.
Next thing is using vi or gvim to open your source file, and move cursor to the keyword, e.g, class name, function name, etc., and use CTRL-] to get this keyword's source position. If you want to get backward, then use CTRL-T.
CTAGS is small and big enough for me.
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Monday, April 18, 2011
Tuesday, March 22, 2011
Export the Bibliography as You Like Using Jabref
This document introduce how to export the bibliography in a .RTF or .HTML format using the Jabref.
1. Download and install Jabref from website “http://jabref.sourceforge.net/index.php”.
2. Open the database. “File”->”Open database” and choose the right file.
3. Customize entry types. Add the sentence “ Acknowledgement: acknowledgement; bccn; status” to “options”->”Set up general fields”.
4. Use the export template. The templates for RTF or HTML can be downloaded from website “ http://jabref.sourceforge.net/resources.php”. They need be further changed to get what we want, e.g., including acknowledgements. Click “Options”->”Management custom exports ” -> “add new” and choose the right template file, e.g., “edward_elgar.layout”, then give it a name, e.g. “edward” and specify the format, e.g., “.rtf”.
5. Export settings. If you want to index the output file first by entry type and second by the year, you can first click the “Entry type” with control key “Ctrl”, then click the “Year”. Now you have to make sure the export setting is right: click the “Options”->”Preference”->”file”->”sort order” and choose “Export in current table sort order”.
6. Do export. Click “File”->”Export” and choose the right format, e.g., “edward (*.rtf)”.
1. Download and install Jabref from website “http://jabref.sourceforge.net/index.php”.
2. Open the database. “File”->”Open database” and choose the right file.
3. Customize entry types. Add the sentence “ Acknowledgement: acknowledgement; bccn; status” to “options”->”Set up general fields”.
4. Use the export template. The templates for RTF or HTML can be downloaded from website “ http://jabref.sourceforge.net/resources.php”. They need be further changed to get what we want, e.g., including acknowledgements. Click “Options”->”Management custom exports ” -> “add new” and choose the right template file, e.g., “edward_elgar.layout”, then give it a name, e.g. “edward” and specify the format, e.g., “.rtf”.
5. Export settings. If you want to index the output file first by entry type and second by the year, you can first click the “Entry type” with control key “Ctrl”, then click the “Year”. Now you have to make sure the export setting is right: click the “Options”->”Preference”->”file”->”sort order” and choose “Export in current table sort order”.
6. Do export. Click “File”->”Export” and choose the right format, e.g., “edward (*.rtf)”.
Friday, September 24, 2010
Nautilus open folder from terminal
Great command....
You can open current folder from terminal command line....
You can open current folder from terminal command line....
Wednesday, March 3, 2010
conflict command in linux: matlab mex with mex from pdflatex
In the Ubuntu, two commands have same name. The way to solve this problem is to use command name with whole directory, e.g, /opt/matlab/bin/mex. You can use this whole name instead of short name "mex" in the Makefile.
Thursday, January 14, 2010
Linux Matlab and German keyboard
The new linux version matlab (e.g. R2008, R2009) can not work with german keyboard, it works following the english keyboard map.
I have tried a lot method and it still can not work until today (great day)!
When I run matlab, it show me a error message:
"
********************************libjvm.so
[0xb31ab8ec]
Locking assertion failure. Backtrace:"
It can not lock the java. The reason is it find the wrong one. The solution is run a command shell and type:
"export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.17/jre
"
Now it correctly show the character of the german keyboard. Of course, you may have different version of JAVA and install directory that you must figure out, and use yours instead mine. You also can add this command to your "~/.bashrc" file, so that every time you login, you donot have to run this command manually.
But the symbols "^" and "~" still can not work in this Linux. I test this method on Windows Vista, both symbols can work.
On Vista, open a command prompt, then use command setx to set the variable MATLAB_JAVA:
"setx "MATLAB_JAVA" "C:\*************""
I have tried a lot method and it still can not work until today (great day)!
When I run matlab, it show me a error message:
"
********************************libjvm.so
[0xb31ab8ec]
Locking assertion failure. Backtrace:"
It can not lock the java. The reason is it find the wrong one. The solution is run a command shell and type:
"export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.17/jre
"
Now it correctly show the character of the german keyboard. Of course, you may have different version of JAVA and install directory that you must figure out, and use yours instead mine. You also can add this command to your "~/.bashrc" file, so that every time you login, you donot have to run this command manually.
But the symbols "^" and "~" still can not work in this Linux. I test this method on Windows Vista, both symbols can work.
On Vista, open a command prompt, then use command setx to set the variable MATLAB_JAVA:
"setx "MATLAB_JAVA" "C:\*************""
Monday, November 16, 2009
Convert bib file to bbl file
I have a bibliography database file which was created by kbib. I want to use it on latex. In the tex file, I add
"
\bibliographystyle{plain}
\bibliography{bibfile}
"
just begin the end of documentation.
When I first compile the file, it told me it can not find reference .bbl file. So I use bibtex to build a .bbl file which can be used in latex.
$ bibtex filename.aux
here .aux was created by first run of latex. It automatically transfer data from bibfile.bib to filename.bbl by filename.aux.
It's great. Because you just need one database, then you can use it forever.
Thanks latex.
"
\bibliographystyle{plain}
\bibliography{bibfile}
"
just begin the end of documentation.
When I first compile the file, it told me it can not find reference .bbl file. So I use bibtex to build a .bbl file which can be used in latex.
$ bibtex filename.aux
here .aux was created by first run of latex. It automatically transfer data from bibfile.bib to filename.bbl by filename.aux.
It's great. Because you just need one database, then you can use it forever.
Thanks latex.
Thursday, November 12, 2009
Smart search history command in linux bash
Well, many people knows the up key can search the similar command in matlab terminal. But in linux (Ubuntu), if you work on terminal and want to try this, then nothing happen. If you want it search command history automaticly, you need do:
edit \etc\inputrc
uncomment next part:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
Now you can use page up and down to search command history. Is that cool? eh.....
edit \etc\inputrc
uncomment next part:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
Now you can use page up and down to search command history. Is that cool? eh.....
Wednesday, October 21, 2009
Setting nfs client to run server's program
System: Ubuntu
1. Install NFS client:
#sudo apt-get install portmap nfs-common
2. Mount the server files on laptop:
#sudo mkdir /nfs/matlab
#sudo mount server:/pub/matlab /nfs/matlab
Now it should work.
If you want to automount it, you need install autofs first:
1. Install autofs
# sudo apt-get install autofs
2. Add the following line at the end of /etc/auto.master:
/nfs /etc/auto.nfs
3. create a file /etc/auto.nfs and add following line( please make sure the dpi file doest include any file has same name with "matlab"):
matlab server:/pub/matlab
4. reload configure file:
$ sudo /etc/init.d/autofs reload
5. Check if it works:
$ls /nfs/matlab
1. Install NFS client:
#sudo apt-get install portmap nfs-common
2. Mount the server files on laptop:
#sudo mkdir /nfs/matlab
#sudo mount server:/pub/matlab /nfs/matlab
Now it should work.
If you want to automount it, you need install autofs first:
1. Install autofs
# sudo apt-get install autofs
2. Add the following line at the end of /etc/auto.master:
/nfs /etc/auto.nfs
3. create a file /etc/auto.nfs and add following line( please make sure the dpi file doest include any file has same name with "matlab"):
matlab server:/pub/matlab
4. reload configure file:
$ sudo /etc/init.d/autofs reload
5. Check if it works:
$ls /nfs/matlab
Tuesday, July 21, 2009
Input Chinese in Ubuntu(输入中文)
I follow the guidance of website "http://ubuntuforums.org/showthread.php?p=124214".
1. Install libraries:
* scim
* scim-chinese
* scim-config-socket
* scim-frontend-socket
* scim-gtk2-immodule
* scim-server-socket
* scim-tables-zh (option)
* xfonts-intl-chinese
* xfonts-intl-chinese-big
* ttf-arphic-gbsn00lp
* ttf-arphic-gkai00mp
* ttf-arphic-bkai00mp
* ttf-arphic-bsmi00lp
2, Open a terminal,
$gvim .xsession
Type
"
scim -d
export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
gnome-session
"
Then save .xsession under your home direcotry.
$chomd +x .xsession
Restart X server by CTRL+ALT+BACKSPACE
Activate the chinese input by CTRL+SPACE.
Finally I got it. Very cool, just feel a little strange.
现在可以用中文咯。。。。。嘻嘻。。。
This method is dead in June, 2010.
But I find a solution:
$sudo apt-get install scim-qtimm im-switch scim-pinyin
$im-switch -z en_US -s scim
It works again......你看到了吧。。。死掉的SCIM又活回来了。。
1. Install libraries:
* scim
* scim-chinese
* scim-config-socket
* scim-frontend-socket
* scim-gtk2-immodule
* scim-server-socket
* scim-tables-zh (option)
* xfonts-intl-chinese
* xfonts-intl-chinese-big
* ttf-arphic-gbsn00lp
* ttf-arphic-gkai00mp
* ttf-arphic-bkai00mp
* ttf-arphic-bsmi00lp
2, Open a terminal,
$gvim .xsession
Type
"
scim -d
export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
gnome-session
"
Then save .xsession under your home direcotry.
$chomd +x .xsession
Restart X server by CTRL+ALT+BACKSPACE
Activate the chinese input by CTRL+SPACE.
Finally I got it. Very cool, just feel a little strange.
现在可以用中文咯。。。。。嘻嘻。。。
This method is dead in June, 2010.
But I find a solution:
$sudo apt-get install scim-qtimm im-switch scim-pinyin
$im-switch -z en_US -s scim
It works again......你看到了吧。。。死掉的SCIM又活回来了。。
Thursday, June 11, 2009
Check disk Usage by "du"
For example:
$ du -s -m *
Here -s means dont show children folder. -m means show in MB
$ du -s -m *
Here -s means dont show children folder. -m means show in MB
Dual IP on one internet card
For Ubuntu do :
$ cd /etc/network/
$ sudo vi interfaces
Then add follow line in:
If your 1st ip config is:
iface eth0 inet static
address 172.xxx.xxx.xxx
netmask 255.255.xxx.xxx
...
auto eth0
Now add 2th ip :
iface eth0:1 inet static
address 192.xxx.xxx.xxx
netmask 255.255.xxx.xxx
auto eth0:1
do:
#sudo /etc/init.d/networking restart
$ cd /etc/network/
$ sudo vi interfaces
Then add follow line in:
If your 1st ip config is:
iface eth0 inet static
address 172.xxx.xxx.xxx
netmask 255.255.xxx.xxx
...
auto eth0
Now add 2th ip :
iface eth0:1 inet static
address 192.xxx.xxx.xxx
netmask 255.255.xxx.xxx
auto eth0:1
do:
#sudo /etc/init.d/networking restart
Thursday, March 12, 2009
A way to load module when linux system is booting
If you want load a modules "some.ko" to kernel when system is booting.. You can do this:
$ cd /etc/init.d/
$ sudo gvim "boot.local"
Add follow line in boot.local file:
"insmod /filedirectory/some.ko"
Make the file executable
$ sudo chmod +x boot.local
Make it bootable ..Dont forget the last dot.
$ sudo update-rc.d boot.local start 51 S .
Now If you reboot system ,you will see the that module already was loaded by command "lsmod";
$ cd /etc/init.d/
$ sudo gvim "boot.local"
Add follow line in boot.local file:
"insmod /filedirectory/some.ko"
Make the file executable
$ sudo chmod +x boot.local
Make it bootable ..Dont forget the last dot.
$ sudo update-rc.d boot.local start 51 S .
Now If you reboot system ,you will see the that module already was loaded by command "lsmod";
Tuesday, January 20, 2009
Multi-threads program
Before I always think Multi-thread program is difficult and a little bit huge !^_^
Today I realize one simple parallelize program by two threads.Although it did not fulfill my idea,but it do I told it..
That's not so difficult to know what's the multi-thread and write a simple example program..
Yes it's still huge because it want to do more work and fulfill more ideas. But for me or some task ,,we just need one pieces of it..So dont fear any more ..
Fear is because you know nothing about it..Just sit down and concentrate to read books and google. Then you will find it's not so difficult to do it like other guys..
Here is a very nice tutorial about pthreads.
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
Ps:Under linux c++, you can not define function like void* function(). Maybe you can do it in c language under c compiler. But for c++, GCC or G++ will give you wrong information about the function's parameter. I solved it by define function like void* function(void * p);
Here p is no used but you do need it to compile your program...
Today I realize one simple parallelize program by two threads.Although it did not fulfill my idea,but it do I told it..
That's not so difficult to know what's the multi-thread and write a simple example program..
Yes it's still huge because it want to do more work and fulfill more ideas. But for me or some task ,,we just need one pieces of it..So dont fear any more ..
Fear is because you know nothing about it..Just sit down and concentrate to read books and google. Then you will find it's not so difficult to do it like other guys..
Here is a very nice tutorial about pthreads.
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
Ps:Under linux c++, you can not define function like void* function(). Maybe you can do it in c language under c compiler. But for c++, GCC or G++ will give you wrong information about the function's parameter. I solved it by define function like void* function(void * p);
Here p is no used but you do need it to compile your program...
Friday, November 28, 2008
Install Orocos on RTAI/LXRT linux system (Ubuntu 8.04)
Today I install Orocos on RTAI system.
There are many errors on the screen. But after I download and install many libraries , finally it is working now.
For Ubuntu 8.04 Hardy system, I did not do this work as
"The OROCOS Real-Time Toolkit Installation Guide " .
They said I should do like:
So I change my idea and go the normal way to install it.
1, You should check the RTAI/LXRT setting("The OROCOS Real-Time Toolkit Installation Guide 2.3.1")
2,before you install orocos, make sure you have installed Boost,gcc, xerces,ace&tao,cppunit,cmake
3,download the tar ball from Orocos website.
4, Start install Orocos following "The OROCOS Real-Time Toolkit Installation Guide 1.3.3"
cmake ..
ccmake ..
cmake is to build makefile in build file. ccmake will let you change some option,like the directory of linux source(/usr/src/linux) and RTAI library(/usr/realtime).. Before you use this ,you should know how to use ccmake.
If there is no errors, you can continue.
7, do:
make
sudo make install
Then that's all.
If you want to install OCL , you should download tar ball with KDL and BFL.
Before installing OCL ,first you should install kdl and bfl. They need more libraris, such as ltilib , readline, docbook, etc..
When you install these library, you should always use "ccmake" to change some configuration about the folder directory or OROCOS_TARGET=LXRT.
SEE more:
http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.6.x/doc-xml/orocos-installation.html#install-debian
Finally I finished it..^_^
There are many errors on the screen. But after I download and install many libraries , finally it is working now.
For Ubuntu 8.04 Hardy system, I did not do this work as
"The OROCOS Real-Time Toolkit Installation Guide " .
They said I should do like:
$ cd srcBut I have a problem when I "sudo apt-get build-dep orocos-rtt ". It gives me errors about " 'xenomai". It 's very strange because I use RTAI/LXRT ,not xenomai.
$ sudo apt-get update
$ apt-get source orocos-rtt
$ sudo apt-get build-dep orocos-rtt
$ sudo apt-get install devscripts build-essential fakeroot dpatch
$ cd orocos-rtt-1.4.0
$ dpkg-buildpackage -rfakeroot -uc -us
$ cd ..
$ for i in *.deb; do sudo dpkg -i $i; done
So I change my idea and go the normal way to install it.
1, You should check the RTAI/LXRT setting("The OROCOS Real-Time Toolkit Installation Guide 2.3.1")
2,before you install orocos, make sure you have installed Boost,gcc, xerces,ace&tao,cppunit,cmake
3,download the tar ball from Orocos website.
4, Start install Orocos following "The OROCOS Real-Time Toolkit Installation Guide 1.3.3"
mkdir orocos-rtt-1.6.0/build6.after configure.do:
cd orocos-rtt-1.6.0/build
../configure --enable-corba --with-lxrt [--prefix=/usr/local][--with-linux=/usr/src/linux]
5.You will see some error information when you configure it.That's let you know what library you need install.
cmake ..
ccmake ..
cmake is to build makefile in build file. ccmake will let you change some option,like the directory of linux source(/usr/src/linux) and RTAI library(/usr/realtime).. Before you use this ,you should know how to use ccmake.
If there is no errors, you can continue.
7, do:
make
sudo make install
Then that's all.
If you want to install OCL , you should download tar ball with KDL and BFL.
Before installing OCL ,first you should install kdl and bfl. They need more libraris, such as ltilib , readline, docbook, etc..
When you install these library, you should always use "ccmake" to change some configuration about the folder directory or OROCOS_TARGET=LXRT.
SEE more:
http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.6.x/doc-xml/orocos-installation.html#install-debian
Finally I finished it..^_^
Thursday, November 27, 2008
Ubuntu can not shutdown as NetworkManager 's problem
last time when I compiled the kernel, I choose disable ACPI in Power Management ,so that my computer can not shutdown as NetworkManager can not reply the system or using bus to send signal.
I have tried two method:
1,add "acpi=force apm=power_off" to menu.lst
2,disable NetworkManager
It still can not solve the problem.
Afterwards, I find I disable ACPI which has some functional things about managing the power for bus and others. I have a look at the guide book from
RTAI and find I need enable ACPI.
So today I recompiled the kernel and enable it. Now it's working!!!
About how to disable and enable NetworkManager:
I have tried two method:
1,add "acpi=force apm=power_off" to menu.lst
2,disable NetworkManager
It still can not solve the problem.
Afterwards, I find I disable ACPI which has some functional things about managing the power for bus and others. I have a look at the guide book from
RTAI and find I need enable ACPI.
So today I recompiled the kernel and enable it. Now it's working!!!
About how to disable and enable NetworkManager:
sudo /etc/dbus-1/event.d/26NetworkManagerDispatcher stop/start
sudo /etc/dbus-1/event.d/25NetworkManager stop/start
Monday, November 24, 2008
RTAI on Ubuntu 8.04
Today I compile the RTAI on the new computer which has 4 cores.
I find a good tutorial "How to Install RTAI in Ubuntu Hardy" .
I do it by that guided book.
Three parts need to be changed:
1, In the kernel configure menu, I need turn off "cpu idle PM management" and select ACPI and deselect APM).
2,In the RTAI configure menu, I need set"General > Linux source tree =/usr/src/linux".Not the headers directory.
3, Add path" /usr/realtime/bin " to the environment. I need add the command to /home/usrname/.bashrc or /root/.bashrc.(like "export PATH=$PATH:/usr/realtime/bin")
I find a good tutorial "How to Install RTAI in Ubuntu Hardy" .
I do it by that guided book.
Three parts need to be changed:
1, In the kernel configure menu, I need turn off "cpu idle PM management" and select ACPI and deselect APM).
2,In the RTAI configure menu, I need set"General > Linux source tree =/usr/src/linux".Not the headers directory.
3, Add path" /usr/realtime/bin " to the environment. I need add the command to /home/usrname/.bashrc or /root/.bashrc.(like "export PATH=$PATH:/usr/realtime/bin")
Remove kernel version
Sometime you have two or more kernel version, these versions need more disk space . If you want to save disk space, you need remove them.
For ubuntu, I do:
For ubuntu, I do:
.deb based distro - Debian or Ubuntu Linux
Again find out all installed kernel version:$ dpkg --list | grep linux-image
Output:
ii linux-image-2.6.24-19-generic 2.6.24-19.41 Linux kernel image for version 2.6.24 on x86
ii linux-image-2.6.24-21-generic 2.6.24-21.43 Linux kernel image for version 2.6.24 on x86
Now remove linux-image-2.6.24-19-generic with apt-get command itself:
# apt-get remove linux-image-2.6.24-19-generic
OR$ sudo apt-get remove linux-image-2.6.24-19-generic
More information is in:
http://www.cyberciti.biz/faq/debian-redhat-linux-delete-kernel-command/
Do update after installing new Ubuntu system
Every time you need install ubuntu system, please remember updating and upgrading your system.
#apt-get update
#apt-get upgrade
If you dont do that, sometimes you can not find new library when you want to "search" or "install" it.
#apt-get update
#apt-get upgrade
If you dont do that, sometimes you can not find new library when you want to "search" or "install" it.
Wednesday, October 8, 2008
read and save video file by opencv
I spent two days to test the program as one of my friend want to save frames in video file.
I find that opencv work on video things by FFMPEG library.So before you install opencv ,you mush check if you have install ffmpeg and libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev.
After that ,you can recompile the opencv :
./configure
make
sudo make install
If when you do ./configure ,you can see "ffmpeg yes", then it said opencv can work on ffmpeg..
When I do recompile the source code of opencv , I find something interesting.
Afger configure,I find opencv can find ffmpeg..but it still can not read and write video files.
but after I change something in highgui's source code and do recompile again, it's working..
I think maybe that's because if you dont change anything in the source code .It does not refresh the library...
More information about opencv and Ubuntu
http://dircweb.king.ac.uk/reason/opencv_cvs.php
I find that opencv work on video things by FFMPEG library.So before you install opencv ,you mush check if you have install ffmpeg and libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev.
After that ,you can recompile the opencv :
./configure
make
sudo make install
If when you do ./configure ,you can see "ffmpeg yes", then it said opencv can work on ffmpeg..
When I do recompile the source code of opencv , I find something interesting.
Afger configure,I find opencv can find ffmpeg..but it still can not read and write video files.
but after I change something in highgui's source code and do recompile again, it's working..
I think maybe that's because if you dont change anything in the source code .It does not refresh the library...
More information about opencv and Ubuntu
http://dircweb.king.ac.uk/reason/opencv_cvs.php
Thursday, September 11, 2008
choose octave editor from emacs to gvim
To be honest, I don't familiar with emacs. Gvim is my favor editor under linux. Now I want to choose gvim as default editor.
Just one command line:
# export EDITOR=gvim
It seems octave use environment variable to decide which editor it should use.
I add this line to ".bashrc" to make sure it always work after start my pc;
Just one command line:
# export EDITOR=gvim
It seems octave use environment variable to decide which editor it should use.
I add this line to ".bashrc" to make sure it always work after start my pc;
Subscribe to:
Posts (Atom)