Jun 02

Interactive coding in Visual Studio with Alive

Tags: , , , , Comments Off on Interactive coding in Visual Studio with Alive

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

How to generate C# code in 2016

Tags: , , , , , Comments Off on How to generate C# code in 2016

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 »

Apr 24

Learn Node.js basics with Learnyounode

Tags: , , Comments Off on Learn Node.js basics with Learnyounode

There is a nice Node.js module that can be installed via npm called learnyounode. It contains 13 exercises that practice the basics of node development. The nice thing is that it gives you instructions for implementing a short node program and then also provides an automated way to verify your solution.

See this GitHub page for more details and installation instructions.

I have completed half of the exercises by now. Maybe there is time for the remaining ones next week. But the weather is nice, too ;)

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?

Oct 17

The only list of Google Wave Robot capabilities is contained in the API reference documentation of the enum EventType, but unfortunately does not contain a description when the events are triggered. Here is a documented list of what I’ve figured out so far (needs to be completed in the future):

    Could not produce this event yet.
    Could not produce this event yet.
    Participants have been added to and/or removed from a Wave. Access the new/removed participants via Event#getAddedParticipants() / Event#getRemovedParticipants()
    The robot has been added to a wave.
    The robot has been removed from a wave.
    The modification timestamp of a wave has changed.
    The title of the wave has changed.
    Haven’t figured out what version means exactly.
    The contributors for a blip have changed, i.e. added or removed.
    A blip was removed.
    A new blip was created.
    The timestamp of a blip has changed.
    Haven’t figured out what version means exactly.
    The content of a blip was changed.
    Haven’t figured out yet what this really means.

As one can see, the description is not complete yet. Feel free to help me out in the comments ;)

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 ;)

Oct 21

I just discovered TextUML, an Eclipse extension that enables you to define UML models textually. It started out as a free but closed source project and was open sourced eventually.

The core of this tool is the editor for the textual UML representation that provides many features that developers are used to (syntax highlighting, validation, outline view etc.). Additionally, Graphviz can be integrated to create diagrams from the textual models.

There are detailed instructions for the installation of TextUML and the Graphviz integration and a tutorial to get started with textual modeling.

A huge advantage of textual over graphical notations is in my opinion the possibility to create diffs which means you can easily put those textual models under version control and profit from Eclipse’s compare mechanism. This enables teams of developers to share a common model and to edit it concurrently like any other piece of source code.

According to Rafael Chaves’ (the author of the project) comment on the previously linked article,

[…] the final goal is at some point to submit a proposal to Eclipse.org […]

I hope that this goal will be reached, because TextUML is a very interesting and promising project. Claiming

  • increased modeling productivity
  • live graphical visualization of your class diagrams

as two of the key benefits of using TextUML, the goal should not be too far away. Productivity is always welcome and the graphical visualization may be one of the key arguments for your manager ;)

Seriously, even if it’s not the core feature of TextUML, a simple and efficient way to create class diagrams quickly would be a great win for any technical documentation or idea sketching as well.

Oct 15

Programmers, join the Stack Overflow!

Tags: , , Comments Off on Programmers, join the Stack Overflow!

This is not supposed to be a flame war. It’s just an attempt to bring a little more diversity to the already interesting and very well implemented Stack Overflow.

I have been a member since the beginning of August and was lucky enough to join the private beta. Currently, the site is in public beta status and there have been a lot of interesting questions already.

In my opinion, questions concerning the Microsoft stack still dominate the site. Many have attributed this to the fact that Jeff’s and Joel’s readers are coming from this background. However, the goal of the site was to have resources for any kind of programming language/environment that may exist.

In order to support the achievement of that goal, this is a call to all programmers out there, no matter how weird the language they (must) use:

Join the Stack Overflow and share your rare knowledge!

Or just try to find some answers where Google can’t look (yet?): In the brains of some fellow programmers ;)

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 »