Snippets

Create a CakePHP Project CakePHP
composer create-project --prefer-dist cakephp/app:^3.9 my_app_name
Create a controller for a table called users CakePHP

creates src/Controller/UsersController.php

bin/cake bake controller Users
Create a model (and entity) for a table called users CakePHP

creates src/Model/Table/UsersTable.php
creates src/Model/Entities/User.php

bin/cake bake model Users
Create the default template files for a table (add/edit/view/index) CakePHP

creates src/Template/Users/index.ctp add.ctp edit.ctp view.ctp

bin/cake bake template Users
Bake add/edit/view/index using one command CakePHP
bin/cake bake all Users
Bake just the index template file CakePHP

creates src/Template/Users/index.ctp

bin/cake bake template Users index
Install Ionic Ionic
npm install -g @ionic/cli
Create a Ionic Project Ionic
ionic start   <my_app_name>  <template> [options]

template Description
tabs A starting project with a simple tabbed interface
blank A blank starter project
sidemenu A starting project with a side menu with navigation in the content area
super A starting project complete with pre-built pages, providers and best practices for Ionic development.
conference A project that demonstrates a realworld application
tutorial A tutorial based project that goes along with the Ionic documentation
aws AWS Mobile Hub Starter

Run Locally in a Web Browser Ionic
ionic serve
Adding a new page Ionic
ionic g page login
Routing to another page Ionic
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-gamelevels',
  templateUrl: './gamelevels.page.html',
  styleUrls: ['./gamelevels.page.scss'],
})
export class GamelevelsPage implements OnInit {

  constructor(private router: Router) {}

  ngOnInit() {
  }

  playgame(level:number){
    this.router.navigate(['gameplay', level ]);
  }

}
Integrating JQuery Ionic
npm install jquery --save
npm install @types/jquery
Import jquery on your page like this Ionic
import * as $ from "jquery";
Convert jpg to PDF Linux
# Install the ImageMagick package
  sudo apt-get install imagemagick

  # List files as a single column
  ls -v --format single-column *.jpg

  # Convert images to PDF
  convert `ls -v --format single-column *.jpg` FileName.pdf

  #eg:  convert `ls -v --format single-column *.svgz` Book.pdf
  
Install LAMP Linux
1. Update your system:
$ sudo apt update && sudo apt upgrade

2. Install Tasksel if not already installed by default:
$ sudo apt install tasksel

3. Use Tasksel to install the LAMP stack:
$ sudo tasksel install lamp-server

Install Packages Separately
If you prefer not to install the bundled packages via Tasksel, you can instead install them separately:

Install Apache 2.4 from the Ubuntu repository:

sudo apt install apache2
Install the mysql-server package:

sudo apt install mysql-server
Install PHP, the PHP Extension and Application Repository, Apache support, and MySQL support:

sudo apt install php7.2 libapache2-mod-php7.2 php-mysql
Optionally, install additional cURL, JSON, and CGI support:

sudo apt install php-curl php-json php-cgi

Useful Command

* Restart Apache:
sudo systemctl restart apache2

or

sudo service apache2 restart

* Log in to MySQL’s SQL shell:
sudo mysql -u root

* Create a database and a user with permissions for it.
CREATE DATABASE webdata;
GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';

