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 »

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 29

Automatic WordPress upgrades fail? Use PHP 5!

Tags: , , Comments Off on Automatic WordPress upgrades fail? Use PHP 5!

If automatic upgrades of plugins or your whole WordPress installation do not work, you might need to enforce PHP 5 usage. This is fortunately very simple. In the root directory of your WordPress installation, look for a file called .htaccess. If it does not exist, create it with the following content:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

If the file already exists, just append the above two lines at the end.

Thanks to Schnurpsel for this hint.

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?

Jun 03

Quick Guide: Embedding Google Wave in a blog post or web site

Tags: , Comments Off on Quick Guide: Embedding Google Wave in a blog post or web site

[wave id=”googlewave.com!w%252BPGAYVAPjA”]

Please see these great articles for more detailed instructions:

Oct 19

Public Waves broken? No, it’s just the search term with:public…

Tags: , , Comments Off on Public Waves broken? No, it’s just the search term with:public…

The search term “with:public” in Google Wave seems to be broken and shows only waves in which you are already a participant. Most likely, this is a bug, since it is a more convenient way to see public waves.

However, until this is fixed again, use the search term “group:public@a.wave.com” to get to the public waves in the meantime.

Update: “with:public” is working again.

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

  • WAVELET_BLIP_CREATED
    Could not produce this event yet.
  • WAVELET_BLIP_REMOVED
    Could not produce this event yet.
  • WAVELET_PARTICIPANTS_CHANGED
    Participants have been added to and/or removed from a Wave. Access the new/removed participants via Event#getAddedParticipants() / Event#getRemovedParticipants()
  • WAVELET_SELF_ADDED
    The robot has been added to a wave.
  • WAVELET_SELF_REMOVED
    The robot has been removed from a wave.
  • WAVELET_TIMESTAMP_CHANGED
    The modification timestamp of a wave has changed.
  • WAVELET_TITLE_CHANGED
    The title of the wave has changed.
  • WAVELET_VERSION_CHANGED
    Haven’t figured out what version means exactly.
  • BLIP_CONTRIBUTORS_CHANGED
    The contributors for a blip have changed, i.e. added or removed.
  • BLIP_DELETED
    A blip was removed.
  • BLIP_SUBMITTED
    A new blip was created.
  • BLIP_TIMESTAMP_CHANGED
    The timestamp of a blip has changed.
  • BLIP_VERSION_CHANGED
    Haven’t figured out what version means exactly.
  • DOCUMENT_CHANGED
    The content of a blip was changed.
  • FORM_BUTTON_CLICKED
    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.

blog