Wednesday 14 March 2018

Simplest way to display Server Time in JSP using js

THE BELOW CODE WORKS ONLY IN JSP :

<html>
<body >
<table width="95%" border="1" cellpadding="1" cellspacing="1" style="margin-left:2; margin-top:10;margin-bottom:10;">
<tr>
<td><strong>Server Time&nbsp;:&nbsp;&nbsp;</strong><label id="timelable"></label></td>
</tr>
<tr>
<td><strong>Client Time&nbsp;:&nbsp;&nbsp;</strong><label id="timeClient"></label></td>
</tr>
</table>
</body>
<script type="text/javascript">
var myVar = setInterval(function(){ myTimer() }, 1000);
var jsVar=  <%=java.util.Calendar.getInstance().getTimeInMillis()%>;
var k = new Date(jsVar);
var timeZoneOffset=<%=java.util.TimeZone.getDefault().getOffset(System.currentTimeMillis())%>;
jsVar=jsVar+timeZoneOffset;

function myTimer() {
jsVar=jsVar+1000;
var d = new Date(jsVar);
var t=d.toUTCString();
document.getElementById("timelable").innerHTML = t;
document.getElementById("timeClient").innerHTML=k;
}
</html>

Friday 1 July 2016

Struts 2 Questions

1.How Struts 2 validation works?
When the user presses the submit button, Struts 2 will automatically execute the validate method and if any of the if statements listed inside the method are true, Struts 2 will call its addFieldError method. If any errors have been added then Struts 2 will not proceed to call the execute method. Rather the Struts 2 framework will return input as the result of calling the action.
So when validation fails and Struts 2 returns input, the Struts 2 framework will redisplay the view file. Since we used Struts 2 form tags, Struts 2 will automatically add the error messages just above the form filed.
These error messages are the ones we specified in the addFieldError method call. The addFieldError method takes two arguments. The first is the form field name to which the error applies and the second is the error message to display above that form field.

Wednesday 13 January 2016

BI Publisher

1.How to generate report in PDF directly instead of from HTML to PDF in BI Publisher from Browser?


Hi All,
One solution has been found to generate the report directly in PDF format instead of generating the from html to PDF.

Steps to follow are below.
A.Open the file “_report.xdo” which will be located in the <Report_Name>.xdo  folder EX: DetailedCustomerReportAdhoc.xdo
In file search for “label” in that line change the below attributes.
                        1.From outputFormat="html,pdf,rtf,xlsx,pptx" to outputFormat="pdf"
                        2.From defaultFormat="html" to defaultFormat="pdf"
For Ex:
Change From below line
<template label="test1" url="DetailedCustomerReportAdhoc1.rtf" type="rtf" outputFormat="html,pdf,rtf,xlsx,pptx" defaultFormat="html" locale="en_US" disableMasterTemplate="true" active="true" viewOnline="true"/>
To
            <template label="test1" url="DetailedCustomerReportAdhoc1.rtf" type="rtf" outputFormat="pdf" defaultFormat="pdf" locale="en_US" disableMasterTemplate="true" active="true" viewOnline="true"/>

B.After changing the file Go to catalog select the required report and click on edit as shown below


C.After that click on save button and click View Report as shown below




If still the report is getting viewed directly in HTML. Check the _report.xdo file where the Step 1 done changes are there are not.
If not please follow once again the steps mentioned above.


2.Useful Links for BIP
http://bipublisher.blogspot.in/2012/02/bi-publisher-xdotop-msword-debugging.html


2. How to Set up the Debug On for BIPUBLISHER?
Steps to Turn ON Logging for BI Publisher for Reports debugging

1.Create a folder xdolog and place it under

<Middleware_Home>/user_projects/domains/bifoundation_domain/config/bipublisher

This has to be used in LogDir parameter in step 2.

Note: The above mentioned path is optional .You can create it anywhere

2.Create a file named xdodebug.cfg and place it under

<Middleware_Home>/Oracle_BI1/jdk/jre/lib/

3.Add below listed lines in xdodebug.cfg file

Under Windows

LogLevel=STATEMENT
LogDir=c:\<Middleware_Home>\user_projects\domains\bifoundation_domain\config\bipublisher\xdolog

Under Unix:

LogLevel=STATEMENT
LogDir=<Middleware_Home>/user_projects/domains/bifoundation_domain/config/bipublisher/xdolog

4.Retest the issue

5.Check the files created in the specified LogDir (xdolog) directory.Here you can see XDO.log
6.Remove xdodebug.cfg when finished replicating the issue.


The logging is specifically useful for troubleshooting the Template(RTF/PDF) or Data File(XML file) specific issues. The generated XML file is the actual data file which is run from the MS Word Design Helper Preview mode to narrow down the issue.