* Use the mysql_secure_installation tool to configure additional security options [https://mariadb.com/kb/en/library/mysql_secure_installation/]
sudo mysql_secure_installation

Answer Y at the following prompts:

Remove anonymous users?
Disallow root login remotely?
Remove test database and access to it?
Reload privilege tables now?
  
Reload .File (.bashrc , .profile) Linux
source ~/.File
Bash aliases and functions Linux
#ALIASES and FUNCTIONS
# Aliases  
alias workspace="cd /mnt/f/Users/username/Documents/workspace"
alias ls="ls -al"
alias mvninstall="mvn install -DskipTests"
alias mvncleaninstall="mvn clean install -DskipTests"
alias mvnclean="mvn clean"
# usage: $ workspace

#Functions
function deployd4() { mvninstall; chmod 664 "$@"; scp "$@" SERVER04:~/.w;}
function deployd5() { mvninstall; chmod 664 "$@"; scp "$@" SERVER05:~/.w;}
# usage: $ deployd4 target/app.war
Record Everything You Do In Terminal Linux
#Run the following command to start the Terminal session recording.
$ script -a my_terminal_activities

#After running all commands, end the ‘script’ command’s session using command:
$ exit

#Create an alias for the script command like below.
$ alias rec=’script -aq ~/term.log-$(date “+%Y%m%d-%H-%M”)’

#Now simply enter the following command start recording the Terminal.
$ rec
Copy Remote File Linux
scp username@server:/tmp/filename.txt .

#Pass password to SCP command
$ sshpass -p 'password' scp username@server:/tmp/filename.txt .
Editing remote files via scp in vim Linux
vim scp://remoteuser@server//absolute/path/to/document
ssh-keyscan Linux
#DSA 
ssh-keyscan -t dsa <SERVER>

#RSA 
ssh-keyscan -t rsa <SERVER>
Display files sizes in MB Linux
#To display the file sizes in units like 7K, 5M, 8.2G, etc… use the -lh option with  ls. 
ls -lh

#To display the sizes rounded up to the nearest MiB (2^20 bytes), you should use the command :
ls -l –block-size=M

#If the M suffix bothers you in some way, you can get rid of it by using –block-size=1M.
ls -l –block-size=1M

#If however you want to see the size in MB (10^6 bytes) instead, you should use the command with the option –block-size=MB
ls -l –block-size=MB
Select a single row of data PeopleCode
/* Read class name and parameter record name from the database. */ 
SQLExec("SELECT RECNAME, FIELDNAME, PC_EVENT_TYPE, PC_FUNCTION_NAME FROM PSROLEDEFN WHERE ROLENAME= :1", &ROLENAME, &rec, &fld, &pce, &pcf);
Select Multiple rows of data PeopleCode
Local SQL &SQL; 
Local Record &REC; 
  
&REC = CreateRecord(RECORD.TRANS_TBL); 
&SQL = CreateSQL("%SelectAll(:1) WHERE PROCESSED <> 'Y'");  
  
&SQL.Execute(&REC); 
While &SQL.Fetch(&REC) 
/* do processing */ 
...  
End-While;
Run BI Publisher Report via PSXP_RPTDEFNMANAGER PeopleCode
import PSXP_RPTDEFNMANAGER:*;

/*Create Report*/
Function CreateReport(&reportDefnId, &templateName, &reportName)
    
    MessageBox(0, "", 0, 0, "Processing Report: %1", &reportName);
    
    Local string &languageCode = "ENG";
    Local string &outputFormat = "PDF";
    Local date &AsOfDate = %Date;
    Local string &folderName = "General";
    Local number &PID = MCM_GRDADM_AET.PROCESS_INSTANCE;
    
    /* Initializing Report Def class Object */
    Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&reportDefnId);
    &rptDefn.Get();
    rem &rptDefn.OutDestination = %FilePath;
    &rptDefn.ReportFileName = &reportName;
    &rptDefn.ProcessReport(&templateName, &languageCode, &AsOfDate, &outputFormat);
    rem CommitWork();
    rem &rptDefn.DisplayOutput();
    &rptDefn.Publish("", "", &folderName, &PID);
    
    MessageBox(0, "", 0, 0, "Posted Report: %1", &reportName);
    
End-Function;

/*Declare and Initialize Variables/
Local string &reportDefnId = "<Report_Defition_Id>";
Local string &templateName = "<Template_Name>";
Local string &reportName = "<Report_Name>";

/*Call Create Report Function*/
CreateReport(&reportDefnId, &templateName, &reportName);
  
  
Run BI Publisher Via PSXPQRYRPT PeopleCode
/*Create Report*/
Function CreateReport(&runctrl)
   
  Local string &AppEngineName;
  Local ProcessRequest &RQST;
  &AppEngineName = "PSXPQRYRPT";
  &RQST = CreateProcessRequest("XML Publisher", &AppEngineName);
  &RQST.OutDestType = "Web";
  &RQST.OutDestFormat = "PDF";
  &RQST.RunControlID = &runctrl;
  rem &RQST.RunLocation = "PSUNX";
  &RQST.Schedule();
  
End-Function;

/*Declare and Initialize Run Control ID variable/
Local string &runctrl = "<RunControlID>";

/*Call Create Report Function*/
CreateReport(&runctrl);
Run PS Job PeopleCode
/*Function name : Run Process*/
Function RunProcess(&ProcessName)
    MessageBox(0, "", 0, 0, "Run %1", &ProcessName);
    
    /* Create the ProcessRequest Object & Run the Scheduled JobSet Now */
    Local ProcessRequest &JobRQST;
    Local integer &instanceList;
    
    /* SetupScheduleDefnItem(ScheduleName, JobName)*/
    &JobRQST = SetupScheduleDefnItem(&ProcessName, &ProcessName);
    &JobRQST.RunJobSetNow();
    &PRCSINSTANCE = &JobRQST.ProcessInstance;
    &PRCSSTATUS = &JobRQST.Status;
    If &PRCSSTATUS = 0 Then
      MessageBox(0, "", 0, 0, "Process Instance: %1", &PRCSINSTANCE);
    Else
      MessageBox(0, "", 0, 0, "Process Not submitted");
    End-If;
    
End-Function;

/*Declare and Initialize Process Name Variable*/
Local string &processName = "<Process_Name>";

/*Call Run Process Function */
RunProcess(&processName);
Scaling FLUID pages for iPhone PeopleCode
Declare Function GetDefaultViewportSetting PeopleCode PTLAYOUT.FUNCLIB FieldFormula;
Declare Function SetViewport PeopleCode PTLAYOUT.FUNCLIB FieldFormula;

Local string &Viewport;
Local number &Pos;

&Viewport = GetDefaultViewportSetting();

If %Request.BrowserDeviceFormFactor = 0 And
      %Request.BrowserPlatformClass = "ios" Then
    &Pos = Find("minimal-ui", &Viewport);
    If &Pos = 0 Then
      &Viewport = &Viewport | ", minimal-ui";
    End-If;
End-If;

SetViewport(&Viewport);
AddMetaTag("format-detection", "telephone=no");
File Layout Line Break PeopleCode
Local string &CRLF = Char(13) | Char(10);

