Thursday, June 5, 2014

Several ways to manage windows on OS X

1. Switch between different active windows of same application
Command-` (grave accent)

2. Minimize current window
Command-M

3. Enter and exit full screen
Command-Control-F

4. Close window
Command-W
or
Command-Q (always really quit application except Finder)

5. Hide other applications' window and keep focus window
Command-Option-H

6. Hide focus window
Command-H

7. Switch between different windows
Four fingers slide from bottom to top on touchpad and select the one you need.

How to cut and paste file or folder by shortcut on OS X?

Heard this operation is disabled on OS X. But we have another option, copy first then paste and delete.

1. Command + C
2. Command + Option + V

Wednesday, June 4, 2014

Set JAVA_HOME on OS X

Add on line in  ~/.profile


export JAVA_HOME=$(/usr/libexec/java_home)

Save and quit.

** "/usr/libexec/java_home" points to Java home which is being used now if there are multiple JDKs installed.

Eclipse can't open on OS X

Double-click eclipse icon but it is prohibited.
Because it's limited by Security & Privacy in System Preference. Select to use: Anywhere on Allow apps downloaded from.

Tuesday, June 3, 2014

Install JDK on OS X 10.9.3 (or above?)

1. Go to oracle web site to download the OS X dedicated installer, e.g. jdk-7u60-macosx-x64.dmg.
2. Double click and follow the prompts to install.

Note: There is one point needs to clarify. Some posts and oracle official installation instructions mentions you need to go to Applications -> Utilities -> Java Preferences and do certain operations. It seems no need do anything on it now because JDK is not pre-installed on OS X 10.9.x or above anymore, and you even can't find Java Preference in Utilities folder. The Java control panel is now at System Preference.

Open terminal and type java -version
...Now can start working.

Monday, May 26, 2014

Design Pattern Review - 1

What is design pattern?
A design pattern is a re-usable solution to common problem which software developers faced during software development.

They are not finished design. They are the summary of practical experience during software development process with object-oriented programming language. They are drawn from numerous developers' previous lessons learned over substantial period of time.

How many design patterns are there?
23. The 23 GoF design patterns are generally considered the foundation for all other patters.

What is GoF?
The abbreviation of Gang of Four. Four authors of the book Design Patterns: Elements of Reusable Object-Oriented Software, which was published in 1994. Words design patterns gained popularity after this book publication.
The four authors are Erick Gamma, Richard Helm, Ralph Johnson and John Vlissides.

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.



Sunday, February 9, 2014

How to install rpm file on Ubuntu?

A file with extension .rpm is generated by RPM Package Manager or Redhat Package Manager.
How to install this kind of file on your Ubuntu? It need alien's help.

NAME
       alien - Convert or install an alien binary package

SYNOPSIS
        alien [--to-deb] [--to-rpm] [--to-tgz] [--to-slp] [options] file [...]

DESCRIPTION
       alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware
       tgz, and Solaris pkg file formats. If you want to use a package from another linux
       distribution than the one you have installed on your system, you can use alien to convert
       it to your preferred package format and install it. It also supports LSB packages.

First check if alien has been installed on your Ubuntu. It need dpkg command (dpkg - package manager for Debian) or Ubuntu Software Center.

I installed once. Have you installed? If not please run
~$sudo apt-get install alien
Now I can start installing my rpm file. For example, sqldeveloper-4.0.0.13.80-1.noarch.rpm

~$sudo alien sqldeveloper-4.0.0.13.80-1.noarch.rpm

It will generate a sqldeveloper_4.0.0.13.80-2_all.deb file. Now you can use command line

~$sudo dpkg -i sqldeveloper_4.0.0.13.80-2_all.deb

or right click it to open with Ubuntu Software Center.



 

Thursday, February 6, 2014

Why it is called bash?

The name bash is an acronym for “Bourne Again SHell”. It is a shell program from the GNU project and was developed by Stephen Richard (SteveBourne. It is an enhanced replacement for sh (Bourne Shell), the original Unix shell program also written by Steve Bourne. The Bourne Shell was the default shell of Unix version 7.