Posts

Showing posts from January, 2018

Experiential learning

I have always challenged myself to learn. In fact that's an ingredient that keeps my own sanity in place. There are days when there is no learning and just doing. Those are the kind of days I really dislike. For last nine months I have learnt to become a full stack web-developer from having an absolute zero background in software development. In this post, I want to shed some light on the way I learned and how I feel right now. I am especially going to focus on the ways you can learn anything new, maybe this is contextually more related to technology skills, but nonetheless its an interesting insight into how some of us manage to learn new things with 'ease' and some keep going through perennial struggle and mostly just give up. Just Do It Yeah, that's right. The best way to teach yourself something completely new and complicated is to just observe how it translates into reality. When we are talking about technology there is no better way to learn systems and fram

WIKIPEDIA API and ChatBots

I have been trying to use ontological bases in my chatbot to introduce interactivity which can take the conversation forward. What I have till now : Any user query is parsed by an NLP engine to classify if the intent is any one of the preset intents. Some of these preset intents are greetings, compliments, tasks assigned in the Talentify for Business app amongst a few. If none of the intents are matched then the user query is passed in sequence to various search engines and their web results are scraped to get a metadata response generated by the search engine, which usually is a representation of the internal knowledge graph of the search engine implementation. If none of the search engines can identify that query, then the query is passed to a knowledge engine called wolfram alpha which in most of the cases can give response to even very complex queries like "what is the distance between Chennai and Bangalore in kilometres" If even that fails then a default random

Getting same MD5 from java and javascript

Java: try { String plaintext = "test123"; MessageDigest m; m = MessageDigest.getInstance("MD5"); m.reset(); m.update(plaintext.getBytes()); byte[] digest = m.digest(); BigInteger bigInt = new BigInteger(1, digest); String hashtext = bigInt.toString(16); // Now we need to zero pad it if you actually want the full 32 chars. while (hashtext.length() < 32) { hashtext = "0" + hashtext; } System.out.println(hashtext); javascript: var MD5 = function(s){function L(k,d){return(k<<d)|(k>>>(32- d))}function K(G,k){var I,d,F,H,x;F=(G&2147483648);H=( k&2147483648);I=(G&1073741824) ;d=(k&1073741824);x=(G& 1073741823)+(k&1073741823);if( I&d){return(x^2147483648^F^H)} if(I|d){if(x&1073741824){ return(x^3221225472^F^H)}else{ return(x^1073741824^F^H)}} else{return(x^F^H)}}function r(d,F,k){return(d&F)|((~d)&k)} function q(d,F,k){return(d&k)|(F&(~k))} function p(d,F,k){return(d^F^k)} function n(d,F,

Using cookies with HttpURLConnection

Before the advent of REST, we services were stateful. There were cookies sent with every HTTP request to maintain the state of the client using the services. When we use HttpURLConnection (Java) we need to discretely mention the cookies in the header and store it somewhere for maintaining the session. Below is an attempt using a singleton class for maintaining the session details and some sample HTTP methods: First our Singleton to maintain the cookies in memory between successive transactions: package singletonCookieManager; import java.net.CookieManager; /**  * @author absin  *  */ public class EaqerInitializedCookieHelper { private static final CookieManager instance = new CookieManager(); // private constructor to avoid client applications to use constructor private EaqerInitializedCookieHelper() { } public static CookieManager getInstance() { return instance; } } Next, wherever you want to use this class initialize it as such private static jav

ehCache getting Started

First create a singleton class (CacheHelper) to return an instance of cache: package cache; import org.ehcache.Cache; import org.ehcache.CacheManager; import org.ehcache.config.builders.CacheConfigurationBuilder; import org.ehcache.config.builders.CacheManagerBuilder; import org.ehcache.config.builders.ResourcePoolsBuilder; import com.istarindia.android.pojo.ComplexObject; public class CacheHelper { private CacheManager cacheManager; private Cache<Integer, ComplexObject> squareNumberCache; public CacheHelper() { cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(); cacheManager.init(); squareNumberCache = cacheManager.createCache("squaredNumber", CacheConfigurationBuilder .newCacheConfigurationBuilder(Integer.class, ComplexObject.class, ResourcePoolsBuilder.heap(10))); } public Cache<Integer, ComplexObject> getSquareNumberCacheFromCacheManager() { return cacheManager.getCache("squaredNumber", Int