Wednesday, June 9, 2010

Cpanel: Apache + Tomcat + simple web application



Since 2 days i was struggling to deploy a spring based webapplication on a shared hosting server.
I had access using cPanel but was struggling somehow to get it work even though JSP/mod_jk was enabled on my servlet. After 2 days of research it was just two simple things which fixes the issue.

Without adding too-much of prologue, let me put it straight.

Following are the two things which needs to be done to make your spring-web-app work on shared hosting server.

1) Created a .war file of my application and put it into the /public_html directory.
2) Also added the following lines to the .htaccess file inside /public_html

###########################
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
###########################

The above settings will be enough if anyone wants to deploy a web-application with spring-framework on cPanel :)

Provided, mod_jk is enabled on your server so that apache understand these requests.

*Your application should be accessible using the foll url:
http://server_name/app_name/blah.jsp

*Depending on the directory structure of ur application.

Special thanks to the person who posted this

and this pdf from cPanel



Happy coding... :)

Saturday, September 13, 2008

configure idea GPRS

After trying out Airtel GPRS for an year and half i have now planned to move on to Idea connxn recently.  Last week i was struggling with configuring my new Idea GPRS connection...

Even after putting all the settings in place, i was still getting connection failure errors. 

Reason :- my modem configuration was set for airtel gprs . which was the culprit.

I connect to my laptop using bluetooth..

Solution : -
  1. Go to Control Panel > Select Phone & Modems > Select the Required Modem (Bluetooth DUN Modem) > Go to Properties of that Modem > Select Advance TAB & insert Extra Initialization Command (AT+CGDCONT=1, "IP", "INTERNET")

this command for Airtel is somewhat like this...
(AT+CGDCONT=1,"IP","airtelgprs.com"")

Wednesday, June 18, 2008

PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysql.dll' - The specified procedure could not be found.

Well, i m highlighting this line, so that you all vl know the intensity with which this one has bugged me. Yeah, i was struggling with this one for 3 looooooonnnnnnng days.. After trying my hand @ jsp now jus came in the php-room to have a lil bita dancing in the party.. ;D... well, first i installed php5+apache2.2+mysql5.0.41. It was gr8 to see the hello world on my browser. I then thought of creating a small application insert, update, delete. But guess what?? i started getting the above error. After a lotta googling around, on 90% of the forums i found only a single answer, i.e. this bug is with the libmysql.dll supplied with Mysql, so weel have to use the libmysql.dll supplied with the zip installer.
Reinstalled php using php zip package, but no luck.
Only solution to this i found on somewhere third page of a google result was resolve this error using the Apache way.
Jus add following lines to ur Apache httpd.conf file and it does it all. No need to copy any dll's.

LoadFile "C:/Software/PHP/libmysql.dll"
PHPIniDir "C:/Software/PHP/"

LoadModule php5_module "C:/Software/PHP/php5apache2_2.dll"


Well, what apache does is its loads the specified dll before any one else search for it. Thanx to Apache and Sander for finding this out. Well this guy has kept his comments Off, so i cudnt thank him on his blog.. No matter. Now my php5+mysql5.51+Apache2.2 on Windows is working like a Maska [Desi word for smooth ;)]

Please change your directory accordingly in the path. Above code is specific to my settings.
Tip: Dont rely on the MSI- Installer of php. Windows go mad, use the zip installer, works gr8!

njoy ;)

Wednesday, June 11, 2008

InnoDB v/s MyISAM

InnoDb
1) recovers from crash/ shutdowns by replying its logs. Hence, InnoDB approach is approximately fixed time.
2) Caches reads and writes to data rows within the engine itself.
3) Stores data rows physically in primary key order. Uses MS SQL Server featrue of "Clustered Indexes."
4) Doesnt support compression and terse rowformats.
5) Can be used for tables which needs performance and data security.

MyISAM
1) fully scans and repairs any indexes which had been updated. Time taken using MyISAM approach depends on the size of the data files.
2) Relies on OS for caching reads and writes to data rows.
3) Stores data rows mostly in the order in which they are added. Uses Oracle feature known as "Index Organized Tables".
4) Support compression and terse rowformats.
5) Can be used for tables which are used for search purposes.


The last point is possible b making the database as InnoDB and selective tables in that DB as MyISAM. This is possible in MySQL

Monday, June 9, 2008

Cools gadgets : Digital Photo Keychain


Hi folks, the world is becoming smaller, closer and more compact... and all this is possible coza technology.. Every where we can see small gadgets which are self running. Every gadget has a tiny lil silicon chip, which does all the dirty work.. Right from mobile phone to our iPod's.. everything has a chip in it.. Last week i found a similar gadget which is very tiny but vei vei handy.. Well this gadget sits inside an attractive Digital Photo Keychain and has a 1.5inch 128X128 LCD display. Apart from this it has 4.8 MB internal memory which can store abt 72 pictures with formats supporting JPG, BMP, GIF, PNG. A slideshow with adjustable slide time, time display, auto cropping of pictures, rechargeable battery. And guess what it weighs jus 85gms... gr8 isnt it??? So.. how about changing ur key chain pics daily as if u change ur clothes... :P...

Wednesday, June 4, 2008

Apache + Tomcat + mod_jk.. how does it work...

In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Load the servlet container adapter library and initialize it (prior to serving requests). When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it. The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. Things are even more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs.

Sunday, May 4, 2008

Installing ROR on linux

1) Install Ruby
yum update
yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql


2) Get Gem

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz


3) Install Gem

tar -xvzf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb
cd ..


4) Install Rails

gem install rails --include-dependencies


5)
Install MySql
yum install mysql mysql-server

6)
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start