Java classpath hell solution

16 Aug 2016

If there's one thing I really like in nodejs is how it loads dependencies.
Each dependency is loaded relatively from the current file or from a known path (usually node_modules).
Unfortunately in java things are much messier. Today I will show how you can create a folder named java_modules that acts similarly to node_modules.

read more →

Add pageviews and news feed to static website with firebase

15 Aug 2016

Previously I wrote about how to setup a static website with metalsmith.
Today, I will describe how you can add dynamic and persistent content to your static website using firebase

read more →

The Many Ways Of Running Typescript

30 Jul 2016

Recently, everywhere I look, I see Typescript.
The web is full of tutorials about the Typescript language and discussion around it.

read more →

Contribute a micro library to java with JitPack today!

24 Jul 2016

Java is moving towards the micro lib world.
For some unknown reason it is called micro-frameworks.
I guess it is because Java can only have frameworks and no libraries..
The web is full with info about blogs about it and new micro libraries (frameworks!):

read more →

Move your blog from blogger to metalsmith today

14 Jul 2016

Over the years I have maintained a technical blog on blogger.
However, blogger's interface is not so friendly for technical writing.

read more →

Angular - 5 lines of code to prevent memory leaks

12 Oct 2015

5 lines of code in angular written once can affect your entire project by auto releasing resources and cancel delayed action after navigating away from the page. in this post i will explore and explain the problem and its solutions.

read more →

grunt-aws CERT_UNTRUSTED quick fix

20 Dec 2014

If there's anything I hate in the programming world, is when something that worked well suddenly breaks. Unfortunately, today it happens a lot since everything is a "service" that is upgraded under your feet.
My build process broke so many times, I lost count.
Even if you keep it simple like

read more →

json parse is insane

29 Oct 2014

every project i've been in so far had the same stupid bug with JSON.parse. at the beginning someone got a string instead of an object and they used JSON.parse to convert it to an object.
then after a while, someone fixed it upstream, and now JSON.parse is getting an object and fails with a very cryptic error message.

read more →

seo with phantomjs part 3

22 Oct 2014

before we reach the final part of hooking it all together there are 2 seo things we should do.
the first one is to add index.html to your path.
it will make your life easier handling redirects and default index page etc..
it is not a requirement, but i recommend it and i assume you applied this in the rest of the post.
plus - developers are not usually aware of this, but not specifying index.html will cause problems when deadling with iframes.
i am not going to dwell on this here, but only mention that i had 2 iframes in my application that did not work until i added index.html to the src attribute.

read more →

seo with phantomjs part 2

15 Oct 2014

so now that we know how to generate a prerendered version of a page using phantomjs
all we need to is to identify a crawler and redirect them to the prerendered version.
turns out this is the tricky part..

read more →

seo with phantomjs part 1

08 Oct 2014

phantomjs is a browser that runs in the memory (no graphics required).
you install it by running npm -g install phantomjs and then verify it is available by running phantomjs --version.
since it is a browser, it can do whatever a browser can such as render css, execute javascript and so on

read more →

seo with phantomjs

01 Oct 2014

when i was asked about how to make an angular site seo friendly, i was shocked to discover that even though googlebot is supposed to support javascript, angular apps still have placeholders
where values should be, making your search result display as \{{title}}.

read more →

Gruntfile.js - adding another HTML file to usemin

05 Nov 2013

Recently I started using node and with it yo, grunt and bower. It is nice to get a quick kickstart. But now when I have to add/modify something in the build process, I get stumped a lot.

read more →

Configuration Module for NodeJS

28 Oct 2013

NodeJS is great but it lacks settings/configuration mechanisms.
Actually - I understand why it lacks it - configuration nowadays is written in JSON anyway.. so in node you just import it..
But there are some features you still want/need that do not exist yet.

read more →

When Play Framework 2.X Sass plugin says 'Sass compiler: ruby.exe: No such file or directory -- project_root/sass (LoadError)'

21 Oct 2013

Running Play!Framework (I am using 2.0.4) with Sass plugin throws a LoadError message.

read more →

Improving Play!Framework 2.x Configuration

14 Oct 2013

