Thursday, January 30, 2014

Invalid techniques of proof

Recently I took an algorithms course which involved a lot of proofs. I used to work together with my buddies on some of the hard problems, and while trying to come up with a proof for a particularly hard problem I would often joking say to my buddies "I bet a $1000 that this is true, are you willing to take this bet?" "Proof is complete if no one takes the bet."

While searching for types of proof techniques, I stumbled across this hilarious collection of invalid proof techniques. Obviously, I had to submit my proof technique as well, which is now part of that amazing collection.

Monday, November 19, 2012

Contributing Java Editor templates via a plugin

JDT provides several editor templates. You can also add your own via the Templates View. However, if you want to share the templates between your several workspaces or with others you can also create a plugin.

As a first step, define the following extension for the extension point org.eclipse.ui.editors.templates.
   <extension
         point="org.eclipse.ui.editors.templates">
      <include
      file="templates/default-templates.xml"
      translations="$nl$/templates/default-templates.properties">
      </include>
   </extension>
The xml file just contains the template descriptors. For example, here is a template for printing the enclosing type and the enclosing method.
<template name="debugout" description="%Templates.debugout" id="com.eclipse.jdt.ui.templates.debugout" context="java-statements" enabled="true" autoinsert="true">
System.out.println("${enclosing_type}#${enclosing_method}(..)");${cursor}
</template>
You can read about the available template variables in Eclipse help.

I have also shared a plugin with the above code on GitHub.

Tuesday, November 6, 2012

Debugging with sysouts made awesome

At times I like to debug by writing to console. However, in a long debugging session I often end up with several sysout statements in several files/methods, which makes it hard to track where a particular line of console output came from.

In the past I tried to use code templates to also print the 'enclosing type' and 'enclosing method', but I often forgot to use the template. In any case, via templates you cannot 'link' back to the source code.

Jeeeyul presents a neat solution - just replace PrintStream by a DebugStream so that you can also print 'file : line number : method name' information. I took this code, added it to a plugin and then added this plugin to my launch config. Now everytime I launch an Eclipse Application 'DebugStream' gets activated. 

Essentially, the plugin converts console messages from
Hello World.
to include a link to the source code
(HelloWorld.java:10) main(..) : Hello World.

Saturday, July 28, 2012

Going back to school

After working at IBM for 5 years, I am going back to school. August 10th is my last day as a 'full-time' JDT committer, after which I head to University of British Columbia for Masters in Computer Science. I am looking forward to spending two fun-filled years in Vancouver. :-)

It has been fun contributing to Eclipse so far, and in my free time I will likely continue to contribute. So, I will not actually say 'Good bye'.

Sunday, July 1, 2012

Eclipse Tip: Stepping into selection and hyperlink debugging

The Java debugger allows you to step into a single method within a series of chained or nested method calls. Simply select the method you wish to step into and select Step into Selection from the Java editor context menu. I prefer to use the shortcut Ctrl+F5.


You can also step into a method by using hyperlink navigation. Simply place the cursor over the method you wish to step into and use Ctrl+Alt+Click to step into the method (rather than Ctrl+Click which will navigate to the source code).

Saturday, June 30, 2012

Improving Java code quality with Eclipse Juno

The Eclipse Java compiler performs more checks and analyses than are mandated by the Java Language Specification. See Java > Compiler > Errors/Warnings preference page for available options.

Now several of these options should be obvious, however a few maybe not :-) In Juno we (I mean Stephan) added a few pages to give some background on certain analyses and hints on how to make the best use of them.




Please let us know if these pages could be improved, or if you want to know more details on some other compiler options as well.

Thursday, June 28, 2012

Eclipse Demo Camp 2012 - Bangalore

The Demo Camp happened last Friday, and was great fun! A couple of things stood out for me.

First, I was pleasantly surprised to see people from Bosch already exploring Orion and evaluating how they can use the Orion platform and the Orion editors at their work.

Second, I came to know about Eclipse Spykit which looks an interesting project. Based on Runtime Spy Eclipse Spykit creates more charts and does a bit more analysis on what happens during Eclipse startup. Annamali started this project and mentioned that he is looking for contributors.

Oh yeah, the Fajitas were good and the wine was excellent!