Sunday, March 30, 2014

vim usage quiz - level 3 Better, Stronger, Faster

Just want to help remembering commands. Answers are in this good article, Learn Vim Progressively.

Better

1. How to repeat the last command?
2. How to repeat a command and specify the number of repetitions?

Stronger

3. How to move cursor to  a specified number of row?
4. How to go to start line of the file?
5. How to go to the last line of the file?

6. How to go to the start of following word (regard a punctuation mark as a single word)?
7. How to go to the end of this word (regard a punctuation mark as a single word)?
8. How to go to the start of following word (the word includes punctuation marks)?
9. How to go to the end of this word (the word includes punctuation marks)?

10. How to go to the corresponding round brackets, square brackets and braces?

Faster

11. How to execute a command from a specified start position to a specified end position? 
      A command format.



Friday, March 28, 2014

vim usage quiz - level 2 Feel comfortable

Just want to help remembering commands. Answers are in this good article, Learn Vim Progressively.

1. How to insert after current cursor?
2. How to insert a new line after the current one?
3. How to insert a new line before current one?
4. How to replace the characters from current cursor to the end of this word?
5. How to move cursor to the first column?
6. How to move cursor to the first non-blank character of the line?
7. How to move cursor to the end of the line?
8. How to move cursor to the last non-blank character of the line?

9. How to search for text from start to end?
10. How to search for text from end to start?
11. How to move to next occurrence forwards when searching for text from start to end?
12. How to move to next occurrence backwards when searching for text from start to end?
13. How to move to next occurrence forwards when searching for text from end to start?
14. How to move to next occurrence backwards when searching for text from end to start?

15. How to paste before current cursor?
16. How to copy the current line?
17. How to undo?
18. How to redo?
19. How to open another file?
20. how to save but don't quit currently editing file?
21. How to quit without saving?
22. How to show the next file in buffer?


vim usage quiz - level 1 Survive


Just want to help remembering commands. Answers are in this good article, Learn Vim Progressively.

1. How to go in insert mode?
2. How to return normal mode?
3. How to delete the character under cursor?
4. How to save and quit?
5. How to delete (and copy) the current line?
6. How to paste after current cursor?
7. How to move the cursor without using direction keys?
8. How to get help about command?

Tuesday, March 11, 2014

Solve javascript errors in Eclipse

When you import a java web project into eclipse at first time you may always get some JavaScripts errors like
If those files with errors are yours you may want to fix them. But practically in most instances the files come from some third party libraries. So that is impossible to fix them by yourself. Hiding those errors become the best or only choice.

Two ways:
1. Disable all validations: Window-->References-->Validation

Not only ignore those javascript errors but also accelerate your eclipse.

2. Exclude JavaScript files:
Right click project-->Properties-->JavaScript-->Include Path-->Source (Tab), modify the directory or add exclusion pattern. Anyway I have excluded all...


Sunday, February 23, 2014

Several common used virtual effects to prettify your Ubuntu

First you need to install compiz.
Then open CompizConfig Settings Manager to enjoy your works.

1.Windows Shadow




2.Top Panel Transparency&Launcher Panel Transparency





'Experimental' Tab --> 'Panel Opacity' item. The value is from 0 to 1.
'Experimental' Tab --> 'Launcher Opacity' item. The value is from 0 to 1.

You can get effects:





















3.Menu Transparency&Windows Transparency







On 'Opacity Tab' --> Click 'New' button and add "DropDownMenu", "PopupMenu" and "ToolTip" and adjust corresponding value to an integer below 100,  its range from 0 to 100.


This function is very powerful. You can try clicking plus sign button, add more things for it and explore.
Commons windows transparency are also configured here. It provides several ways to specify which windows are transparent. I used to set windows transparency, but later I removed it. I found that was simply test my eyesight.

4.Title Bar Transparency

Open 'Configuration Editor', find directory '/apps/gwd', edit two keys 'metacity_theme_active_opacity' and 'metacity_theme_shade_opacity'.

 See the title of terminal window


Friday, February 21, 2014

Install compiz on Ubuntu 12.04LTS

Just one line stuff...

~$ sudo apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-extra compiz-fusion-plugins-main compiz-plugins

Monday, February 10, 2014

How to ssh/sftp/scp a remote server without password prompt?

Without password prompt when you access a remote server, transfer files to or from a remote server or copy files to a remote server is very meaningful to execute some tasks over a shell script between several servers.
Assuming you want A to access B
1. Using ssh-keygen to generate public and private keys

NAME
     ssh-keygen — authentication key generation, management and conversion.

Don't put pass-phrase, just type an enter when it asks you "Enter pass-phrase" otherwise it will still prompt you to key in pass-phrase when it connects.

2. Using ssh-copy-id to install your public key to remote server

NAME
       ssh-copy-id - install your public key in a remote machine's authorized_keys.

Type
~$ ssh-copy-id -i ~/.ssh/id_rsa.pub <username>@<host_ip>

Then test ssh, sftp and scp.