Tuesday, November 04, 2008

tkprof GUI tool

tkprof GUI tool

http://www.dirisala.net/oracle/tkprof_trace_viewer.do

Sunday, May 04, 2008

Simple example for FORALL loop performance


CREATE TABLE parts (pnum NUMBER(4), pname CHAR(15));

DECLARE
TYPE numtab IS TABLE OF NUMBER(4) INDEX BY BINARY_INTEGER;
TYPE nametab IS TABLE OF CHAR(15) INDEX BY BINARY_INTEGER;
pnums numtab;
pnames nametab;
t1 NUMBER(9);
t2 NUMBER(9);
t3 NUMBER(9);
BEGIN
FOR j IN 1..5000 LOOP -- load index-by tables
pnums(j) := j;
pnames(j) := 'Part No. ' TO_CHAR(j);
END LOOP;

t1 := dbms_utility.get_time;
FOR i IN 1..5000 LOOP -- use FOR loop
INSERT INTO parts VALUES (pnums(i), pnames(i));
END LOOP;
t2 := dbms_utility.get_time;

FORALL i IN 1..5000 -- use FORALL statement
INSERT INTO parts VALUES (pnums(i), pnames(i));
t3 := dbms_utility.get_time;

dbms_output.put_line('Execution Time (secs)');
dbms_output.put_line('---------------------');
dbms_output.put_line('FOR loop: ' TO_CHAR(t2 - t1));
dbms_output.put_line('FORALL: ' TO_CHAR(t3 - t2));
END;

Thursday, March 13, 2008

checkout hidden oarameters

SELECT
x.ksppinm name,
y.ksppstvl VALUE,
decode(ksppity,
1, 'BOOLEAN',
2, 'STRING',
3, 'INTEGER',
4, 'PARAMETER FILE',
5, 'RESERVED',
6, 'BIG INTEGER',
'UNKNOWN') typ,
decode(ksppstdf,
'TRUE', 'DEFAULT VALUE',
'FALSE', 'INIT.ORA') isdefault,
decode(bitand(ksppiflg / 256, 1),
1, 'IS_SESS_MOD(TRUE)',
'FALSE') isses_modifiable,
decode(bitand(ksppiflg / 65536, 3),
1, 'MODSYS(NONDEFERED)',
2, 'MODSYS(DEFERED)',
3, 'MODSYS(*NONDEFERED*)',
'FALSE') issys_modifiable,
decode(bitand(ksppstvf, 7),
1, 'MODIFIED_BY(SESSION)',
4, 'MODIFIED_BY(SYSTEM)',
'FALSE') is_modified,
decode(bitand(ksppstvf, 2),
2, 'ORA_STARTUP_MOD(TRUE)',
'FALSE') is_adjusted,
ksppdesc description,
ksppstcmnt update_comment
FROM x$ksppi x,
x$ksppcv y
WHERE x.inst_id = userenv('Instance')
AND y.inst_id = userenv('Instance')
AND x.indx = y.indx
AND x.ksppinm LIKE '%optim%';

Tuesday, March 04, 2008

Keyboard state - hebrew

1) Compile the java code to generate the class files.


++ Since the sample code uses forms classes also, it is necessary to include the frmall.jar(10.1.2)/f90all.jar(9.0.4) in CLASSPATH before compilation.


set CLASSPATH=%ORACLE_HOME%\forms\java\frmall.jar;%CLASSPATH% (in 10.1.2 windows)

%ORACLE_HOME%\jdk\bin\javac ChangeInputMethodOnFocus.java 

%ORACLE_HOME%\jdk\bin\javac VTextFieldHeb.java

%ORACLE_HOME%\jdk\bin\javac VTextFieldEng.java

2) Generate the jar file with the 'jar' command to package the class files in step 1.


%ORACLE_HOME%\jdk\bin\jar -cvf InputMethod.jar VTextFieldEng.class VTextFieldHeb.class ChangeInputMethodOnFocus.class

3) Place the jar file in the codebase directory of Forms which is ORACLE_HOME/forms90/java(9.0.4 version) or ORACLE_HOME/forms/java(10.1.2 version) directory by default.


4) Include the jar file in the archive parameter in formsweb.cfg to enable the jar file to be downloaded and cached on the client machine.


archive=frmall.jar,InputMethod.jar

5) Set the 'Implementation Class' property in the form to 'VTextFieldHeb' for the Hebrew text items and 'VTextFieldEng' for english text items where this functionality is required.



Sample Code

-------------------ChangeInputMethodOnFocus.java--------------------


import java.awt.Component; 
import java.awt.event.FocusAdapter; 

import java.awt.event.FocusEvent; 
import java.awt.im.InputContext; 
import java.util.Locale; 

public class ChangeInputMethodOnFocus extends FocusAdapter 

Locale _locale;
class="km">Locale defLocale;
public ChangeInputMethodOnFocus(Locale locale) 

_locale = locale; 


public void focusGained(FocusEvent fe) 

Component c = fe.getComponent(); 

InputContext inputContext = c.getInputContext();
defLocale = inputContext.getLocale();
inputContext.selectInputMethod(_locale); 

}
 public void focusLost(FocusEvent fe) {
      Component c = fe.getComponent(); 

      InputContext inputContext = c.getInputContext(); 
      inputContext.selectInputMethod(defLocale); 
    } 
}

 ----------------VTextFieldHeb.java ------------------


import java.util.Locale;
import oracle.forms.handler.IHandler;

import oracle.forms.ui.VTextField;
public class VTextFieldHeb extends VTextField
{
public void init(IHandler ih)

{
super.init(ih);
ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("iw","IL"));
this.addFocusListener(focusAdapter);
}
}


----------------VTextFieldEng.java ------------------


import java.util.Locale;
import oracle.forms.handler.IHandler;

import oracle.forms.ui.VTextField;
public class VTextFieldEng extends VTextField
{
public void init(IHandler ih)

{
super.init(ih);
ChangeInputMethodOnFocus focusAdapter = new ChangeInputMethodOnFocus (new Locale("en","US"));

this.addFocusListener(focusAdapter);
}
}



Sample Code Output

When you navigate to text items which implement the 'VTextFieldHeb' class, the input locale automatically changes to 'HE' (Hebrew)
and you can begin to enter Hebrew characters. Then when you navigate to text items which implement the 'VTextFieldEng' class, the input locale automatically changes to 'EN' (English) and you can enter English characters.


Additional information


This solution is also applicable for arabic language after performing the following:
1)-On the client machine ,set "Arabic
(Egypt)" as an input keyboard language.

2)-In the above code,change:
ChangeInputMethodOnFocus (new Locale("iw","IL"));


To be:

ChangeInputMethodOnFocus (new Locale("ar","EG"));

Tuesday, February 26, 2008

Exit IE window on application exit

To exit the IE/Firefox window when the application is closed we need to create an HTML file (i.e. exit.htm) with the following code:


{HTML}
{BODY onload="window.opener=null;window.close();"}
{/HTML}

(swith the {} to <>)


Now - in KEY-EXIT we need to call this file:

WEB.SHOW_DOCUMENT('http://myServer/virtualDir/exit.htm', '_SELF');