Thursday, November 1, 2012

How to find table size in MySql using workbench?

If you want to calculate memeory usage of all yout tables in your database as we did in mysql admintrator tool then simply the following query:


SELECT table_name "Tables",
( data_length + index_length ) / 1024 /
1024 "Table Size in MB",
( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
where table_schema="YOUR SCHEMA NAME"

You need to change only the SCHEMA NAME only.

Try it and let me know your feedback.

Enjoy!!!

Thursday, March 29, 2012

If you want to generate pdf from HTML on Ubuntu and try to search the tool for the same, you will find lots of tools for it. But wkhtmltopdf is the best one among them. 

So please follow these steps to install wkhtmltopdf along with qt4 that can convert rich javascript graphs into pdf.

Step 1: First install the dependencies
          sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libqt4-dev qt4-dev-tools
Step 2: Install wkhtmltopdf
     sudo apt-get install wkhtmltopdf
Step 3: Test the installation
      wkhtmltopdf http://www.highcharts.com/demo test.pdf
  
If you are using highchart and facing issue related to segmentation fault then try after disabling animation as mentioned 
in the follwoing code:
 
<script type="text/javascript" charset="utf-8">
 
  var chart = new Highcharts.Chart({
      chart: { renderTo: 'container' },
 
      // These make it work nicely with wkhtmltopdf
      plotOptions: { series: { enableMouseTracking: false, shadow: false, animation: false } },
 
      xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct'] },
      series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1] }]
 
  });
 
</script>
 
Have fun with wkthltopdf !!!!