Search This Blog

Sunday, August 12, 2018

Thursday, August 9, 2018

Password Strength Check In Oracle Apex



Step 1:- Post Text

<span id="password_strength"></span>

Step 2:- Custom Attributes

onkeyup="CheckPasswordStrength(this.value)" 

Step 3:- Function and Global Variable Declaration

function CheckPasswordStrength(password) {
        var password_strength = document.getElementById("password_strength");

        //TextBox left blank.
        if (password.length == 0) {
            password_strength.innerHTML = "";
            return;
        }

        //Regular Expressions.
        var regex = new Array();
        regex.push("[A-Z]"); //Uppercase Alphabet.
        regex.push("[a-z]"); //Lowercase Alphabet.
        regex.push("[0-9]"); //Digit.
        regex.push("[$@$!%*#?&]"); //Special Character.

        var passed = 0;

        //Validate for each Regular Expression.
        for (var i = 0; i < regex.length; i++) {
            if (new RegExp(regex[i]).test(password)) {
                passed++;
            }
        }

        //Validate for length of Password.
        if (passed > 2 && password.length > 8) {
            passed++;
        }

        //Display status.
        var color = "";
        var strength = "";
        switch (passed) {
            case 0:
            case 1:
                strength = "Weak";
                color = "red";
                break;
            case 2:
                strength = "Good";
                color = "darkorange";
                break;
            case 3:
            case 4:
                strength = "Strong";
                color = "green";
                break;
            case 5:
                strength = "Very Strong";
                color = "darkgreen";
                break;
        }
        password_strength.innerHTML = strength;
        password_strength.style.color = color;
    }

Create PDB , Alter/Open , TNSNAMES Configer, Drop PDB



CREATE PDB(Plaggable Database)
================================
create pluggable database NAME
admin user 
   app_admin identified by Password
file_name_convert = ('/pdbseed/', '/NAME/');



alter pluggable database NAME open;

TNSNAMES.ORA
================================
Path:
cd /u01/app/oracle/product/12.1.0/db_1/network/admin/

NAME =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.022)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = NAME)
    )
  )


DROP PDB
================================

alter pluggable database NAME close;

drop pluggable database NAME including datafiles;

Source: http://www.dba-oracle.com/t_pluggable_database.htm




Text Generation by PL/SQL

-- Create directory 
create or replace directory EXPIMP_DIR  as 'E:\hira';

--PL/SQL Block

DECLARE
v_file  UTL_FILE.FILE_TYPE;
BEGIN
  v_file := UTL_FILE.FOPEN(location     => 'EXPIMP_DIR',
                           filename     => 'New_Card_Test.txt',
                           open_mode    => 'w',
                           max_linesize => 32767);
                           
  FOR cur_rec IN (select sl,data_desc from tt order by sl) LOOP
  
    UTL_FILE.PUT_LINE(v_file,cur_rec.data_desc);
  
  END LOOP;
  UTL_FILE.FCLOSE(v_file);
    
EXCEPTION
  WHEN OTHERS THEN UTL_FILE.FCLOSE(v_file); RAISE;
END;

Tuesday, August 7, 2018

Global Back Button in Oracle Apex Using JavaScript


Back Button in Oracle Apex by doing this you can go back your immediate previous page.

1. Create a button with name "Back"

2. Button Properties >> Action When Button Clicked >>Action>> Redirect to URL >> URL Target>>    javascript:history.go(-1) 

And Enjoy 

Call Process From Dynamic Action in Oracle Apex 5.1




Some time we have need long PL/SQL block or raise_applicaiton_error and many other things which we can do in Apex Process level but can not do in Dynamic Action.

Now here I am show how to call a Process from item  Dynamic Action.

1. Create a Item and create Dynamic Action on this Item. 

2. This Dynamic Action Event can be anything but Action will Execute JavaScript Code and right this JavaScript Code >> Settings.

apex.submit({  request:"ID", showWait:true});

3.  Here "ID" is a reference to call a process. 

4.  Now a Create One or multiple Process with what ever as your wish.

5.  Go to Process >>Properties >> Conditions>> Condition Type >>Select :- Request= Expression 1 >> Expression 1 >> ID (reference)

That's It. Now enjoy Process form Dynamic Action.

Make a Oracle Apex 5.1 Item Readonly

