Skip to content

Instantly share code, notes, and snippets.

@tirthb
tirthb / gist:5366126
Created April 11, 2013 18:52
Neo4j cypher query to remove orphan nodes i.e. nodes with no relationships
START n=node(*)
WHERE not(n-[*..2]-())
DELETE n;
/**
* Get Company Alias of Apple
* @return
*/
public static Set<CompanyAlias> getCompanyAlias(){
@tirthb
tirthb / SingleThreadWithTimeout.java
Last active December 15, 2015 06:39
Recently, I was working towards making a web app more robust. The web app depended on auxiliary API's and databases. I wanted the web app to be operational even without these auxiliary sources. Ajax was not the way to go for SEO reasons. The TimeoutException was taking more than ten seconds to appear. The solution was to implement a single threa…
package any.pack.age;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;