Friday, March 8, 2013

Installing the mod_jk in centos

 

$httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Syntax error on line 200 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_jk.so into server: /etc/httpd/modules/mod_jk.so: wrong ELF class: ELFCLASS32
                                                           [FAILED]
 

 To add the repo of mod_jk in cent os

1) cd /etc/yum.repos.d/
2) wget http://jpackage.org/jpackage.repo
3) Edit jpackage.repo and specify 'enabled=1' in the [jpackage-rhel] section
3) if you now do
# yum search mod_jk*

you'll get:

yum search mod_jk
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.hns.net.in
 * extras: mirrors.hns.net.in
 * jpackage-generic: ftp.heanet.ie
 * jpackage-rhel: ftp.heanet.ie
 * updates: mirror.nbrc.ac.in
jpackage-generic                                                                                                                                  | 2.3 kB     00:00   
jpackage-rhel                                                                                                                                     | 2.3 kB     00:00   
jpackage-rhel/primary_db                                                                                                                          | 4.7 kB     00:00   
============================================================================ Matched: mod_jk ============================================================================
mod_jk-ap20.i386 : Tomcat mod_jk connector for Apache 2.0.x
mod_jk-debuginfo.i386 : Debug information for package mod_jk
mod_jk-manual.i386 : Tomcat mod_jk connector manual
mod_jk-tools.i386 : Analysis and report tools for mod_jk

Sunday, October 7, 2012

No need for loop in java using hql and in js using jquery template :)


Hi All,

Most of our people using list in hibernate query for list of maps  and iterating and converting in to list of maps. Instead of that we can reduce the execution cycle and we can improve the performance as well. A special thanks to Mr. Loganathan who is my team met to sharing this article with me.


select c.name, c.orderfrom customer c


In my opinion iterating over lists of Object[] is verbose and error-prone because processing the result-list is directly dependant on the sequence of selected properties in the hql string. If you change the query string you have to change the sourcecode as well.



Check out the following snippet (HQL specific feature):


select new map(c.name as name, c.order as order)
from Customer c

Instead of returning arrays this query will return a list of maps each containing entries with aliases (the keys) to selected values.

Example in our project:

List<Map<String, Object>> itemList = getHibernateTemplate().find("select new map(item.id as id,item.aditmName as name,item.molecule as molecule) from Item as item");

Instead of returning arrays this query will return a list of maps each containing entries with aliases (the keys) to selected values:

[{molecule=ANTIOXIDANTS;MULTIVITAMIN;MULTIMINERAL;METHYCOBALAMINE;, id=ITEM-744786, name=A TO ZTAB}, {molecule=OMEGA3FATTYACIDS;GREENTREEEXTRACT;GINKGOBILOBA;GINSENG;GRAPESEEDEXTRACT;ANTIOXIDANTS;VITAMINS;MINERALS;TRACEELEMENTS;, id=ITEM-744794, name=ABSOLUT  3G CAP}, {molecule=ANTIOXIDANTS;MULTIVITAMIN;MULTIMINERAL;;, id=ITEM-745166, name=CARDIOPLUS CAP}]

JavaScript using jQuery Template:



Example in our project:

$.template("itemListTemplate","<a><dt>${name}</dt><dd><span class='item_id'>${id}</span><p>${molecule}</p></dd></a>");

$.tmpl( "itemListTemplate", response.itemList ).appendTo( "#alternativeMedicineListId" ); 

this generate the html list:

<dl id="alternativeMedicineListId">
<a>
<dt>A TO ZTAB</dt>
<dd><span class="item_id">ITEM-744786</span><p>ANTIOXIDANTS;MULTIVITAMIN;MULTIMINERAL;METHYCOBALAMINE;</p></dd>
</a>
<a class="">
<dt>ABSOLUT  3G CAP</dt>
<dd><span class="item_id">ITEM-744794</span><p>OMEGA3FATTYACIDS;GREENTREEEXTRACT;GINKGOBILOBA;GINSENG;GRAPESEEDEXTRACT;ANTIOXIDANTS;VITAMINS;MINERALS;TRACEELEMENTS;</p></dd>
</a>
<a class="">
<dt>CARDIOPLUS CAP</dt>
<dd style="border: medium none;"><span class="item_id">ITEM-745166</span><p>ANTIOXIDANTS;MULTIVITAMIN;MULTIMINERAL;;</p></dd>
</a>
</dl>