Play!Framework 1.0 had a nasty configuration mechanism.
To make a long story short - it was a properties file.
Play!Framework 2.0 came out, and even though the configuration section
got some big improvements, there are still things that annoy me.
In this post I will show you what annoys me and how to resolve it.

read more →

Adding IFrame Support To Our Selenium Framework - Part 2

07 Oct 2013

This is another post in our "Selenium Extension Library" serie. In this post we will fix our IFrame support so that we support IFrames that are in other IFrames. Previously we:

read more →

Adding IFrame Support To Our Selenium Framework

30 Sep 2013

So far we have written a nifty selenium extension library that allows you to treat the pages as if they were built by components rather than the primitive WebElement.
This brought your page design and development closer to your Selenium test code.
It also allows you a high abstraction and re-usability of your test code which is always good.

read more →

Extending Selenium Even More

25 Sep 2013

My last post was about how we can easily correct the faults in Selenium's Page Model by constructing smarter components that can expose better API than WebElement.
We got rid of the impotency of the WebElement class by writing our own Decorator and Locator
and thus allowing ourselves to define Components that wrap WebElement in the most natural way you can think.
As an example, we showed a better way to implement a Select rather than exposing some utility function as proposed by Selenium.

read more →

How to restart services vi ssh?

09 Sep 2013

Recently I am occupied by automations. I want to upgrade and troubleshoot as automatically as possible.
If my backend needs a reboot for some odd reason, I want it to be available from some CI tool.

read more →

Extending Selenium In Java

12 Aug 2013

previously we saw some limitations Selenium has. One of those points was that we are bound to "WebElement" and we cannot define and use "complex" like "select" and invoke "getOptions" on it. Today, our wishes will become true.
We will need a page to test on.
I chose the this page.
So lets add a select box with id "testme" and 2 options

read more →

AngularJS - I18N

06 Aug 2013

As AngularJS becomes more popular, the demand for features increases immensely. While chart libraries and effects support take shape, quick fix solutions are useful.

read more →

Zigzag my CSS

29 Jul 2013

Recently I wanted to do a zigzag header/footer since it is so modern.
I decided to implement it with pure CSS.
I quickly found out a solution over at stackoverflow.
However that solution was only for zigzag facing down.
I decided to enhance the solution, implement it as a mixin in SCSS,
and get the color as parameter.

read more →

AngularJS - Adding Sort

22 Jul 2013

So far we have a table where we can select the columns, search the content and pagination where we select the page size.
Believe it or not, but the entire code (HTML+CSS+JS) is no longer than 200 lines - without using plugins!

read more →

AngularJS - Searching The Table

15 Jul 2013

So far we have pagination, and the ability to select the table headers.
We can also change the page size.
Today, we will add "search" to the table.
So far we implemented everything on the client side - which means we get all the data and we manipulate it.
When dealing with a lot of data, you will prefer to move this to the server side - just like the pagination.

read more →

AngularJS - Adding "Toggle Header" Feature

08 Jul 2013

In the previous posts we implemented a simple paging for a table
using AngularJS directive and filter.
In this post, we will add a feature that enables us to choose which
columns we show.
The template we are using ( See first post) already places the available headers on the scope.

read more →

AngularJS - Using Our Table Paging Directive

01 Jul 2013

This is the second part of a serie about AngularJS super table directives where we add "paging" and "search" and "sort" to a table in a highly
reusable, customizable way.
So far we have a directive that adds "prev" and "next" buttons.
This directive handles disable/enable on the button.

read more →

AngularJS - Table Paging Directive

24 Jun 2013

In this post and the next one I will show you how to write a directive that adds paging to your table using AngularJS.
Thanks to AngularJS great structure, all code is reusable and activated
as easily as adding a class!

read more →

AngularJS - Sort, Filter and Paging - A Table Directive

18 Jun 2013

AngularJS is GREAT! you should neglect whatever framework you are using right now, and switch to AngularJS immediately!

read more →

Why the Hack am I Getting OptimisticLockException?

20 May 2013

For a while now I've been trying to figure out an exception I got using EBean and Play!Framework. I know what OptimisticLockException, and I know why it usually happens, but nothing matched my scenario.
Today I had an enlightenment and I managed to resolve the exception. Thought I'd share.

read more →

Selenium Page Model Limitations

