Very nice option to switch windows is Contexts app. It allows you to switch applications using Alt+Number. It provides a sidebar with all running apps and ability to replace Cmd+Tab including smart search through currently opened windows.

Switch with search to any window

However I often prefer to use a keyboard shortcut that doesn’t change – for example Alt+x for XCode and Alt+c for Google Chrome. BetterTouchTool is very handy for this. Just create a keyboard shorcut, use Execute Terminal Command action and put configure it with similar command:

I wanted to open the current file from XCode 5 in MacVim similarly as I do in IntelliJ. After some research I found following solution that works for me. If Assistant editor is opened, the file from the Standard Editor (on the left side) is opened regardless which editor is active.

AppleScript

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

onrun{input,parameters}

setcurrent_document_pathto""

tellapplication"Xcode"

setlast_word_in_main_windowto(word-1of(getnameofwindow1))

if(last_word_in_main_windowis"Edited")then

displaynotification"Please save the current document and try again"

-- eventually we could automatically save the document when this becomes annoying

As I develop an application in GWT and have IntelliJ set up to open the app in IE when debugging/running it, I end up with quite a lot of opened IE windows. I use Chrome as my main browser so I don’t mind killing all the IE windows to cleanup. To make it easy I use batch file with this command:

Background and motivation

Very often it is more useful to log variables to console or file (using Log4J for example) instead of using breakpoints and manually step over. Especially when the execution goes through the interesting line multiple times debugging can be quite annoying.

When we are dealing with our code, it is pretty easy to add a log statement to the specific part. When we are dealing with 3rd party code we don’t have such options. In such a case we can achieve this using AOP (e.g. AspectJ or Spring AOP), however sometimes it is just too heavy solution when we need to do this one time only to find a small bug or so.

How to use adhoc logging in Eclipse

So here we go… we will use conditional breakpoints in Eclipse to enable us to log important stuff.

Create a breakpoint on the line you are interested in. Right click that breakpoint and select Breakpoint Properties…. Check “Enable Condition” checkbox and input your code into the box below. The breakpoint icon will show a question mark on that line meaning that it is a conditional breakpoint now.

The trick here is to do the output and then return false so that execution is not suspended and you do not have to interact with the debugger as it is exactly what we want to avoid (see the option below the text box: Suspend when – condition is true).

To test it, we obviously have to run the program using Debug instead of Run because we need to enable breakpoints. The output should be similar to following: