Friday, November 19, 2021

Python IF ELSE WHILE BREAK

Breaks out of the loop

 while True:
    print('***** BEGIN ******')
    print('Program to find if the person is a Minor, Teenager or Adult.')
    print('Enter a value :')
    age=int(input())
    
    if(age>0 and age<13):
        print('Participant is a Child')
    elif(age>13 and age <18):
        print('Participant is a Teenager')
    elif(age>18):
        print('Participant is an Adult')
    elif(age==0):
        break;

print('*** EXIT END OF PROGRAM *****')

Python Flow statements IF ELSE ELIF

 print('***** BEGIN ******')
    print('Program to find if the person is a Minor, Teenger or Adult.')
    print('Enter a value :')
    age=int(input())
    
    if(age>0 and age<13):
        print('Participant is a Child')
    elif(age>13 and age <18):
        print('Participant is a Teenager')
    elif(age>18):
        print('Participant is an Adult')
    elif(age==0):
        break;

Tuesday, November 16, 2021

Unix shell variables parameters and loops

 The following site is a good link for someone who is aware of programming but wants a quick insight into the shell constructs of programming

https://www.baeldung.com/linux/use-command-line-arguments-in-bash-script



Wednesday, November 10, 2021

Clear the command entered in a Terminal on Mac Ctrl+U and Ctrl+C

 example:

 xyz-mac:~user: mac abc/vbs/vjbad/jkbsjkn/skdnasldn/sdjkkjbasdb

Lets say you want to clear this on a Mac terminal.

Use : Ctrl + U or Ctrl + C

 Note: Use Ctrl key not Command key

 Source: https://superuser.com/questions/192490/clear-command-from-terminal-in-os-x

 Additional Keys:

Ctrl+K clears the screen 


https://osxdaily.com/2006/12/19/command-line-keyboard-shortcuts-for-mac-os-x/


Read REST data using XML input to PLSQL

declare
l_value varchar2(4000);
begin

for x in (select *
from xmltable(
   '/Entities/Entity/Fields/Field'
   passing xmltype(get_rest_details('http:///....us.xyz.com/q...../...//....'))
   COLUMNS
   name varchar2(4000) path '@Name',
   value varchar2(4000) path 'Value'
)
)
loop
htp.p(x.name||chr(9)||chr(9)||'=>'||x.value);
end loop;
exception when others then
htp.p(sqlerrm);

end;

 

-- get_rest_details is a procedure that performs authentication and call REST service
Source: https://docs.oracle.com/cd/E37097_01/doc.42/e35127/GUID-4AC0229D-85E2-439A-9485-531B7B8B6274.htm#AEAPI1955

Example:

l_clob := apex_web_service.make_rest_request(
        p_url => 'http://us.music.yahooapis.com/ video/v1/list/published/popular',
        p_http_method => 'GET',
        p_parm_name => apex_util.string_to_table('appid:format'),
        p_parm_value => apex_util.string_to_table('xyz:xml'));