13 May 2013

In this post I will talk about an annoying limitation Selenium presents, and in the next posts I will show how to enhance Selenium to support my wish list.

read more →

AngularJS Cookies Example

06 May 2013

Your first step would be to include the JS file and then add dependency on cookie module.

read more →

Quickly resolving RuntimeException: No join columns

15 Apr 2013

So it is late at night, and I am working over the weekend again..
Creating a OneToOne relationship with EBean and exporting schema to create schema upgrade script
when all of a sudden, I get an exception I have never seen before.
Since it took me a couple of minutes to figure it out - maybe too late at night? - I decided to post
the problem and the solution.

read more →

Removing background from image with imagemagick - revisited

08 Apr 2013

A long time ago I wrote a post about how to remove background from images using 2 simple commands with imagemagick. Recently, I acquired a new computer, and I had to download imagemagick again.
Obviously, I went to my blog to remember the commands I used, and I copy-pasted them, only to discover they do not work!

read more →

Serving Static Files From JAR

01 Apr 2013

If you have a lot of static files (images, JS, css) in your WAR,
Or maybe you have static files that are shared between different projects
you might want to pack those resources into a JAR and serve them from there.

read more →

Overriding Spring MVC Context From Java Arguments And Environment Variables

25 Mar 2013

Recently I added spring MVC to an existing project using Jetty. Like all projects, I wanted this one to support DEV mode and PROD mode.
It is a Spring best practice to keep 2 context files (at least).
One file for Spring MVC controllers and stuff,
and the other for beans that can be used outside Spring MVC and reusable everywhere.

read more →

Setting Logback with Play!Framework 2.0

11 Mar 2013

Last time I wrote about how to setup a Maven Project with SLF4J using Logback. In this post I will explain how to do the same for Play!Framework 2.0.

read more →

Using postMessage for JavaScript API clients

08 Mar 2013

In a previous post Being Your Own Rest Client I explained how REST and API are 2 different things
and using REST API from your front-end is not really recommended
Lately I have been using postMessage to create JavaScript API clients.
I know that CORS is already here and this is the way to go,
but I find something so appealing in postMessage that I just can't let it go.
For example, with postMessage, the API provider can use cookies!
This seems very powerful to me.
Using postMessage also forces the API to be in a DOM environment.
I wonder which cool usages this will bring with it.

read more →

SLF4J with Logback in a Maven Project

05 Mar 2013

I recently started migrating my projects to SLF4J. SLF4J is a single API for all logger implementations.
There are at least 3 implementations I know about:

read more →

How to make postMessage support multi origins and multi messages

19 Feb 2013

In my previous post I talked about HTML5 - cross domain messaging with postMessage. I showed how to use a JQuery plugin written by Ben Alman that wraps this method and falls back on hash tags in the URL for older browsers.
In this post I will talk about how to improve the usage in this plugin to support multiple messages
from different origins.

read more →

HTML5 - cross domain messaging with postMessage

12 Feb 2013

postMessage an HTML5 modification that was added to JavaScript in order to allow
passing messages across domains.
Now it is easy to send and receive messages to and from an iframe
and define a messages whitelist keeping your frame safe from evil messages.

read more →

Being Your Own REST Client

06 Feb 2013

REST and API are two words that got stuck together.
Using REST between your client and server is one things.
Exposing an API - be it REST or not - is a different thing.
Thinking these are the same thing is a mistake I see a lot lately.

read more →

playframework - Showing HTML in textarea

29 Jan 2013

Every now and then you get to show HTML in a textarea.
A common usage for this would be to copy some HTML code you should embed in your site

read more →

Installing Extensions - Sublime Text Editor

22 Jan 2013

I recommend Sublime Text Editor.
It has some really nice and strong features, and it has a lot of extensions.
Extensions in Sublime is called a "package" I think... but I will call it "extension".
You'll just need to cope with that.

read more →

Implementing Base Templates In Play 2.0 Without Passing Arguments

16 Jan 2013

I just migrated from Java+Play1.0 to Java+Play2.0 and the templates are the hardest part so far, and the best way I found to implement a base template (for title, head etc..) is by using the Http.Context. There is a very nice syntax you can achieve with tags.

read more →

