Welcome to this Blog. I am Software Engineer and work for Zühlke Engineering AG in Bern. This is my private blog, in which I will post mainly about technical stuff like Software Engineering or IT related topics. The views expressed herein do not necessarily represent those of my employer.
Today, I encountered a very helpful feature in Eclipse. When I am debugging code, I sometimes want to know, what’s the result of a method is. If the result it’s not assigned to a variable, it gets complicated. Take a look to this example: what is the result of add(17,19)?
public class DemoApplication { public static void main(String[] args) throws Exception { DemoApplication calc = new DemoApplication(); System.out.println(calc.divide(calc.add(17, 19), 2)); } public int add(int i, int j) { return i + j; } public int divide(int i, int j) { return i / j; } }
In earlier times, I stepped one step further to get into the method divide. Then I got the result of add(17,19) in my parameter.
But Eclipse is offering a better solution. In the Debugging Perspective, there is a view called Expressions. Just add a new expression add(17,19) and the Debugger is printing out the result.
The result is directly printed out:
A simple, but helpful feature in Eclipse!
The standard way to read out the battery life on a Windows Mobile smartphone is a small icon on the top, which has 3 indicators to show, how the battery life is:
This is not really a helpful information. Today, I found a small, simple but incredible program (open source), which is the best battery program I’ve seen so far. It’s called Batti and it’s hosted on Google (http://code.google.com/p/batti/).
This program adds a 2-3 pixel deep line at the top. The line is coloured and has a gradient. With this line, I see know always, how many battery I’ve left. This is just nice.
I have some blogs, where I only read blog entries, if their headline contains some specific words. Today, I found a nice and really easy tool called Feed Sifter. This tool filters RSS feeds, which you can subscribe on.
Try it out!
In a software project, Software Engineers need to ensure, that the source code meets the architectural rules. One of a usual architecture rule are the dependencies between the layer and packages. There are a lot of tools, which can be used to ensure, that no class breaks this rules.
If you know, that there are some specific classes, which do not meet these rules, a dependency code analysis is needed. Therefore, I found a free tool called CDA (http://www.dependency-analyzer.org/), which is very helpful in such a situation. It can also be used for repeated check to ensure architecture compatibility, but in this blog entry, I will focus on code analysis.
First of all, just install this tool as described on the website (http://www.dependency-analyzer.org/#Installation). CDA doesn’t need any installation (just unzip the compressed file) and can be run with Java 1.5.
After finishing the installation procedure, you need to create for every project a Workset. A Workset can contain different code sources, which are analysed together. First, define a Name. After that, go to the Classpath register. The easiest way to use CDA is to analyse a JAR file. Add all JAR files, which you want to analyse.
If you are finished, save the Workset. CDA will load now all classes from the JAR files into a tree. With CTRL + F you can search for a specific class or you can navigate with the package name to a specific class. With right click, you can analyse all dependencies (on which classes/packages does the class depends on) or you can analyse all dependants (which classes/packages depends on the currently selected class).
If you are analysing the dependencies, you can show the classes or packages, on which the specified class depends on. Furthermore, you will see all third-party libraries, on which the class depends on. If you do not want to see some specific packages, you can apply a filter (button “edit filter”), on which you can define excluded packages.
The generated graph looks like following. It is almost the same as the textual dependency view, with the exception, that no third-party libraries are shown.
This tool is user friendly. If you are using this tool, you will very fast get to work with it. I use this tool to find dependants on a class and to draw simple UML diagrams of a class (very useful if you want to draw a UML diagram from just one class with all it dependencies).
In a previous post I mentioned the Putty Connection Manager. I found this week a very nice feature. In the Putty Connection Manager, it is possible to create Login Macros. A Login Macro is based on some shell commands, which are send after the login. Now, you can just open a log file with one double click.
- As first step, you have to create a new Putty Connection Manager Database (File – New – Database). In this database, you can store connections. Unlike the Putty sessions, you can add to this connections some Login Macros.
- Now, define a name and a host for the connection. Also enable the Login Macro mode
- Define your macro. You can just define some steps like cd … and less …, to open a log file directly.
- As last step you have to link the connection with a putty connection.
This is it. Now, you can just open a log file with one double click from the "Connection Manager" panel. This feature is time saver if you have to observe a lot of logfiles.
Older Posts »