3.How to create dynamic query execution in BI Publisher?
In the XDM we have so many DATASETS. Based on some parameters we can have conditional query preparation and execution.

SYNTAX:
                        create sql dataset with following query
                        $if{ (:PARAM == VALUE) }$
                 select 'ravi' as X from dual
            $elsif{(:PARAM == VALUE1 )}$
                 select 'kale' as Z from dual
            $else{
                 select 'TEJ' as Y from dual
            }$
            $endif$

POINTS TO REMEBER:
1. At least One if and one else is mandatory
2.We should not use the double quotes(") or single quotes ('), if the VALUE is string or character.
    EX: a. ravi    --> Correct 
           b. 'ravi'   --> Not Correct
           c. "ravi"  --> Not Correct

EXPLANATION:
While the XDM is exectuing when the above code encounters then the when the inputted parameter is equal value i.e, when the condition satisfies then only the corresponding query executes. Not all the queries executes.

4.How to show Images in generated PDF using RTF Template?
We have 4 solutions. Those solution are available in My Google Drive (BI Publisher/dynamicImages.zip)

Friday 27 November 2015

PL/SQL

Exception handling
Sample
  EXCEPTION
                     WHEN OTHERS THEN  
                      dbms_output.put_line('we get exception'||sqlcode);
                      dbms_output.put_line('we get exception'||sqlerrm);
                      dbms_output.put_line('we get exception');

Tuesday 20 October 2015

Connect to Oracle mails through Mobile

Hi friends,

I have seen many of my friends searching for stbeehive and chat configuration.

Following are the few simple steps to enable you to check mail and chat from your mobile with your oracle id:
1.For enabling chat in your android mobile first download "IM+" app from android market. After downloading, open the app and click on Add Account and enter the details as given below:
login: abcd@oracle.com
password: your oracle password
host: stbeehive.oracle.com
Port: 5223
Priority: 5
Resource: IM+ Android
Check "Use old-style SSL"
and then save.
Now you can chat with any of your colleagues at oracle

2.For enabling stbeehive mail in your android mobile first download "K-9 Mail" app from android market. After downloading, open the application and click on add account and following are the details:
email address: abc@oracle.com
Password: your oracle password
click on Manual Setup and click IMAP and enter following details:
username:abc@oracle.com (append oracle.com at the end)
IMAP server: stbeehive.oracle.com
security type: SSL(if available)
Auth type: PLAIN
Port: 993
and click "Next".
You will get another screen asking for Outgoing server settings. Enter the following details:
SMTP server: stbeehive.oracle.com
Security Type: SSL(if available)
Port: 465
Leave other details as it is and click "Next".
Enter the "Account options" as you want and click "Next".

Now you will be able to receive stbeehive mails and even reply back to those mails from your android mobile.

Enjoy!!!

Wednesday 22 April 2015

Mobile(Tips and Tricks)

For android OS
 If u want your custome ringtones then you have to make a folder in internal sdcard .. Which sholud be named "media" inside it create another folder naming "audio" n inside it "ringtones" .
Name exactly as it has been quoted .. The ringtone you want u can save it in ringtone folder ...

Friday 10 April 2015

Comparator And Comparable

Comparator vs Comparable
ParameterComparableComparator
Sorting logicSorting logic must be in same class whose objects are being sorted. Hence this is called natural ordering of objectsSorting logic is in separate class. Hence we can write different sorting based on different attributes of objects to be sorted. E.g. Sorting using id,name etc.
ImplementationClass whose objects to be sorted must implement this interface.e.g Country class needs to implement comparable to collection of country object by idClass whose objects to be sorted do not need to implement this interface.Some other class can implement this interface. E.g.-CountrySortByIdComparator class can implement Comparator interface to sort collection of country object by id

Sorting method
int compareTo(Object o1)
This method compares this object with o1 object and returns a integer.Its value has following meaning
1. positive – this object is greater than o1
2. zero – this object equals to o1
3. negative – this object is less than o1
int compare(Object o1,Object o2)
This method compares o1 and o2 objects. and returns a integer.Its value has following meaning.
1. positive – o1 is greater than o2
2. zero – o1 equals to o2
3. negative – o1 is less than o1
Calling methodCollections.sort(List)
Here objects will be sorted on the basis of CompareTo method
Collections.sort(List, Comparator)
Here objects will be sorted on the basis of Compare method in Comparator
PackageJava.lang.ComparableJava.util.Comparator

Print Friendly Version of this pagePrint Get a PDF version of this webpagePDF

Simplest way to display Server Time in JSP using js

THE BELOW CODE WORKS ONLY IN JSP : <html> <body > <table width="95%" border="1" cellpadding="1&...