Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

How to create a stream from an iterator in java 8

Hi guys! In this post I’ll show you how to convert an java iterator to a java 8 stream. The code is really simple:

Just copy paste this static method in any class you like. It’s generic so you can use this method for all types of iterators. Enjoy!

How to fix Unirest General SSLEngine problem

I tried to post data to a rest service using Unirest (unirest.io). But when I tried to post to an HTTPS url, I got the following error:

To fix this, you could use the following code:

Then, you need to execute the code below before useing Unirest itself:

Hopefully this works for you too. Enjoy

How to create a vertx fat-jar with maven

If you use Vertx, It could be helpful to create a jar or war where Vertx is included. If you use maven. You can add the following code in your pom.xml:

If you integrated Spring, you need to add extra transformers. You can use the following code in your pom.xml for that:

Don’t forget to change ‘com.laurenthinoul….ApplicationMainClass’ to…

How to delete duplicate rows in SQL

To find and delete duplicate rows from a table, you can execute the query below. Note that this is for Oracle. You can use it for other databases but you need to change the ‘rowid’ then.

You need to change the ‘table_name’ by your table name an the ‘column_name’ by your column you want to check on. To explain…

How to enable CORS in Solr

If you are using Solr with Angular or something like that. The browser can be anoying about cross site scripting. To enable CORS in Solr you just have to add the code below in solr-x.x.x/server/solr-webapp/webapp/WEB-INF/web.xml (x.x.x stands for the solr version). Just after the <web-app> tag.