// here response.itemList  is JSON Object
// "alternativeMedicineListId" is id of the list(ex:ul,dl) in jsp
// here i am using definition list

<dl id="alternativeMedicineListId"></dl>

Tuesday, July 31, 2012

To find Database Size or table wise memory allocation using query in mysql.


To find Database Size using query in mysql.

The following mysql query is used to find the database size in Mb.

With the use of information_schema we can get it done easily.

SELECT SUM(ROUND(((data_length + index_length) / 1024 / 1024),2)) AS "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "----Your DB Name---";

In this we can also have table wise memory occupation with the use of following query.


SELECT TABLE_NAME, table_rows, data_length, index_length, 
ROUND(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = " "----Your DB Name---";

Thanks,

Ramanavel Selvaraju.

Tuesday, January 24, 2012

How to find installed yum packges on centos?

Hi All,

How to find installed yum packges on centos? Its very simple. Just give the following command on you teriminal.

$ yum list installed | grep <package_name> | cut -d' ' -f1

Thanks,
Ramanavel Selvaraj

Getting File Browser with superuser privileges in UBUNTU

Hi All,

How to open a file browser with superuser privileges in UBUNTU?

Its very simple just open a file browser  and press Alt + F2.

And type as  

gksu nautilus

Thats it You got the File Browser now.With superuser privileges ENJOY!!!!.


Thanks,
Ramanavel Selvaraj

Completely Uninstalling the mozilla firefox from ubuntu

Hi All,

To uninstall the mozilla firefox from the ubuntu machine just follow the instructions. Its all just easy to remove.

1. Removing via synaptic package manager

Go to System=>Administration=>Synaptic Package Manager

Search as firefox if that returns any installed packages of firefox just right click and choose completely remove  and the click apply. Then the firefox package will completely get uninstalled.

2.Uninstalling via Teriminal


$ sudo apt-get purge firefox


3. Removing temp files of firefox


After uninstalling firefox you have to remove the temp files of firefox for that just Run


$ sudo rm -rf /home/<user>/.firefox /home/<user>/.macromedia  /home/<user>/.adobe /etc/firefox/ /usr/lib/firefox/


Just restart the system you will get firefox cleared.


To get older versions of firefox just follow the link.


ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases


Thanks,
Ramanavel Selvaraj.

Installing windows fonts (Arial) on CENT-OS,FEDORA and UBUNTU

Hi All,

Installing the windows fonts on CENT-OS,FEDORA and UBUNTU for this you have two main packages they are rpm-build and cabextract you can install these packages via yum. If cabextract is not available on yum packages means we can download the rpm and install. Please follow the instruction to get microsoft fonts.

For CENT-OS/FEDORA

1. Installing Dependencies:

sudo yum install rpm-build cabextract

or download the cabextract from the follwing link,

www.cabextract.org.uk/cabextract-1.4-1.i386.rpm

TO install rpm package:

$ rpm -ivh cabextract-1.4-1.i386.rpm

2. After installing this rpm we can download the  msfonts spec file from the following link.

$ wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

3. Build the RPM

$ rpmbuild -ba msttcorefonts-2.0-1.spec


if any problem occur while build change the mirror url in spec(Line no:63) :

mirror="http://switch.dl.sourceforge.net/sourceforge/corefonts/"

The mirrors will very busy and some times it will not redirect properly so you can try several times untill its get succeeded. Don't loose your confidence. If you very luck you will get in first time itself. Good luck for that.

4. Install the RPM

$ rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

For Ubutu:


1. You can get from aptitute install 

sudo aptitude install msttcorefonts

Thats all, now you have installed your new windows fonts on your system, you can start using them immediately in you Open Office, or in any other application, I have tested on Fedora, Ubuntu, Debian with Gnome and KDE.

Thanks,
Ramanavel Selvarj