Friday, September 26, 2008

Switch in c++

Today I start use switch to do something . But I missed a important thing , that's the term 'break' in Switch just make program get out "switch". I have though "break " just work for loop ,like "for" and "while". Now I know it also work for "switch".

case 1:
//here break just make program get out switch ,dont check case 2 and 3.
case 2:
//do sth, if you dont add break , the program will go to case 3 to check;
case 3:


Wednesday, September 24, 2008

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;

Tuesday, September 9, 2008

Scp's error information

When I use scp to copy one file from server to laptop, it gives me a error, said:
pemission denied(publickey,password......)
lost connection

But ssh works , so I google for a while and find the resolution .

If you work on a server ,don't do :
scp -r usr@ip(server):path usr@ip:path
because maybe you don't have right to transfer files on ip server.
So you can do:
scp -r path usr@ip:path

Because the path is on your local folder, so it works for me..

Use Octave instead of Matlab

I don't want to pay money for Matlab, so I am using Octave which is a open source math tool for Linux and Windows.
I tried it today. Its command very like Matlab and convenient.

Friday, September 5, 2008

Linker and compiler

In the Makefile, if you want to get object file ,you just need headfile and cpp file. If you build the execute file ,you should add lib files .

Tuesday, September 2, 2008

Check swap in Ubuntu

When you install Ubuntu,first thing is partition one part of disk to give swap for Ubuntu system. The swap part will be used if system memory is not enough for running some programs.
The size of swap should be better between one time memory and two time memory.
How to check if it's working?
$fdisk -l
//check the disk information,it will show the size of the swap
//it will show you the information about memory and swap.