&FILE.SetFileLayout(FileLayout.MCM_PER_UPSYNC);
&FILE.SetRecTerminator(&CRLF); 
CREF Date Change PeopleCode
Local ApiObject &Portal;
Local string &PORTAL_NAME = "EMPLOYEE";
Local string &CRefName = "MCM_TILE_TOGGLE";

&Portal = %Session.GetPortalRegistry();
&Portal.Open(&PORTAL_NAME);
rem &CRef = &Portal.FindCRefByName(&CRefName);
&CRefLink = &Portal.FindCRefLinkByName(&CRefName);

MessageBox(0, "", 0, 0, "ValidFrom: %1", &CRefLink.ValidFrom);
MessageBox(0, "", 0, 0, "ValidTo: %1", &CRefLink.ValidTo);

Local date &newDate = AddToDate(%Date, 0, 0, 10);
&CRefLink.ValidTo = &newDate;

MessageBox(0, "", 0, 0, "New ValidTo: %1", &CRefLink.ValidTo);

&CRefLink.Save();
Create a File PeopleCode
Local string &sFileName = "triggerfile.txt";
Local File &exportFile = GetFile(GetURL(URL.FILE_REPO) | "/OUT/" | &sFileName, "W", %FilePath_Absolute);

If &exportFile.IsOpen Then
  &exportFile.WriteLine("");
  &exportFile.Close();
Else
  MessageBox(0, "", 0, 0, "Error cannot open file %1", &sFileName);
  Exit (0);
End-If;
Read a File PeopleCode
Local File &MYFILE;
Local array of string &MYARRAY;
Local string &TEXT;
&MYFILE = GetFile("names.txt", "R", "UTF8BOM");
&MYARRAY = CreateArrayRept("", 0);
While &MYFILE.ReadLine(&TEXT);
    &MYARRAY.Push(&TEXT);
End-While;
&MYFILE.Close();
    
IB Publish Message PeopleCode

PeopleCode used to publish the LOCATION_SYNC service operation. This code has been placed in the SavePostChange event in the SETID field in the LOCATION_TBL record.

Local Message &MSG;

&MSG = CreateMessage(Operation.LOCATION_SYNC, %IntBroker_Request);
&MSG.CopyRowsetDelta(GetLevel0()(1).GetRowset(Scroll.LOCATION_TBL));
%IntBroker.Publish(&MSG);
Call an App Engine program immediately PeopleCode
/* Set the state record for the App Engine */
Local Record &stateRec;

&stateRec = CreateRecord(Record.STATE_REC_AET);
&stateRec.EMPLID.Value = <EMPLID>;
&stateRec.ITEM_TYPE.Value = <ITEM_TYPE>;

CallAppEngine("<APP_ENGINE_NAME>", &stateRec);
  
Using SQLExec and Record Objects PeopleCode
Local Record &recO;
&recO = CreateRecord(Record.PSOPRDEFN);
SQLExec("%selectall(:1) WHERE PSOPRDEFN.EMPLID = :2", &recO, "EE2343", &recO);
Calculate SHA-256 Checksum for an Input String PeopleCode
SQLExec("SELECT CAST(STANDARD_HASH ( '<INPUT>', 'SHA256') AS CHAR(100)) FROM DUAL;", &SHAHex);
MessageBox(0, "", 0, 0, "" | &SHAHex);
Left-pad and right-pad string functions PeopleCode
/*Left Pad Function*/
Function lpad(&in_string As string, &length As number, &pad_char As string) Returns string

  If Len(&in_string) < &length Then
  &in_string = Rept(&pad_char, &length - Len(&in_string)) |
        &in_string;
  End-If;

  Return &in_string;

End-Function;

/*Right Pad Function*/
Function rpad(&in_string As string, &length As number, &pad_char As string) Returns string

  If Len(&in_string) < &length Then
  &in_string = &in_string |
        Rept(&pad_char, &length - Len(&in_string));
  End-If;

  Return &in_string;

End-Function;

Local string &num_char = "123";
&num_char = lpad(&num_char, 10, "0");
MessageBox(0, "", 0, "" | &num_char);
Copy File PeopleCode
/*Copy File*/
Function copyFile(&filePath, &destinationPath) Returns boolean;
   
    try
       
       Local JavaObject &file = CreateJavaObject("java.io.File", &filePath);
       Local JavaObject &dest = CreateJavaObject("java.io.File", &destinationPath);
       Local boolean &success = &file.renameTo(&dest);
       If Not &success Then
          throw CreateException(0, 0, "Unable to move file " | &filePath | " to " | &destinationPath | ".");
       Else
          Return True;
       End-If;
       
    catch Exception &Err
       Warning (&Err.ToString());
       Return False;
    end-try;
    
End-Function;

/*Declare variables*/
Local string &file1 = "H:\temp\test1\mcmaps-extract.csv";
Local string &file2 = "H:\temp\test2\mcmaps-extract.csv";

/*Copy Files*/
If copyFileTo(&file1, &file2) Then
  MessageBox(0, "", 0, 0, "Success");
Else
  MessageBox(0, "", 0, 0, "fail");
End-If;
 
DMS Export PeopleSoft
SET OUTPUT L:\temp\TABLE.dat;
SET LOG   L:\temp\TABLE_Export.log;

