Saturday, June 1, 2013

These steps are COPIED from this URL http://meandmyubuntulinux.blogspot.com/2012/05/installing-oracle-11g-r2-express.html all the credit goes to above user
1) Download the Oracle 11gR2 express edition installer from the link given below: http://www.oracle.com/technetwork/products/express-edition/downloads/index.html ( You will need to create a free oracle web account if you don't already have it ) 2) Unzip it :
cd ~/Downloads/INSTALL
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
# It unzips into sub-dir called "Disk1"
3) Install the following packages :
sudo apt-get install alien libaio1 unixodbc vim
4) Convert the red-hat ( rpm ) package to Ubuntu-package :
cd ~/Downloads/INSTALL
sudo alien --scripts -d Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm
#(Note: this may take a while , till that time you can go for step 5 )
5) Do the following pre-requisite things:
sudo vi /sbin/chkconfig
#(copy and paste the following into the file )

#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01
5a) Save the above file and provide appropriate execute privilege :
       chmod 755 /sbin/chkconfig
5b) Set the Kernel parameters : Oracle 11gR2 XE requires to set the following additional kernel parameters:
sudo vi /etc/sysctl.d/60-oracle.conf 
#(Enter the following) 


# Oracle 11g XE kernel parameters  
fs.file-max=6815744  
net.ipv4.ip_local_port_range=9000 65000  
kernel.sem=250 32000 100 128 
kernel.shmmax=536870912 

##(Save the file) 
Note: kernel.shmmax = max possible value , e.g. size of physical RAM ( in bytes e.g. 512MB RAM == 512*1024*1024 == 536870912 bytes ) 5c) Verify the change :
sudo cat /etc/sysctl.d/60-oracle.conf 
Load new kernel parameters: 
sudo service procps start  
Verify: sudo sysctl -q fs.file-max 
       -> fs.file-max = 6815744 
5d) make some more required changes :
ln -s /usr/bin/awk /bin/awk 
mkdir /var/lock/subsys 
touch /var/lock/subsys/listener 

6) Now you are ready to install Oracle 11gR2 XE. Go to the directory where you created the ubuntu package file in Step 4 and enter following commands in terminal :
cd ~/Downloads/INSTALL
# the deb file will be created at this dir, in above steps
 sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb 

6b) This isimportant step
Efore doing this make sure to close all other programs running , they may crash, if shared-meemory is being used
sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm
(here size will be the size of your RAM in MBs ). The reason of doing all this is that on a Ubuntu system /dev/shm is just a link to /run/shm but Oracle requires to have a seperate /dev/shm mount point.
6c) To make the change permanent do the following : create a file named S01shm_load in /etc/rc2.d :
sudo vim /etc/rc2.d/S01shm_load
#Now copy and paste following lines into the file :

#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
       touch /var/lock/subsys/listener
       rm /dev/shm 2>/dev/null
       mkdir /dev/shm 2>/dev/null
       mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
   exit 1 ;;
esac 

6d) Save the file and provide execute permissions :
 sudo chmod 755 /etc/rc2.d/S01shm_load 

6e) Configuring Oracle
sudo /etc/init.d/oracle-xe configure 
Enter the following configuration information:
A valid HTTP port for the Oracle Application Express (the default is 8080)  
A valid port for the Oracle database listener (the default is 1521) 
A password for the SYS and SYSTEM administrative user accounts
Confirm password for SYS and SYSTEM administrative user accounts
Whether you want the database to start automatically when the computer starts (next reboot).
the output will be something like this
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

7) Before you start using Oracle 11gR2 XE you have to set-up more things : a) Set-up the environmental variables : Add following lines to your .bashrc :
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH

7b) execute your .profile to load the changes:
     
          . ./.profile

8) Start the Oracle 11gR2 XE :
sudo service oracle-xe start

The output should be similar to following :
user@machine:~$ sudo service oracle-xe start
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
user@machine:~$

8) Create your user :
SQL> create user xxxx-username identified by yyyyy-password;
User created.
SQL> grant connect,resource to xxxx-username;
Grant succeeded. 

9) Now as you have created the user , you can login to it :
SQL> select 2+2 from dual;

2+2
----------
4

Friday, April 19, 2013

extjs 4 links

BEST MVC http://www.mysamplecode.com/2012/06/extjs-check-browser-type-version.html

cd ~/.config/sublime-text-3/Packages

git clone https://github.com/jdc0589/JsFormat.git
restart ST3
Ctrl+Shift+P, then "Format:Javascript"



http://www.mysamplecode.com/2012/04/jquery-ajax-request-response-java.html

http://www.mysamplecode.com/2012/08/sencha-touch-search-field-example.html

http://www.mysamplecode.com/2012/07/linux-tips-and-tricks-beginners.html

http://www.mysamplecode.com/2012/06/extjs-button-click-example.html

http://www.mysamplecode.com/2012/06/extjs-date-manipulation-add-subtract.html

BEST for me 

Thursday, April 18, 2013

reverse proxy for jetty 9 with nginx


========jetty 9  docs =========
http://wiki.eclipse.org/Jetty_Expanded_Webapp_Deploy
http://wiki.eclipse.org/Jetty/Howto/Configure_JNDI_Datasource
http://www.eclipse.org/jetty/documentation/current/

