Lightning fast commenting (in and out)

I have used this two or three times in my life but it's one of those simple (and useful?) hard to forget tricks. It could be useful during tough debuging times.
If you have several lines of code and you want to comment them out, you can use standard multi-line comments (this is for C++, Java, and others):
    /*
    Component contentArea = getContentArea();
    layout.addComponent(contentArea);
    layout.setExpandRatio(contentArea, 1);
    //*/
But you can also comment out the first and last lines using single-line comments:
    //*
    Component contentArea = getContentArea();
    layout.addComponent(contentArea);
    layout.setExpandRatio(contentArea, 1);
    //*/
Now you can comment in and out your code just by removing or typing the first "/":

CAUTION: Avoid usage in programmers with chronic lava flow disease, including junior and senior developers.
Programming
May 21, 2013
0

Search

Popular Posts

Testing MariaDB ColumnStore performance

MariaDB 's ColumnStore is an engine that stores data in a columnar fashion…

How to call a Java method from a JavaScript function in the browser

In this video I demonstrate how to call a Java method that runs in the server f…

New book - Practical Vaadin: Developing Web Applications in Java

I'm glad to announce the availability of my most recent book, Practical Vaa…

Recent Comments

Contact Me