EXPORT TABLENAME WHERE FIELD = :FieldValue; 
DMS Import PeopleSoft
SET INPUT L:\temp\TABLE.dat;
DELETE TABLENAME WHERE FIELD = :FieldValue;

IMPORT *;
Define Process Definition PeopleSoft
#Process Definition
Navigation: PeopleTools > Process Scheduler > Processes

Process Type: Application Engine
Name: App Engine Name

Process Definition Options

Component: 
AE_REQUEST
PRCSMULTI

Process Groups:
TLSALL
Run App Engine PeopleSoft
Navigation: PeopleTools > Process Scheduler > System Process Request
App Engine Locked / Abend and Restart Required PeopleSoft
Accidentally run an app engine outside of the PIA 
and have it lock on you because it had restart required?

Two easy ways to fix:

If you have a PIA, Peopletools > Application Engine > Manage Abends (safer)
If you just have database access, remove the relevant rows for the process 
instance from the following tables PS_AETEMPTBLMGR, PS_AERUNCONTROL, 
PS_AERUNCONTROLPC

Prevent App Engine Locking:
1. Click Program Properties icon 
2. Click Advanced tab
3. Uncheck Disable Restart
4. Click OK
Ctrl+J Configuration PeopleSoft
Enable this feature on the Debugging page. 
Select PeopleTools > Web Profile > Web Profile Configuration. 
Access the Debugging tab.
Select the Show Connection & Sys Info check box.
URL Information PeopleSoft
The URL also gives you information about the current component. 
The last two elements in the URL are <MenuName>.<ComponentName>.<Market>. 

For example, the instructor information is on the PSU_INSTR component (global market), 
attached to the PSU_TRAINING menu: http://ple79/psp/PLECBT12/EMPLOYEE/PSFT_TRN/c/PSU_TRAINING.PSU_INSTR.GBL
Create Query Content Reference PeopleSoft
1. Navigate to PeopleTools > Portal > Structure and Content
2. Choose the folder of your choice
3. Click Add Content Reference
4. Enter the following information:

Section: Content Ref Administration
Name:  <Query_Name>
Label:  <Label>
Long Description: <Description>

Section: URL Information
Node Name: HRMS_LS not LOCAL_NODE
URL Type: PeopleSoft Generic URL
Portal URL: q/?ICAction=ICQryNameURL=PUBLIC.<Query_Name>
SOAP Security Header PeopleSoft
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>PS</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PS</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
Tracing PeopleSoft Application Engine PeopleSoft
Open the process definition for the App engine in question and navigate to the Override Options tab. 
Select ‘Append’ in the Parameter List drop-down and fill in the Parameters field with the below command.

-TRACE 135 -TOOLSTRACEPC 3596 -TOOLSTRACESQL 7
Message Referenced in Runtime Tables PeopleSoft
There are currently messages displayed in the async monitor hence the status: 
Message cannot be changed.  Message referenced in runtime tables. 

You can do 1 or 2 things:

1. Delete or archive each PERSON_BASIC_SYN message or
2. Run the archiving process:  
PeopleTools > Integration Broker > Service Operations Monitor > Monitoring  > Archive Monitor Data.
Alter Session SQL
ALTER SESSION SET CURRENT_SCHEMA=SYSADM;
Unlock Account SQL
ALTER USER oracledbuser ACCOUNT UNLOCK;
Create User with User Permissions SQL
CREATE USER oracledbuser IDENTIFIED BY password
QUOTA UNLIMITED ON SYSTEM
QUOTA UNLIMITED ON SYSAUX;

GRANT CREATE SESSION TO oracledbuser;

GRANT CREATE TABLE TO oracledbuser;

GRANT SELECT_CATALOG_ROLE TO oracledbuser; 

GRANT EXECUTE_CATALOG_ROLE TO oracledbuser;

EXECUTE DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(grantee => 'oracledbuser');

GRANT UNLIMITED TABLESPACE TO oracledbuser;

GRANT RESOURCE TO oracledbuser;

ALTER USER oracledbuser QUOTA unlimited ON system;

GRANT UNLIMITED TABLESPACE TO oracledbuser;
Create table, Sequence, Trigger SQL
CREATE TABLE "SOFTWARE" (
"SOFTWARE_ID"      NUMBER(10,0) NOT NULL ENABLE,
"SOFTWARE_VERSION" VARCHAR2(255 BYTE),
"SOFTWARE_TITLE"   VARCHAR2(255 BYTE),
"COMP_LAB"         NUMBER(10,0),
PRIMARY KEY ("SOFTWARE_ID"));

CREATE SEQUENCE SOFTWARE_SEQUENCE START WITH 1 INCREMENT BY 1;

CREATE OR REPLACE TRIGGER SOFTWARE_trigger
BEFORE INSERT
ON SOFTWARE
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT SOFTWARE_SEQUENCE.nextval INTO :NEW.software_id FROM dual;
END;
Drop all tables, constraints, and sequences in a Schema SQL
BEGIN

FOR c IN (SELECT table_name FROM user_tables) LOOP
EXECUTE IMMEDIATE ('DROP TABLE ' || c.table_name || ' CASCADE CONSTRAINTS');
END LOOP;

