For example:
$ du -s -m *
Here -s means dont show children folder. -m means show in MB
Thursday, June 11, 2009
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
Wednesday, June 10, 2009
How to resize opencv image window
AS I need transfer the image to client computer by vnc, so bigger size image will be very slow. So I need resize it. But when you want to resize the window, you need make sure define the window like:
cvNamedWindow("winname",0);
cvResizeWindow("winname",200,200);
Then you also can resize the window manually.
But if you want window fit the image size automatically then you should :
cvNamedWindow("winname",CV_WINDOW_AUTOSIZE);
Then you are not allowed to resize it anymore. So be careful here.
cvNamedWindow("winname",0);
cvResizeWindow("winname",200,200);
Then you also can resize the window manually.
But if you want window fit the image size automatically then you should :
cvNamedWindow("winname",CV_WINDOW_AUTOSIZE);
Then you are not allowed to resize it anymore. So be careful here.
Tuesday, June 9, 2009
Connect to headless desktop by TightVNC
My teamer is using s-video to connect laptop with TV. But for headless desktop, I think the work should be same: configure Xorg.conf file.
My laptop is lucky as the graphic card is Intel985, so ubuntu does nothing to transfer desktop of my laptop to TV, although the resolution is not good.
But my desktop is unfortunately has a Nvidea Graphcard. So if I use s-video which means I need configure Xorg.conf file, that 's now I want.
So I prefer use VNC or NX. Ubuntu already includes a X11vnc which is vino. That can work perfect if you login the X11 window of server. But our headless computer can not do that. So I choose TightVnc which seems can work with headless computer.
First,
1, install tightvncserver on headless computer and install vncviewer in my laptop.
2, use "ssh host@serverip" to connect server. run "vncserver :1". Then you need type password which you will need them to login later. Finally "exit".
3, On local machine, we run "vncviewer serverip :1", then type the password. Now you will get a window and a shell.
By the way, if you want to change the password, just run "vncpasswd" in the server machine through ssh.
If you want to kill the server then do "vncserver -kill :1"
Many guys said NX is better than VNC as it's faster. But for me, it's too complicate and VNC is fast enough.
If you want to use NX, then check here:
http://ubuntuforums.org/showthread.php?t=467219
My laptop is lucky as the graphic card is Intel985, so ubuntu does nothing to transfer desktop of my laptop to TV, although the resolution is not good.
But my desktop is unfortunately has a Nvidea Graphcard. So if I use s-video which means I need configure Xorg.conf file, that 's now I want.
So I prefer use VNC or NX. Ubuntu already includes a X11vnc which is vino. That can work perfect if you login the X11 window of server. But our headless computer can not do that. So I choose TightVnc which seems can work with headless computer.
First,
1, install tightvncserver on headless computer and install vncviewer in my laptop.
2, use "ssh host@serverip" to connect server. run "vncserver :1". Then you need type password which you will need them to login later. Finally "exit".
3, On local machine, we run "vncviewer serverip :1", then type the password. Now you will get a window and a shell.
By the way, if you want to change the password, just run "vncpasswd" in the server machine through ssh.
If you want to kill the server then do "vncserver -kill :1"
Many guys said NX is better than VNC as it's faster. But for me, it's too complicate and VNC is fast enough.
If you want to use NX, then check here:
http://ubuntuforums.org/showthread.php?t=467219
Thursday, June 4, 2009
Friday, May 15, 2009
Scientist: Four golden lessons
Scientist: Four golden lessons
Steven Weinberg1
When I received my undergraduate degree — about a hundred years ago — the physics literature seemed to me a vast, unexplored ocean, every part of which I had to chart before beginning any research of my own. How could I do anything without knowing everything that had already been done? Fortunately, in my first year of graduate school, I had the good luck to fall into the hands of senior physicists who insisted, over my anxious objections, that I must start doing research, and pick up what I needed to know as I went along. It was sink or swim. To my surprise, I found that this works. I managed to get a quick PhD — though when I got it I knew almost nothing about physics. But I did learn one big thing: that no one knows everything, and you don't have to.
Another lesson to be learned, to continue using my oceanographic metaphor, is that while you are swimming and not sinking you should aim for rough water. When I was teaching at the Massachusetts Institute of Technology in the late 1960s, a student told me that he wanted to go into general relativity rather than the area I was working on, elementary particle physics, because the principles of the former were well known, while the latter seemed like a mess to him. It struck me that he had just given a perfectly good reason for doing the opposite. Particle physics was an area where creative work could still be done. It really was a mess in the 1960s, but since that time the work of many theoretical and experimental physicists has been able to sort it out, and put everything (well, almost everything) together in a beautiful theory known as the standard model. My advice is to go for the messes — that's where the action is.
My third piece of advice is probably the hardest to take. It is to forgive yourself for wasting time. Students are only asked to solve problems that their professors (unless unusually cruel) know to be solvable. In addition, it doesn't matter if the problems are scientifically important — they have to be solved to pass the course. But in the real world, it's very hard to know which problems are important, and you never know whether at a given moment in history a problem is solvable. At the beginning of the twentieth century, several leading physicists, including Lorentz and Abraham, were trying to work out a theory of the electron. This was partly in order to understand why all attempts to detect effects of Earth's motion through the ether had failed. We now know that they were working on the wrong problem. At that time, no one could have developed a successful theory of the electron, because quantum mechanics had not yet been discovered. It took the genius of Albert Einstein in 1905 to realize that the right problem on which to work was the effect of motion on measurements of space and time. This led him to the special theory of relativity. As you will never be sure which are the right problems to work on, most of the time that you spend in the laboratory or at your desk will be wasted. If you want to be creative, then you will have to get used to spending most of your time not being creative, to being becalmed on the ocean of scientific knowledge.
Finally, learn something about the history of science, or at a minimum the history of your own branch of science. The least important reason for this is that the history may actually be of some use to you in your own scientific work. For instance, now and then scientists are hampered by believing one of the over-simplified models of science that have been proposed by philosophers from Francis Bacon to Thomas Kuhn and Karl Popper. The best antidote to the philosophy of science is a knowledge of the history of science.
More importantly, the history of science can make your work seem more worthwhile to you. As a scientist, you're probably not going to get rich. Your friends and relatives probably won't understand what you're doing. And if you work in a field like elementary particle physics, you won't even have the satisfaction of doing something that is immediately useful. But you can get great satisfaction by recognizing that your work in science is a part of history.
Look back 100 years, to 1903. How important is it now who was Prime Minister of Great Britain in 1903, or President of the United States? What stands out as really important is that at McGill University, Ernest Rutherford and Frederick Soddy were working out the nature of radioactivity. This work (of course!) had practical applications, but much more important were its cultural implications. The understanding of radioactivity allowed physicists to explain how the Sun and Earth's cores could still be hot after millions of years. In this way, it removed the last scientific objection to what many geologists and paleontologists thought was the great age of the Earth and the Sun. After this, Christians and Jews either had to give up belief in the literal truth of the Bible or resign themselves to intellectual irrelevance. This was just one step in a sequence of steps from Galileo through Newton and Darwin to the present that, time after time, has weakened the hold of religious dogmatism. Reading any newspaper nowadays is enough to show you that this work is not yet complete. But it is civilizing work, of which scientists are able to feel proud.
Steven Weinberg1
When I received my undergraduate degree — about a hundred years ago — the physics literature seemed to me a vast, unexplored ocean, every part of which I had to chart before beginning any research of my own. How could I do anything without knowing everything that had already been done? Fortunately, in my first year of graduate school, I had the good luck to fall into the hands of senior physicists who insisted, over my anxious objections, that I must start doing research, and pick up what I needed to know as I went along. It was sink or swim. To my surprise, I found that this works. I managed to get a quick PhD — though when I got it I knew almost nothing about physics. But I did learn one big thing: that no one knows everything, and you don't have to.
Another lesson to be learned, to continue using my oceanographic metaphor, is that while you are swimming and not sinking you should aim for rough water. When I was teaching at the Massachusetts Institute of Technology in the late 1960s, a student told me that he wanted to go into general relativity rather than the area I was working on, elementary particle physics, because the principles of the former were well known, while the latter seemed like a mess to him. It struck me that he had just given a perfectly good reason for doing the opposite. Particle physics was an area where creative work could still be done. It really was a mess in the 1960s, but since that time the work of many theoretical and experimental physicists has been able to sort it out, and put everything (well, almost everything) together in a beautiful theory known as the standard model. My advice is to go for the messes — that's where the action is.
My third piece of advice is probably the hardest to take. It is to forgive yourself for wasting time. Students are only asked to solve problems that their professors (unless unusually cruel) know to be solvable. In addition, it doesn't matter if the problems are scientifically important — they have to be solved to pass the course. But in the real world, it's very hard to know which problems are important, and you never know whether at a given moment in history a problem is solvable. At the beginning of the twentieth century, several leading physicists, including Lorentz and Abraham, were trying to work out a theory of the electron. This was partly in order to understand why all attempts to detect effects of Earth's motion through the ether had failed. We now know that they were working on the wrong problem. At that time, no one could have developed a successful theory of the electron, because quantum mechanics had not yet been discovered. It took the genius of Albert Einstein in 1905 to realize that the right problem on which to work was the effect of motion on measurements of space and time. This led him to the special theory of relativity. As you will never be sure which are the right problems to work on, most of the time that you spend in the laboratory or at your desk will be wasted. If you want to be creative, then you will have to get used to spending most of your time not being creative, to being becalmed on the ocean of scientific knowledge.
Finally, learn something about the history of science, or at a minimum the history of your own branch of science. The least important reason for this is that the history may actually be of some use to you in your own scientific work. For instance, now and then scientists are hampered by believing one of the over-simplified models of science that have been proposed by philosophers from Francis Bacon to Thomas Kuhn and Karl Popper. The best antidote to the philosophy of science is a knowledge of the history of science.
More importantly, the history of science can make your work seem more worthwhile to you. As a scientist, you're probably not going to get rich. Your friends and relatives probably won't understand what you're doing. And if you work in a field like elementary particle physics, you won't even have the satisfaction of doing something that is immediately useful. But you can get great satisfaction by recognizing that your work in science is a part of history.
Look back 100 years, to 1903. How important is it now who was Prime Minister of Great Britain in 1903, or President of the United States? What stands out as really important is that at McGill University, Ernest Rutherford and Frederick Soddy were working out the nature of radioactivity. This work (of course!) had practical applications, but much more important were its cultural implications. The understanding of radioactivity allowed physicists to explain how the Sun and Earth's cores could still be hot after millions of years. In this way, it removed the last scientific objection to what many geologists and paleontologists thought was the great age of the Earth and the Sun. After this, Christians and Jews either had to give up belief in the literal truth of the Bible or resign themselves to intellectual irrelevance. This was just one step in a sequence of steps from Galileo through Newton and Darwin to the present that, time after time, has weakened the hold of religious dogmatism. Reading any newspaper nowadays is enough to show you that this work is not yet complete. But it is civilizing work, of which scientists are able to feel proud.
What makes a good PhD student
What makes a good PhD student?Georgia Chenevix-Trench1
Some tips for PhD students.
Doing a PhD should be fun and rewarding, because you can spend all your working time discovering things and pursuing ideas — and getting paid for it, without any administrative responsibilities. Those who stick with a career in science do so because, despite the relatively poor pay, long hours and lack of security, it is all we want to do.
Unfortunately most new PhD students are ill-prepared, and as a consequence very few will fulfil their aspirations to be independent scientists. The main reasons for this are the 'grade creep' inherent at most universities, making it difficult to identify the really talented first-class graduates from the rest, and the pressure on universities to graduate as many PhD students as possible. The consequence is that we enrol far too many of them without telling them clearly what doing a doctorate should entail. We therefore set ourselves, and the students, on a path of frustration and disappointment.
So what should we be telling prospective PhD students?
Choose a supervisor whose work you admire and who is well supported by grants and departmental infrastructure.
Take responsibility for your project.
Work hard — long days all week and part of most weekends. If research is your passion this should be easy, and if it isn't, you are probably in the wrong field. Note who goes home with a full briefcase to work on at the end of the day. This is a cause of success, not a consequence.
Take some weekends off, and decent holidays, so you don't burn out.
Read the literature in your immediate area, both current and past, and around it. You can't possibly make an original contribution to the literature unless you know what is already there.
Plan your days and weeks carefully to dovetail experiments so that you have a minimum amount of downtime.
Keep a good lab book and write it up every day.
Be creative. Think about what you are doing and why, and look for better ways to go. Don't see your PhD as just a road map laid out by your supervisor.
Develop good writing skills: they will make your scientific career immeasurably easier.
To be successful you must be at least four of the following: smart, motivated, creative, hard-working, skilful and lucky. You can't depend on luck, so you had better focus on the others!
Some tips for PhD students.
Doing a PhD should be fun and rewarding, because you can spend all your working time discovering things and pursuing ideas — and getting paid for it, without any administrative responsibilities. Those who stick with a career in science do so because, despite the relatively poor pay, long hours and lack of security, it is all we want to do.
Unfortunately most new PhD students are ill-prepared, and as a consequence very few will fulfil their aspirations to be independent scientists. The main reasons for this are the 'grade creep' inherent at most universities, making it difficult to identify the really talented first-class graduates from the rest, and the pressure on universities to graduate as many PhD students as possible. The consequence is that we enrol far too many of them without telling them clearly what doing a doctorate should entail. We therefore set ourselves, and the students, on a path of frustration and disappointment.
So what should we be telling prospective PhD students?
Choose a supervisor whose work you admire and who is well supported by grants and departmental infrastructure.
Take responsibility for your project.
Work hard — long days all week and part of most weekends. If research is your passion this should be easy, and if it isn't, you are probably in the wrong field. Note who goes home with a full briefcase to work on at the end of the day. This is a cause of success, not a consequence.
Take some weekends off, and decent holidays, so you don't burn out.
Read the literature in your immediate area, both current and past, and around it. You can't possibly make an original contribution to the literature unless you know what is already there.
Plan your days and weeks carefully to dovetail experiments so that you have a minimum amount of downtime.
Keep a good lab book and write it up every day.
Be creative. Think about what you are doing and why, and look for better ways to go. Don't see your PhD as just a road map laid out by your supervisor.
Develop good writing skills: they will make your scientific career immeasurably easier.
To be successful you must be at least four of the following: smart, motivated, creative, hard-working, skilful and lucky. You can't depend on luck, so you had better focus on the others!
Subscribe to:
Posts (Atom)
