Thursday, February 27, 2020

JQUERY - GET SELECTED TEXT AND VALUE





ERROR Handling for COMBO BOX or SELECTED BOX -

<select size="1" id="cmbSTHour" name="cmbSTHour" class="recordData">
<option selected value="0"></option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
</select>

Get the selected value
$('#cmbSTHour').val() == 0

Get the Selected Text
$('#cmbSTHour option:selected').text()

if (( $('#cmbSTHour').val() == 0 )  || isBlank( $('#cmbSTHour option:selected').text() )){
    G_MSG += "Error - Start hour is blank.\n";}


/***   Function Name:  isBlank()*   Description :   Used to validate a text box contains a string.*   Parameters:     String - String value*   Return:         True - String is blank*                   False - String contains characters*/function isBlank( str ){
    
    for( var idx = 0; idx < str.length; idx++ ){
        var charc = str.charAt(idx);        if (( charc != ' ') && ( charc != '\n' ) && ( charc != '\t' )){
            return false;        }
    }
    return true;}


Reference -
https://learn.jquery.com/using-jquery-core/faq/how-do-i-get-the-text-value-of-a-selected-option/

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 








Tuesday, January 17, 2017

ACA - Medicaid is the better Alternative

Use Healthy Michigan as the alternative to the ACA. Healthy Michigan - http://www.michigan.gov/healthymiplan/ .


Cost containment within the Medicaid rules. Though people who service Medicaid will at least receive something, as oppose to nothing.

Modify the eligibility rules -

Modify the income requirements to cover all.


http://www.michigan.gov/healthymiplan/0,5668,7-326-67874---,00.html.

See if you qualify for the Healthy Michigan Plan.

The Healthy Michigan Plan provides health care benefits to Michigan residents at a low cost so that more people can have health care coverage. Individuals are eligible for the Healthy Michigan Plan if they:
  • Are age 19-64 years
  • Have income at or below 133% of the federal poverty level* ($16,000 for a single person or $33,000 for a family of four)
  • Do not qualify for or are not enrolled in Medicare
  • Do not qualify for or are not enrolled in other Medicaid programs
  • Are not pregnant at the time of application
  • Are residents of the State of Michigan
*Eligibility for the Healthy Michigan Plan is determined through the Modified Adjusted Gross Income methodology.

Thursday, September 22, 2016

Tuesday, September 13, 2016

Simple Layout for using JSP (Java Server Pages) , Template

SIMPLE Layout for JSP (Java Server pages, the low level stuff)

<html>
    <body>
        <div class="container">
     
            <header>
                <%@include file="<YOUR JSP HEADER FILE>" %>
            </header>
            <nav>
                <%@include file="<YOUR JSP NAVIGATION FILE>" %>
            </nav>    
            <article>
                      MY INPUT STUFF
                     <advertisement>
                             TRYING TO MAKE SOME MONEY
                     </advertisement>
            </article>
            <footer>
                <%@include file="<YOUR JSP FOOTER FILE>" %>
            </footer>
        </div>
   </body>
</html>