FOR s IN (SELECT sequence_name FROM user_sequences) LOOP
EXECUTE IMMEDIATE ('DROP SEQUENCE ' || s.sequence_name);
END LOOP;

END;
Grant select, insert, update, delete SQL
GRANT SELECT, INSERT, UPDATE, DELETE ON SYSADM.TABLENAME TO PUBLIC;
How to Find PeopleSoft Processes/PSJobs in a Recurrence SQL
SELECT PROCESS_JOB_NAME,
  DESCRIPTION,
  RECURNAME
FROM PS_PRCSRECUR A,
  (SELECT P.PRCSNAME AS PROCESS_JOB_NAME,
    P.DESCR          AS DESCRIPTION,
    P.RECURNAME      AS RECURNAME
  FROM PS_PRCSDEFN P
  UNION
  SELECT JP.PRCSJOBAME AS PROCESS_JOB_NAME,
    (SELECT J.DESCR FROM PS_PRCSDEFN J WHERE J.PRCSNAME = JP.PRCSNAME
    )            AS DESCRIPTION,
    JP.RECURNAME AS RECURNAME
  FROM PS_PRCSJOBDEFN J,
    PS_PRCSJOBITEM JP
  WHERE J.PRCSJOBNAME = JP.PRCSJOBNAME
  ) B
WHERE B.RECURNAME = A.RECURNAME
AND A.RECURNAME   = :1
ORDER BY 1;
  
Find/Unlock PeopleSoft Objects SQL
-- Find locked PeopleSoft Object
SELECT * FROM PSCHGCTLLOCK WHERE OPRID = :UserId;

-- Delete locked PeopleSoft Object
DELETE FROM PSCHGCTLLOCK WHERE OPRID = :userId AND OBJECTVALUE1 = :ObjectName; 
Find navigations where a process is attached SQL
SELECT A.PORTAL_URI_SEG2,
    RTRIM(E.PORTAL_LABEL)
    || ' >> '
    || RTRIM(D.PORTAL_LABEL)
    || ' >> '
    || RTRIM(C.PORTAL_LABEL)
    || ' >> '
    || RTRIM(B.PORTAL_LABEL)
    || ' >> '
    || RTRIM(A.PORTAL_LABEL)
  FROM PSPRSMDEFN A
  LEFT JOIN PSPRSMDEFN B
  ON B.PORTAL_NAME     = A.PORTAL_NAME
  AND B.PORTAL_OBJNAME = A.PORTAL_PRNTOBJNAME
  LEFT JOIN PSPRSMDEFN C
  ON C.PORTAL_NAME     = B.PORTAL_NAME
  AND C.PORTAL_OBJNAME = B.PORTAL_PRNTOBJNAME
  LEFT JOIN PSPRSMDEFN D
  ON D.PORTAL_NAME     = C.PORTAL_NAME
  AND D.PORTAL_OBJNAME = C.PORTAL_PRNTOBJNAME
  LEFT JOIN PSPRSMDEFN E
  ON E.PORTAL_NAME         = D.PORTAL_NAME
  AND E.PORTAL_OBJNAME     = D.PORTAL_PRNTOBJNAME
  WHERE A.PORTAL_URI_SEG2 IN
    (SELECT PNLGRPNAME FROM PS_PRCSDEFNPNL P WHERE P.PRCSNAME = :PROCESS_NAME );
