Jun 02

If you like NCrunch, you should take a look at the Visual Studio plugin Alive. I stumbled upon this tool while researching for my previous post about C# code generation.

Just like NCrunch, it executes your code while you type. But instead of test outcomes, it focusses on the details of the code execution and provides invaluable insight into the contents of variables and even the control flow as you type. You can even drag a slider to see different iterations in loops. All you need is a starting point like a static method, a test method or any method where the parent type can be instantiated with some generic defaults.

This short video (~6 minutes) gives a great first impression so far:

Continue reading »

Jun 01

Today I wanted to generate a bit of rather trivial C# code to provide a convenient facade to an internal library. After creating a T4 template, loading the required assembly and adding some namespace imports, I found it rather inefficient to write code in that simple text editor without IntelliSense. So of course, there is always the option to write a code generator class with a method that returns a string. The T4 template can instantiate that class, call the method and emit the value directly:

<#= new CodeGenerator().Generate() #>

Next comes the question of how to implement the generator. StringBuilder? Come on, there must be a better way. I checked in another library that I knew was using code generation. Then I saw that the library was using CodeDOM. For my simple needs, I decided that this would be sufficient for the time being (and efficient, since I didn’t want to spend too much time there).

But then I started to wonder. Will CodeDOM still work with the new .NET Core?

Continue reading »

Jun 10

MDSD Survey 2010

Tags: , , , , , , Comments Off on MDSD Survey 2010

The Generative Software GmbH and the FZI have done a survey about the usage of Model-Driven Software Development approaches with around 300 participants. Almost 90% of the respondents have prior experience with the topic, so the report might give interesting general insights.

Please see the MDSD report 2010 (sorry, only in German) for details on the results.

Do you make use of MDSD techniques?

Feb 18

There is a great tutorial on vogella.de describing how to add a pie chart with JFreeChart to an Eclipse RCP application or plug-in. The ChartFactory that is used to create the pie chart does not include a method to create a speedometer (or dial) as shown in the sample section of JFreeChart. The following code fragment creates a view that displays a very basic speedometer using the org.jfree.chart.plot.MeterPlot class:

package com.martinklinke.eclipse.jfreechart.demo.views;
 
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.MeterPlot;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.experimental.chart.swt.ChartComposite;
 
/**
* @author martin
*
*/
public class MeterChartView extends ViewPart {
   public static final String ID = "com.martinklinke.eclipse.jfreechart.demo.views.MeterChartView";
 
   public void createPartControl(Composite parent) {
      JFreeChart chart = createChart();
      final ChartComposite frame = new ChartComposite(parent, SWT.NONE, chart, true);
   }
 
   public void setFocus() {
   }
 
   /**
    * Creates the Chart based on a dataset
    */
   private JFreeChart createChart() {
      DefaultValueDataset data = new DefaultValueDataset(20.0);
      MeterPlot plot = new MeterPlot(data);
      JFreeChart chart = new JFreeChart("Meter Chart",
      JFreeChart.DEFAULT_TITLE_FONT, plot, false);
      plot.setNoDataMessage("No data available");
      return chart;
   }
}

The result should look like the following screenshot:

JFreeChart Speedometer in Eclipse View

JFreeChart Speedometer in Eclipse View

Of course, the MeterPlot can be further customized by calling the plot.setXXX(…) methods. However, this exercise is left to the willing reader ;)

Jul 11

Eclipse JBoss server runtime library lost

Tags: , , , Comments Off on Eclipse JBoss server runtime library lost

Today, I had a strange problem with Eclipse. I have an EJB project with JBoss v4.2 selected in targeted runtimes (project properties) and as such the JBoss v4.2 server runtime classpath variable. I have really no idea what happened, but the effect was that the JBoss classpath entry didn’t show up any longer. My first thought was that maybe the .classpath file got mixed up, but it still contained the required entry. The project properties also contained all the correct information. Just the package explorer didn’t show the entry and it definitely wasn’t there as the build for the project failed because the required classes could not be found.

The <workspace>/.metadata/.log file contained the following error message many times:

!ENTRY org.eclipse.jst.server.core 4 0 2008-07-11 16:24:46.251
!MESSAGE Error calling delegate RuntimeClasspathProviderWrapper[org.eclipse.jst.server.generic.runtimeTarget]: null

So this must have been a bug in resolving the server classpath. I couldn’t find an equivalent problem description, and after playing around with the project settings, adding and removing the library manually, which didn’t help any further, I tried updating the Java Standard Tools. There was indeed a patch available. My previous version of JST was org.eclipse.jst_2.0.2.v200802150100-7B-7_8dDTOvmuz0di_U5vgUfz0em and I installed the patch org.eclipse.jst.web_core.feature.patch_2.0.2.v200803241913-208i8s733I395D6BA7. My Eclipse SDK version used is 3.3.2, Build id M20080221-1800.

After the installation of the patch and a restart of Eclipse, the JBoss v4.2 entry showed up again and the error message didn’t occur any longer in the log file. As I said, I don’t really know what had happened, but the patch might have resolved the issue for me, so maybe this helps someone out there, who runs into the same problem.

Jul 10

Eclipse is a great IDE for developing any kind of Java code, e.g. Rich Client (RCP), Web or standalone applications. However, when a project is built using any IDE (yes, there are others – e.g. Netbeans or IntelliJ IDEA), there may be some dependencies towards the chosen tool when it comes to compiling and packaging the code. This doesn’t matter too much as long as there is no requirement to automate the build process. This will happen, as soon as you decide to set up Continuous Integration for your project.

Continue reading »

blog