Skip to main content


Showing posts from May, 2016

Kiva - microfinancing to people

Kiva is a nonprofit organization that leverages a network of microfinance institutions on five continents in order to provide microfinancing to people who do not have access to traditional banking systems. Since Kiva’s launch in 2005, the total amount lent through Kiva is $718,839,975, the repayment rate is 98.71%, and the average loan size is $

Stripe, a leading digital payment solutions provider

Stripe publicly launched in September 2011 and initially served customers in the United States. Since the launch, Stripe has expanded its digital payment services to 20 countries including Australia, Canada, Denmark, Finland, Ireland, and the United Kingdom. According to a recent Bloomberg Business article, Stripe has formed several key partnerships with companies including Apple, China-based Alibaba, and Twitter. Stripe is now integrated with Apple Pay, has added support for Alipay to Stripe Checkout, and provides digital payments services for Twitter. In addition, Stripe and Braintree (owned by PayPal), will be handling the payments for Pinterest’s newly launched Buy Button feature.

Google Blogger API Example

// Get the stored credentials using the Authorization FlowAuthorizationCodeFlow authFlow = initializeFlow(); Credential credential = authFlow.loadCredential(getUserId(req)); // Build the Plus object using the credentialsBlogger blogger =newBlogger.Builder(Utils.HTTP_TRANSPORT, Utils.JSON_FACTORY, credential).setApplicationName("").build(); // Make the API blog = blogger.blogs().getByUrl("").execute(); resp.setContentType("text/html"); resp.setStatus(200); Writer writer = resp.getWriter(); writer.append( blog.getDescription()); writer.close();

Alpine Linux is a security-oriented, lightweight Linux distribution

 Alpine Linux is based on musl libc and busybox.
Alpine Linux is an independent stripped down flavour of Linux that’s based on musl libc (pronounce ‘muscle’) and busybox. Apart from being lightweight, it’s also security oriented and uses grsec/Pax which is a security enhancement to the Linux kernel. Simply having less packages and utilities that are otherwise added by default in other distributions also adds to its security.

In addition, Alpine uses its own package manager called apk which is fast and pretty straightforward to use. And Another cool perk is its run-from-RAM feature.

HtmlCleaner - an open-source HTML parser written in Java

HTML found on Web is usually dirty, ill-formed and unsuitable for further processing. For any serious consumption of such documents, it is necessary to first clean up the mess and bring the order to tags, attributes and ordinary text. For the given HTML document, HtmlCleaner reorders individual elements and produces well-formed XML. By default, it follows similar rules that the most of web browsers use in order to create Document Object Model. However, user may provide custom tag and rule set for tag filtering and balancing.

Features Summary
HtmlCleaner parses input HTML and generates tree-structure suitable for programmatic manipulation.Serializers are responsible for outputting the DOM structure to XML, HTML, DOM or JDom.Parsing phase relies on tag descriptions which can be customized by the user.HtmlClaner's behaviour can be configured through number of parameters.HtmlClaner is thread safe, meaning that single instance can clean multiple html sources at the same time.HtmlClaner …

Difference between a tag and a branch in Git

A tag represents a version of a particular branch at a moment in time. A branch represents a separate thread of development that may run concurrently with other development efforts on the same code base. Changes to a branch may eventually be merged back into another branch to unify them.

You tag a particular version so that you can recreate it, e.g., this is the version we deploy to server #1, that is another version we deploy to server #2. A branch is more of a strategy to provide on-going updates on a particular version of the code while continuing to do development on it. You'll make a branch of the delivered version, continue development on the main line, but make bug fixes to the branch that represents the delivered version. Eventually, you'll merge these bug fixes back into the main line.

It is common to mix both branching and tagging. You'll have various tags that may apply to different branches. You can't however have same tag name across different branches.


How to get the parameters of a running JVM

jps -lvm
jps - Java Virtual Machine Process Status Tool

-qSuppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.-mOutput the arguments passed to the main method. The output may be null for embedded JVMs.-lOutput the full package name for the application's main class or the full path name to the application's JAR file.-vOutput the arguments passed to the JVM.-VOutput the arguments passed to the JVM through the flags file (the .hotspotrc file or the file specified by the -XX:Flags=<filename> argument).

How to analyze Java Thread dump

How to register and un-register an MXBean

After you register an MXBean, you can start the jconsole or jmc etc and query the exposed MXBean for the values it contains.
staticpublicObjectName register(String serviceName, String nameName, Object theMbean) { finalMBeanServer mbs =ManagementFactory.getPlatformMBeanServer(); ObjectName name = getMBeanName(serviceName, nameName); if (name !=null) { try { mbs.registerMBean(theMbean, name); LOG.debug("Registered "+ name); return name; } catch (InstanceAlreadyExistsException iaee) { if (LOG.isTraceEnabled()) { LOG.trace("Failed to register MBean \""+ name +"\"", iaee); } else { LOG.warn("Failed to register MBean \""+ name +"\": Instance already exists."); } } catch (Exception e) { LOG.warn("Failed to register MBean \""+ name +"\"", e); …

Blogger variables examples

/* Variable definitions ==================== <Variablename="keycolor"description="Main Color"type="color"default="#ffffff"/> <Groupdescription="Page"selector="body"> <Variablename="body.font"description="Font"type="font" default="normal normal 13px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/> <Variablename="body.background.color"description="Background Color"type="color"default="#000000"/> <Variablename="body.text.color"description="Text Color"type="color"default="#ffffff"/> </Group> <Groupdescription="Links"selector=".main-inner"> <Variablename="link.color"description="Link Color"type="color"default="#888888"/> <Variablename="link.visited.color"description="Visited Color"ty…