Find navigations from Component name SQL
SELECT SRCH.PORTAL_LABEL LABEL ,
    NVL(SRCH.PORTAL_URI_SEG2, ' ') COMPNOENT ,
    SRCH.PORTAL_OBJNAME
    --L1.PORTAL_LABEL,  L2.PORTAL_LABEL,  L3.PORTAL_LABEL,
    --L4.PORTAL_LABEL,  L5.PORTAL_LABEL,  L6.PORTAL_LABEL
    ,
    'Main Menu > '
    || L1.PORTAL_LABEL
    || DECODE(L1.PORTAL_REFTYPE, 'F', ' > ')
    || L2.PORTAL_LABEL
    || DECODE(L2.PORTAL_REFTYPE, 'F', ' > ')
    || L3.PORTAL_LABEL
    || DECODE(L3.PORTAL_REFTYPE, 'F', ' > ')
    || L4.PORTAL_LABEL
    || DECODE(L4.PORTAL_REFTYPE, 'F', ' > ')
    || L5.PORTAL_LABEL
    || DECODE(L5.PORTAL_REFTYPE, 'F', ' > ')
    || L6.PORTAL_LABEL NAV_PATH,
    DECODE(SRCH.PORTAL_REFTYPE, 'F', ' ', 'C', SRCH.DESCR254) DESCR
  FROM PSPRSMDEFN L1
  LEFT JOIN PSPRSMDEFN L2
  ON L2.PORTAL_NAME         =L1.PORTAL_NAME
  AND L2.PORTAL_PRNTOBJNAME = L1.PORTAL_OBJNAME
  LEFT JOIN PSPRSMDEFN L3
  ON L3.PORTAL_NAME         =L2.PORTAL_NAME
  AND L3.PORTAL_PRNTOBJNAME = L2.PORTAL_OBJNAME
  LEFT JOIN PSPRSMDEFN L4
  ON L4.PORTAL_NAME         =L3.PORTAL_NAME
  AND L4.PORTAL_PRNTOBJNAME = L3.PORTAL_OBJNAME
  LEFT JOIN PSPRSMDEFN L5
  ON L5.PORTAL_NAME         =L4.PORTAL_NAME
  AND L5.PORTAL_PRNTOBJNAME = L4.PORTAL_OBJNAME
  LEFT JOIN PSPRSMDEFN L6
  ON L6.PORTAL_NAME         =L5.PORTAL_NAME
  AND L6.PORTAL_PRNTOBJNAME = L5.PORTAL_OBJNAME
  LEFT JOIN PSPRSMDEFN SRCH
  ON SRCH.PORTAL_NAME       = 'EMPLOYEE'
  AND SRCH.PORTAL_OBJNAME   = NVL(L6.PORTAL_OBJNAME,NVL(L5.PORTAL_OBJNAME,NVL(L4.PORTAL_OBJNAME, NVL(L3.PORTAL_OBJNAME,(NVL(L2.PORTAL_OBJNAME,NVL(L1.PORTAL_OBJNAME,' ')))))))
  WHERE L1.PORTAL_NAME      ='EMPLOYEE'
  AND L1.PORTAL_PRNTOBJNAME = 'PORTAL_ROOT_OBJECT'
  -------------------------
  --  Search for Items
  -------------------------
  AND SRCH.PORTAL_URI_SEG2 = :ComponentName -- Component
    --AND SRCH.PORTAL_LABEL LIKE 'PeopleTools%' -- Label
    --AND L1.PORTAL_OBJNAME = 'PT_PEOPLETOOLS' -- Folder/Ref Object Name
  ORDER BY L1.PORTAL_REFTYPE DESC,
    L1.PORTAL_LABEL,
    L2.PORTAL_REFTYPE DESC,
    L2.PORTAL_LABEL,
    L3.PORTAL_REFTYPE DESC,
    L3.PORTAL_LABEL,
    L4.PORTAL_REFTYPE DESC,
    L4.PORTAL_LABEL,
    L5.PORTAL_REFTYPE DESC,
    L5.PORTAL_LABEL,
    L6.PORTAL_REFTYPE DESC,
    L6.PORTAL_LABEL ;
Integration Broker (IB) Tables SQL
/* Error Msg Data */
  SELECT *
    FROM PSIBERR A
   WHERE A.IBTRANSACTIONID IN
      (SELECT IBTRANSACTIONID
         FROM PSAPMSGPUBHDR B
        WHERE B.IB_OPERATIONNAME = :operName); 
  
  /* Error Msg Parameters */
  SELECT *
    FROM PSIBERRP A
   WHERE A.IBTRANSACTIONID IN
      (SELECT IBTRANSACTIONID
         FROM PSAPMSGPUBHDR B
        WHERE B.IB_OPERATIONNAME = :operName);
  
  
  /* Msg Publishing */
  SELECT *
    FROM PSAPMSGPUBCON A
   WHERE A.IBPUBTRANSACTID IN
      (SELECT IBTRANSACTIONID
         FROM PSAPMSGPUBHDR B
        WHERE B.IB_OPERATIONNAME = :operName);
  
  /* Msg Subscription */
  SELECT *
    FROM PSAPMSGSUBCON A
   WHERE A.IBPUBTRANSACTID IN
      (SELECT IBTRANSACTIONID
         FROM PSAPMSGPUBHDR B
        WHERE B.IB_OPERATIONNAME = :operName);
  
  /* Published Msg Data */
  SELECT *
    FROM PSAPMSGPUBDATA A
   WHERE A.IBTRANSACTIONID IN
      (SELECT IBTRANSACTIONID
         FROM PSAPMSGPUBHDR B
        WHERE B.IB_OPERATIONNAME = :operName);
  
  /* Msg Header */
  SELECT *
    FROM PSAPMSGPUBHDR B
   WHERE B.IB_OPERATIONNAME = :operName;
Find Records and Fields used in a PeopleSoft Page SQL
-- SQL Query to find all the Records and Fields used in a PeopleSoft page:
SELECT RECNAME,
  FIELDNAME
FROM PSPNLFIELD
WHERE PNLNAME = :PAGENAME;

-- SQL Query to find all the Records where a particular PeopleSoft field is used:
SELECT DISTINCT RECNAME,
  FIELDNAME
FROM PSRECFIELD
WHERE FIELDNAME = :FIELDNAME;

-- SQL query to find all the page names where a field is used from a particular record:
SELECT PNLNAME
FROM PSPNLFIELD
WHERE RECNAME = :RECORDNAME
AND FIELDNAME = :FIELDNAME;
Find Record fields SQL
SELECT PSRECFIELD.FIELDNAME, 
    CASE PSDBFIELD.FIELDTYPE
       WHEN 0 THEN 'Char'
       WHEN 1 THEN 'Long'
       WHEN 2 THEN 'Nbr'
       WHEN 4 THEN 'Date'
       WHEN 6 THEN 'DtTm'
       ELSE ''
     END CASE, 
   PSDBFIELD.LENGTH, 
   PSDBFLDLABL.LONGNAME,
   PSDBFLDLABL.SHORTNAME
   FROM PSRECFIELD, PSDBFIELD, PSDBFLDLABL WHERE PSRECFIELD.RECNAME = :RECORD_NAME 
   AND PSRECFIELD.FIELDNAME = PSDBFIELD.FIELDNAME
   AND PSDBFLDLABL.FIELDNAME = PSRECFIELD.FIELDNAME
   AND PSDBFLDLABL.DEFAULT_LABEL = 1
   ORDER BY PSRECFIELD.FIELDNUM ASC;
   
