Due to the pop­ular­ity of my art­icles on jsPlumb, I am receiv­ing more and more requests for help with jsPlumb prob­lems. As hon­oured as I am by your requests, and as much as I would love to help each and every one of you with a com­plete solu­tion, I am unfor­tu­nately unable to do so. A fam­ous Chinese pro­verb is applic­able here: “Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a life­time.” In this art­icle, I want to teach you how to fish by show­ing four resources that you can use to get more and bet­ter help on jsPlumb faster than you could ever get from me directly.
Continue read­ing

In the pre­vi­ous art­icles in this series, we have built func­tion­al­ity that allows our users to cre­ate a graph and give a name to the states in that graph. In this art­icle we will take a look at how we can have the user save the graph he has created.

There are two ways to save your graph. The first approach is to send a call to the server every time the user cre­ates a con­nec­tion. The second one is to save the entire graph in one go when the user clicks a save button.
Continue read­ing

I like learn­ing new stuff, which is why I like books. Today, I have two links for you to web­sites that con­tain links to free books about JavaScript and Python. Both lists are offered by the same com­pany and actu­ally link to the ori­ginal con­tent. The books are not just about the pro­gram­ming lan­guages them­selves, but cover frame­works and other sub­jects as well. A few examples for JavaScript are CoffeeScript, Node.js and AngularJS; for Python: Flask and Django. Check out the free JavaScript books and the free Python books and use them to learn some­thing new today!

When you need to cre­ate schem­at­ics or dia­grams in your webap­plic­a­tion, or have your user cre­ate these, jsPlumb is a won­der­ful lib­rary to use. An example of a use case for some­thing like this is hav­ing the user cre­ate a flow dia­gram for a pro­cess he or she is modeling.

In the pre­vi­ous art­icle in this series, we made some divs that the user could con­nect using jsPlumb. Only con­nect­ing a few pre­defined items is not very use­ful. In this art­icle we will see how to have the user add new items and how to make them draggable.

Continue read­ing

The ori­ginal art­icle was pub­lished on 13 January 2013. It has been updated on 14 August 2014 to reflect the new­est ver­sions of jsPlumb and jQuery.

When you need to cre­ate schem­at­ics or dia­grams in your webap­plic­a­tion, or have your user cre­ate these, jsPlumb is a won­der­ful lib­rary to use. An example of a use case for some­thing like this is hav­ing the user cre­ate a flow dia­gram for a pro­cess he or she is modeling.

The jsPlumb-website has some great demos and a lot of doc­u­ment­a­tion. An easy guide to get star­ted is, how­ever, not avail­able. This art­icle will get you up and run­ning with jsPlumb in no time!

Continue read­ing

Suppose you have a method that con­cat­en­ates strings, like the method in code snip­pet 1 below. One day, you come to a point where this method does not suf­fice any­more. You need an addi­tional para­meter, to allow the user to place a char­ac­ter between each con­cat­en­ated string. That’s easy, right? You just alter the method, and its sig­na­ture, as in code snip­pet 2.

Works like a charm. We can just wrap this up and leave work early, can’t we?

No, we can’t. What about all the other code in your pro­ject (or in other people’s pro­jects) that uses the method you have just altered? That code now doesn’t work any­more. It doesn’t even com­pile any­more, because you changed the method’s sig­na­ture. Is there a way to pre­vent this from happening?

Continue read­ing

Everyone knows that auto­mated tests are use­ful. When you are just start­ing a new pro­ject, it is easy to include all sorts of auto­mated test­ing dir­ectly from the start. You can take all sorts of things into account: auto­matic unit tests, auto­matic user inter­face tests, or even con­tinu­ous integ­ra­tion with auto­matic tests.

But what if you have an exist­ing code base that you wish to add auto­matic test­ing to? Chances are that you can­not just do extens­ive changes to your cur­rent code base, just to add auto­mated tests. Where to start? My advice: start small.

This art­icle will show you how to add auto­mated unit tests to your jar builds. This is fairly simple, and can be done without mov­ing your entire code base around.

Continue read­ing

JavaFX 2 is an amaz­ing new plat­form that allows you to build cli­ent applic­a­tions eas­ily. I am by no means an expert yet, but I love what I have seen so far. Here are a few char­ac­ter­ist­ics of JavaFX that I like in particular.

  • Specify your lay­out in Java-code, or in a seper­ate so called FXML–file. The sep­ar­ate file allows you to keep the actual lay­out out of your code, so you can focus on functionality.
  • Specify a con­trol­ler in the same FXML–file, keep­ing your code clean.
  • Style your lay­out using CSS, again keep­ing your code clean.
  • Easily build your own com­pon­ents, again using either Java-code or FXML.

Continue read­ing