Sunday, August 26, 2018

7 mac os x shortcuts combo that save your time

Replacing a few clicks with a keyboard shortcuts seems to be trivial, but the time they save adds up. If you are a computer professional, using shortcuts means you are running at a faster cycle. Here are 7 mac os x shortcuts combos that save tons of time.


  1. Browsing shortcuts combo. When you are browsing websites using a browser, you press command + N to open a new window, then you regret, so you press command + W to close it. You press command + T to open a new search tab instead. You suddenly want to look up something in your local file system. You press command + O to open your Finder. You click a file, press command + I to get detailed information about the file, including the url the file is downloaded from. You are happy about the information, so you command + W to close the information window. Then, you press command + T to open a new finder tab. Here you want to open an document, so you type command + shift + O to switch to Document folder, then you click open a pdf file. Now you want to compare something in the pdf with a webpage, so you press command + tab to switch back and forth between your browser and the pdf viewer.
  2. Configuration shortcuts combo. You suddenly feels boring and want to change every mac os x default settings. Good idea, lets start with the browser window. You press command + "," to open the browser configuration no matter it is chrome, safari or firefox. You click advanced, take a look at your certificates -- suddenly wants to check if your firewall is on. So you press command + O followed by command + shift + U to open the utility folder in Finder. Then you click open the System information application, then verified that the firewall was on. So you regain your happiness and decided to turn the display brighter. The brightness adjusting key is at the top of the keyboard, you can just press it. However, you are very picky, you want more control from the system preference. So you press option + F2 to open the build in display panel in system preference and changed a few thing. How about sound? No problem, press option + F11 opened the Sound panel. You feels the power, so you want to go deeper. You press command + space to open spotlight and type "console" then hit enter. In the console window, you saw the log flows like a creek but there is no error and warning. So you are happier and want to open a terminal, you press command + space to open spotlight and type "terminal" then hit enter. In the terminal, you did your check and changes. There is only one problem -- you just opened too many configurations, its time to close them. 
  3. Closing shortcuts combo. You press F3 the mission control to display all the applications, you then press F3 again to restore the view. Too much stuff, so you press command + F3 to take a look at your clear desktop, draw a deep breath then press command + F3 to bring back the mess. Let's start from Finder windows. You press command + H to bring all the finder windows to the front, then press command + option + W to close them all. You press command + tab to navigate through the applications you have opened. Then you close them with command + W. In case you just want to check how many windows are open for a particular application, you can press control + down arrow to view them. Notice command + W only close active windows for an application, to quit an application, press command + Q.
  4. Reopening shortcuts combo. In case an application is minimized with command + M, you can maximize it with the following shortcuts combo: first select the application by pressing command + tab, then press option + command then release option key. The same trick can be used to reopen previously closed but not quit applications. To reopen a quit application, you press command + space to open spotlight, then type the application name.
  5. Navigating shortcuts combo. You have opened many applications, you press command + tab to navigate through them and land on browser app. Your browser opened many tabs, you press control + tab to navigate through them and stop at a page. The page has tons of contents, so you press option + down arrow and option + up arrow to scroll the contents page by page. The contents is long and you loose patient, so you press command + down arrow to scroll to the end of page, nothing there, so you press command + up arrow to scroll back to the top. Eye balling doesn't work, no worry, you can press command + F to open a finder dialog. Then type in the search string then hit enter. The matches are highlighted, you press command + G and command + shift + G to move your cursor to the next and previous match.
  6. Selecting shortcuts combo. Now you find what you are looking for, you want to copy those text. The shift control option command and arrow key combinations will let you look like a selecting pro. Try these out. shift + left selects one character at left, shift + option + left selects one word at left, shift + control + left selects everything at the left. I don't have to mention how right key behave, right? The up and down keys behave a little bit different. shift + up selects one line above, shift + option + up selects to the beginning of the current paragraph, shift + command + shift selects to the beginning of the text. I don't have to mention how down key behave, right?
  7. Zooming shortcuts combo. It will be nice to zoom in when you are trying to show something to your co-workers. Press command + "=" increases the text size, press command + "-" decreases the text size. Press command + shift + "=" zooms in, press command + shift + "-" zooms out.

Tuesday, August 7, 2018

7 eclipse debugging tips you should know

You may already know that you can set a breakpoint in eclipse for your java code, then have the program stop at the breakpoint in debug perspective, so that you can inspect the variable values or step through the code line by line. These are the basic usage of eclipse debugger. The following 7 tips will allow you do eclipse debug like a pro.

1. Change variable value
When a breakpoint is hit, you can right click a variable value then select "Change Value...".

2. Use breakpoint view
click Window -> Show View -> Breakpoint
In this tab, you can select/deselect breakpoints. High light one of the break point, you can set conditional match such as exceeding a certain hit count or matching a particular value.
For multi-threading program, "suspend VM" option allows you to exam the stack of the other threads. You can shift from one thread's stack to another thread's by clicking the thread name.

3. Use display view
click Window -> Show View -> Display
In this tab, you can write a few lines of code, highlight these code you want to run, then click the little triangle at the upper right corner to execute the code in the context of the breakpoint.

4. be able to inspecting code in project and depended jars.
If you are using maven project, install m2e plugin, then configure it to download both the source files and javadoc by going into Window > Preferences > Maven and checking the "Download Artifact Sources" and "Download Artifact JavaDoc" options.


You can search a class in project and depended jars with shortcut Command + Shift + T (mac) or Control + Shift + T (windows).
You can search a string in the workspace with shortcut Control + H.
You can search call hierarchy with shortcut Control + Command + H.

5. Remote debug
When you are trouble-shooting an application running in a remote machine. you need two piece of information: hostname or IP, the debugger port.
If you are not sure what port is the debugger port, you can login the hostname, then issue command
"netstat -nulpt | grep java " and see which ports the java application is listen to, then try these ports one by one.



6. set up tomcat to run local.
If your application produces a war file which can be deployed into tomcat, you can setup eclipse (J2EE) to integrate with tomcat and run your application local, then you can debug the code. To do so, download and unzip tomcat, in eclipse
Preference -> Server -> Runtime Environment
Click Add -> apache -> select the version matching the apache server you downloaded
Click next, browse to the directory of your downloaded apache server.
Click finish


Now you can run your j2EE project local by select Run -> Run As -> Run on Server
Click choose an existing server, then select your apache server from the server list.
Now tomcat will run your project's war file as a web container. Even with apache server configured, you program still need Arguments to be set correctly.

7. Use jrebel for quick deployment. JRebel fast tracks Java application development by skipping the time consuming build and redeploy steps in the development process.

chatgpt's view about universe

 is there god? The existence of a higher power, commonly referred to as "God," is a matter of personal belief and faith. There is ...