tips
JFreeCharts – Add subtitle with different fonts
Jun 17th
This little snippet adds subtitle to jfreechart.
JfreeChart chart = ChartFactory.createBarChart("Title Goes Here",....); chart.getTitle().setFont(new Font("Tahoma", Font.BOLD, 20)); TextTitle dataTitle= new TextTitle("This is subtitle"); dataTitle.setHorizontalAlignment(HorizontalAlignment.CENTER); dataTitle.setFont(new Font("Verdana", Font.ITALIC, 18)); chart.addSubtitle(dataTitle);
Install Perl modules without root access
Jun 17th
Sometimes we need to install perl modules on a machine where you dont have root (sudo) access. Here are the steps to install perl modules as a normal user
- Get Source package from search.cpan.org ( Example -> http://search.cpan.org/~pythian/DBD-Oracle-1.24b/Oracle.pm)
- Extract the content into your local directory.
- Navigate to the extracted directory ( Ex- cd /home/ukanth/oracle )
- Now compile the source using the following command
perl Makefile.PL PREFIX=/home/ukanth/oracle-perl-module
This will override the default installation directory.
Then,
makeand
make install
If you don’t find any error in the installation, you are now ready to use it in your perl program.
use lib '/home/ukanth/oracle-perl-module/lib/site_perl/5.8.3/i686-linux-thread-multi'
This is very simple way to install perl modules to custom directory( where you have read/write access ) .
Connect Oracle DB from Python
Mar 15th
Simple steps to connect to oracle database from windows operating system.
Requirements:
To connect to oracle we need either oracle client installed on your local machine or instant client from oracle ( recommended , if you don’t have oracle client)
Get the proper version of Python and cxOracle versions ( I’ve used Python 2.6.4 with cxOracle 5.0.2 and Oracle 10g ) . If you have installed everything , get the oracle instant client and extract to your local folders.
Say example , I’ve extracted it to c:\insOracle\
Now, We should create or update ORACLE_HOME and PATH variable for instant client.
from console ,
set ORACLE_HOME = C:\insOracle\ PATH = %PATH%;C:\insOracle\
Or you can add it to your system path using windows path editor.
That’s it. Now we can connect to oracle from python. Make sure that you don’t use “;” at the end of your queries from python.