Adsense Ad

Wednesday, 8 May 2019

Calculator in Python example



#Assignment Calculator
prompt = "Enter number "
num1 = int(input(prompt))
prompt = "To DO? '+','-','*','/' "
todo = input(prompt)
prompt = "Enter number again "
num2 = int(input(prompt))
if todo == '+':
    print(num1+num2)
elif todo == '-':
    print(num1-num2)
elif todo == '*':
    print(num1*num2)
elif todo == '/':
    print(num1/num2)  

Enter number 16
To DO? '+','-','*','/' -
Enter number again 8
Result: 8

Sunday, 5 May 2019

Run Oracle Forms without using browser (Java WebStart)

There are so many issues raised while running oracle forms on browser and many people can't configure it properly and thinking about launching oracle application without using browser.
Good new is that we can do that with the help of JAVA WEBSTART but bad news is, it is not supported by oracle.

In following steps we will see that how we can configure it in oracle application server.

1- Make sure your application server is properly installed and configured with JRE environment.
2- Now create a file with ".jnlp" extension at <OracleHome\\j2ee\home\default-web-app>
     for e.g. D:\Oracle\FRHome_1\j2ee\home\default-web-app\webstart.jnlp
3- Copy / Paste the following into the file:

<jnlp spec="1.0+" codebase="http://192.168.0.107:7778/forms/java/">
  <information>
    <title>Webstart Application</title>
    <vendor>www.hasanjawaid,blogspot.com</vendor>
    <homepage href="null"/>
    <description>dbWare Application</description>
  </information>
  <security>
    <all-permissions/>
  </security>
  <update check="timeout" policy="always"/>
  <resources>
    <java version="1.6.0"/>
    <jar href="frmall.jar" download="eager" main="true"/>
      </resources>
  <applet-desc name="Webstart Test Oracle Forms 10g" main-class="oracle.forms.engine.Main" width="990" height="600">
    <param name="background" value="false"/>
    <param name="logo" value="false"/>
    <param name="serverApp" value="default"/>
    <param name="lookAndFeel" value="oracle"/>
    <param name="allow_debug" value="true"/>
    <param name="separateFrame" value="false"/>
    <param name="serverArgs" value="module=D:\forms\Sample.fmx userid=scott/tiger@orcl"/>
    <param name="serverURL" value="http://192.168.0.107:7778/forms/lservlet?ifcfs=http://192.168.0.107:7778/forms/frmservlet?config=stk"/>
    <param name="colorScheme" value="blaf"/>
    <param name="splashScreen" value="false"/>
    <param name="dontTruncateTabs" value="true"/>
  </applet-desc>
</jnlp>

4- Update following parameters into your file.
    IP / Config / Form name & location / Port / DB User & TNS.
5- Save the file. Close and double click to run application.

Thursday, 25 April 2019

My first code on Python3

print("Marksheet Program\n")
ask=['Student Name: ','Father Name: ','Class: ']
ans=[]
for bio in range(0,len(ask)):
    val = input(ask[bio])
    ans.append(val.title())
print("\n")   
subjects=['English ','Urdu','Science']   
marks=[]
for score in range(0,len(subjects)):
    res=int(input(subjects[score].title()+" Obtained Marks out of 100: "))
    marks.append(res)


for printing in range(0,len(ask)):
    print(ask[printing]+ans[printing])
   
error=0
errSub=''
totalMarks=0
percentage=0
for printmarks in range(0,len(subjects)):
    if marks[printmarks] >0 and marks[printmarks] <=100:
        totalMarks=totalMarks+marks[printmarks]
        print(subjects[printmarks]+" /100 = "+str(marks[printmarks]))
    else:
        error=1
        errSub=subjects[printmarks]
        print('Invalid marks '+str(marks[printmarks])+' given for the subject '+subjects[printmarks])
if error==1:
    print("Please re-enter the marks for the "+errSub.strip()+" subject")
else:
    print("Total Marks Obtained: "+str(totalMarks)+"/300")
    percentage=totalMarks/300 * 100
    print("Percentage: "+str(percentage))
    if percentage >=80 and percentage <=100:
        print("Grade: A+")
    elif percentage >=70 and percentage <=79:
        print("Grade: A")
    elif percentage >=60 and percentage <=69:
        print("Grade: B")
    elif percentage >=50 and percentage <=59:
        print("Grade: C")
    elif percentage >=40 and percentage <=49:
        print("Grade: D")
    else:
        print("Fail")


Monday, 1 April 2019

Oracle SQL: Query to get Month-Year of current year's sys date and previous months

    select  
    to_char(add_months(trunc(sysdate, 'year'), level - 1), 'MON-YYYY') mon  
    from dual  
    connect by level <= to_number(to_char(sysdate, 'MM'))  
      
    MON  
    --------  
    JAN-2019  
    FEB-2019  
    MAR-2019  
    APR-2019