jTblRefe = new javax.swing.JTable(){public Component prepareRenderer
(TableCellRenderer renderer,int Index_row, int Index_col)
{
Component comp = super.prepareRenderer(renderer, Index_row, Index_col);
//even index, selected or not selected
if (Index_row % 2 == 0 ) {
comp.setBackground(new java.awt.Color(230,212,212));
}
else
{
comp.setBackground(Color.white);
}
return comp;
}
public boolean isCellEditable(int row,int column){
return false;
};
}
;
Monday, July 1, 2013
Check java jar application is already running.
ServerSocket ss;
try {
ss = new ServerSocket(MY_PORT);
// not already running.
} catch (BindException e) {
// already running.
}
Steps.
1) open listning port.
2) check listning port alredy runnig.
Good luck.
Thursday, May 30, 2013
java textbox + jformattedtextfield format
MaskFormatter formatter = new MaskFormatter("*****");
jtxtSellingPrice.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(formatter));
formatter.setValidCharacters("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ $#@!&*()");
| Character |
Description
|
|---|---|
| # | Any valid number, uses Character.isDigit. |
| ' | Escape character, used to escape any of the special formatting characters. |
| U | Any character (Character.isLetter). All
lowercase letters are mapped to upper case. |
| L | Any character (Character.isLetter). All
upper case letters are mapped to lower case. |
| A | Any character or number (Character.isLetter
or Character.isDigit) |
| ? | Any character
(Character.isLetter). |
| * | Anything. |
| H | Any hex character (0-9, a-f or A-F). |
Friday, May 24, 2013
How to search data in java jtable
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
public class Main {
public static void main(String[] args) {
Object[][] data = { { "A", 5 }, { "B", 2 }, { "C", 4 }, { "D", 8 } };
String columnNames[] = { "Item", "Value" };
TableModel model = new DefaultTableModel(data, columnNames) {
public Class getColumnClass(int column) {
return getValueAt(0, column).getClass();
}
};
JTable table = new JTable(model);
RowFilternew RowFilter() {
public boolean include(Entry entry) {
Integer population = (Integer) entry.getValue(1);
return population.intValue() > 3;
}
};
TableRowSorter sorter = new TableRowSorter (model);
sorter.setRowFilter(filter);
table.setRowSorter(sorter);
JScrollPane scrollPane = new JScrollPane(table);
JFrame frame = new JFrame("Filtering Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(scrollPane);
frame.setSize(300, 200);
frame.setVisible(true);
}
}refer http://www.java2s.com/Code/JavaAPI/javax.swing.table/DefaultRowSortersetRowFilterRowFiltersuperTableModelsuperIntegerfilter.htm mycode TableRowSorter sorter = new TableRowSorter(dtm);
RowFilter Tuesday, February 12, 2013
Import data into Oracle8i or higher release database. import export compatibility matrix Which Export client to use when importing into an Oracle8i 8.1.7
or a higher release target database
(always use the Import client of the target database):
+-----------+--------------------------------------------------------------+
| EXPORT | IMPORT into: |
| from +--------+--------+--------+--------+--------+-----------------+
| \/ 8.1.7 |9.2.0 |10.1.0 |10.2.0 |11.1.0 |11.2.0 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 5.x 1)2) | EXP5x | EXP5x | EXP5x | EXP5x | EXP5x | EXP5x | |
| 6.x 2) | EXP6x | EXP6x | EXP6x | EXP6x | EXP6x | EXP6x | |
| 7.x 3) | EXP7x | EXP7x | EXP7x | EXP7x | EXP7x | EXP7x | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 8.0.3 | EXP803 | EXP803 | EXP803 | EXP803 | EXP803 | EXP803 | |
| 8.0.4 | EXP804 | EXP804 | EXP804 | EXP804 | EXP804 | EXP804 | |
| 8.0.5 | EXP805 | EXP805 | EXP805 | EXP805 | EXP805 | EXP805 | |
| 8.0.6 | EXP806 | EXP806 | EXP806 | EXP806 | EXP806 | EXP806 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 8.1.5 | EXP815 | EXP815 | EXP815 | EXP815 | EXP815 | EXP815 | |
| 8.1.6 | EXP816 | EXP816 | EXP816 | EXP816 | EXP816 | EXP816 | |
| 8.1.7 | EXP817 | EXP817 | EXP817 | EXP817 | EXP817 | EXP817 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 9.0.1 | EXP817 | EXP901 | EXP901 | EXP901 | EXP901 | EXP901 | |
| 9.2.0 | EXP817 | EXP920 | EXP920 | EXP920 | EXP920 | EXP920 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 10.1.0 4)| EXP817 | EXP920 |
| 10.2.0 4)| N/S | EXP920 |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 11.1.0 4)| N/S | EXP920*|
| 11.2.0 4)| N/S | EXP920*|
+-----------+--------+--------+--------+--------+--------+--------+--------+
Remarks:1) Import can read export dump files created by EXPORT release 5.1.22 and higher (up to same version).
2) An Oracle5 or Oracle6 export dump and an Oracle8 or Oracle8i or Oracle9i Import: see the Oracle Utilities Manual, Chapter 2 "Import" for special considerations to keep in mind.
3) An Oracle7 export dump and an Oracle8 or Oracle8i or Oracle9i Import: check constraints on the DATE columns become invalid when TO_DATE function has not been used in the constraint (this was not required in earlier Oracle versions).
4) To have a better performance and more flexibility when exporting from and importing into Oracle10g and higher release databases, we recommend the usage of the Export Data Pump (expdp) and Import Data Pump (impdp) clients.
5) The original Export client is desupported for general use as of Oracle Database 11g.
or a higher release target database
(always use the Import client of the target database):
+-----------+--------------------------------------------------------------+
| EXPORT | IMPORT into: |
| from +--------+--------+--------+--------+--------+-----------------+
| \/ 8.1.7 |9.2.0 |10.1.0 |10.2.0 |11.1.0 |11.2.0 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 5.x 1)2) | EXP5x | EXP5x | EXP5x | EXP5x | EXP5x | EXP5x | |
| 6.x 2) | EXP6x | EXP6x | EXP6x | EXP6x | EXP6x | EXP6x | |
| 7.x 3) | EXP7x | EXP7x | EXP7x | EXP7x | EXP7x | EXP7x | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 8.0.3 | EXP803 | EXP803 | EXP803 | EXP803 | EXP803 | EXP803 | |
| 8.0.4 | EXP804 | EXP804 | EXP804 | EXP804 | EXP804 | EXP804 | |
| 8.0.5 | EXP805 | EXP805 | EXP805 | EXP805 | EXP805 | EXP805 | |
| 8.0.6 | EXP806 | EXP806 | EXP806 | EXP806 | EXP806 | EXP806 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 8.1.5 | EXP815 | EXP815 | EXP815 | EXP815 | EXP815 | EXP815 | |
| 8.1.6 | EXP816 | EXP816 | EXP816 | EXP816 | EXP816 | EXP816 | |
| 8.1.7 | EXP817 | EXP817 | EXP817 | EXP817 | EXP817 | EXP817 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 9.0.1 | EXP817 | EXP901 | EXP901 | EXP901 | EXP901 | EXP901 | |
| 9.2.0 | EXP817 | EXP920 | EXP920 | EXP920 | EXP920 | EXP920 | |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 10.1.0 4)| EXP817 | EXP920 |
| 10.2.0 4)| N/S | EXP920 |
+-----------+--------+--------+--------+--------+--------+--------+--------+
| 11.1.0 4)| N/S | EXP920*|
| 11.2.0 4)| N/S | EXP920*|
+-----------+--------+--------+--------+--------+--------+--------+--------+
Remarks:1) Import can read export dump files created by EXPORT release 5.1.22 and higher (up to same version).
2) An Oracle5 or Oracle6 export dump and an Oracle8 or Oracle8i or Oracle9i Import: see the Oracle Utilities Manual, Chapter 2 "Import" for special considerations to keep in mind.
3) An Oracle7 export dump and an Oracle8 or Oracle8i or Oracle9i Import: check constraints on the DATE columns become invalid when TO_DATE function has not been used in the constraint (this was not required in earlier Oracle versions).
4) To have a better performance and more flexibility when exporting from and importing into Oracle10g and higher release databases, we recommend the usage of the Export Data Pump (expdp) and Import Data Pump (impdp) clients.
5) The original Export client is desupported for general use as of Oracle Database 11g.
Thursday, August 9, 2012
Wednesday, April 11, 2012
Performanace tuning by AWR and ADDM.
Snapshots
BEGIN
DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(
retention => 43200, -- Minutes (= 30 Days). Current value retained if NULL.
interval => 30); -- Minutes. Current value retained if NULL.
END;
/
Extra snapshots can be taken and existing snapshots can be removed, as shown below
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_snapshot_range (
low_snap_id => 22,
high_snap_id => 32);
END;
/
Baselines View the difference between two time.
BEGIN
DBMS_WORKLOAD_REPOSITORY.create_baseline (
start_snap_id => 210,
end_snap_id => 220,
baseline_name => 'batch baseline');
END;
/
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_baseline (
baseline_name => 'batch baseline',
cascade => FALSE); -- Deletes associated snapshots if TRUE.
END;
/
DBA_HIST_SNAPSHOT view is use for get the snapshot ID;
Workload Repository Reports
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
@$ORACLE_HOME/rdbms/admin/awrrpti.sql
http://www.dbapool.com/analyzer/ Online Analyzer
ADDM report
By script
-- Create an ADDM task.
DBMS_ADVISOR.create_task (
advisor_name => 'ADDM',
task_name => '970_1032_AWR_SNAPSHOT',
task_desc => 'Advisor for snapshots 970 to 1032.');
-- Set the start and end snapshots.
DBMS_ADVISOR.set_task_parameter (
task_name => '970_1032_AWR_SNAPSHOT',
parameter => 'START_SNAPSHOT',
value => 970);
DBMS_ADVISOR.set_task_parameter (
task_name => '970_1032_AWR_SNAPSHOT',
parameter => 'END_SNAPSHOT',
value => 1032);
-- Execute the task.
DBMS_ADVISOR.execute_task(task_name => '970_1032_AWR_SNAPSHOT');
END;
/
-- Display the report.
SET LONG 100000
SET PAGESIZE 50000
SELECT DBMS_ADVISOR.get_task_report('970_1032_AWR_SNAPSHOT') AS report
FROM dual;
SET PAGESIZE 24
BEGIN
DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(
retention => 43200, -- Minutes (= 30 Days). Current value retained if NULL.
interval => 30); -- Minutes. Current value retained if NULL.
END;
/
Extra snapshots can be taken and existing snapshots can be removed, as shown below
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_snapshot_range (
low_snap_id => 22,
high_snap_id => 32);
END;
/
Baselines View the difference between two time.
BEGIN
DBMS_WORKLOAD_REPOSITORY.create_baseline (
start_snap_id => 210,
end_snap_id => 220,
baseline_name => 'batch baseline');
END;
/
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_baseline (
baseline_name => 'batch baseline',
cascade => FALSE); -- Deletes associated snapshots if TRUE.
END;
/
DBA_HIST_SNAPSHOT view is use for get the snapshot ID;
Workload Repository Reports
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
@$ORACLE_HOME/rdbms/admin/awrrpti.sql
http://www.dbapool.com/analyzer/ Online Analyzer
ADDM report
By script
@/u01/app/oracle/product/10.1.0/db_1/rdbms/admin/addmrpt.sqlBEGIN
BY Pakage
-- Create an ADDM task.
DBMS_ADVISOR.create_task (
advisor_name => 'ADDM',
task_name => '970_1032_AWR_SNAPSHOT',
task_desc => 'Advisor for snapshots 970 to 1032.');
-- Set the start and end snapshots.
DBMS_ADVISOR.set_task_parameter (
task_name => '970_1032_AWR_SNAPSHOT',
parameter => 'START_SNAPSHOT',
value => 970);
DBMS_ADVISOR.set_task_parameter (
task_name => '970_1032_AWR_SNAPSHOT',
parameter => 'END_SNAPSHOT',
value => 1032);
-- Execute the task.
DBMS_ADVISOR.execute_task(task_name => '970_1032_AWR_SNAPSHOT');
END;
/
-- Display the report.
SET LONG 100000
SET PAGESIZE 50000
SELECT DBMS_ADVISOR.get_task_report('970_1032_AWR_SNAPSHOT') AS report
FROM dual;
SET PAGESIZE 24
Subscribe to:
Posts (Atom)