Finding duplicate values in a SQL table SQL
SELECT
    name, email, COUNT(*)
  FROM
    users
  GROUP BY
    name, email
  HAVING 
    COUNT(*) > 1
List Component Items SQL
SELECT CASE FIELDTYPE
      WHEN 0 THEN 'Static Text'
      WHEN 1 THEN 'Frame'
      WHEN 2 THEN 'Group Box'
      WHEN 3 THEN 'Statis Image'
      WHEN 4 THEN 'Edit Box'
      WHEN 5 THEN 'Dropdown List'
      WHEN 6 THEN 'Long Edit Box'
      WHEN 7 THEN 'Check Box'
      WHEN 8 THEN 'Radio Button'
      WHEN 9 THEN 'Image'
      WHEN 10 THEN 'Scroll Bar'
      WHEN 11 THEN 'Subpage'
      WHEN 12 THEN 'Peoplecode Command - (Button/Hyperlink Destination)'
      WHEN 13 THEN 'Scroll Action - (Button/Hyperlink Destination)'
      WHEN 14 THEN 'Toolbar Action - (Button/Hyperlink Destination)'
      WHEN 15 THEN 'External Link - (Button/Hyperlink Destination)'
      WHEN 16 THEN 'Internal Link - (Button/Hyperlink Destination)'
      WHEN 17 THEN 'Process - (Button/Hyperlink Destination)'
      WHEN 18 THEN 'Secondary Page'
      WHEN 19 THEN 'Grid'
      WHEN 20 THEN 'Tree'
      WHEN 21 THEN 'Secondary Page - (Button/Hyperlink Destination)'
      WHEN 23 THEN 'Horizontal Rule'
      WHEN 24 THEN 'Tab Separator'
      WHEN 25 THEN 'Html Area'
      WHEN 26 THEN 'Prompt Action - (Button/Hyperlink Destination)'
      WHEN 27 THEN 'Scroll Area' 
      WHEN 29 THEN 'Page Anchor'
      WHEN 30 THEN 'Chart'
      WHEN 31 THEN 'Push Button/Link'
      WHEN 32 THEN 'Analytic Grid'
      ELSE TO_CHAR(FIELDTYPE)
  END CASE
  FROM PSPNLFIELD
  WHERE PNLNAME = :ComponentName;
PeopleSoft Object Type List SQL
VALUE   DESCRIPTION
  0       Record
  1       Index
  2       Field
  3       Field Format
  4       Translate Value
  5       Page
  6       Menu
  7       Component
  8       Record PeopleCode
  9       Menu PeopleCode
  10      Query
  11      Tree Structure
  12      Tree
  13      Access Group
  14      Color
  15      Style
  16      Business Process Map
  17      Business Process
  18      Activity
  19      Role
  20      Process Definition
  21      Process Server Definition
  22      Process Type Definition
  23      Process Job Definition
  24      Process Recurrence Definition
  25      Message Catalog
  26      Dimension
  27      Cube Definition
  28      Cube Instance Definition
  29      Business Interlink
  30      SQL Object
  31      File Layout
  32      Component Interface
  33      Application Engine Program
  34      Application Engine Section
  35      Message Node
  36      Message Channel
  37      Message
  38      Approval rule set
  39      Message PeopleCode
  40      Subscription PeopleCode
  41      N/A
  42      Component Interface PeopleCode
  43      Application Engine PeopleCode
  44      Page PeopleCode
  45      Page Field PeopleCode
  46      Component PeopleCode
  47      Component Record PeopleCode
  48      Component Record Field PeopleC
  49      Image
  50      Style sheet
  51      HTML
  52      Not used
  53      Permission List
  54      Portal Registry Definitions
  55      Portal Registry Structure
  56      URL Definitions
  57      Application Packages
  58      Application Package PeopleCode
  59      Portal Registry User Homepage
  60      Problem Type
  61      Archive Templates
  62      XSLT
  63      Portal Registry User Favorite
  64      Mobile Page
  65      Relationships
  66      Component Interface Property P
  67      Optimization Models
  68      File References
  69      File Type Codes
  70      Archive Object Definitions
  71      Archive Templates (Type 2)
  72      Diagnostic Plug In
  73      Analytic Model
  79      Service
  80      Service Operation
  81      Service Operation Handler
  82      Service Operation Version
  83      Service Operation Routing
  84      Info Broker Queues
  85      XLMP Template Definition
  86      XLMP Report Definition
  87      XMLP File Definition
  88      XMPL Data Source Definition
  89      WSDL
  90      Message Schemas
  94      Abstract
  95      SQR File
  96      Cobol File
  97      Configuration
  98      Crystal File
