Most Useful Eclipse shortcuts

10:18 PM
This blog is about useful Eclipse shortcuts ,this list is by no means complete and I will suggest you guys to share eclipse shortcuts listed other than here to make this more useful.Knowing Eclipse shortcuts not only improve your productivity but also makes your more efficient, you will have more time for things you like to do.I was big fan of Netbeans IDE before coming across Eclipse because I was from J2ME background and Netbeans provide sofisticated IDE environment to enable you to build, debug and run your application in various emulator including some advanced processing options e.g. PreProcessing , setting up Exception breakpoint etc.
But when I join a big bank I came acorss Eclipse IDE , since everybody in my team is using and etbeans IDE was not available in company ( don't know why that was not allowed netbeans even though it was free) I have decided to go Eclipse way , later I found that Eclipse was most suited for those application give some of cool feature of eclipse e.g. Remote Debugging, Conditionnal Breakpoint , Exception breakpoint and Ctrl+T and Ctrl+R kind of shortcuts.
Here I am sharing list of Eclipse shortcut which I found most useful and using in my day to day life while writing code, reading code or debugging .
Eclipse Shortcut
1) Ctrl + T for finding class even from jar
2) Ctrl + R for finding any resource (file) including config xml files
3) Ctrl + 1 for quick fix
4) Ctrl + Shift + o for organize imports
5) Ctrl + / for commenting , uncommenting lines and blocks
6) Ctrl + Shift + / for commenting ,uncommenting lines with block comment
7) Ctrl + o for quick outline going quickly to method
8) Selecting class and pressing F4 to see its Type hierarchy
9) Alt + right and Alt + left for going back and forth while editing.
10) Ctrl + F4 or Ctrl + w for closing current file
11) Ctrl+Shirt+W for closing all files.
12) Alt + Shift + W for show in package explorer
13) Ctrl + Shift + Up and down for navigating from member to member (variables and methods) 14) Ctrl + l go to line
15) Ctrl + k and Ctrl + Shift +K for find next/previous
16) select text and press Ctrl + Shift + F for formatting.
17) Ctrl + F for find , find/replace
18) Ctrl + D to delete a line
19) Ctrl + Q for going to last edited place
20) Ctrl + T for toggling between super type and subtype
21) Go to other open editors: Ctrl + E.
22) Move to one problem (i.e.: error, warning) to the next (or previous) in a file: Ctrl + . for next, and Ctrl + , for previous problem
23) Hop back and forth through the files you have visited: Alt + ← and Alt + →, respectively.
24) Go to a type declaration: F3
25) CTRL+Shift+G, which searches the workspace for references to the selected method or variable
26) Ctrl+Shift+L to view listing
27) Alt + Shift + j to add javadoc at any place in java source file.
28) CTRL+SHIFT+P to find closing brace. place the cursor at opening brace and use this.
29) Alt+Shift+X, Q to run Ant build file using keyboard shortcuts.
30) Ctrl + Shift +F for Autoformating.
Please post if you guys have some more useful Eclipse shortcuts as comments , I will include them in this list.
Read On 1 comments

Cool JavaScript Hacks

9:52 AM

Crazy Hack 1: Edit any webpage..

Go to any web page, clear the address bar, and paste this…

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

and hit enter…

Yaahhooo…!!! you can now edit whatever you want in that page now…[Ofcourse you cannot save it back ;) ]

Crazy Hack 2: Dancing Images

Go to any web page, clear the address bar, and paste this…

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);

and hit enter…

And….Enjoy the Image Dance…

Read On 0 comments

Trick To Block Any Website On Your Computer

9:33 AM

If you want to block certain websites on your computer without any software then this trick can be very helpful to you.You can block any number of websites and if blocked they cannot be opened in any browser like google chrome,firefox,opera and Internet explorer.

For this trick we will edit the host file of the windows and will use the Ip address 127.0.0.1 (i.e localhost).Whenever somebody will try to open the blocked website the user will be redirected to local host.This trick works in windows xp,vista and windows 7

Here is the Trick To Block Any Website On Your Computer

  • Open My Computer/Computer
  • Navigate to your Operating system drive (Usually C drive)
  • Now goto Windows –>System32–>drivers–>etc
  • Here you will see your Hosts file.Open this file with notepad.
  • Now move to the last line in this file and add the address of the website to be blocked prefixed by 127.0.0.1

For example In the screenshot below I have blocked google-analytics.com on my computer


Trick-To-Block-Any-Website-On-Your-Computer

Remember that you should insert the Url of the blocked website with and without www prefix as shown in the above screenshot

Now Save the file.

Note:-You should open notepad with administrative privileges otherwise you won,t be able to save it,

Read On 0 comments

10 Tricky Java Interview Questions

6:26 AM
Here are some Java interview questions which are un-common

1) What is the performance effect of a large number of import statements which are not used?
Ans: They are ignored if the corresponding class is not used.


2) Give a scenario where hotspot will optimize your code?
Ans: If we have defined a variable as static and then initialized this variable in a static block then the Hotspot will merge the variable and the initialization in a single statement and hence reduce the code.

3) What will happen if an exception is thrown from the finally block?
Ans: The program will exit if the exception is not catched in the finally block.


4) How does decorator design pattern works in I/O classes?
Ans: The various classes like BufferedReader , BufferedWriter workk on the underlying stream classes. Thus Buffered* class will provide a Buffer for Reader/Writer classes.


5) If I give you an assignment to design Shopping cart web application, how will you define the architecture of this application. You are free to choose any framework, tool or server?
Ans: Usually I will choose a MVC framework which will make me use other design patterns like Front Controller, Business Delegate, Service Locater, DAO, DTO, Loose Coupling etc. Struts 2 is very easy to configure and comes with other plugins like Tiles, Velocity and Validator etc. The architecture of Struts becomes the architecture of my application with various actions and corresponding JSP pages in place.

