Skip to main content


Showing posts from May, 2012

Capture website screenshots in PHP using grabzit library

Near about 1 year ago, one of our project’s requirement was to take screenshot of some website pages at run time and save them, but at that moment our team didn’t find any proper solution. Today while I was going through Google Reader found a article “ Sreenshots in PHP with GrabzIt ”, went into detail of that and found useful. Although it’s properly documented on the website even then I will try to summaries in few easy steps. 1)  Register yourself : 2)  After successful completion of registration you will get Application Key and        Application Secret . Store it somewhere. 3)  Download Simple PHP Library from : 4)  Assign write and read permissions to images folder. 5) G o to GrabzItConfig.php file and set the values of configuration variables :      $grabzItApplicationKey , $grabzItApplicationSecret and       $grabzItHandlerUrl . 6)  Run index.php file. It will show you all the screensho

Draw 3D Line Chart Using JFreeChart in Java

Hi all, following is the example of how to draw 3D Line Chart in Java using JFreeChart library. /*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package drawgraph; /**  *  * @author sshankar  */ import java.awt.Color; import java.awt.Dimension; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import; import; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities; import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryLabelPositions; /**  * A simple demonstration application showing how to create a line chart using data from a  * {@link Ca

Shell Script to export MySQL table data into a text file

Hi, our today's topic is " Write Shell Script to export MySql table data into a text file ". I will try my best to explain each and everything in steps. Let's start : Following is full shell script   #(1) define variables DBNAME=test FNAME=/usr/tmp/$(date +%Y.%m.%d)-$1.txt #(2)creates an file with column names seperated by comma in a single line mysql -u$2 -p$3 $DBNAME -B -e "SELECT COLUMN_NAME FROM information_schema.COLUMNS C WHERE table_name = '$1';" | awk '{print $1}' | grep -iv ^COLUMN_NAME$ | sed 's/^/"/g;s/$/"/g' | tr '\n' ',' > $FNAME #(3)appends newline to mark beginning of data vs. column titles echo "" >> $FNAME #(4)dumps data from DB into /usr/tmp/tempfile.txt mysql -u$2 -p$3 $DBNAME -B -e "SELECT * INTO OUTFILE '/usr/tmp/tempfile.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' FROM $1;