List Log Message actions in Application Programs SQL
SELECT A.AE_APPLID,
    A.AE_SECTION,
    A.AE_STEP,
    M.AE_MESSAGE_PARMS,
    S.MESSAGE_SET_NBR,
    S.MESSAGE_NBR
  FROM PSAESTMTDEFN A,
    PSAESTEPMSGDEFN M,
    PSAESTEPDEFN S
  WHERE A.AE_APPLID  = M.AE_APPLID
  AND A.AE_APPLID    = S.AE_APPLID
  AND A.AE_SECTION   = M.AE_SECTION
  AND A.AE_SECTION   = S.AE_SECTION
  AND A.MARKET       = M.MARKET
  AND A.MARKET       = S.MARKET
  AND A.DBTYPE       = M.DBTYPE
  AND A.DBTYPE       = S.DBTYPE
  AND A.EFFDT        = M.EFFDT
  AND A.EFFDT        = S.EFFDT
  AND A.AE_STEP      = M.AE_STEP
  AND A.AE_STEP      = S.AE_STEP
  AND A.AE_STMT_TYPE = 'M';
Optional Prompts/Criteria SQL
SELECT * FROM TABLENAME WHERE FIELDNAME = :1 OR TRIM(:1) IS NULL;
Message Catalog SQL

PeopleTools > Utilities > Administration > Message Catalog
Behind the scenes, the message catalog uses the following PeopleTools records:

PSMSGSETDEFN - Messages group by message set (a header record really)
PSMSGSETLANG - Related language record for PSMSGSETDEFN
PSMSGCATDEFN - Messages grouped by message set and number
PSMSGCATLANG - Related language record for PSMSGCATDEFN

SELECT *
  FROM PSMSGCATDEFN
  WHERE MESSAGE_SET_NBR = '14210'
  AND MESSAGE_NBR       = '1';

Messages
There are three things you need to decide when you create a message:

1. The severity (cancel, error, message, warning)
2. The message text
3. The explanation

Message Severity
Severity is important. For example, the MessageBox function treats message severity as follows (from PeopleBooks):

Message: The message is displayed and processing continues
Warning: The message is displayed and treated as a warning
Error: The message is displayed and treated as an error
Cancel: The message is displayed and forces a Cancel

Find Page Fields SQL
SELECT RECNAME "Record Name"
  , FIELDNAME "Field Name"
  , CASE FIELDTYPE
          WHEN 0 THEN 'Static Text'
          WHEN 1 THEN 'Frame'
          WHEN 2 THEN 'Group Box'
          WHEN 3 THEN 'Statis Image'
          WHEN 4 THEN 'Edit Box'
          WHEN 5 THEN 'Dropdown List'
          WHEN 6 THEN 'Long Edit Box'
          WHEN 7 THEN 'Check Box'
          WHEN 8 THEN 'Radio Button'
          WHEN 9 THEN 'Image'
          WHEN 10 THEN 'Scroll Bar'
          WHEN 11 THEN 'Subpage'
          WHEN 12 THEN 'Peoplecode Command - (Button/Hyperlink Destination)'
          WHEN 13 THEN 'Scroll Action - (Button/Hyperlink Destination)'
          WHEN 14 THEN 'Toolbar Action - (Button/Hyperlink Destination)'
          WHEN 15 THEN 'External Link - (Button/Hyperlink Destination)'
          WHEN 16 THEN 'Internal Link - (Button/Hyperlink Destination)'
          WHEN 17 THEN 'Process - (Button/Hyperlink Destination)'
          WHEN 18 THEN 'Secondary Page'
          WHEN 19 THEN 'Grid'
          WHEN 20 THEN 'Tree'
          WHEN 21 THEN 'Secondary Page - (Button/Hyperlink Destination)'
          WHEN 23 THEN 'Horizontal Rule'
          WHEN 24 THEN 'Tab Separator'
          WHEN 25 THEN 'Html Area'
          WHEN 26 THEN 'Prompt Action - (Button/Hyperlink Destination)'
          WHEN 27 THEN 'Scroll Area' 
          WHEN 29 THEN 'Page Anchor'
          WHEN 30 THEN 'Chart'
          WHEN 31 THEN 'Push Button/Link'
          WHEN 32 THEN 'Analytic Grid'
          ELSE TO_CHAR(FIELDTYPE)
      END "Field Type" 
  , LBLTEXT "Label"
  FROM PSPNLFIELD
  WHERE PNLNAME = 'MCM_APPL_SUMMARY'
  ORDER BY FIELDNUM ASC;
Find charset of a file charset
file -i filename
Converting files to UTF-8 charset
iconv -f original_charset -t utf-8 originalfile > newfile
List file sizes using powershell powershell
powershell -command "$fso = new-object -com Scripting.FileSystemObject; gci -Directory | select @{l='Size'; e={$fso.GetFolder($_.FullName).Size}},FullName | sort Size -Descending | ft @{l='Size [MB]'; e={'{0:N2}    ' -f ($_.Size / 1MB)}},FullName"
List directories in a folder windows
dir /s /b /o:n /ad
List File names only Windows
dir /b /a-d
List Folders and Sub folders Windows
dir /s /b /o:n /ad
Mount to nfs on windows windows
mount -o anon \\<IPADDRESS>\<DRIVE> Z:
Get SSL Certificate SSL
openssl s_client -connect <SERVER>:<PORT> < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > <SERVER>.crt