2014년 6월 12일 목요일

Linux Library 사용하기

Linux 에서 사용하는 library는 크게 두가지로 나뉜다.


  • Static library
  • Shared library(or Dynamical library)


Ubuntu software center 에서 library 를 찾아보면 static 인 경우도 있고 shared 인 경우도 있다. 초보자의 입장에서는 별로 상관이 없고, 사용법만 알 면 될 것 같은데,
문제는 경우에 따라 다운 받은 library를 사용하는 데 compiler 가 library를 못찾는 경우가 있다.

저장되는 library는 3가지 중에 하나의 이름을 가진다.

  • linker 가 사용하는 이름: 'lib' 로 시작하고 '.a' 나 '.so' 로 끝나는 이름. '.a' 는 static library 인 경우이고 '.so'는 shared object library인 경우이다. (예: libpthread.so) 이것은 Dynamic library 라고 불린다. 
  • Fully qualified name or soname: linker 가 사용하는 이름과 같지만, 마지막에 버전 넘버가 붙는다. (예: libpthread.so.1) 
  • Real name : 버전 넘버 뒤에 마이너 버전 넘버가 붙는 경우.(예: libpthread.so.1.1 )


library를 다운 받으면 보통 다음 3개 directory 중 하나에 저장된다고 한다.

  • /lib   : 처음 linux start up 에서 사용되거나 root file system이 사용하는 library들이 위치한다.
  • /usr/lib : 대부분의 user 가 사용하거나 system 이 internally 사용하는 library들이 위치한다. 
  • /usr/local/lib : standard libary가 아닌 대부분의 library가 위치한다.

이러한 표준 directory에 저장된 경우 특별한 위치 지정이 없어도 library를 컴파일러가 알아서 찾지만, 그 이외의 특별한 위치에 저장되면 그 위치를 알려 주어야만 library를 사용할 수 있다.  

보통 지정해 주어야하는 directory는 linker 가 사용하는 이름인 *.a 나 *.so 가 있는 곳이다.

gcc -L/usr/lib -llapack -lmathlib

gcc 에서 -L 은 디렉토리 위치를 추가하기 위한 것이고, -l 은 library를 불러오기 위한 것이다.
여기서 -l 뒤에 library의 이름을 붙이는데 library 이름 중 lib 는 뺀다. (예를 들어 원래 library 이름이 liblapack.a 일 때 lapack 만 사용한다.)

2014년 6월 11일 수요일

Ubuntu Setting Up

내가 항상 vmware 로 새로운 우분투를 깔 때마다 새로 설정해야하는 사항들을 모아보자.

1. 우분투 설치하기 및 update

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install build-essentials

2. Tweak : scroll bar 설정, launcher 의 icon size변경, work space 사용하기 등등...

  • make a shortcut of terminal to task bar
  • Repository and package manager (In System> software and update)
        enable the Canonical Partners’ Repository.
        sudo apt install synaptic
        sudo apt install gdebi

  • Additional Drivers (In System> software and update)
  • enable Workspace( System Settings >>> Appearance >>> Behavior)
  • Fix app menu problem(System Settings >>> Appearance >>> Behavior tab >> ‘Show the Menus for a Window’ . always displayed)




3. install Java: sudo apt-get install default-jre

4. Nautilus configuration:
  • open terminal command in nautilus: sudo apt-get install nautilus-open-terminal 
(From 16.04, it seems not need to install nautilus-open-terminal. Also, new terminal opens a new tab by 'control-shift-T' )
  • nautilus action configure tool to make customization of right click in nautilus :
  • sudo apt-get install nautilus-actions-configuration (From 16.04, I could not find the package)        
  • Bookmark the network server I use
  • install meld nautilus-compare
5. classic menu indicator

6. dropbox 설치
    sudo apt install nautilus-dropbox

7. secpanel

8. Texworks and latex
    : for tex, install texlive, texlive-extras, texlive-publishers (for revtex)