Make a Oracle Apex 5.1 Item Readonly. It's not mean Display Only item type. By doing this you can just read a input text field but can not edit or remove.

1. Make a Item in a Region.

2. Go to Item properties >> Element >>HTML Form Element Attributes >> readonly

and Save.   

RESTful Get API Example in Oracle Apex

DECLARE
   l_param_list      VARCHAR2 (512);
   l_http_request    UTL_HTTP.req;
   l_http_response   UTL_HTTP.resp;
   l_response_text   VARCHAR2 (32767);
   l_response        VARCHAR2 (32767);

   v_url             VARCHAR (500);
   url_param_list    VARCHAR2 (512);

   p_userid          VARCHAR2 (500) := '100140';
   p_sessionid       VARCHAR2 (500) := '123456';
   p_companyid       VARCHAR2 (500) := '101';
   p_executionmode   VARCHAR2 (500) := 'S';
   p_studentid       VARCHAR2 (500) := '9005';
   p_authkey         VARCHAR2 (500) := 123456;
   ts                VARCHAR2 (32000)
      := '{"std_info_node":[{"errormessage":"Invalid ID . Please input valid ID","studentname":"Qaium","accountno":"0487878778","mobileno":"01234","errorcode":"1"}]}';

   l_data_count      NUMBER := 0;
   l_values          apex_json.t_values;

   t_timeout         INTEGER;
BEGIN
   v_url := 'http://10.11.150.12/PmsWebService/StudentInfo?';
   url_param_list :=
         'userid='
      || p_userid
      || '&sessionid='
      || p_sessionid
      || '&companyid='
      || p_companyid
      || '&executionmode='
      || p_executionmode
      || '&studentid='
      || :P180_STUDENT_ID                                        
      || '&authkey='
      || p_authkey;

   /*begin
   l_http_request :=  UTL_HTTP.begin_request (v_url, 'GET', 'HTTP/1.1');
   UTL_HTTP.write_text (l_http_request, l_param_list);
   --  raise_application_error(-20007,'1');
   l_http_response := UTL_HTTP.get_response (l_http_request);
   raise_application_error(-20007,'2 : '||l_http_response.status_code);
   end ; */

   UTL_HTTP.get_transfer_timeout (t_timeout);
   UTL_HTTP.set_transfer_timeout (10);
   UTL_HTTP.get_transfer_timeout (t_timeout);

   l_param_list := NULL;
   l_http_request :=
      UTL_HTTP.begin_request (v_url || url_param_list, 'GET', 'HTTP/1.1');
   UTL_HTTP.write_text (l_http_request, l_param_list);
   l_http_response := UTL_HTTP.get_response (l_http_request);

   UTL_HTTP.read_text (l_http_response, l_response_text);

   IF l_response_text IS NULL
   THEN
      raise_application_error (-20003,
                               'Request Does Not Get Any Response !!!');
   END IF;

   apex_json.parse (l_response_text);

   SELECT    'DCMC'
          || REPLACE (TO_CHAR (SYSDATE, 'DD-MM-YY'), '-', '')
          || DCMC_PAYMENT.NEXTVAL
     INTO :P180_REF_NO
     FROM DUAL;

   :P180_NAME :=
      apex_json.get_varchar2 (p_path => 'std_info_node[1].studentname');
   :P180_MOBILE :=
      apex_json.get_varchar2 (p_path => 'std_info_node[1].mobileno');
   :P180_AC_NUMBER :=
      apex_json.get_varchar2 (p_path => 'std_info_node[1].accountno');
   --raise_application_error(-20003,:P180_MOBILE);

   /*
    FOR i IN 1 ..3

    LOOP
   :P180_NAME:= apex_json.get_varchar2 (p_path => 'std_info_node[' || i || '].studentname') ;
   :P180_MOBILE:= apex_json.get_varchar2 (p_path => 'std_info_node[' || i || '].mobileno') ;
   :P180_AC_NUMBER :=apex_json.get_varchar2 (p_path => 'std_info_node[' || i || '].accountno') ;

    -- DBMS_OUTPUT.put_line ('a is '|| apex_json.get_varchar2 (p_path => 'std_info_node[' || i || '].studentname')|| l_data_count);

    END LOOP; */

   UTL_HTTP.end_response (l_http_response);
EXCEPTION
   WHEN UTL_HTTP.end_of_body
   THEN
      UTL_HTTP.end_response (l_http_response);
END;

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...