{{ message }}

Instantly share code, notes, and snippets.

# Parlinggoman Hasibuan linggom

Last active Aug 29, 2015
View gist:9762847
 /* Combine tab into actionbar, i'm using pager sliding tab strinb (https://github.com/astuetz/PagerSlidingTabStrip) */ package com.srin.flores; import android.app.ActionBar; import android.content.Context; import android.os.Bundle;
Created Mar 26, 2014
View gist:9776475

Created Apr 25, 2014
View gist:11286094
 Problem Statement Cat Taro has N cards. Exactly two integers are written on each card. You are given two int[]s first and second, each with N elements. For each i, the element first[i] represents the first integer on the i-th card, and the element second[i] represents the second integer on the i-th card. It is known that for each x from 1 to N, inclusive, there is exactly one card with the first integer equal to x. In other words, all elements of first represent a permutation of integers from 1 to N, inclusive. On the other hand, second may contain duplicates, but all elements of second are only between 1 and 10, inclusive. You are also given an int K. Taro wants to choose some subset of the cards (possibly none or all of them) in such a way that the total number of different integers written on the cards is less than or equal to K. Return the total number of ways to do that. Definition
Created Sep 4, 2014
View gist:4f3069210c74a3bbfd90
 public double findSuitableDensity(int[] v, int[] w) { int s=v.length; double[] d= new double[s]; for(int i=0; i
Last active Aug 29, 2015
View MapUtil.java
 /** * An utility to encode the point in GoogleMap API * Reference see this {@link https://developers.google.com/maps/documentation/utilities/polylinealgorithm?csw=1} * @author SRIN * */ public class MapUtil { /** * Step 1 : Take the decimal value and multiply it by 1e5, rounding the
Created May 8, 2015
View UserBasedRecommendation
 package com.company; import lombok.extern.slf4j.Slf4j; import org.apache.mahout.cf.taste.common.TasteException; import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator; import org.apache.mahout.cf.taste.impl.model.file.FileDataModel; import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood; import org.apache.mahout.cf.taste.impl.neighborhood.ThresholdUserNeighborhood; import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender; import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
Last active Mar 5, 2016
View sanitize_the_number.py
 import datetime def convert_from_string(number): nums = number.split(".") real_num = 0 count = len(nums) for idx, num in enumerate(nums): if idx < count - 1: real_num += int(num) * (1000**(count - idx - 1))
Created Aug 6, 2016
View response.json
 { "keywords": [ [ "boarding pass qr code spoofing software", 26.10909090909091 ], [ "improved boarding pass authentication systems", 22.90909090909091 ],