Skip to main content

Posts

Gestalt Diffing algorithm in Java

What we see depends mainly on what we look for. John Lubbock
We do not see things as they are, we see things as we are. Anais Nin



Gestalt Diffing algorithm in Java Intro When it comes down to diffing or LCS usually story ends with Myers algorithm. It is idea to create BitMatrix (or IntMatrix) of similarities between two strings and then to approach to a problem from graph point, and find the shortest path of changes between two arrays. It sounds as a great solution, and it is, but in reality it has few drawbacks.

It is algorithm that gives great results most of the time but it is a slow algorithm for some obvious cases, if strings are equal, or very similar. You create whole matrix but for your solution not all values from matrix are needed. It involves one more algorithm, finding the shortest path in it self.




Then improvements of Myers algorithm came, like to check on start are strings are equals, to check for same prefix or suffix, and so on. Most popular version of this improvements …
Recent posts

Sailor turn to Pirate farewell letter

On that fatal night when my love towards Lord betrays me
when finally all curses from my enemies gets me down and destiny turns its back on me
on that night I will walk into ninth circle of hell so easy like the devil is my brother
shining brightly like a falling star
like a lost worn-out jacket with two false faces

that night you will wait me with your tired soul
it is so hard to wait for false promises of crooked man
that is fucking hard
and it's so easy to live just for tomorrow and to die all alone, my love

on that night when I leave forever, when I say my farewell
on that night only two women will wake up
one will be my beloved mother and she will cry
second will be you, you will curse me

Is Java the right language for Micro Services?

[work in progress]
Micro Server for Micro services

Micro services are becoming slowly but steady mainstream programming architecture. People often compare them to web services or rest services witch gives more problems than understanding. And when you look at implementation you'll see that developers are running away from Java to Scala, Nodejs or Python or name it. Is Java old? Is it time to close Java book and learn something new? Learning new things is always good, but I think reason why developers run away from Java is not a language problem, but Java legacy.

Biggest problem why developers avoid Java to make micro services is that there are not so many good tools and servers for micro services in Java or put it better there are many old wrong tools and server to start with. If you are old Java developer you will have problems to grasp this.

When you start to create micro service your focus should be on micro. Project should compile in less than 10s.Your service should have onl…

New Year's card

Today is a new day, a new clean start. I wish you to feel well for what used to hurt you before, and that you are loved by whomever didn't loved you before.

I wish you that your children are better than you, and that you brag more with them than your kids brag with you.

I wish you healthy and strong (feet) legs and to have more work than time.
I wish you to be more needed by others than others are needed to you.

I wish you to dream and do more than you need, and share with those that can not. Do not take more than you give. I wish you to acquire, win or get what you dream of and to respect and enjoy what you already have. I wish you a Happy New Year and little bit more luck than in previous one.
by Dusko Radovic
http://www.lupiga.com/vijesti/dusko-radovic-novogodisnja-cestitka

My Tilt-Shift exercise

I love photos, much more just to look at enjoy and admire then to be active in taking some. Mainly because, when I look at what I shoot it looks to me that I always snap at wrong moment, that just few mili-seconds before (or after) it was a perfect moment, or that I did it with wrong camera or wrong camera settings. Prices of good cameras are very affordable nowadays but I stay with love to simple idiot cameras that have one or few setting modes. So afterwards I stay longer time in-front of my PC trying to filter them and take best of what I actually did.

Key point for me is to take a lot more pictures than needed. Here are few latest work with Tilt shift filter on common image. To make tilt shift effect you do not need support from editing tool you can do it with simple filters, blur+hue+contrast, there a lot of tutorials on the net.

Original:
















Tell me what you think, or share with me your experience.

Unsent email

The Good, Bad and Ugly programmer.

When they ask me: "why did I stay for so long time in that company?", and when I start to make lies about how interesting projects company had, in my mind I think of you. Could it be that I stay so long because I enjoyed working with you?

When I tell the story of that time I always try to make you out to be the bad guy. Does that helps me  to present myself as a good one? And although sometimes you were the bad guy the truth is that I was even worse.

Sometimes when I try to remind of that time It's much easier to me just to remember all the awful things you said to me, and what you chose to do with legitimate need. You made me look like a fool.

And I don't know why does it hurt me more to recall your good side, your true side. I always went to you for advice, you were a smart one, a wise one back then. When I think about you in that time it looks to me that you were that friend that I missed to get to know. Sometimes I wish that we…

JPA service generalization, templeting

JPA made small revolution among ORM tools and EJB 2 world. Easy to use, simple unified way to develop you model and services. After i used it in few projects, i have found that all JPA services are very similar, so this is a simple try to generalize or template them.

This can be for example simple abstract interface for all:
packagetest.service;importjava.util.List;publicabstractinterfaceJpaService<T>{voidsave(Tt);Tfind(Longid);voidremove(Longid);List<T>findAll();longcount();}
And abstract implementation class look like this:
packagetest.service.impl;importjava.util.List;importjavax.persistence.EntityManager;importjavax.persistence.PersistenceContext;importjavax.persistence.Query;importorg.apache.log4j.Logger;importtest.service.JpaService;publicabstractclassJpaServiceImpl<T>implementsJpaService<T>{/** Logger. */privatestaticfinalLoggerlog=Logger.getLogger(JpaServiceImpl.class);/** Entity manager. */@PersistenceContextprotectedEntityManagerem;/** Reflection ut…