6) What is a deadlock in Java? How will you detect and get rid of deadlocks?
Ans: Deadlock exists when two threads try to get hold of a object which is already held by another object.


7) Why is it better to use hibernate than JDBC for database interaction in various Java applications?
Ans: Hibernate provides an OO view of the database by mapping the various classes to the database tables. This helps in thinking in terms of the OO language then in RDBMS terms and hence increases productivity.

8) How can one call one constructor from another constructor in a class?
Ans: Use the this() method to refer to constructors.

9) What is the purpose of intern() method in the String class?
Ans: It helps in moving the normal string objects to move to the String literal pool


10) How will you make your web application to use the https protocol?
Ans: This has more to do with the particular server being used than the application itself. Here is how it can be done on tomcat:
Read On 0 comments

Best Funny Google Tricks

9:18 AM

1. Meaning Of Search For Google

  • Goto Google.com
  • Type Search in search box
  • Press I’m Feeling Lucky Button

2. Loneliest Number

  • Goto Google.com
  • Enter the following line in search box the loneliest number
  • Press enter and see which is the loneliest number.

3. Meaning Of Recursion

  • Goto Google.com
  • Enter the following line in search box Recursion
  • Press Enter.On top of results you will See “Did You Mean: Recursion

4. Google Loco

  • Goto Google.com
  • Type Google loco in search box
  • Press I’m Feeling Lucky Button

5. The number of horns on a unicorn

  • Goto Google.com
  • Enter the following line in search box the number of horns on a unicorn
  • Press Enter key

6. Chuck Norris

  • Goto Google.com
  • Enter the following line in search box Find Chuck Norris
  • Press I’m Feeling Lucky Button

7. French military Victories

  • Goto Google.com
  • Type in French Military Victories
  • Press I’m feeling lucky button
8. Google had been translating 'Suresh Raina is God' in Serbian to 'Sachin Tendulkar is god.
Read On 0 comments

Some Cool Google+ Tricks

8:57 AM

Google+ has added 20 million users in just 3 weeks from its launch.Google+ has tried to address all the issues like privacy,interface,navigation which users faced in facebook. They have been regularly removing fake profiles as well as spam to keep it clean.If you are already on Google+ then you should know these tips and tricks as they will help you to easily use this social networking site.


GooglePlus-CheatSheet

Here is the Cheat Sheet for Some Cool Google+ Tricks

  • By writing text between * it gets bold.If you write *word* it will become word
  • By writing text between _ it gets underlined.If you write _word_ it will become word
  • By writing text between - it gets strike through.If you write –word- it will become word
  • Google+ supports Drag and Drop,so you can share things like links,photos,videos by directly dropping them into Share box
  • To mention someone in your comments use + or @ before writing their name.
  • Google+ doesn’t have private messages but you can share a post with only specific friends and don’t forget to disable Reshare
  • To get permalink of any post click on the timestamp of that post.
  • Public and Private posts are differenced by colors; Green = Public, Blue = Limited to circles
  • In one of my earlier posts I mentioned about Facebook Shortcut Keys .Here are Google+ Hotkeys
  1. Space=Scroll Down
  2. Shift+Space=Scroll up
  3. J=Single Post Down Scroll
  4. K=Single Post Up Scroll
  5. Q=Jump to Chat
  6. Return=Start Comment
  • You can Like any post by clicking on +1 button and unlike it by again clicking on +1 button

If you know any other trick that has not been shared here then Do share it by posting a comment.Also Like or +1 this post to share these cool Google+ tricks with your friends.

Read On 0 comments

Keyboard Shortcuts For Facebook

8:52 AM
If you spend a lot of time on facebook then why not spend it more efficiently.There are a lot of browser specific keyboard shortcuts for facebook.You can create new messages,view account settings,View notifications etc .Once you get familiar with these shortcuts you can easily navigate on facebook.In this post I will give the shortcut keys for Google Chrome,Firefox and Internet Explorer.There is also a trick to create custom shortcuts keys for your computer programs

Here is a comprehensive list of facebook Shortcuts for each browser.

Google Chrome Facebook Shortcuts

  • Alt+1: View your News Feed
  • Alt+2: View your own Profile
  • Alt+3: View pop-up of friend requests
  • Alt+4: View pop-up of messages
  • Alt+5: View pop-up of notifications
  • Alt+6: View Account Settings
  • Alt+7: View Privacy Settings
  • Alt+8: View Facebook’s own profile
  • Alt+9: Read latest Terms of Service agreement.
  • Alt+?: Search
  • Alt+m: Compose a new message

If you are using Firefox browser then you also need to press SHIFT along with the above shortcut keys.

Firefox Facebook Shortcuts

  • Shift+Alt+1: View your News Feed
  • Shift+Alt+2: View your own Profile
  • Shift+Alt+3: View pop-up of friend requests
  • Shift+Alt+4: View pop-up of messages
  • Shift+Alt+5: View pop-up of notifications
  • Shift+Alt+6: View Account Settings
  • Shift+Alt+7: View Privacy Settings
  • Shift+Alt+8: View Facebook’s own profile
  • Shift+Alt+9: Read latest Terms of Service agreement.
  • Shift+Alt+0: Open Facebook Help Center
  • Shift+Alt+?: Search
  • Shift+Alt+m: Compose a new message

If you are using Internet Explorer then you you can use the Facebook shortcuts of Google chrome,but you have to press ENTER after each shortcut .,

Read On 0 comments

Followers