Integration Between Maven And Eclipse Sucks

08 Jan 2013

Even though I don't support working from the IDE, I have to give support to developers that do.
For example, when I assimilate Maven into the project, I must make sure all workspaces adjust accordingly.
Even though Maven has support for ".project" file auto-generation, there are still so many problems along the way that I have to sit down with each and help resolve all the issues.
In the last project, I assimilated Maven into a GWT project.
This project has dependencies of GWT module type.
These dependencies are simple jars, however, GWT compiler needs their sources in order to use them later on.
All in all I came across 7 different problems. I will show you how I resolved 4 problems
The other problems are related to GWT not synchronizing with Maven.
It is important to note, I did not come across any problems while working with Intellij. Intellij's approach is to enable console commands from the IDE, while Eclipse's approach is to hide Maven in the background. This is the main reason why Intellij introduces less problems.

read more →

Troubleshooting Missing Artifact in Eclipse Maven Repository -

01 Jan 2013

I found 2 reasons that cause this error in Eclipse.

read more →

Eclipse Ignores Maven Settings

25 Dec 2012

I defined a custom local repository for Maven, but eclipse simply ignored it. You can define local repository location easily by modifying M2_HOME/conf/settings.xml.
This resulted in a strange behavior. The commands were successful when running from command line but failed on missing artifacts from Eclipse.
Eclipse complained about missing artifacts, but when I check, I saw they were there.

read more →

Play 2.0 DB migrations shell script

18 Dec 2012

I recently joined a Play!Framework 2.X project. After 2 years developing with Play!Framework 1.X, it is certainly a big difference.
One of the things I miss most is the nice migrate module.
2.x has something called evolutions, which might be as powerful, but I really didn't like it
So I decided to write my own simple migrate module.
Since I didn't have the motivation to learn how to write a module for Play 2, I decided to implement it with a simple Shell script.

read more →

About Running Maven Plugins and Running Maven Jetty Plugin

21 Nov 2012

When I followed tutorials and guides for using Maven Jetty Plugin
I kept seeing the same instructions saying:

read more →

Open Files From Console With Sublime

20 Nov 2012

Sublime Text Editor is a great new text editor.
Its motto is "The Text Editor You'll Fall In Love With" and indeed I did.
I have been a notepad++ user for a long time, but I think I will make the switch.
I find it so useful, I am even writing this very post in sublime.
Later I will copy-paste the content to Blogger.
Wouldn't it be great to have an add-on to sublime though that would work with Blogger?

read more →

Mysql lower case on windows! Annoying!!!!

13 Nov 2012

try running the following query on a MYSQL instance running on windows

read more →

How to export DB Schema in Play! 1.2.1

06 Nov 2012

So I am writing an application in Play 1.2.1 And I want to use the cool migrate module. This means I need to start writing SQL now.
And I am bad at it.. Sometimes I forget to put "OneToOne" and it takes me a while to see it
I found it useful to tell hibernate to export the DB scheme, thus quickly finding out the problems.
For this post I created the following models

read more →

My list of useful Intellij Live Templates

14 Feb 2012

I like Intellij's "live templates" feature and I try to use it as much as possible.
Here some live templates I just can't do without.

read more →

removing backgrounds from images with 2 commands and a freeware

11 Jan 2012

I had a problem.. I bought an image from and I had to use it. Seems the image was in EPS format and had 17MB !!

read more →

Setting up a selenium/chrome project

26 Nov 2011

Selenium is an automation for GUI testing for Web Applications.
Once you run the automation, a browser popup up, and you will see user action happen on its screen such as :

read more →

Adding min-height to TinyScrollbar JQuery plugin

21 Sep 2011

Today I added "minHeight" feature a JQuery plugin a became quite fond of.. This plugin is called Tiny Scrollbar, and for this post you will need to have a look at the source, as I am going to modify it just a bit, while adding a powerful feature.

read more →

Disabling a button/link with JQuery

08 Aug 2011

As you probably know, if you want to make a sexy button, you need to implement it with a link.

read more →

Resolving play!Framework's test migration problems

02 Jul 2011

I recently upgraded to play 1.2.1.
As I was running the tests, I got weird exceptions. That contained strings like :

read more →

HTTP Basic Authentication - Thank you PlayFramework!