9. Numerical libraries:
  • gfortran 
  • LAPACK, SCALAPACK: liblapack, libscalapack 을 검색해서 install 
    (여러 패키지중에서 dev 가 붙어 있고 static 이라고 쓰여 있는 것. liblapack.a 파일이 있는지 확인할 것.)
  • MATHLIB: install libmathlib2-dev   or install cernlib
  • MPICH: 
      sudo apt install gfortran
      sudo apt install libmpich-dev
  • LAPACK, scalapack: 
      sudo apt install liblapack-dev
      sudo apt install libscalapack-mpi-dev
  • openmpi: 
      sudo apt install openmpi-bin openmpi-dev

  • FFTW3:  sudo apt-get install  fftw3-dev 

10. build-essential package

     sudo apt install build-essential
     sudo apt install gfortran

11. vim and change its color scheme : vimrc file 복사하기, encryption method change
     ( default vi editor is not good to use.) 

     sudo apt install vim vim-gtk

.vimrc  example
--------------------
" When searching try to be smart about cases
set smartcase
" Makes search act like search in modern browsers
set incsearch
" Show matching brackets when text indicator is over them
set showmatch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:syntax enable
set background=dark
:colo desert

" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8

" Use Unix as the standard file type
set ffs=unix,dos,mac

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>

" Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm

" Set encryption method to blowfish
set cm=blowfish
     


---------------------

12. gftp or filezilla

13. variety : wallpaper changer

14. python and ipython, matplotlib, scitools, scipy , pip

     # add alias to .bashrc_aliases file
        alias python=python3  

      sudo apt-get install ipython
      sudo apt-get install python-pip python-tk
      python -m pip install --upgrade pip
pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
# Consider adding this at the end of your ~/.bashrc file
    export PATH="$PATH:/home/[your_user]/.local/bin"
15. Make /bin and /lib directory for personal usage.
    # add path in .basrc
    export PATH=$PATH:/home/yhsong/bin:/home/yhsong/lib

16. gnuplot
    FRESCO

    sudo apt install gnuplot-qt

and more ...


Ubuntu 18.04 : click-action setting.
                One can choose click-action for the dock :
                 'minimize', 'minimize-or-overview', 'previews','cycle-windows'

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'


10-or-20-things-to-do-after-installing-ubuntu-14-04-trusty-tahr

http://scienceblogs.com/gregladen/2014/04/24/10-or-20-things-to-do-after-installing-ubuntu-14-04-trusty-tahr/

2014년 6월 10일 화요일

Remove/Uninstall Copy.com from Ubuntu

THESE are copied from other site and here for easy reference.



Follow these steps to completely remove Copy from your system:
  1. Disable autostart for each user, if necessary. (You don't need to use sudo if no other user accounts on your system are using Copy)...
    sudo rm -rf /home/<user>/.config/autostart/CopyAgent.desktop
    
  2. Log out and log back in. This will shut down the running copy process so it does not re-create the files you are about to delete in step 3. (You can also just kill the "CopyAgent" process using System Monitor if you don't want to log out.)
  3. Execute the following for each user, if necessary. (You don't need to use sudo if no other user accounts on your system are using Copy).
    sudo rm -rf /home/<user>/<path_to_users_copy_folder>/.copy.cache/
    sudo rm -rf /home/<user>/<path_to_users_copy_folder>/.user_info
    sudo rm -rf /home/<user>/.copy
    sudo rm -rf /home/<user>/.icons
    
  4. If you had manually installed the Nautilus overlay icons, uninstall them...
    sudo <installation_location>/<architecture>/CopyCmd Overlay remove
    
  5. Uninstall Copy software...
    sudo rm -rf /root/.copy
    
  6. If you had manually added a launcher shortcut, remove it. Assuming you called the launcher "copy.desktop" do the following.
    For all users...
    sudo rm  /usr/share/applications/copy.desktop
    
    Or, for each user...
    sudo rm  /home/<user>/.local/share/applications/copy.desktop
    
Note, in the above steps...
  • Replace <user> with the user on your system that is using Copy.
  • Replace <path_to_users_copy_folder> with the user's local "Copy" folder (for example, Documents/Copy).
  • Replace <installation_location> with the location where you installed Copy (for example /usr/share/copy).
  • Replace <architecture> with "x86" (if you have a 32bit computer) or with "x86_64" (if you have a 64bit computer).

스트레스 줄이기