====== set up proxy for jetty 9 ==========
from jetty side, if you want to run at a maven webapp dir, do as follows:

1) cd ~/projects-try/ccaApp
2) mvn war:inplace (run this only if java compile is needed, jsp's gets refreshed directly)
3) add jetty-web.xml with following details under WEB-INF
you can also do setup extra things like datasource, jndi etc.,
look at url jetty 9 http://www.eclipse.org/jetty/documentation/current/
4) note the context name given here should match with the one we will put in nginx proxy-pass as follows
before close of last "}", paste folowing contents
#inside server add
sudo vi /etc/nginx/sites-available/default
sudo /etc/init.d/nginx reload

location ^~ /j9090 {
     proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:9090;
    }
5) then you can start jetty by jetty.jar or using jetty-maven-plugin too
java -jar ~/programs/jetty-9.jar --port 9090  ~/projects-try/ccaApp/src/main/webapp

6) test these both url's it should work
a) using nginx http://localhost/j9090/
b) using jetty http://localhost:9090/j9090/

nginx setup and php


sudo apt-get install nginx
sudo /etc/init.d/nginx start

#install php-fpm
sudo apt-get install php5-fpm
sudo vi /etc/nginx/nginx.conf

#adjust values
worker_processes  4;
keepalive_timeout   2;

mkdir ~/www-nginx
cp /etc/nginx/sites-available/default ~/www-nginx/default.orig

#Virtual hosts are defined in server {} containers. The default #virtualhost is defined in the file /etc/nginx/sites-available/default:

sudo vi /etc/nginx/sites-available/default

========
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6

        #root /usr/share/nginx/www;
root /home/rajesh/www-nginx;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        # Only for nginx-naxsi : process denied requests
        #location /RequestDenied {
                # For example, return an error code
                #return 418;
        #}

        #error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}
==========

sudo /etc/init.d/nginx reload
sudo apt-get install php5-fpm

echo "" > ~/www-nginx/info.php

#test using http://rpradeshik/info.php

Friday, March 29, 2013

Downloading and configuring jetty9

More info is available here http://www.eclipse.org/jetty/documentation/current/jetty-runner.html
http://linuxdatum.info/web-server/howto-install-php-fpm-with-nginx-on-ubuntu-12-04-lts
NgInx server install with FastCGI check  /etc/resolv.conf , /etc/hostname, /etc/hosts check for hostname in (127.0.1.1)

===Downloading and configuring jetty9==

search.maven.org for "jetty-runner"

wget -O ~/programs/lib/jetty-runner-9.0.0.v20130308.jar http://search.maven.org/remotecontent?filepath=org/eclipse/jetty/jetty-runner/9.0.0.v20130308/jetty-runner-9.0.0.v20130308.jar

rm ~/programs/jetty-9.jar
ln -s -T ~/programs/lib/jetty-runner-9.0.0.v20130308.jar ~/programs/jetty-9.jar


==in another Window RUN war from cmdLine
cd ~/projects-try
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.0 -DgroupId=com.example -DartifactId=ccaApp -Dversion=1.0-SNAPSHOT

cd ccaApp
mvn war:inplace

java -jar ~/programs/jetty-9.jar --port 9090  ~/projects-try/ccaApp/src/main/webapp or add this to pom.xml and run as mvn -Djetty.port=9090 jetty:run ===============



    ccaApp

  
   
   
   
  org.eclipse.jetty
  jetty-maven-plugin
  9.0.0.v20130308
  
  
    10
    
      /j9090
    
  


  




test using http://http://rpradeshik:9090/
===========

Working with Sencha for ExtJs


=== download Sencha tool here http://www.sencha.com/products/sencha-cmd
stored in
Linux //samba-share/downloads/sencha/SenchaCmd-3.1.0.256-linux.run.zip
Window //samba-share/downloads/sencha/SenchaCmd-3.1.0.256-windows.exe.zip

== download ExtJs SDK from http://www.sencha.com/products/extjs/
http://www.sencha.com/products/extjs/download/ext-js-4.2.0/2142
Zip Sorted in //samba-share/downloads/sencha/extjs_420_build_2142/SenchaCmd-3.1.0.256-windows.exe.zip

==help install URL == http://stackoverflow.com/questions/14730977/build-failed-in-sencha-cmd
install ruby from http://rubyinstaller.org/
or sudo apt-get install ruby

==put in bashrc
export EXTJS_SDK=~/programs/sencha-cmd/ext-4.2.0.663
export SENCHA_HOME=$SENCHA_CMD_3.1.0.256
PATH=...$SENCHA_HOME/bin:$PATH

ll $SENCHA_HOME/sencha.cfg
echo "skip.sass=1" == $SENCHA_HOME/sencha.cfg
echo "skip.slice=1" == $SENCHA_HOME/sencha.cfg

test Sencha cmd as
==sencha

create new app as follows
cd ~/projects-try

sencha -sdk $EXTJS_SDK generate app CCAProject ~/projects-try/ccaApp

== to build app first cd to it and then build
cd ~/projects-try/ccaApp

echo "skip.sass=1" ext/cmd/sencha.cfg
echo "skip.slice=1" ext/cmd/sencha.cfg

sencha app build