Aseem Bansal

I am Aseem Bansal, working as a Senior Engineer in Technology Division at TO THE NEW. Please go through my posts below.

Big Data, Java/JVM

When you take your Machine Learning Models to Production for Real Time Predictions

Problem We had a use case where we needed to use machine learning to make predictions in real time. To give an estimate of what we consider real time - latency less than 10 milliseconds for our predictions. In this blog, we would discuss what is needed to have the kind of latency for machine learning models that we can use in production....

06-Jun-2017

Grails, Java/JVM

Day 1 of Gr8Conf IN 2017 – A Groovy Start to the Year

GR8Conf IN 2017, the second Indian edition of the GR8Conf was held on the first week of January in New Delhi. GR8Conf is an independent series of conferences in India, Denmark and the US that are dedicated to the Groovy and Grails community. The 2-day conference was attended by over 200 Groovy and Grails enthusiasts and technocrats...

13-Jan-2017

Technology

How to Reduce the Number of Druid Segments?

We have been using Druid in our project for a while and had shared our experiences during GIDS. It has given us great results as it powers our real-time dashboards, reports on running Ad campaigns and provides real-time data to make quick decisions. But like any other databases there will be times when it needs to be optimized. This is...

15-Dec-2016

Automation Testing, Technology

Javascript to groovy objects in GEB functional test cases

Use Case While writing functional tests sometimes we need to test whether a certain javascript objects have some particular values. If we have a JavaScript object such as in our page [code] var myObj = { attr1 : 'attr1-val', attr2 : 'attr2-val'}; [/code] then after reaching that page we can execute the below in our GEB spec...

02-Dec-2015

Java/JVM, Technology

Structured logging in logback using MDC

General Use Case When any application fails in production then it is necessary is to track how the execution went. For this the standard approach is to add logs. Logs can be helpful in tracking how the execution went but tracking the execution becomes more difficult in multithreaded applications. The logs start to get jumbled for...

24-Nov-2015

Java/JVM, Technology

Runnables with Timeout from submission time

Problem not covered by Java ExecutorService Java's ThreadPoolExecutor is a great tool. After configuring a thread pool we can keep on submitting Callables and get Futures. These futures can be used to get the values that the callable is supposed to return. In case we want to limit the execution time of this callable we have the...

05-Nov-2015

Technology

Regex in groovy

Groovy Language enhancements that help with Regex Slashy Strings is the first thing that comes to my mind while talking about regex in Groovy. They are a simpler way to represent regex patterns as String compared to their Java counterparts. If we have to find all numbers in a String we can do something like this in Java [code] ...

05-Nov-2015

Java/JVM, Technology

Why you should stop using underscore as variable name in Java

There is a programming practice in many languages that if in a function call you don't care about the variable's value then use _ to denote this. This convention is usually used where lambdas are used. Some people may be using this in Java also. If you are using it then you should stop. You must be asking why? Simply because underscore...

15-Sep-2015

Automation Testing, Grails

Automatically run test suites and coverage reports for open-source grails projects using Travis CI and coveralls

Automated testing helps a lot in maintaining the quality of code. But setting up CI environments like Jenkins may seem like a hassle if you are working on small projects. Luckily for us there is a simple solution, at least for open-source projects hosted(or mirrorred) on github. Travis CI is a service freely offered to make builds...

05-Jun-2015

Grails

Adding interactive charts to web pages using Highcharts

I recently had to add charts to a web page in my project. I used Highcharts library for this. It is very dynamic allowing you to change graphs even after the chart has been drawn. To display a graph we need a div with an ID. Let's say we have div with ID "chartDivId" and we want to display two lines in the chart. We can use the...

26-May-2015

Grails

Reusing grails Criteria for multiple domains using Closure.delegate

I recently had a situation where I had the exact same criteria in multiple domains. I found a way to DRY them using Closure.delegate. I wanted to share that in this post. Just including the relevant details the domains that I had were like the following. [code language="groovy"]class Subscription { static belongsTo = [topic:...

12-Apr-2015

Technology

Why are atomic commits a best practice in Git?

Atomic means all or nothing - either everything succeeds or all fails. Git is known to have atomic operations i.e. an environment issue will not cause git to commit half of the files into the repository and leave the rest. So what are we doing talking about atomic commits when all operations are already atomic in git? When we talk...

15-Feb-2015