Skip to main content


Showing posts from April, 2012

Example to draw LineChart using JFreeChart in Java

JFreeChart   provides pretty good library to draw graphs in Java. As the documentation is paid you would have to struggle a lot to find the solution as per your requirements albeit simple examples are easily accessible. My requirement was also bit different than simple ones so made some efforts to achieve this. Following is an example of line chart with series. So i have names it "". I had tried my best to cover everything related to line chart in this example, using proper documentation. //Code Starts here /*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package jfreecharts; /**  *  * @author sshankar  */ import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.Stroke; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree

PHP Associative Arrays and Hashtable

Our today’s topic is how associative arrays are implemented in PHP. Let’s  discuss over it…. Basic Arrays in C   Let’s take an example of basic array in C where index or key is always an integer. It can’t be string. All the arrays start from index 0 and ends at index (n-1), where n is the number of elements in array. All the elements are stored in continuous memory locations. For example first element at memory location 0 and 10 th  element on 9th location.  This is the basic array of C.  What is Hashtable?   A hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys (e.g., a person's name), to their associated values (e.g., their telephone number). Thus, a hash table implements an associative array.  We will go into detail of this in next few minutes.. What is Hash Function? The hash function is used to transform the key into the index (the hash) of an array element (the slot or bucket) where the corre

Understanding OAuth

In this post we are going to discuss over   OAuth, it’s use and the workflow etc. Although it’s not easy to sum it up in just one post but i will try my best to cover it. I am using Oauth 1.0 to explain it. What is OAuth Oauth is an open standard for authorization. Today most of the third party application use this terminology for user authorization.  As per Wikipedia  “ OAuth is an open standard for authorization. It allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their credentials, typically supplying username and password tokens instead. Each token grants access to a specific site (e.g., a video editing site) for specific resources (e.g., just videos from a specific album) and for a defined duration (e.g., the next 2 hours). This allows a user to grant a third party site access to their information stored with another service provider, without sharing their a