30

Regardless of what others might say, I can only see that life gets stranger as you get old.

Wouldn't necessarily say better or worse but simply strange. We learn so much and get wiser, yet one can also get so unsurprised about new things and becomes quite boring per times.

As I grow older, I also start to note some patterns emerging on people around my age gap. And this reflection comes to place since this month is my birthday date. It is a special event for me as I will be celebrating thirty years of existence.

I truly wish that I could have done many things differently across these short decades. There were so many happy thoughts, sad moments and unique emotions that will never be repeated. Perhaps I should (finally) give some credit to the comments from some friends claiming that I am a fatalistic person, looking too often to the past and interpreting my own future has already written.

 However, if the future hasn't been written already, what else can be waiting behind the door?

Oh well.. I just wish that I could smile more often. Wish that I could enjoy life with the same passion as before.

While writing this I see that I'm not so fatalistic after all, I do want to feel life, I don't want to stop feeling amazed when I see new things, I want to keep moving and doing new things that make each day special. Thirty is not the end of the world, it is the beginning of a new chapter.

Let's break the patterns and move forward! :)

Java scripting for the Remedium platform

The latest version of Remedium comes with support for dynamic Java scripting provided by the BeanShell interpreter: http://www.beanshell.org/

If you never heard of it, think of bean shell as the PHP equivalent for Java.

Remedium needed a way of getting away from statically compiled classes onto a scripting language. There were plenty of choices available and I chose beanshell because of its simplicity and close resemblance to the Java language. If you know Java or C, you will instantly figure out how this works.

What's the advantage for Remedium?

As a web based platform, it allows developers to create scripts that take advantage of the platform without needing to setup a full development environment. This also eases the task of customization and updates.

Along with support for bean shell scripts I also added support for displaying pages of raw HTML from the disk. This works nicely to create, for example, HTML forms that call a given bean shell script. This way it is possible to add business logic without any compilation being necessary.


So, now we have a neat standalone application server that is capable of serving and interpreting scripts that output web pages. No need for a JBoss, Tomcat, JSP, Apache or even PHP interpreters.

If you haven't try out BeanShell before, go ahead. It is worth the time to try out.

:)

Making a long name shorter within a range

This is just a small JAVA snippet to reduce a given long name onto a format that fits a max size.

Enjoy.

/**
* Provides a text that will match a desired dimension, reducing
* it if necessary.
*/

public static String shortText(String text, int maxLength){
String result = text;

// if this text portion is bigger than allowed, reduce
if(text.length() > maxLength){
int half = maxLength / 2;
int length = text.length();
result = text.substring(0, half) + ".."
+ text.substring(length - half, length);
}

return result;
}