Simplifying geometries
Hi,
I need to simplify a layer of geometries. I have a roads table with 30,000 records and need to reduce the complexity of the data by reducing the number of points in each record. How can I achieve this in Oracle?
Keith.
Keith,
This is VERY easy. Depending on what other data you have (and assuming that you want to keep the original data intact), you could either copy the entire table, or add another SDO_GEOMETRY column.
Next, you could just do something like:
UPDATE datatable a
SET simple_geom = SDO_UTIL.SIMPLIFY(a.complex_geom, 0.5);
To make this happen as you insert and update records (assuming the complex and simple geometries are in the same table) you could use a trigger such as:
CREATE TRIGGER datatable_iutrg
BEFORE UPDATE OR INSERT on datatable FOR EACH ROW
BEGIN
:NEW.simple_geom := SDO_UTIL.SIMPLIFY(:NEW.complex_geom, 0.5);
END;
/
Similar Messages
-
I'm trying to simplify a layer with line (spaghetti) geometries that are geodetic (SRID 8307).
1. Does the SDO_SAM.SIMPLIFY_LAYER work with Geodetic data?
When I try to use sdo_sam.simplify_layer function, the number of vertices does not change, regardless of the "pct_area_change_limit" I use (the only parameter where I can change the value). I even tried 100 (which I take to mean 100%).
execute sdo_sam.simplify_layer('TRACK_TEST','SHAPE','SMPL_SHAPE', '10', '100');
Maybe this is only applicable for polygon data?
2. Should I use SDO_UTIL.SIMPLIFY, instead, for geodetic data?
I was able to create a simplified layer using SDO_UTIL.SIMPLIFY, but I had understood that the SDO_SAM.SIMPLIFY_LAYER was simply a wrapper around SDO_UTIL.SIMPLIFY. I incrementally tried increasingly larger values for the parameters in SDO_UTIL.SIMPLIFY, and it ended up that I had to change the threshold parameter to 10000, and the tolerance parameter to 9999 before I saw a significant difference in the number of vertices.
CREATE TABLE TRACK_TEST_2
AS SELECT ID,
sdo_util.simplify(
MDSYS.SDO_GEOMETRY(
A.SHAPE.SDO_GTYPE,A.SHAPE.SDO_SRID,A.SHAPE.SDO_POINT,A.SHAPE.SDO_ELEM_INFO,A.SHAPE.SDO_ORDINATES),
10000,9999) SMPL_SHAPE
FROM TRACK_TEST A;
3. Why are the parameters controlling the functions different for SDO_SAM.SIMPLIFY_LAYER (commit interval, pct_area_change_limit)
SDO_SAM.SIMPLIFY_GEOMETRY (tolerance,pct_area_change_limit)
and SDO_UTIL.SIMPLIFY (threshold, tolerance)?
I tried changing the tolerance in my layer's metadata, but that didn't seem to affect sdo_sam.simplify_layer.
4. Perhaps my data are not suited for simplifying, but I was hoping to achieve data that displayed more quickly in an on-line map viewer. Are the SIMPLIFY functions best suited to geometries with very closely spaced vertices?
Any insight would be appreciated!
--NancyHi Nancy,
first of all: it works... :)
ok, you have between point 1 and point 2 a difference in Longitude with 0.0001 (-4.4782 -4.4783). This is roughly approached 11m (40.000.000 m/360°*0.0001). If you use a threshold oh 10m and then a threshold of 20m you will see the difference of the result (or 100m, 10000m, 100000m)...
The number of points will be reduced by the algorithm, if there are possible distances to reduce!
for douglas peuker you should see:
http://geometryalgorithms.com/Archive/algorithm_0205/algorithm_0205.htm#Douglas-Peucker%20Algorithm
create table TEST_SP(
ID NUMBER NOT NULL,
GEOM MDSYS.SDO_GEOMETRY,
constraint PK_TESTSP primary key(ID));
insert into MDSYS.USER_SDO_GEOM_METADATA values ('TEST_SP', 'GEOM',
MDSYS.SDO_DIM_ARRAY (
MDSYS.SDO_DIM_ELEMENT ('Longitude', -180, 180, .05),
MDSYS.SDO_DIM_ELEMENT ('Latitude', -90, 90, .05)),8307);
create index TEST_SP_GIDX on TEST_SP(GEOM) indextype is MDSYS.SPATIAL_INDEX parameters('sdo_indx_dims=2');
INSERT INTO TEST_SP(ID,GEOM)
VALUES (1,
MDSYS.SDO_GEOMETRY(2006, 8307, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1),
MDSYS.SDO_ORDINATE_ARRAY(-4.4782, 48.383, -4.4783, 48.3839, -4.5072, 48.3523, -4.8323, 48.2802, -4.9683, 48.2977
, -5.2159, 48.4632, -5.4231, 48.9394, -5.6304, 49.4157, -5.8376, 49.8919, -5.8881, 50.016, -5.8588, 50.5097, -5.8296
, 51.0035, -5.8003, 51.4972, -5.7041, 51.9855, -5.608, 52.4738, -5.5118, 52.9621, -5.4198, 53.3168, -5.3821, 53.3369
, -5.3164, 53.6902, -5.2506, 54.0435, -5.1849, 54.3968, -5.4752, 54.7332, -5.7656, 55.0696, -6.0559, 55.406, -6.5756
, 55.4709, -6.8982, 55.76, -7.2207, 56.0492, -7.5433, 56.3383, -7.2575, 56.7691, -6.9716, 57.2, -6.6858, 57.6308, -6.6665
, 57.6427, -6.2458, 57.8083, -5.825, 57.9738, -5.5861, 58.4546, -5.3473, 58.9355, -5.1084, 59.4163, -4.9137, 59.7915
, -4.719, 60.1667, -4.5436, 60.5136, -4.3682, 60.8605, -4.1047, 61.3391, -3.8412, 61.8176, -3.5777, 62.2962, -3.361
, 62.7598, -3.8819, 63.1987, -4.4027, 63.6375, -4.9236, 64.0764, -5.4563, 64.4946, -5.989, 64.9128, -5.9889, 64.9258
, -5.3195, 65.2554, -4.65, 65.5851, -3.9806, 65.9147, -3.7081, 66.3963, -3.4357, 66.878, -3.1632, 67.3596, -3.0062
, 67.7413, -2.9647, 68.0694, -2.9232, 68.3976, -2.8955, 68.7173, -2.887, 68.8462, -2.8182, 69.3409, -2.7494, 69.8357
, -2.6806, 70.3304, -2.6327, 70.7036, -2.5849, 71.0769, -2.537, 71.4501, -2.4891, 71.8233, -2.4831, 71.8485, -2.4675
, 71.8937, -2.4678, 71.9014, -2.4799, 71.9143, -2.4814, 71.9087, -2.4772, 71.9077, -1.9743, 71.7427, -1.5918, 71.8198
, -.3136, 72.0398, .9646, 72.2599, 2.2428, 72.4799, 3.3439, 72.6617, 4.4449, 72.8435, 4.4565, 72.8586, 4.418, 72.8691
, 2.9688, 72.6301, 1.5196, 72.3912, .0704, 72.1522, -.6649, 72.0252, -1.4002, 71.8982, -1.417, 71.8855, -1.3403, 71.8332
, -1.2964, 71.8326, .1123, 72.074, 1.5209, 72.3153, 2.9296, 72.5567, 3.7046, 72.6857, 4.4796, 72.8146, 4.5257, 72.8115
, 4.5476, 72.799, 4.5273, 72.786, 3.696, 72.6769, 3.6234, 72.638, 2.2485, 72.4053, .8735, 72.1727, -.5014, 71.94, -.5454
, 71.9384, -.7357, 72.0499, .4759, 72.2537, 1.6876, 72.4575, 2.8992, 72.6613, 2.9211, 72.6507, 1.9359, 72.4834, .9506
, 72.316, -.0346, 72.1487, -.028, 72.1346, .009, 72.1265, .9959, 72.2905, 1.9827, 72.4546, 2.9696, 72.6186, 3.0143
, 72.6149, 3.0332, 72.6001, 3.002, 72.5875, 2.0095, 72.42, 1.0169, 72.2524, .0244, 72.0849, .0186, 72.0717, .0446
, 72.0605, .0888, 72.0604, 1.0737, 72.2246, 2.0587, 72.3887, 3.0436, 72.5529, 3.111, 72.5134, 2.14, 72.3481, 1.169
, 72.1829, .198, 72.0176, .2107, 72.0031, .2599, 71.9984, 1.2471, 72.1609, 2.2343, 72.3234, 3.2215, 72.4859, 3.2602
, 72.478, 3.2657, 72.4632, 2.278, 72.2965, 1.2903, 72.1297, .3026, 71.963, .2758, 71.952, .2828, 71.9386, .3297, 71.9323
, 1.2185, 72.0805, 1.7223, 72.1642, 2.503, 72.2919, 3.2837, 72.4196, 3.3688, 72.3642, 2.4037, 72.2013, 1.4386, 72.0384
, .4735, 71.8755, .5692, 71.8254, .6111, 71.8254, 1.125, 71.9124, 2.0029, 72.0607, 2.7263, 72.1807, 2.7578, 72.1925
, 2.2202, 72.4803, 1.6826, 72.7682, 1.5122, 72.7334, 2.1082, 72.3975, 2.7043, 72.0615, 3.3003, 71.7256, 3.3001, 71.7124
, 3.2157, 71.6973, 3.1737, 71.6952, 2.3869, 72.1318, 1.6002, 72.5685, .8134, 73.0051, .5468, 73.1462, .3685, 73.1217
, .3595, 73.1095, 1.1552, 72.6727, 1.9509, 72.2359, 2.7466, 71.7991, 3.2359, 71.5183, 3.2114, 71.5062, 3.0948, 71.4854
, 3.0524, 71.4834, 2.2702, 71.9181, 1.488, 72.3528, .7058, 72.7875, .121, 73.0845, -.0487, 73.0569, .2024, 72.9178
, .388, 72.9389, .4762, 72.9269, .5364, 72.89, .3319, 72.8554, .3409, 72.8406, 1.0959, 72.4252, 1.8508, 72.0099, 2.6058
, 71.5945, 2.4501, 71.5637, 2.4042, 71.566, 1.6172, 71.9987, .8302, 72.4313, .0432, 72.864, -.1008, 72.9388, -.1515
, 72.9379, -.6602, 72.8529, -.6974, 72.8597, -.8222, 72.9223, -.8075, 72.9346, -.7236, 72.9474, -.5355, 72.9736, -.5009
, 72.9844, -.4884, 72.9991, -.5006, 73.0334, -.3954, 72.9838, .2817, 72.6227, .9588, 72.2616, 1.6359, 71.9005, 1.603, 71.8921
, 1.4702, 71.8735, 1.4273, 71.8777, .8944, 72.1673, .3614, 72.4568, .3643, 72.4713, 1.4427, 72.6505, 2.521, 72.8297, 2.6168
, 72.7773, 2.5908, 72.767, 1.1703, 72.5281, -.2502, 72.2891, -.2771, 72.2779, -.2594, 72.2632, -.212, 72.2585, .8306
, 72.4334, 1.8733, 72.6083, 2.9159, 72.7832, 2.9674, 72.7852, 2.9902, 72.7712, 2.9657, 72.7592, 1.9165, 72.5801
, .8673, 72.4009, -.1819, 72.2218, -.1901, 72.2083, -.1611, 72.1973, -.1161, 72.1973, .9307, 72.3749, 1.9774, 72.5525
, 3.0242, 72.7301, 3.0573, 72.7214, 3.3182, 72.5681, 2.3711, 72.4083, 1.6896, 72.4105, 1.4702, 72.2525, .0765, 72.0164
, -1.3172, 71.7804, -1.5303, 71.9025, -1.5214, 71.9157, -.7819, 72.0493, -.7584, 72.0625, -.1361, 72.1707, -.0875, 72.1713
, .0304, 72.0919, .0141, 72.0786, -.9506, 71.905, -1.9152, 71.7315, -1.9596, 71.7391, -1.9712, 71.7533, -1.9458, 71.7646
, -1.8996, 71.7677, -1.8199, 71.7848, -1.7743, 71.7845, -1.7465, 71.7709, -1.7419, 71.7559, -1.8251, 71.744, -1.8392, 71.73
, -1.7998, 71.7272, -1.7953, 71.7285, -1.6374, 71.7675, -1.6548, 71.7691, -1.8372, 71.7472, -1.8217, 71.746, -1.8177, 71.7408
, -1.7915, 71.748, -1.8019, 71.7254, -1.9911, 71.2377, -2.1803, 70.7499, -2.3695, 70.2622, -2.55, 69.7684, -2.7305, 69.2745
, -2.911, 68.7807, -3.0756, 68.2892, -3.2401, 67.7976, -3.4047, 67.3061, -3.5591, 66.8129, -3.7134, 66.3197, -3.8678, 65.8265
, -4.0106, 65.3313, -4.1534, 64.8361, -4.2962, 64.3409, -4.3917, 64.0736, -4.5101, 63.6701, -4.6284, 63.2665, -4.7468, 62.863
, -4.8133, 62.5646, -4.8797, 62.2661, -5.0123, 61.8243, -5.1449, 61.3824, -5.2784, 60.8876, -5.412, 60.3927, -5.5455, 59.8979
, -5.6914, 59.4059, -5.8373, 58.914, -5.9832, 58.422, -6.1319, 58.0188, -6.1481, 58.0064, -6.4952, 57.9001, -6.8148, 57.4395
, -7.1344, 56.979, -7.454, 56.5184, -7.5405, 56.3236, -7.1569, 56.009, -6.7734, 55.6943, -6.3898, 55.3797, -6.1153, 55.3535
, -5.8063, 55.0412, -5.4973, 54.7289, -5.1883, 54.4166, -5.3286, 53.9254, -5.4688, 53.4341, -5.6091, 52.9429, -5.7337, 52.4541
, -5.8583, 51.9652, -5.9829, 51.4764, -5.9945, 50.9804, -6.0062, 50.4845, -6.0178, 49.9885, -5.7687, 49.5197, -5.5196, 49.0509
, -5.2705, 48.5821
-- Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
-- Threshold value to be used for the geometry simplification.
-- Should be a positive number. (Zero causes the input geometry to be returned.)
-- If the input geometry is geodetic, the value is the number of meters;
-- if the input geometry is non-geodetic, the value is the number of units associated with the data.
-- Tolerance reflects the distance that two points can be apart and still be considered the same
-- MUST NOT! be greater than threshold, or null (then internally = 0.005)
--> You have defined a tolerance in metadata with 0.05; so why don't use here?
SELECT ID,
sdo_util.simplify(
GEOM,
10000,0.05) SMPL_SHAPE
FROM TEST_SP A;
1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -4,8323474, 48,2797711, -5,2159566, 48,4627829, -5,88816
28, 50,0156972, -5,1849215, 54,3967266, -6,0559248, 55,4059499, -6,5756301, 55,4
708485, -7,5433349, 56,3382611, -6,6858165, 57,6307846, -5,8250091, 57,9737903,
-3,3610006, 62,7598027, -5,9890247, 64,9128292, -3,9806117, 65,9147493, -3,16320
41, 67,3597054, -2,4798621, 71,9148546, -1,9742256, 71,7432283, 4,41878772, 72,8
698623, -1,416879, 71,8860517, 4,52649053, 72,8122526, -,50120336, 71,9405632, -
,73551748, 72,0504801, 2,89978127, 72,6620086, -,03435262, 72,1492992, 2,97018311
, 72,6193014, ,018847266, 72,0722867, 3,04418215, 72,5535901, ,198259139, 72,0181787
, 3,22209193, 72,4865797, ,276061466, 71,9525685, 3,28428939, 72,4202686, ,473772831
, 71,8760574, 2,72680263, 72,1813226, 1,68306421, 72,7689189, 3,30060056
, 71,7129527, ,547178691, 73,1469855, 3,05285269, 71,4839162, ,121326784, 73,085271
, 2,45051033, 71,5642229, -,10050751, 72,9395414, -,82198316, 72,9230354, -,50034338
, 73,0341583, 1,47055648, 71,874063, ,364605226, 72,4719567, 2,52156221, 72,8304369
, -,24996327, 72,2897221, 2,91649976, 72,7839314, -,18986264, 72,2089086
, 3,02480439, 72,7308224, 3,31881376, 72,5687954, -1,3170745, 71,7809355, -1,5212864
, 71,9162563, -,13586013, 72,1713025, ,014347302, 72,0791878, -1,9711251
, 71,75383, -1,6372994, 71,7680328, -3,7134102, 66,319762, -5,5455029, 59,897899
, -6,1319107, 58,0187899, -6,4952136, 57,9000878, -7,540535, 56,3235608, -5,1883214
, 54,4165272, -5,9829533, 51,4761912, -6,0178661, 49,9881936, -5,2705573, 48,5816924))
SELECT ID,
sdo_util.simplify(
GEOM,
1000,0.05) SMPL_SHAPE
FROM TEST_SP A;
1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -4,5072387, 48,35188, -4,8323474, 48,2797711, -4,9683509
, 48,2972713, -5,2159566, 48,4627829, -5,8881628, 50,0156972, -5,8003495, 51,496
9942, -5,5118342, 52,9619711, -5,4198306, 53,3166867, -5,3821299, 53,3367877, -5
,1849215, 54,3967266, -6,0559248, 55,4059499, -6,5756301, 55,4708485, -7,5433349
, 56,3382611, -6,6858165, 57,6307846, -5,8250091, 57,9737903, -4,7190009, 60,166
6997, -3,5777005, 62,2962013, -3,3610006, 62,7598027, -4,4027049, 63,6375088, -5
,9890247, 64,9128292, -3,9806117, 65,9147493, -3,1632041, 67,3597054, -3,006201,
67,7414256, -2,4798621, 71,9148546, -1,9742256, 71,7432283, ,964944602, 72,2605
232, 2,24328978, 72,4805703, 4,44568645, 72,8442578, 4,41878772, 72,8698623, 1,5
2000878, 72,3918494, -1,416879, 71,8860517, -1,3401746, 71,8337437, -1,2962712,
71,8331437, ,112555419, 72,0745875, 1,52130154, 72,3159363, 4,52649053, 72,81225
26, 4,52808622, 72,7867478, 3,69667156, 72,6776188, 3,6240575, 72,638711, 2,2489
818, 72,4059572, -,50120336, 71,9405632, -,54520702, 71,9389628, -,73551748, 72,
0504801, ,476199597, 72,2543194, 2,89978127, 72,6620086, 2,92168221, 72,6514068,
1,93635925, 72,4840686, -,03435262, 72,1492992, ,009249796, 72,1270957, 2,97018
311, 72,6193014, 3,03378745, 72,6007986, 3,00258239, 72,588196, ,024648569, 72,0
854889, ,018847266, 72,0722867, ,089052559, 72,0609852, 3,04418215, 72,5535901,
3,11158397, 72,5140836, ,198259139, 72,0181787, ,260163137, 71,9989759, 3,222091
93, 72,4865797, 3,26629348, 72,4638761, ,276061466, 71,9525685, ,329964682, 71,9
328656, 3,28428939, 72,4202686, 3,36939068, 72,3648597, ,473772831, 71,8760574,
,569477285, 71,82595, ,611380719, 71,8259502, 2,72680263, 72,1813226, 2,75830711
, 72,1931249, 1,68306421, 72,7689189, 1,5126426, 72,7341112, 3,30060056, 71,7129
527, 3,17418717, 71,6957489, 1,60063452, 72,5691815, ,547178691, 73,1469855, ,35
9854829, 73,1102772, 1,95133441, 72,2365257, 3,23637231, 71,518823, 3,05285269,
71,4839162, 1,48840202, 72,3534425, ,121326784, 73,085271, -,04839361, 73,057664
8, ,202722649, 72,9185387, ,388343833, 72,9396437, ,47655216, 72,9276418, ,53675
5404, 72,890735, ,33223128, 72,8561273, ,341231045, 72,8413245, 1,09627118, 72,4
258526, 2,60622659, 71,5950287, 2,45051033, 71,5642229, 2,40460672, 71,5665229,
1,61758053, 71,999284, -,10050751, 72,9395414, -,65997036, 72,8536226, -,8219831
6, 72,9230354, -,50064638, 72,9851486, -,50034338, 73,0341583, 1,63627318, 71,90
10684, 1,47055648, 71,874063, 1,42765317, 71,8782634, ,894730643, 72,1679072, ,3
64605226, 72,4719567, 2,52156221, 72,8304369, 2,61736591, 72,7780277, 2,59136171
, 72,7677256, -,24996327, 72,2897221, -,25916558, 72,2638176, -,21176165, 72,259
117, 2,91649976, 72,7839314, 2,96800578, 72,7859322, 2,96630196, 72,7599273, -,1
8166113, 72,2224109, -,18986264, 72,2089086, -,1158568, 72,197907, ,931051106, 7
2,3755428, 3,02480439, 72,7308224, 3,31881376, 72,5687954, 2,37159441, 72,408958
7, 1,69002721, 72,411154, 1,47059079, 72,2531252, -1,3170745, 71,7809355, -1,521
2864, 71,9162563, -,13586013, 72,1713025, -,08725586, 72,1719028, ,014347302, 72
,0791878, -1,9151213, 71,7320267, -1,9711251, 71,75383, -1,7742095, 71,7850351,
-1,7418077, 71,7564308, -1,8250142, 71,7445288, -1,8391156, 71,7305266, -1,79971
27, 71,7277262, -1,6372994, 71,7680328, -1,8371151, 71,7477293, -1,7914116, 71,7
485295, -2,5499818, 69,7686808, -3,7134102, 66,319762, -4,296207, 64,3409166, -4
,7468036, 62,8630039, -4,8797025, 62,2661018, -5,5455029, 59,897899, -5,9832082,
58,4219931, -6,1319107, 58,0187899, -6,4952136, 57,9000878, -7,4540322, 56,5183
651, -7,540535, 56,3235608, -6,3898286, 55,3796474, -6,1153258, 55,3534483, -5,1
883214, 54,4165272, -5,9829533, 51,4761912, -6,0178661, 49,9881936, -5,2705573,
48,5816924))
SELECT ID,
sdo_util.simplify(
GEOM,
100000,0.05) SMPL_SHAPE
FROM TEST_SP A;
1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -7,5433349, 56,3382611, -3,3610006, 62,7598027, -5,9890247
, 64,9128292, -2,4798621, 71,9148546, 4,54839096, 72,7997504, ,569477285, 71,82595
, ,547178691, 73,1469855, 3,23637231, 71,518823, -,82198316, 72,9230354, 3,31881376
, 72,5687954, -1,9711251, 71,75383, -7,540535, 56,3235608, -5,1883214, 54,4165272
, -5,2705573, 48,5816924)) Which version of server and client do you use (database)?
regards, Andreas -
I have a set of 3D-coordinates representing points in 3D-space. This set of points represents a relatively simple 2D or 3D geometrical element like a circle, a rectangle, a sphere, a cylinder, a plane, a cone, ... and I know the type of geometry that I'm looking for. I know that LabView includes functionality to fit circles and spheres, and that fitting planes is done quite easily, but are there any possibilities withing LabView (or maybe Diadem?) to fit the other mentioned posibilities?
Any help would be appreciated.Fitting data to a function requires two things:
A mathematical description of the model.
A mathematical expression of the fit quality, a value that should be minimized by adjusting the model parameters.
Once you have that, you can just use Levenberg Marquardt. Chisquare might not be the best for (2) in 3D, you could e.g. use the sum of the square of the distance vectors between data and model. Sometimes it might help to transform the problem into a different coordiate system (spherical, cylidrical, etc.)
Also be sure to use good starting values for your parameters..
Under very specific conditions the problem can be dramatically simplified. Here's a recent discussion of the sphere fitting algorithm: http://forums.ni.com/ni/board/message?board.id=170&message.id=149402#M149402
Do you know what shape you want to fit or do you also want the program to automatically determine the shape of the object (i.e. determine if it is a cylinder or cone, then fit it accordingly)?
LabVIEW Champion . Do more with less code and in less time . -
2 accounts to 1. I was so anxious to set up my new iPad at the store that I accidentally set up a new Account. With so many people requesting to merge 2 legitimate accounts that they own, I can't understand why Apple is refusng to allow us to do so! This would simplify our lives so much. I have just switched over to Apple products and if I could at least set up both accounts on my iPad it would help -without signing in and out. I could do this on my android.
http://www.apple.com/feedback
-
I have two Apple ID's (accounts). How can I combine these accounts into one so I can simplify updates and purchases?
Sorry, but Apple IDs/iTunes Store accounts cannot be merged.
Regards. -
[b]Tutorial:[/b] Simplify Developing OLE Automation Code Using VBA
INTRODUCTION
Automating Office applications from Oracle Forms can be a tedious, frustrating, and time-consuming process. Because the OLE2 and CLIENT_OLE2 built-ins do not validate the automation commands that they relay, code that compiles without errors often dies at runtime with a not-so-helpful error code. This tutorial will demonstrate how to simplify the development of automation code using a tool that ships with all Microsoft Office editions -- the Visual Basic for Applications (VBA) IDE.
The VBA IDE, a core Office component, is a full-fledged development environment featuring code completion, basic syntax highlighting, context-driven help and a runtime debugger. Its Object Browser provides a convenient means of browsing the Word object model, as well as searching by keyword.
For those who may not interested in following this tutorial in detail, I would like to stress the usefulness of the Object Browser as a tool for inspecting the functions supported by OLE server applications and, perhaps more importantly, valid values for function arguments. Whether/not anyone buys the assertion that starting with VBA prototypes is far more productive than pounding out OLE2 code from the very start, they will find the Object Browser invaluable as a reference -- I rely on it exclusively for this sort of documentation.
A BRIEF INTRODUCTION TO THE VBA IDE & THE OBJECT BROWSER UTILITY
Try this:
1. Open Word
2. Launch the VBA IDE by pressing <Alt><F11>
3. Open the Object Browser by pressing <F2>
The Object Browser allows you to visually navigate Word's class hierarchy. Its user interface is a bit crowded, so controls are unlabeled. Hovering the mouse cursor above a control will display a tooltip explaining that control's purpose. The browser's scope can be narrowed by using the Project/Library combo. Typing a keyword or substring in the Search Text combo and clicking on the Search button will cause all classes/members whose name contains the specified search text to be listed in the Search Results pane. Selecting an item from this list will update the two panes below it, showing the selected class, and its members. Beneath the Classes and Members panes is an untitled pane, gray in color, which displays details for the selected class/member, including hyperlinks to relevant information such as arguments, their types and allowable values. If Visual Basic Help is installed, pressing <F1> will display help on a selected class/member. (This feature can be installed from your Office install CD, if necessary.)
NOTE: While it is possible to cut-and-paste the code examples that follow, I highly recommend that they be typed in by hand. Doing so will provide a better understanding of how the IDE's code completion behaves. Use code completion most efficiently by not using the mouse or <Enter> key when selecting from completion lists. Instead, just type enough letters to select the desired list element, then continue along as if you had typed the entire element, typing the next operator in your statement. It really is slick!
HELLO WORLD - VBA-STYLE
1. Open Word
2. Launch the VBA IDE by pressing <Alt><F11>
3. Select Module from the Insert menu.
4. In the blank area that appears, enter the following code:
Public Sub HelloWorld()
Documents.Add
Selection.TypeText ("Hello, world!")
End Sub5. Press <F5> to run the code.
If you switch back to Word by pressing <Alt><F11>, there should appear a newly-created document containing the text Hello, world!.
A MORE AMBITIOUS EXAMPLE
In this example, we will launch Word, type some text, and alter its formatting. For the purposes of this tutorial, consider it the process we wish to automate from within Forms.
1. If Word is running, close it.
2. Open any Office application except Word, such as Excel, Outlook or PowerPoint
3. Launch the VBA IDE by pressing <Alt><F11>.
4. Select References from the Tools menu -- a dialog should pop up.
5. From within this dialog, locate and select Microsoft Word <version> Object Library, then click OK.
6. Select Module from the Insert menu.
7. In the blank area that appears, enter the following code:
Public Sub LaunchWord()
Dim app As Word.Application
Set app = CreateObject("Word.Application")
app.Visible = True '!!! IMPORTANT !!!
app.Documents.Add
With app.Selection
.TypeText "This is paragraph 1."
.TypeParagraph
.TypeText "This is paragraph 2."
.TypeParagraph
.TypeText "This is paragraph 3."
End With
With ActiveDocument
.Paragraphs(1).Range.Words(3).Bold = True
.Paragraphs(2).Range.Words(3).Italic = True
.Paragraphs(3).Range.Words(3).Underline = True
End With
End Sub8. Press <F5> to run the code.
A new Word session should have been launched. Switch to it, to view the results of our handiwork!
TAILORING VBA CODE INTENDED FOR OLE2 CONVERSION
Now, things get a bit uglier. The code listed above gives a good idea of how concise VBA code can be, but With blocks and chained object references do not translate readily into OLE2 code. Here's the same process, rewritten in a more OLE2-friendly style. Note the numerous intermediate object references that have been declared.
Public Sub LaunchWord()
Dim app As Word.Application
Dim doc As Word.Document
Dim docs As Word.Documents
Dim pars As Word.Paragraphs
Dim par As Word.Paragraph
Dim wrds As Word.Words
Dim sel As Word.Selection
Dim rng As Word.Range
Set app = CreateObject("Word.Application")
app.Visible = True '!!! IMPORTANT !!!
Set doc = app.Documents.Add
Set sel = app.Selection
sel.TypeText "This is paragraph 1."
sel.TypeParagraph
sel.TypeText "This is paragraph 2."
sel.TypeParagraph
sel.TypeText "This is paragraph 3."
Set pars = doc.Paragraphs
'select third word of first paragraph and make it bold
Set par = pars.Item(1)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Bold = True
'select third word of second paragraph and italicize it
Set par = pars.Item(2)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Italic = True
'select third word of second paragraph and underline it
Set par = pars.Item(3)
Set rng = par.Range
Set wrds = rng.Words
Set rng = wrds.Item(3)
rng.Underline = True
End Sub
TRANSFORMATION: CONVERTING VBA CODE INTO PL/SQL
Here is the PL/SQL counterpart to our previous VBA routine. Compare printouts of the two and note their similarities. Notice the need for argument lists -- this causes the code to fluff up quite a bit, and really interferes with readability.
PROCEDURE LAUNCH_WORD IS
v_app OLE2.OBJ_TYPE; -- Application
v_doc OLE2.OBJ_TYPE; -- Document
v_docs OLE2.OBJ_TYPE; -- Documents collection
v_pars OLE2.OBJ_TYPE; -- Paragraphs collection
v_par OLE2.OBJ_TYPE; -- Paragraph
v_wrds OLE2.OBJ_TYPE; -- Words collection
v_sel OLE2.OBJ_TYPE; -- Selection
v_rng OLE2.OBJ_TYPE; -- Range
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* launch Word and MAKE IT VISIBLE!!! */
v_app := OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
/* initialize key object references */
v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
/* type first paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 1.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
/* type second paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 2.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
/* type third paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 'This is paragraph 3.');
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
/* set reference to Paragraphs collection */
v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
/* select third word of first paragraph and make it bold */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 1);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Bold', TRUE);
/* select third word of second paragraph and italicize it */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 2);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Italic', TRUE);
/* select third word of second paragraph and underline it */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, 3);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, 'Underline', TRUE);
END;
REFACTORING FOR REUSABILITY AND READABILITY
While the previous procedure runs without errors, it suffers from poor readability which, in turn, makes it difficult to maintain. Here, we address those issues by moving repetetive low-level operations into separate procedures.
PROCEDURE LAUNCH_WORD IS
v_app OLE2.OBJ_TYPE; -- Application
v_doc OLE2.OBJ_TYPE; -- Document
v_docs OLE2.OBJ_TYPE; -- Documents collection
v_sel OLE2.OBJ_TYPE; -- Selection
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* launch Word and MAKE IT VISIBLE!!! */
v_app := OLE2.CREATE_OBJ('Word.Application');
OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
/* create a new Word document */
v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
/* add a few paragraphs */
PRINT_PARAGRAPH(v_sel, 'This is paragraph 1.');
PRINT_PARAGRAPH(v_sel, 'This is paragraph 2.');
PRINT_PARAGRAPH(v_sel, 'This is paragraph 3.');
/* apply formatting */
APPLY_FORMATTING(v_doc, 1, 3, 'Bold', TRUE);
APPLY_FORMATTING(v_doc, 2, 3, 'Italic', TRUE);
APPLY_FORMATTING(v_doc, 3, 3, 'Underline', TRUE);
END;
PROCEDURE APPLY_FORMATTING(
v_doc OLE2.OBJ_TYPE,
v_paragraph_num NUMBER,
v_word_num NUMBER,
v_attribute VARCHAR2,
v_value BOOLEAN) IS
v_pars OLE2.OBJ_TYPE; -- Paragraphs collection
v_par OLE2.OBJ_TYPE; -- Paragraph
v_wrds OLE2.OBJ_TYPE; -- Words collection
v_rng OLE2.OBJ_TYPE; -- Range
v_args OLE2.LIST_TYPE; -- OLE2 argument list
BEGIN
/* set reference to Paragraphs collection */
v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
/* get specified paragraph */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_paragraph_num);
v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
OLE2.DESTROY_ARGLIST(v_args);
/* get words for specified paragraph */
v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
/* apply formatting to word found at specified index */
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_word_num);
v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
OLE2.SET_PROPERTY(v_rng, v_attribute, v_value);
END;
PROCEDURE PRINT_PARAGRAPH(v_sel OLE2.OBJ_TYPE, v_text VARCHAR2) IS
v_args OLE2.LIST_TYPE;
BEGIN
v_args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(v_args, v_text);
OLE2.INVOKE(v_sel, 'TypeText', v_args);
OLE2.DESTROY_ARGLIST(v_args);
OLE2.INVOKE(v_sel, 'TypeParagraph');
END;
CONCLUSION
It is my hope that this tutorial, despite it's introductory nature, has demonstrated the value of the VBA IDE, the ease with which automation processes can be prototyped using VBA, the noticeable similarity between VBA automation routines and their Forms PL/SQL counterparts, and the advantages of testing automation processes within the VBA IDE. Please feel free to follow up with any specific questions or concerns you may have.
Thanks,
Eric Adamson
Lansing, Michigan
FINAL NOTE: These examples use the OLE2 built-in, and will operate correctly when called from forms running in the Form Builder OC4J. Deploying them to an Oracle Application Server will launch Word on the server itself (if available), which is usually not the developer's intent! Automating Word client-side via web forms requires adding WebUtil support. Adapting the code for WebUtil is trivial -- just replace all instances of OLE2 with CLIENT_OLE2. Adapting forms for WebUtil and configuring OLE support into your Oracle Application Server, however, are beyond the scope of this tutorial.
REVISION HISTORY
This promises to be something of a 'living document'. I've snuck changes through without comment in the past, but in the future, I'll try to document significant changes here.
2006-08-21
* Prefaced boring subject line with text: 'Tutorial:' to clarify purpose
* Added emphasis on value of Object Browser as a referenceThanks James, for your kind words. I do hope this information will help folks out. I honestly believe that tinkering around in the VBA IDE will prove highly gratifying for automation developers. It can be assured that learning to make Word jump through hoops is much more straight-forward in this environment. I'm not one for mottos, but if I were pressed for a cheesy motto, I would say: First, make it work. Then, make it work in Oracle!
Once the idea has sunk in, that Visual Basic routines for automating Word are exact analogs to their OLE2 counterparts, we can remove keywords like Oracle and PL/SQL from our Google searches on Word automation which, at least in this context, are the proverbial kiss of death. Suddenly we find ourselves liberated by the possibility of steal-, ahem... borrowing ideas from the Visual Basic* community!
As for links, my link of choice is invariably http://groups.google.com -- if you don't already use it at least ten times a day, you must try it. This is the venerable USENET archive, including the holdings of now-extinct DejaNews. Another possible site of interest is http://word.mvps.org/FAQs/MacrosVBA, which may serve as a good starting point for those who wish to learn how to do fancy tricks with Word using VBA.
If these links don't prove immediately helpful, please feel free to give specifics on the sort of operations you are interested in automating, and I'll see if I can post an example that addresses it.
Regards,
Eric Adamson
Lansing, Michigan
PS: I do hope, as people read my posts, with every other acronym being VBA, that they are not mistakenly hearing a call to learn Visual Basic. I say this, not because I believe learning VB would be a Bad Thing, but because I assume that few of us feel we have the time to learn a new programming language. Despite having come to the Oracle camp already knowing VB/VBA, and having acquired a fair bit of experience with automating Office applications as an Access developer, I remain confident that what I am suggesting people attempt does not rise to the level of learning a language. What I am suggesting is that they learn enough of the language to get by.
*VB vs. VBA
Just a quick word on this, as readers may wonder why I seem to use these terms interchangeably. Visual Basic (VB) can refer to either a development platform or a programming language. Visual Basic for Applications (VBA) is a language -- more precisely, it is a subset of the Visual Basic language. One purchases VB, usually quite intentionally. VBA is included with Microsoft Office, as is VBA's development environment, the VBA IDE. The key distinction between VB and VBA is that VBA cannot be used to create self-contained executables. Rather, VBA relies on VBA-enabled applications, such as Microsoft Office applications, to serve as a container for VBA code, and to provide a runtime environment for that code. For the purposes of discussing OLE Automation, VB and VBA are quite interchangeable. -
Free Oracle Tool to Simplify Commonly Run Dictionary Queries
(orastat has a very good 'Hot Blocks' query)
Hi,
My co-workers and I at Agilent Technologies have developed a
useful tool to simplify running common dictionary queries. It
runs on UX and requires that you be the "oracle" user. You can
download it from
http://dbamon.com/orastat
For example, if you wanted info about a certain table, you could
query DBA_TABLE, DBA_INDEXES. With our tool "orastat", you would
just run 'orastat -ti <OWNER>.<TABLE>. Example:
2002/01/13-09:09:17 orastat | oraver=8.1.6 oraver3=8.1 sqlcmd=sv
2002/01/13-09:09:17 orastat | ORACLE_SID=DBA ORACLE_HOME=/opt/oracle/product/8.1.6
2002/01/13-09:09:17 orastat | Version=2.23 Host=bigdog Company=agilent
2002/01/13-09:09:17 orastat | Table Info for DBAMON.EVENTS
Table Data (from dba_tables)
Tablespace: DBAMON
RowCount: (Null) (From ANALYZE)
LastAnalyzed: (Null) (From ANALYZE)
Blocks: (Null) (From ANALYZE)
InitialExtents: 20971520
NextExtents: 8146944
MinExtents: 1
MaxExtents: 2147483645
PercentIncr: 1
BufferPool: DEFAULT
Index Data (from dba_indexes and dba_ind_columns)
Index: DBAMON.EVENTS_X1
Tablespace: DBAMON
LastAnalyzed: (Null) (From ANALYZE)
LeafBlocks: (Null) (From ANALYZE)
InitialExtents: 10485760
NextExtents: 2764800
MinExtents: 1
MaxExtents: 2147483645
PercentIncr: 1
BufferPool: DEFAULT
Index Column - Number: 1 Name: INSTANCE Length: 32 Descending: ASC
Index: DBAMON.EVENTS_X2
Tablespace: USERS
LastAnalyzed: (Null) (From ANALYZE)
LeafBlocks: (Null) (From ANALYZE)
InitialExtents: 131072
NextExtents: 983040
MinExtents: 2
MaxExtents: 2147483645
PercentIncr: 1
BufferPool: DEFAULT
Index Column - Number: 1 Name: TS Length: 7 Descending: ASC
Here is a list of all available orastat commands:
2002/01/13-09:07:48 orastat | oraver=8.1.6 oraver3=8.1 sqlcmd=sv
2002/01/13-09:07:48 orastat | ORACLE_SID=DBA ORACLE_HOME=/opt/oracle/product/8.1.6
2002/01/13-09:07:48 orastat | Version=2.23 Host=bigdog Company=agilent
orastat | Usage:
-- View This Help File
- Check for PMON Running, Show Oracle Version, Instance Status
-ad List Archive Destinations (v)
-al Show All Archived Logs
-an Analyze Table COMPUTE STATISTICS - 'orastat -an TABLE-OWNER.TABLE-NAME'
-ar Show Current DB Activity Rate
-au Show DB Audit Status
-az Show Current DB Activity Rate - Log to /opt/oracle/adm/cronlog/db_activity_rate_<SID>.txt
-ba List Contents of dbamon.backup_age Table
-bi List RMAN backup inventory -- ALL
-bp List running RMAN backup sessions (if any)
-br Backups: List all media written to since the last RMAN LVL0 backup
-c Configuration: View init.ora File
-ce Configuration: Edit 'vi' init.ora File
-cf List Control Files
-ck List Time of Last Checkpoint (from v$datafile_headers)
-cp Configuration: View Contents of v$parameter
-ct Coalesce TEMP tablespace
-de List All Datafiles, Online Redo Logs and Control Files (For Destroying a DB)
-df List Datafiles - Optional NOFSCHECK 2nd parm to prevent bdf'ing filesystem
-dc List Datafiles in 'cp' commands to copy all datafiles elsewhere
-ec Configuration: Edit 'vi' config.ora File
-er Display contents of DBA_ERRORS
-ex Select from plan_table
-fs Free Space in Each Datafile
-in List Indexes
-iv List INVALID Objects
-l List Archive Log Status
-lf List Redo Log Files
-li List Resource Limits (v$resource_limit)
-lk Locks - Current TX (Non-Row) Locks
-lh Lock Holders/Waiter
-lo List Current Table Locks
-ls Listener Status
-lv List LVOL's / Usage
-m View Last 20 Lines Of Alert Log
-ma Cat entire Alert Log
-mv 'vi' (read-only mode) Of Alert Log
-op OPS: View V$PING - Lock Conversions
-pi Performance: View Histogram of Datafile I/O
-pd Performance: View Data Block Buffer Hit Ratio
-pf Performance: View Total Cumulative Free List Waits
-ph Performance: Hot Blocks - Block With Latch Sleeps
-ps OPS (Parallel Server) Status
-pw Performance: Show segment names for tables with buffer waits
-ra List Rollback Segment Activity
-rb List Rollback Segments
-rc List And SHRINK All Rollback Segments
-rd List And ALTER MAXEXTENTS UNLIMITED All Rollback Segments
-ro List Roles
-rh List REDO Logs - History
-rl List REDO Logs - Files
-rp RMAN Long Operation Progress
-rs List REDO Logs - Status
-sb Standby DB - Show log gaps
-sc Sessions - By Session CPU Time
-sd Sessions - Details - Sessions, Running SQL and Waits
-se Sessions
-sg List SGA Usage
-sl SELECT * from table - name supplied as 2nd parameter
-sn SNAPSHOT - Run systemstate trace 3 times (for Oracle diagnostics)
-so List sorts by user
-sp List StatsPack Snapshot Data
-sq Run SQL - Pass SQL as argument in single quotes
-sr View Running SQL - 'orastat -sr SESSION_NUMBER'
-ss List default storage clause for all TABLESPACES
-st System Statistics
-su List Active Sessions - From Users Table (Under Construction)
-sw Session Wait Statistics
-ta List All Tables - From DBA_SEGMENTS (Name, TS, Size, Extents, Maxextents)
-tb Count Tables - By Schema
-tc Create Backup Schedule Template from List Of Tablespaces
-td describe table - name of table supplied as 2nd parameter
-ti Table Info - 'orastat -ti TABLE-OWNER.TABLE-NAME'
-ts List Tablespaces
-tt List 8i+ TEMPORARY Locally Managed Tablespaces
-tu Temp space usage by user
-tz List Tables - From DBA_TABLES
-ub List the byte count of data, by User
-ud List Users With ORADBA
-ug List Users Table Grants (Much Output) - 2nd Parm is optional grantee name
-us List All Users
-ut List the byte count of data, by User and Tablespace
-v List Oracle version and whether it is 32-bit or 64-bit
-vs List All Views
-vw Count Views - By Schema
-ws Wait stats - from v
2002/01/13-09:09:18 orastat | Found 2 Indexes
2002/01/13-09:10:45 orastat | oraver=8.1.6 oraver3=8.1 sqlcmd=sv
2002/01/13-09:10:45 orastat | ORACLE_SID=DBA ORACLE_HOME=/opt/oracle/product/8.1.6
2002/01/13-09:10:45 orastat | Version=2.23 Host=bigdog Company=agilent
orastat | Rollback Segments Statistics
RSSize : Current rollback segment size in bytes
A Xn's : Number of current transactions using the rollback segment
HWMSize : High Water Mark size in bytes
Wraps : Cumulative # of times a X'n continues writing from one
extents to another existing extent
Avg Actv: Avg # of bytes in active extents in the rbs measured over time
Name Extents Extends RSSize A Xn's Gets HWMSize Wraps Avg Actv Status Waits
SYSTEM 2 0 118784 0 2093 118784 0 0 ONLINE 0
R01 19 0 2719744 1 261027 2719744 505 143362 ONLINE 122
R02 20 0 2863104 1 263385 2863104 517 144526 ONLINE 164
R03 19 0 2719744 1 264369 2719744 517 143207 ONLINE 155
R04 19 0 2719744 0 267518 2719744 530 156265 ONLINE 139If the application uses a single database session, you can also generate a SQLTrace file to analyse with tkprof by using either Oracle Enterprise Manager to turn on SQL Trace for the session, or use DBMS_MONITOR SESSION_TRACE_ENABLE(session_id, serial_num) - you then have to find the trace file on the datbaas eserver USER_DUMP_DEST and either read manually (the queries are easily visible) or use tkprof to analyze it Using Application Tracing Tools Among other things tkprof can tell you the top resource consuming SQL statements.
-
How to simplify a cumbersome workflow?
Nearly everyday I need to update 5 large .html pages, each currently around 1.5 MB. The work involved to get these pages published is cumbersome to say the least and time consuming. I'm looking for tips or suggestions on ways to achieve this more easily and in less time.
Details:
The pages in question are: http://ppbm5.com/Benchmark5.html and the http://ppbm5.com/Benchmark5-1.html thru http://ppbm5.com/Benchmark5-4.html
Step 1, Excel:
The data are processed in Excel, sorted in 5 different ways and each sorted page is exported as a .html page. Due to some bugs in Excel, each export needs to be done with the active sheet zoomed to 10% of the original size, otherwise the conditional formatting is compromised.and messed up. So, after export, reset the zoom to 100%, resort the sheet on a different test, zoom to 10%, export to .html, zoom to 100%, resort, etc.
While not very convenient, I have not found an alternative, because the conditional formatting and color coding is crucial, so using tables in DW is not an option.
Step 2, .vbs script:
A simple .vbs script is run from the desktop and that inserts in each of the created .html files the necessary code for Spry Tooltips, Lightbox and Scroll-to-Top in a very easy and reliable way. So far, so good.
Step 3, the cumbersome process:
Each of the five pages needs to have a Spry menu inserted in a specific cell of each spreadsheet. In Excel terms cell A2/A3 (merged).
The original code in each .html page to be replaced is:
<td rowspan=2 height=67 class=xl2179194 style='border-bottom:.5pt solid black;
height:50.25pt'> </td>
and needs to be replaced with this:
<td height=67 rowspan=2 bgcolor="#EEE" class=xl2179194 style='text-decoration: none; border-bottom:.5pt solid black; height:50.25pt'>
<ul id="MenuBar1" class="MenuBarVertical">
<li><a href="http://ppbm5.com/index.html">Home Page</a> </li>
<li><a href="#" class="MenuBarItemSubmenu">Sort Results by</a>
<ul>
<li><a href="http://ppbm5.com/Benchmark5.html">Overall Results</a></li>
<li><a href="http://ppbm5.com/Benchmark5-1.html">Disk I/O Results</a></li>
<li><a href="http://ppbm5.com/Benchmark5-2.html">MPEG2-DVD Results</a></li>
<li><a href="http://ppbm5.com/Benchmark5-3.html">H.264-BR Results</a></li>
<li><a href="http://ppbm5.com/Benchmark5-4.html">MPE Results</a></li>
</ul>
</li>
</ul>
</td>
Notice: The bold figures in the code above, currently 217 can vary from page to page and from day to day. This is an Excel anomaly that is unexplainable to me. One day the first page may show 199 as the first figure and the other pages may show 198, the next day the first page may show 217 on the first page and 218 on subsequent pages.
Due to some limitations of .vbs scripting and the strange Excel behavior, I have not found a method to automatically replace this code, because it is no longer static, as the rest of the script is.
Current workaround:
I know that in the .html pages, this code is somewhere in the vicinity of line 3514. So in DW I scroll down to around that line, delete the two unneeded lines and with copy/paste from a text file insert the replacement code and correct the 'class=xl2179194' manually to the correct number. This has to be repeated for each of the 5 files.
As you can understand, far from ideal.
Step 3, uploading and optimizing:
Upload the saved .html files to the site, refresh in FF, use Firebug/Pagespeed to create a compressed .html (saves around 33 KB per file), upload again, refresh and then the next tedious step starts.
Step 4, removing unused CSS code:
Refresh the page in FF, analyze with Firebug/Pagespeed and remove the unused CSS code from the page (saves around 68 K per file) by going back to DW and manually remove all the lines on unused code from bottom to top, for instance removing lines 200-198-197-195-194- 189-186-...-23-22-21-20. Then save the file again, upload and repeat this exercise for the other files.
These optimizing steps generally result in a page speed index that improves from 81 to 85, sizable enough IMO to justify the effort, but this is cumbersome, tedious and error prone. But with the way Excel works with exports of .html files I feel like I'm in a bind.
Can anyone suggest a better, more effective workflow that is less time-consuming.Thank you for your attention. I know it is often suggested to export to a database or table, but the giant complexity of all the conditional formatting with legends and color grading, based on various calculations, the added and automated charts that are based on a number of calculations as well, make that approach extremly complex, not a task I look forward to.
I don't think it's any more complex that what you're currently doing on an almost daily basis
The real issue to me is letting go of the current mindset which has obviously evolved and developed this precision exercise over time.
To me, it now has the hallmarks of a Rube Goldberg invention and is obviously a burden for you to maintain.
It's often difficult to break away from, and re-think, projects that you're close to and have an intimate knowledge of.
Is the current format set in stone or can it be done a different way? I assume you have a skilled readership which is able to digest that data as presented?
All the conditional formatting on those pages is part of Excel's toolkit to try and offer some visual meaning and comprehension to the data displayed.
This can just as easily be done with queries, filters and formatting with a database approach. In addition, a database approach allows you to re-sort, analyze and present the data in countless different ways which the current rigid presentation does not allow.
Just some thoughts.
It would already simplify my current workflow, if I were able to instruct DW to delete lines in the .html code in the following sequence:
200 - 198 - 197 - 195 - 194 - 191 - 189 - 188 - 186- 185 - 183 - 181 - 180 - 179 - 176 - etc.
Notice you have to start with the highest number first and work from there to the lowest numbered line.
Do you happen to know if it is possible to enter this list of line numbers once and then instruct DW to delete these lines in the order indicated for all open documents?
Long shot: It may be possible via RegExp expressions but I'm not skilled in the use of those. However, you're probably better off doing that manually. -
Could not find Simplified Chinese input method when using FormsCentral
Hi
When I creating files using FormsCentral, I could not find the input method of Simplified Chinese, therefore, the document I created look strange. The font is not what I wanted but I really could not find Simplified Chinese to edit the document. Could anyone please show me how should I do it or where I can download the font pack?We currently do not support Chinese forms.
Randy -
Creation of multiple geometric template
i have various templates and want to create a multiple geometric template file
i am unable to do it.
i have uploaded the templates
please help me with it
-$hiv@
Solved!
Go to Solution.
Attachments:
five(OK).png 342 KB
five3(OK).png 269 KB
five4(OK).png 1694 KBBoth geometric matching techniques rely on curves extracted from image to perform the matching. The two geometric matching techniques differ in how the curve information is used to perform the matching. The edge-based geometric matching method computes the gradient value of the edge at each point along the curves found in the image and uses the gradient value and the position of the point from the center of the template to perform the matching. The feature-based geometric matching method extracts geometric features from the curves and uses these geometric features to perform the matching.
You can find more detailed information in the NI Vision Concepts Manual here:
http://zone.ni.com/reference/en-XX/help/372916L-01/nivisionconcepts/geometric_matching_technique/
The article also explain when it is better to use one versus the other.
I couldn't test the templates yesterday, because you did not attach a match image.
I might be wrong, but another thing I noticed is that it looks like you thresholded the images prior to extracting the templates. In general, algorithms that need to extract edges from images, such as geometric matching, will work better when you provide them with the grayscale image, as opposed with a thresholded image. The contour extraction will be more accurate. Also, the algorithm does not only use contour information, but also grayscale information of the image. By thresholding the image, one removes a lot of information that the algorithm can use.
On a last note, combining templates into one is only going to help with speed. If speed is not an issue in your application, you can still learn with Edge Based matching and match all template. If there is a match, the character/number you looked for is the right one.
Another solution might be to use a reverse technique, still using Edge Based matching that seems to work better in your case. We sometimes use it to solve classification applications similar to what you are trying to do:
Instead of learning multiple templates and trying to locate them in your image, take the opposite approach: create a synthetic image that contain your templates (all rotated 1s on one line... all rotated 5s on another line etc). Then if you can locate and extract the number (using blob analysis) on the original image, you can extract that region, learn it as a template, and look for it in the synthetic image. The line you find it indicates which digit it is.
Again, this technique might work if you can extract the digit you're trying to identify from the original image. Performance wise, it is only interesting if learning the extracted digit on the fly is faster than trying to match all the separate templates (learning takes more time than matching).
It looks like you're trying to perform OCR on the image. Again, if the text is always located at the same place and you can draw a region of interest around it, you can try the OCR algorithm and define different classes that have the same label for the different rotated digits.
I tried to give you different possible approaches. Hope that was not too confusing.
Best regards,
-Christophe -
How can i get the length of a string with Simplified Chinese?
when i use eventwriter to add content to a xmldocument,there are some chinese simplified string in it,i use String.length() for the length ,but it is not correct~how can i get the right length for eventwriter?
Below is a simple patch for this problem. Using this patch you need to pass 0 as the length argument for any XmlEventWriter interfaces that take a string length.
Regards,
George
diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
*** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp Fri Nov 3 12:26:11 2006
--- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp Thu Mar 15 13:58:13 2007
*** 234,239 ****
--- 234,241 ----
CHECK_NULL(text);
CHECK_SUCCESS();
+ if (!length)
+ length = ::strlen((const char *)text);
if (!_current)
throwBadWrite("writeText: requires writeStartDocument");
try {
*** 413,418 ****
--- 415,422 ----
CHECK_NULL(dtd);
CHECK_SUCCESS();
+ if (!length)
+ length = ::strlen((const char *)dtd);
if (_current) {
if (!_current->isDoc())
throwBadWrite("writeDTD: must occur before content");
diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp
*** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp Tue Jan 2 16:01:14 2007
--- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp Thu Mar 15 13:59:25 2007
*** 326,331 ****
--- 326,333 ----
needsEscape = false;
else
needsEscape = true;
+ if (!length)
+ length = ::strlen((const char *)chars);
writeTextWithEscape(type, chars, length, needsEscape);
*** 336,341 ****
--- 338,345 ----
bool needsEscape)
if(_entCount == 0) {
+ if (!len)
+ len = ::strlen((const char *)chars);
if ((type == XmlEventReader::Characters) ||
(type == XmlEventReader::Whitespace)) {
char *buf = 0;
*** 381,386 ****
--- 385,392 ----
NsWriter::writeDTD(const unsigned char *data, int len)
if(_entCount == 0) {
+ if (!len)
+ len = ::strlen((const char *)data);
_stream->write(data, len);
} -
Spatial Query with multiple geometries from 2 tables
Hi,
I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
I want to find all polygons where one of this points is within it...
This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
For the session running the query I've allocated 16M sort area with
ALTER SESSION SET SORT_AREA_SIZE=16777216;
Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
SELECT lu.LNU_PARCEL_ID
FROM
seventy.PARCEL_OVERLAPS po,
imap_topol.TP$_PARCEL_AREAS pa,
TP$_PARCEL_CENTROID_AREA pca,
TDCR_LAND_UNIT lu
WHERE
SDO_FILTER(po.geometry, pa.area,
'querytype=WINDOW') = TRUE and
sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
pa.delete_date is null and
Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
pa.AREA_ID = pca.AREA_ID and
pca.DELETE_DATE IS NULL and
pa.DELETE_DATE IS NULL;Albert,
Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
12:26:29 [email protected]:SQL> select count(*)
13:46:22 2 from seventy.PARCEL_OVERLAPS;
COUNT(*)
612
13:48:12 [email protected]:SQL> select count(*)
13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
13:48:21 4 where pca.DELETE_DATE IS NULL
13:48:21 5 and pa.DELETE_DATE IS NULL
13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
COUNT(*)
1310665
There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
so the explan plan for
14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
14:38:50 2 SELECT lu.LNU_PARCEL_ID
14:38:50 3 FROM
14:38:50 4 seventy.PARCEL_OVERLAPS po,
14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
14:38:50 7 TDCR_LAND_UNIT lu
14:38:50 8 WHERE
14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
14:38:50 10 pa.delete_date is null and
14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
14:38:50 12 pa.AREA_ID = pca.AREA_ID and
14:38:50 13 pca.DELETE_DATE IS NULL and
14:38:50 14 pa.DELETE_DATE IS NULL;
is
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 4G|32920G| 547M| | |
| NESTED LOOPS | | 4G|32920G| 547M| | |
| MERGE JOIN | | 547M| 2029G| 230124 | | |
| SORT JOIN | | 1M| 36M| 85014 | | |
| MERGE JOIN | | 1M| 36M| 50019 | | |
| SORT JOIN | | 1M| 17M| 21650 | | |
| TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
| SORT JOIN | | 1M| 22M| 28369 | | |
| TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
| SORT JOIN | | 42K| 160M| 145111 | | |
| TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
14:43:14 [email protected]:SQL> explain plan for
14:43:23 2 SELECT pa.AREA_ID
14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
14:43:23 6 and pa.DELETE_DATE IS NULL;
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 6M| 50G| 10M| | |
| NESTED LOOPS | | 6M| 50G| 10M| | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
| TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
14:45:03 [email protected]:SQL> explain plan for
14:45:04 2 SELECT pa.AREA_ID
14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
14:45:05 6 and pa.DELETE_DATE IS NULL;
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
| SELECT STATEMENT | | 6M| 50G| 863554 | | |
| NESTED LOOPS | | 6M| 50G| 863554 | | |
| TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
| TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
-------------------------------------------------------------------------------- -
Unable to read Simplified Chinese in downloaded excel
Hi,
We are running an MDMP Simplified Chinese SAP system.
After extracting some data with both English and Simplified Chinese and saving it as excel file, we are not able to view the Simplified Chinese characters when it is opened in MS Excel. "Garbage" are being displayed in place of Simplified Chinese. English display is ok.
The PC already has Simplified Chinese fonts installed (Control Panel->Regional & Language Options->Language tab->Install files for East Asian languages), and Windows XP is an English version.
In addition, we are able to key in Simplified Chinese via the keyboard using Hanyu Pinyin.
I am suspecting that the issue is with MS Excel which doesn't know how to convert the Simplified Chinese.
Does anyone know how to overcome this problem?
ThanksHi,
as far as I know you need to set the system locale (Language for Non-Unicode programs) of Windows in the control panel to Chinese.
In addition in a standard MDMP system it is mandatory to logon with language Chinese if you want to download Kanji characters.
Best regards,
Nils Buerckel -
Won't display simplified Chinese
I just checked out an ebook written in simplified Chinese from an online library . The ADE displayed the title and the table of content correctly on the left pane, but the content of the book displayed on the right pane were not - just a bunch of special characters. Do I need to download a language pack to make it work? What do I need to do? This is the first time I use th Adobe Digital Editions so I really don't know much about it.
I have the same problem. I got the book Niubi: The real Chinese you were never taught in School, by Eveline Chao. The Chinese caracteres doesn't appear, the Latin letters with diacrits also not. I noted that Adobe Digital Editions, doesn't have a proper place to fonts, in this case Unicode, would be apreciated. How can I solve the problem? Without this, there isn't any sense to have a software and a book which you can't read properly.
At Adobe PDF, when you open a book like this one, immediately the PDF upload a plugin for that specific language. I also would like an aswer about this problem with Digital Editions. Thanks. -
Change over from traditional chinese and simplify chinese
I am using a MacBook Pro, Hardware : 2010 Q3 product, OS : OSX 10.6 Current OS : OSX 10.7.5
My problem is when I select writing language by using Trackpad handwriting in Traditional Chinese, I write a word in Simplify Chinese, it can give me a Traditional Chinese for selection. But when I change over from Traditional Chinese to Simplify Chinese, I write in Traditional Chinese, it never give me a correct word in Traditional Chinese, I think it is a BUG and I have visit Genius Bar at Apple Shop, nobody can solve thie problem,Ahavavaha wrote:
But when I change over from Traditional Chinese to Simplify Chinese, I write in Traditional Chinese, it never give me a correct word in Traditional Chinese
I can see how that might not be a bug but expected behavior.
Try asking in the Chinese Mac group:
https://groups.google.com/forum/#!forum/chinesemac
Also if you know Chinese well:
https://discussionschinese.apple.com
Maybe you are looking for
-
Mini DisplayPort to S-Video or RCA (yellow)
I know this has been addressed in other topics by other people, but I was wondering what the final outcome of all the discussion was. Is it possible to connect my MacBook Pro 13-inch with Mini DisplayPort to female S-Video or RCA (composite--yellow c
-
URGENT : Please help: Purchasing and Inventory loads
I am currently in BWQ. I did the inital deletion of set up tables by LBWG and then ran the set up jobs through SBIW for Purchasing and Inventory. I also did the industry setting and processkey . I ran the init load yesterday and it gave some records
-
Error setting up HP Photosmart B109n for wireless from Mac
I am trying to configure my B109n for wireless printing but the setup utility keeps crashing. Printer is USB connected but I want to move it to another part of the room. I am runnin OSX 10.9.2. Process: HP Setup Assistant [8324] Path:
-
Keyboard shortcut for "GO to Desktop"
I've been searching all morning and can't find the answer here, so I'll pose the question. I have a new iMac 21.5" with the short wireless bluetooth keyboard. What is the keyboard shortcut so I can hide all open windows and applications and go to my
-
I am using Oracle Blobs to write 100 KB XML file to the database. I find the time required for writing this file to the database is around 300 ms . Can anyone suggest performance improvements