Posts

Showing posts from August, 2014

Unique unconventional Arty Farty gift options in Bangalore

Image
A list of unique arty-farty  gift options in Bangalore. Caricature from BLOT STUDIO Contact them at: callofthecartoons@gmail.com , blotstudio.2010@gmail.com      Blot Studio is a one stop shop catering to all your creative needs delivered with utmost professionalism. Established in 2002, the studio has catered to various clients - corporates as well as individuals. We rely upon detailed ideation, artistic illustrations and a passionate approach in our efforts to achieve creative brillia nce. Furthermore, we seek to build a collaborative relationship with those with whom we work. At Blot Studio we strive to enhance our vision with every project we undertake. Our studio comprises of artists who are experienced, witty and creative. It shall always be our endeavor to provide quality work within available time frames and budgets. Charcoal Painting by PENCIL CHAAP Phone 9902857298 Email bindra.ashmeet @gmail.com Look at the world with

Setting up development environment on Mac with Python and Virtual Environment.

Install virtual environment. pip install virtualenv Create a virtual environment. virtualenv venv Activate your virtual environment. source venv/bin/activate Deactivate your virtual environment. deactivate

Java Merge Sort Source Code

I was not able to find a good implementation of merge sort in java as most of the implementations online didn't use comparable and have flags for sorting direction, so I decided to write one of my own. import java.util.Arrays; public class MergeSort { public static void main(String[] args) { Integer[] a = new Integer[] {3,2,1,4,2,7,1,3,4,5,6,8,9,6,7,8}; sort(a, false ); System. out .println(Arrays.toString(a)); sort(a, true ); System. out .println(Arrays.toString(a)); } public static void sort( Comparable [] list, boolean asc) { Comparable[] aux = new Comparable[list. length ]; mergeSort(list, aux, 0, list. length -1,asc); } private static void mergeSort( Comparable [] list, Comparable [] aux, int start, int end, boolean asc) { if (end <= start) { return ; } int mid = (start+end)/2; mergeSort(list,aux,start,mid,asc); mergeSort(list,aux,mid+1,end,asc); merge(list,aux,star

Simulate the roll of a bias or weighted dice.

Image
Recently I can across this problem and find it really interesting, so i thought why not write a code and share it. There is a probability distribution given for a n sided dice in form an array. Write a code in java to simulate the roll of dice? I came up with a solution initially which I am not proud of involving caching the outcomes and then based on that rolling the dice. But some googling pointed me finally to this Stackoverflow post: http://stackoverflow.com/questions/5850445/simulating-a-roll-with-a-biased-dice Which explains the algorithm for the same: 4 down vote accepted In general, if your probabilities are {p1,p2, ...,p6}, construct the following helper list: {a1, a2, ... a5} = { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4, p1+p2+p3+p4+p5} Now get a random number X in [0,1] If X <= a1 choose 1 as outcome a1 < X <= a2 choose 2 as outcome a2 < X <= a3 choose 3 as outcome a3 < X <= a4 choose 4 as outcome a4 < X

Setting up Google Apps to receive emails on multiple domain.

Many times we have multiple domains for our business like domain.in,domain.co.in and domain.com. And our customers usually make mistakes while tying email as mixing up various domain. So, its important for us to receive all the mails on various domains on the same inbox. This can be achieved in Google Apps environment. To do this : Login to the the control panel of google apps   https://www.google.com/a/ cpanel/ Click on the More Controls at the bottom of your page. Select Domains. Click Add a Domain alias. Enter your new domain. Verify the domain. To do this you would have to login with Google Webmaster Tools account and add google app admin as an owner for that domain. Once the domain is verified add the MX Records. In Big Rock I DNS Management control panel I was getting a weird error as conflict with the CNAME record. For this I modified my @ CNAME record temporarily adding * in place of @ and then added all the MX records based on following table and then re modifi

Sun JDK Java 6 to OpenJDK Java 7 recompilation on Ubuntu 12.04 and movement to Jetty 9.x

Recently I took up a task of moving our old project from Sun Java 6 to Open Java 7. As such our project was using Spring, Hibernate, GWT and many more libraries. There was a lots of fingers crossed when we took up this task, as we did not know the kind of impact it can lead to varying from refactoring to performance. Kind of refactoring attempt which it took: To begin with we need to do a change in our DataSource implementation as  javax.sql.CommonDataSource has added a new method getParentLogger() . So we had to override that method in our class definition.            import java.util.logging.*;           public Logger getParentLogger() {                     return null;           } org.apache.commons StringUtils.join now takes an iterator then list. So we need to pass List.listIterator over there.           StringUtils.join(List.iterator(),..) There were project where maven-war plugin was not specified, that was leading us to problems. A specific pom entry