Tuesday, February 18, 2014

Batch Resize Images in Mac OS

To resize all the images to maximum height of 640px
sips -Z 640 *.jpg
To resize all the images to maximum width of 400px
sips --resampleWidth 400 *.jpg

To resize SVG files in Mac OS, you can use the rsvg library install it with:
brew install -v librsvg
and then run it with the following shell line:
for i in *; do rsvg-convert $i -w 100 -h 100 -f svg -o `echo new/$i`; done
This takes all the svg files in the folder, resizes it and copies the result into new/ folder

Thursday, February 13, 2014

jBPM bpmn designer validation errors

Ok, you must agree with me on this one. It is not nice to develop in environment where you get an errors on unknown location. Well, errors are fine, it is part of software development, but when you are not able to see any details of where the error comes from, it gets to waste enormous amount of time to dig out why such error happens.

I got such errors when I try to use jBPM eclipse environment to try implementing BPM process using an external bpmn file. Since bpm is created in one of those graphical eye-candy oriented BPM modelling software (with little or no support for bpmn validation), I could imagine there are some  pieces (details) missing within bpmn.

No Interface found - According to BPMN standard, every Service Task needs to be defined with a proper service operations. If such is not defined for any of the service tasks within your bpm file, you will get this error.

No Item definitions found - tbd.

If I come up to some more of these errors, I will add them here...

Resize of svg icons from command line

This post would probably only useful to me, but, it is possible to change the size of svg files using XSLT (why would one need to change size of vector graphics??? Well, there are cases where there are no means to scale the images)

I had a bunch of files which I needed to resize into a proper size (in my case, 16px x 16px icons), and was looking for a easy solution. Since I knew svg is xml-based vector graphics, I was hoping to find example similar to

I used the xsl file from the post on https://www.ruby-forum.com/topic/166757#732031, with adding the 16x16px as a target scale.
Command line to run:
xsltproc --stringparam scale 2.5 bigger.xsl in.svg >out.svg
<?xml version="1.0"?>
<!-- bigger.xsl $Id$
     Author: Terry Brown
     Created: Thu Sep 25 2008
<xsl:stylesheet version="1.0"
  <xsl:output method="xml"/>
  <xsl:template match="svg:svg">
    <xsl:copy>  <!-- copying the svg element -->
      <xsl:copy-of select="svg:metadata|svg:defs|sodipodi:namedview"/>
      <xsl:element name="svg:g">
 <xsl:attribute name="transform">
   <xsl:value-of select="concat(concat('scale(',$scale),')')"/>

Thanks Terry Brown!  

Wednesday, February 12, 2014

Create a new Custom Form Field in Vaadin

I am writing this post because of multiple solutions shown on web, which due to multiple drastic implementational changes during Vaadin development (most notably Vaadin 6 to Vaadin 7).

How to create a new custom form field, so that it can easily be integrated into FormLayout.

Simplest way so far is to extend CustomField class.

Here is the example