Tuesday, February 11, 2020

JAVASCRIPT, JQUERY ERROR HANDLING - KEEP IT SIMPLE



Part of Keeping things simple is coding yourself.... You don't have to use frameworks to do SIMPLE things..... Here is a Javascript, Jquery error handler on a button click,. Calls a servlet on the server....... KIS!

//GLOBAL VARIABLES

var G_MSGTITLE;
G_MSGTITLE = "_________________________________________\n\n";
G_MSGTITLE += "CLIENT VALIDATION ERRORS\n";
G_MSGTITLE += "This form was not submitted because of the following error(s). \n";
G_MSGTITLE += "Please correct these error(s) and re-submit.\n";
G_MSGTITLE += "_________________________________________\n\n";

var G_MSG;


/**
*   Function Name:  setloadVCvoucherrecord()
*   Description :   Sets the jQuery controls
*   Parameters:     None.
*   Return:         None.
*/
function setloadVCvoucherrecord(){

    $(document).ready(function() {

        //BUTTON TO GO TO UPDATE Cancer Care Agreement
        $('#UpdateCCA').click( function () {
         
            try{
                var fileIndex = 0;
                G_MSG = "";

                $.each(table3.row('.selected').data(), function(index, value){

                    if ( index===0 ){
                        fileIndex = value;
                    }

                });             

                //Add Parameter to form
                $("#CCAfileIndex").val(fileIndex);                                               

                if (fileIndex === 0 ){
                    G_MSG += "Error - No file selected.\n";
                }
             
                if (G_MSG.length > 0)
                    throw G_MSG;
             
                //Keep Form on Same window
                $('#frmVoucherRecord').on('submit',function(){
                   $(this).attr("target", "_parent");
                   $(this).attr( "action", "UpdateCancerCareAgreement");
                });               

            }catch( err ){

                alert(G_MSGTITLE + err );
                return false;

            }             
         
    });     
        //END OF BUTTON TO GO TO UPDATE Cancer Care Agreement
     }); 

}


Monday, January 20, 2020

INSTALL OCI/JAVA/TOMCAT WEB SERVER - ORACLE CLOUD




PREREQUISITE

Create SSH keys

Creating a Instance (Hint: accept the defaults, it's FREE)

Install OCI (Oracle Cloud Infrastructure) 

Log into Oracle Cloud Compute Instance using putty - 





RUN (Press enter and accept all the defaults) -
[opc@instance-20200119-1236 ~]$ bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"


RUN -
[opc@instance-20200119-1236 ~]$ oci --help



OCI SETUP IS COMPLETE

INSTALL JAVA -
Sergio gives a GREAT explanation of how to install the java JDK.

I recommend to ONLY install JDK 8 and JDK 11. They both work well with the Oracle JDBC drivers to connect to your Oracle ATP.


DON'T FORGET TO SET PATH 

Key commands -


Java Root /usr/java/jdk1.8.0_231-amd64/bin

SET PATH -

[opc@instance-20200119-1236 ~]$ export PATH=/usr/java/jdk1.8.0_231-amd64/bin:$PATH



SET JAVA_HOME -

[opc@instance-20200119-1236 ~]$ export JAVA_HOME=/usr/java/jdk1.8.0_231-amd64

Set default JAVA -
[opc@instance-20200119-1236 ~]$ sudo alternatives --config java

INSTALL TOMCAT -


Run (Installs Web Server) -
[opc@instance-20200119-1236 bin]$ sudo yum install -y tomcat tomcat-webapps tomcat-admin-webapps



Run (Installs Doco) -
[opc@instance-20200119-1236 bin]$ sudo yum install tomcat-docs-webapp tomcat-javadoc



ENABLE TOMCAT SERVICE -
[opc@instance-20200119-1236 bin]$ sudo systemctl enable tomcat

START SERVICE - 
[opc@instance-20200119-1236 bin]$ sudo systemctl start tomcat

TOMCAT OTHER COMMANDS -

STOP SERVICE - 
[opc@instance-20200119-1236 bin]$ sudo systemctl stop tomcat

RESTART SERVICE - 
[opc@instance-20200119-1236 bin]$ sudo systemctl restart tomcat

ADD ACCESS THROUGH LINUX FIREWALL - 
[opc@instance-20200119-1236 bin]$ sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp

RELOAD FIREWALL - 
[opc@instance-20200119-1236 bin]$ sudo firewall-cmd --reload


ADD "INGRESS" RULE ON VCN (Virtual Cloud Network) port 8080 - 


TEST WEB SERVER - 

















Sunday, January 19, 2020

CREATING THE SSH KEYS IN WINDOWS - ORACLE CLOUD





Open Windows PowerShell - 

Change to your "Key" directory

Type the command - "ssh-keygen -b 2048 -t rsa -f <FILENAME>" . Leave the passphrase empty. 
ssh-keygen -b 2048 -t rsa -f  OracleInstanceKey



Convert private key to putty, open puttygen and load the private key generated.


Open private key in putty format.


Save private key in putty format, leave passphrase empty.


Use the same file name, OracleInstanceKey.ppk


Final Look -


Use the OracleInstanceKey.pub contents to copy and paste in instance 


Paste here in setting up instance -



Connect to you instance using putty, IP from instance - 





Use opc ID - 


The file created .ppk format - 


Press "Open" button