07 Jun 2011

Finally, one of my mysteries is resolved.

read more →

Intellij - "J" is shown instead of "C"

31 May 2011

As I was looking at my blog's search keys that got people here, I noticed a weird one

read more →

Python Hands on - The Pickle Problem

30 May 2011

I recently learned how to write to a file in Python, and among it how to use Object Serialization library called "pickle".

read more →

@OneToOne - does not force uniqueness!

15 May 2011

I just discovered something. I have code with @OneToOne mapped to the DB.

read more →

What to do when Apache shows your PHP as plain text

21 Feb 2011

I enabled my apache with SSL recently.. Had to change many files.
And once I managed to get SSL working, I noticed my PHP configuration was messed up..

read more →

Mysql - showing Long timestamps and readable Dates

01 Jan 2011

A while ago I had to find a certain date in the database, but the date column was defined as LONG.
I discovered you can easily turn a LONG to a date, using the following syntax :

read more →

Getting really annoyed with Axis2

14 Dec 2010

So I got a project while back that invoked SOAP messages, and I immediately thought about AXIS.
I used AXIS a long time ago.
This time around I decided to use MAVEN to build the project, and as I searched for axis plugins for maven, I was surprised to know I did the wrong search.

read more →

Quickly Solving NGNIX's "The system cannot find the path specified" in Windows

21 Oct 2010

I just downloaded nginx for a bug/feature to simulate the production environment, and I immediately got :

read more →

javax.persistence.PersistenceException org.hibernate.PropertyAccessException could not get a field value by reflection getter

28 Sep 2010

I have worked with hibernate now for 6 years. and yet..

read more →

Setting up log4j in a maven project

21 Aug 2010

I always forget how to quickly set up log4j in my maven project, even though it is really easy.

read more →

Generics - method signature type definition

03 Aug 2010

On my previous post I introduce some advanced things about generics, when I discovered I forgot a very important feature.

read more →

YARP - const_missing is dependencies

03 Jul 2010

I am living on the edge, working with rails 2.3.4.. As I am moving to production, I decided to integrate with "exception_notification" gem. (or plugin?) , and that's after looking at Ryan's RailsCasts that I love.

read more →

Helpful things to have with Rails

12 Jun 2010

Some stuff I picked up about rails that I wanted to share

read more →

SVN + Apache (Continue) - Permissions

27 Apr 2010

Last time I explained how I got my Apache to forward calls to the SVN.
It was pretty hard due to lack of documentation.

read more →

Rails Quicky - Rails Layout Pothole

20 Apr 2010

So I am working on a small project to exercise my new Rails brain muscles. And just as I start to feel good, I run into a problem.

read more →

SVN + Apache - Easy ? Lets make it work!

10 Apr 2010

Well... I am a bit frustrated..

read more →

My Rails Experience - afterthought

05 Apr 2010

OK. So I went cover to cover for the second time over the agile web development with rails

read more →

Rails Quicky - path , xxx_path function is undefined

03 Apr 2010

As I am going over the rails book - I reached the I18N section.
This section required me to upgrade from 2.0.2 to 2.2 or above.
I upgraded to 2.3.4 - while the book uses version 2.3.4.

read more →

Anonymous classes, Final - Java and Javascript

17 Mar 2010

final is a very intuitive keyword, and even though I use it a lot, I never really took the time to ponder about it. Today is a good day for pondering.. .

read more →

SQL for interviews - Continued

12 Mar 2010

In a previous entry I explained how I always get asked the same SQL questions in interviews. Lo and behold, I am asked the very same questions in an interview I had just the other day.

read more →

Rails Quicky - Mistakes with Blocks

09 Mar 2010

What I wrote here - you won't find in the links below, but if you are looking for tutorials try these cool articles I found

read more →

Setting welcome page in Rails

09 Mar 2010

In Java/Tomcat I have a web.xml to define a "welcome-page" which usually points to some index.jsp. This means that if my root URL is it will show the page .

read more →

Cleaner Java Code with CGLIB

20 Oct 2009

ASM - allows you to generate byte code at runtime.
It might not mean much to you at the moment, but this is a strong ability.
For example - this ability allowed the creation of the Groovy language.

read more →