bind variables not allowed for data definition operations - view
CREATE VIEW GMIS_FIN AS
SELECT NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
201, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"CAR-CD"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
207, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"Car MVH"
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
206, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"CAR AVH-H"
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
301, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"PRO-SV"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
204, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"Car-Others"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
501, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
701, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
702, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
601, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
602, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
303, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0)),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
203, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"CAR speaker"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
ABAL_DIVN_CODE,
202, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"Car AVH-L"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
402, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"TAD SPKRS"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
ABAL_DIVN_CODE,
404, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"TAD Elect"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
ABAL_DIVN_CODE,
105, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"B-Ray"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
305, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:CSV
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
106, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"Compo-Spk"
/ 100),
NVL (
( DECODE (
ABAL_DIVN_CODE,
403, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"MP-Pro"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
ABAL_DIVN_CODE,
205, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"CAR DVH"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100),
NVL (
( DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
208, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:NAVI
/ 100),
0),
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
208, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:NAVI
/ 100,
DECODE (
ABAL_DIVN_CODE,
205, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"CAR DVH"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE (
ABAL_DIVN_CODE,
403, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"MP-Pro"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
106, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"Compo-Spk"
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
305, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:CSV
/ 100,
DECODE (
ABAL_DIVN_CODE,
105, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"B-Ray"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE (
ABAL_DIVN_CODE,
404, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"TAD Elect"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
\,
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
301, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"PRO-SV"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
206, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"CAR AVH-H"
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
207, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:"Car MVH"
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
201, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
:"CAR-CD"
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
/ 100,
DECODE ( ABAL_MAIN_ACNT_CODE,
40100, 1,
40125, 1,
40126, 1.75,
40700, 2,
40725, 2,
40750, 2,
40760, 2,
40775, 2,
40800, 3,
40900, 3,
40150, 3,
40175, 3,
40200, 3,
41300, 3,
41350, 3,
42000, 4,
42100, 4,
42200, 4,
42125, 1.75,
42350, 6,
41800, 5,
42800, 6,
43860, 5,
40250, 7,
45100, 7,
45300, 7,
46500, 7,
47000, 7,
47600, 7,
47500, 7,
40850, 3,
48600, 7,
45101, 7,
48200, 7,
48175, 7,
6),
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
209, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
(DECODE (
(DECODE ( ABAL_DIVN_CODE,
'', 0,
ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0))
:SSD
/ 100,
DECODE (
(DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE)),
0, NVL ( ABAL_LC_MTD_DR * 1, 0)
NVL ( ABAL_LC_MTD_CR * 1, 0),
0),
DECODE ( ABAL_DIVN_CODE, '', 0, ABAL_DIVN_CODE),
MAIN_ACNT_SHORT_NAME,
ABAL_CAL_YEAR,
ABAL_CAL_MONTH,
ABAL_MAIN_ACNT_CODE
FROM FM_MAIN_ACCOUNT , FS_CUR_ACNT_BAL O179130
WHERE (( MAIN_ACNT_CODE = ABAL_MAIN_ACNT_CODE))
ORDER BY DECODE ( ABAL_MAIN_ACNT_CODE,
40100, 1,
40125, 1,
40126, 1.75,
40700, 2,
40725, 2,
40750, 2,
40760, 2,
40775, 2,
40800, 3,
40900, 3,
40150, 3,
40175, 3,
40200, 3,
41300, 3,
41350, 3,
42000, 4,
42100, 4,
42200, 4,
42125, 1.75,
42350, 6,
41800, 5,
42800, 6,
43860, 5,
40250, 7,
45100, 7,
45300, 7,
46500, 7,
47000, 7,
47600, 7,
47500, 7,
40850, 3,
48600, 7,
45101, 7,
48200, 7,
48175, 7,
ASC,
ABAL_MAIN_ACNT_CODE ASC;
The code is very lengthy so decided to call the code using view but got an error. so looking for some alternative solution
Related
Why does SDO_LRS.CONCATENATE_GEOM_SEGMENTS_3D zero out the Z index?
Please look at following query (run on Oracle 19c): SELECT SDO_LRS.CONCATENATE_GEOM_SEGMENTS_3D ( MDSYS.SDO_GEOMETRY( 4402, 4327, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(-87.5581857869439, 41.6569754435628, 589.31538218591, 507.27401, -87.5582131677029, 41.6570011677706, 589.35568218591, 507.27623) ), MDSYS.SDO_GEOMETRY( 4402, 4327, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(-87.5582131677030, 41.6570011677707, 589.35568218592, 507.27624, -87.5582454317806, 41.6570319021015, 589.40968218591, 507.27886) ), .005 ) from DUAL; The two input SDO_GEOMETRY's are contiguous, i.e. the last point of the first geometry coincides with the first point of the second geometry... It returns: MDSYS.SDO_GEOMETRY(4402, 4327, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(-87.5581857869439, 41.6569754435628, 0, 507.27401, -87.558213167703, 41.6570011677707, 0, 507.27623, -87.5582454317806, 41.6570319021015, 0, 507.27885)) It 0's out the third values, i.e. the Z values... Why does this do this? On the other hand if use NULL values for the input geometry SRID's, it does not 0 out the Z values... SELECT SDO_LRS.CONCATENATE_GEOM_SEGMENTS_3D ( MDSYS.SDO_GEOMETRY( 4402, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(-87.5581857869439, 41.6569754435628, 589.31538218591, 507.27401, -87.5582131677029, 41.6570011677706, 589.35568218591, 507.27623) ), MDSYS.SDO_GEOMETRY( 4402, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1), MDSYS.SDO_ORDINATE_ARRAY(-87.5582131677029, 41.6570011677706, 589.35568218591, 507.27623, -87.5582454317806, 41.6570319021015, 589.40968218591, 507.27886) ), .005 ) from DUAL; In fact I tried SRID values of 5706, 43229, even 44444 (made up) and they work... but not 4327, 4329, 4979... Expecting the Z values not to be 0...
How can I get the pixels matrix of an image without using numpy?
I'd like to find a way of getting the pixels matrix without using numpy. I'm aware that using with the code from PIL import Image import numpty as np img = Image.open('example.png', 'r') pixels = np.array(img) pixelsget the pixels matrix of the image. However, I'd like to find a way without using numpy to get the pixels image without using the package numpy. Thanks in advance!
You can use the Image methods getdata(band=None) or getpixel(xy). In [1]: from PIL import Image In [2]: im = Image.open('block.png', 'r') In [3]: data = list(im.getdata()) In [4]: data[:20] Out[4]: [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (144, 33, 33), (144, 33, 33), (144, 33, 33), (144, 33, 33), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (0, 0, 0)] In [5]: pxl = im.getpixel((1, 1)) In [6]: pxl Out[6]: (144, 33, 33) To convert the sequence returned by getdata() to a list of lists, you can use a list comprehension: In [61]: data2d = [data[i:i+im.width] for i in range(0, len(data), im.width)] In [62]: data2d[0] # row 0 Out[62]: [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)] In [63]: data2d[1] # row 1 Out[63]: [(0, 0, 0), (144, 33, 33), (144, 33, 33), (144, 33, 33), (144, 33, 33), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (0, 0, 0)] In [64]: data2d[1][1] Out[64]: (144, 33, 33)
ECLiPSe CLP : slow combined occurrence/3 constraint behaviour
As a subset of a larger problem, I'm trying to write the 2 following constraints for an NxN board (containing N² cells): Each row/col contains exactly N occurrences of integer K given by pre-defined hints No 2x2 block (anywhere on the board) contains more than 1 occurrence of integer K On the board, several cells will already be filled in on beforehand and should be ignored for the constraints in this SO question, therefore we use integer 2 to represent these cells and model the unknown cells to have a finite domain of binary boolean values: model(Board,N,Hints) :- dim(Board,[N,N]), ( foreach(Row-Col,Hints), param(Board) do 2 is Board[Row,Col] ), ( multifor([I,J],1,N), param(Board) do Cell is Board[I,J], ( var(Cell) -> Cell :: 0..1 ; true ) ). The constraints in code respectively: hint_constraints(Board,N,RowHints,ColHints) :- ( for(I,1,N), foreach(RH,RowHints), foreach(CH,ColHints), param(Board,N) do Row is Board[I,1..N], Col is Board[1..N,I], ic_global:occurrences(1,Row,RH), % Here, K=1 and N=RH ic_global:occurrences(1,Col,CH) % Here, K=1 and N=CH ). block_constraints(Board,N) :- ( multifor([I,J],1,(N-1)), param(Board) do Block is Board[I..I+1,J..J+1], flatten(Block,BlockFlat), Sum #:: [0,1], ic_global:occurrences(1,BlockFlat,Sum) % Here, K=1 ). For a simple execution of a puzzle: solve(BT) :- puzzle(N,_,RowHints,ColHints,Hints), model(N,RowHints,ColHints,Hints,Board), hint_constraints(Board,N,RowHints,ColHints), block_constraints(Board,N), once search(Board,0,most_constrained,indomain_max,complete,[backtrack(BT)]). For the 8x8 puzzle, the first solution is found almost instantly: ?- solve(BT). [](0, 0, 0, 0, 0, 0, 1, 2) [](2, 1, 0, 2, 1, 0, 0, 2) [](0, 0, 0, 0, 0, 0, 1, 0) [](0, 0, 0, 1, 0, 0, 0, 0) [](1, 0, 0, 0, 2, 0, 0, 0) [](2, 2, 1, 0, 1, 2, 1, 2) [](1, 2, 0, 2, 0, 0, 2, 0) [](0, 0, 0, 0, 1, 0, 0, 1) BT = 0 Yes (0.01s cpu) for the 20x20 instance however, I have left it running for around 5 minutes without getting any result. To investigate whether one constraint would be significantly more costly than the other, I ran both of them separately: When we use hint_constraints/4, but not block_constraints/2, we get: ?- solve(BT). [](1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0) [](1, 1, 2, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 2, 0) [](2, 1, 1, 1, 2, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0) [](1, 1, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2) [](1, 0, 1, 1, 1, 2, 1, 1, 2, 1, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0) [](2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0) [](2, 0, 0, 0, 1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0) [](1, 0, 0, 0, 2, 1, 1, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0) [](2, 0, 0, 0, 1, 1, 0, 1, 1, 2, 1, 0, 2, 0, 2, 0, 2, 0, 0, 2) [](2, 0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 2, 0) [](0, 0, 0, 0, 2, 0, 2, 0, 0, 1, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2) [](0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 2, 0, 0) [](0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 1, 1, 1, 0, 1, 0, 2, 0, 0) [](2, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1) [](0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 1, 0, 1, 0, 1) [](0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 2, 2, 2, 1) [](0, 2, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 1, 1, 1) [](0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 1, 0, 0, 1, 2, 1, 1) [](2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2) [](0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 1, 2, 1, 1, 1, 2, 1) BT = 0 Yes (0.04s cpu) and can verify that all row/col occurrences are satisfied. The other way around, when we use block_constraints/2, but not hint_constraints/2: ?- solve(BT). [](0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0) [](0, 1, 2, 1, 0, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 2, 0) [](2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0) [](0, 1, 0, 1, 0, 1, 0, 2, 2, 1, 2, 1, 0, 1, 0, 1, 0, 0, 2, 2) [](0, 0, 0, 0, 0, 2, 0, 1, 2, 0, 0, 0, 0, 0, 2, 2, 0, 1, 2, 1) [](2, 1, 0, 1, 0, 1, 0, 0, 0, 1, 2, 1, 0, 1, 2, 1, 0, 0, 0, 0) [](2, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 1) [](0, 1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 2, 0, 0) [](2, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 2, 0, 2, 0, 2, 1, 0, 2) [](2, 1, 0, 1, 0, 1, 2, 0, 0, 1, 0, 1, 0, 1, 0, 1, 2, 0, 2, 1) [](0, 0, 0, 0, 2, 0, 2, 1, 0, 0, 2, 0, 2, 0, 0, 0, 0, 1, 0, 2) [](0, 1, 0, 1, 2, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 0) [](0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 1, 0) [](2, 1, 0, 1, 2, 2, 0, 0, 0, 2, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0) [](0, 0, 2, 0, 0, 1, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0) [](0, 1, 0, 1, 0, 2, 0, 0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 2, 2, 0) [](0, 2, 0, 0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 1) [](0, 1, 2, 1, 0, 0, 0, 0, 2, 2, 1, 2, 1, 0, 1, 0, 0, 2, 0, 0) [](2, 0, 0, 0, 0, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2) [](0, 1, 2, 1, 0, 0, 0, 0, 2, 0, 2, 2, 1, 0, 2, 0, 0, 0, 2, 0) BT = 0 Yes (0.01s cpu) we can once more verify that the 2x2 block constraint successfully holds. Unfortunately, when using both constraints together the program seems not to finish anywhere within 5 minutes. I'm a bit confused by this behaviour since both constraints separately appear to work very fast. Though I understand that a lot of checks will have to occur internally to make sure the correct occurrences for each row/col are present while still satisfying the block constraint throughout the process, the fact that it takes over 5 minutes made me think something else must be wrong with the way I have written the block constraint. Does anyone have an idea on how to optimise my implementation of the block occurrence constraint? Thanks in advance! Puzzle instances puzzle(8, easy, [1,2,1,1,1,3,1,2], [2,1,1,1,3,0,3,1], [1-8, 2-1, 2-4, 2-8, 5-5, 6-1, 6-2, 6-6, 6-8, 7-2, 7-4, 7-7]). puzzle(20,medium,[5,2,6,2,7,1,6,3,5,4,5,3,4,2,4,3,5,4,4,5], [5,4,3,3,6,3,4,5,2,4,4,4,2,7,1,5,3,6,3,6], [1-6, 1-15, 2-3, 2-6, 2-8, 2-14, 2-18, 2-19, 3-1, 3-5, 3-11, 4-8, 4-9, 4-11, 4-19, 4-20, 5-6, 5-9, 5-15, 5-16, 5-19, 6-1, 6-11, 6-15, 7-1, 7-6, 7-15, 8-5, 8-10, 8-15, 8-18, 9-1, 9-10, 9-13, 9-15, 9-17, 9-20, 10-1, 10-7, 10-17, 10-19, 11-5, 11-7, 11-11, 11-13, 11-20, 12-5, 12-18, 13-6, 13-11, 13-18, 14-1, 14-5, 14-6, 14-10, 15-3, 15-12, 16-6, 16-13, 16-17, 16-18, 16-19, 17-2, 17-5, 17-7, 17-15, 18-3, 18-9, 18-10, 18-12, 18-18, 19-1, 19-6, 19-20, 20-3, 20-9, 20-11, 20-12, 20-15, 20-19]).
IWICBitmapScaler doesn't work for 96bppRGBFloat format?
I encountered a probem when I was using the WIC lib. And I found that I can't scale R32G32B32 images using IWICBitmapScaler... The code example shows below: { IWICImagingFactory* m_pWICFactory; HRESULT hr = S_OK; // Initialize COM hr = CoInitialize(nullptr); assert(SUCCEEDED(hr)); // Initialize Factory hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWICImagingFactory), (void**)&m_pWICFactory); assert(SUCCEEDED(hr)); // 4x4 R32G32B32 image XMFLOAT3 srcImg[] = { XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), XMFLOAT3(1, 1, 1), }; // 2x2 R32G32B32 image XMFLOAT3 dstImg[4]; CComPtr<IWICBitmap> pSrcBitmap; hr = m_pWICFactory->CreateBitmapFromMemory(4, 4, GUID_WICPixelFormat96bppRGBFloat, 4 * sizeof(XMFLOAT3), 4 * sizeof(XMFLOAT3)* 4, (BYTE*)srcImg, &pSrcBitmap); IWICBitmapSource *pSrcBitmapSource = pSrcBitmap.p; // scale to 2x2 CComPtr<IWICBitmapScaler> pScaler; hr = m_pWICFactory->CreateBitmapScaler(&pScaler); hr = pScaler->Initialize(pSrcBitmapSource, 2, 2, WICBitmapInterpolationModeFant); pSrcBitmapSource = pScaler.p; // copy back WICRect rect = { 0, 0, 2, 2 }; hr = pSrcBitmapSource->CopyPixels(&rect, 2 * sizeof(XMFLOAT3), 2 * sizeof(XMFLOAT3)* 2, (BYTE*)dstImg); } And I just get -1.#QNAN000 in the dstImg buffer :( I'm not sure whether I did something wrong, or the IWICBitmapScaler just don't support such format? Another ploblem is that when I use IWICFormatConverter to convert R32G32B32A32 (i.e. 128bppRGBFloat) images to R32Gray (i.e.32bppGrayFloat)format, it always clamp the value to [0, 1], is this a desired behavior? (Why???) (My platform: Win 8.1 64bit + VS2013)
You are incorrectly assuming that the IWICBitmapScaler always returns the data in the same pixel format as it's input. It does not. You have to call GetPixelFormat to find out how the result is going to be formatted. Also, when working with a COM API you must be checking the HRESULT for every call that returns one to catch problems. CComPtr<IWICBitmapScaler> pScaler; hr = m_pWICFactory->CreateBitmapScaler(&pScaler); if ( FAILED(hr) ) ... hr = pScaler->Initialize(pSrcBitmapSource, 2, 2, ICBitmapInterpolationModeFant); if ( FAILED(hr) ) ... pSrcBitmapSource = pScaler.p; WICPixelFormatGUID pfScaler; hr = scaler->GetPixelFormat( &pfScaler ); if ( FAILED(hr) ) ... // In many cases, pfScaler will not be the same GUID as your pSrcBItmapSource. You should take a look at DirctXTex for extensive examples of using WIC.
What indexes are on the oracle data dictionary tables
How can I find out what, if any, indexes are set up on the oracle data dictionary tables themselves (eg on the columns of all_tables or all_source)?
ALL_TABLES and ALL_SOURCE are actually views. If you have the privileges you can view the source of them: SQL> select text from all_views where view_name='ALL_TABLES'; TEXT -------------------------------------------------------------------------------- select u.name, o.name,decode(bitand(t.property, 2151678048), 0, ts.name, null), decode(bitand(t.property, 1024), 0, null, co.name), decode((bitand(t.property, 512)+bitand(t.flags, 536870912)), 0, null, co.name), decode(bitand(t.trigflag, 1073741824), 1073741824, 'UNUSABLE', 'VALID'), decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null), decode(bitand(ts.flags, 32), 32, to_number(NULL), decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)), decode(bitand(t.property, 32), 0, t.initrans, null), decode(bitand(t.property, 32), 0, t.maxtrans, null), s.iniexts * ts.blocksize, decode(bitand(ts.flags, 3), 1, to_number(NULL), s.extsize * ts.blocksize), s.minexts, s.maxexts, decode(bitand(ts.flags, 3), 1, to_number(NULL), s.extpct), decode(bitand(ts.flags, 32), 32, to_number(NULL), decode(bitand(o.flags, 2), 2, 1, decode(s.lists, 0, 1, s.lists))), decode(bitand(ts.flags, 32), 32, to_number(NULL), decode(bitand(o.flags, 2), 2, 1, decode(s.groups, 0, 1, s.groups))), decode(bitand(t.property, 32+64), 0, decode(bitand(t.flags, 32), 0, 'YES', 'NO'), null), decode(bitand(t.flags,1), 0, 'Y', 1, 'N', '?'), t.rowcnt, decode(bitand(t.property, 64), 0, t.blkcnt, null), decode(bitand(t.property, 64), 0, t.empcnt, null), decode(bitand(t.property, 64), 0, t.avgspc, null), t.chncnt, t.avgrln, t.avgspc_flb, decode(bitand(t.property, 64), 0, t.flbcnt, null), lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10), lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10), lpad(decode(bitand(t.flags, 8), 8, 'Y', 'N'),5), decode(bitand(t.flags, 6), 0, 'ENABLED', 'DISABLED'), t.samplesize, t.analyzetime, decode(bitand(t.property, 32), 32, 'YES', 'NO'), decode(bitand(t.property, 64), 64, 'IOT', decode(bitand(t.property, 512), 512, 'IOT_OVERFLOW', decode(bitand(t.flags, 536870912), 536870912, 'IOT_MAPPING', null ))), decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'), decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N'), decode(bitand(t.property, 8192), 8192, 'YES', decode(bitand(t.property, 1), 0, 'NO', 'YES')), decode(bitand(o.flags, 2), 2, 'DEFAULT', decode(s.cachehint, 0, 'DEFAULT', 1, 'KEEP', 2, 'RECYCLE', NULL)), decode(bitand(t.flags, 131072), 131072, 'ENABLED', 'DISABLED'), decode(bitand(t.flags, 512), 0, 'NO', 'YES'), decode(bitand(t.flags, 256), 0, 'NO', 'YES'), decode(bitand(o.flags, 2), 0, NULL, decode(bitand(t.property, 8388608), 8388608, 'SYS$SESSION', 'SYS$TRANSACTION')), decode(bitand(t.flags, 1024), 1024, 'ENABLED', 'DISABLED'), decode(bitand(o.flags, 2), 2, 'NO', decode(bitand(t.property, 2147483648), 2147483648, 'NO', decode(ksppcv.ksppstvl, 'TRUE', 'YES', 'NO'))), decode(bitand(t.property, 1024), 0, null, cu.name), decode(bitand(t.flags, 8388608), 8388608, 'ENABLED', 'DISABLED'), decode(bitand(t.property, 32), 32, null, decode(bitand(s.spare1, 2048), 2048, 'ENABLED', 'DISABLED')), decode(bitand(o.flags, 128), 128, 'YES', 'NO') from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o, sys.obj$ cx, sys.user$ cu, x$ksppcv ksppcv, x$ksppi ksppi where o.owner# = u.user# and o.obj# = t.obj# and bitand(t.property, 1) = 0 and bitand(o.flags, 128) = 0 and t.bobj# = co.obj# (+) and t.ts# = ts.ts# and t.file# = s.file# (+) and t.block# = s.block# (+) and t.ts# = s.ts# (+) and (o.owner# = userenv('SCHEMAID') or o.obj# in (select oa.obj# from sys.objauth$ oa where grantee# in ( select kzsrorol from x$kzsro ) ) or /* user has system privileges */ exists (select null from v$enabledprivs where priv_number in (-45 /* LOCK ANY TABLE */, -47 /* SELECT ANY TABLE */, -48 /* INSERT ANY TABLE */, -49 /* UPDATE ANY TABLE */, -50 /* DELETE ANY TABLE */) ) ) and t.dataobj# = cx.obj# (+) and cx.owner# = cu.user# (+) and ksppi.indx = ksppcv.indx and ksppi.ksppinm = '_dml_monitoring_enabled' As you can see, there are many tables referenced there, including SYS.OBJ$. Now you can look up the indexes on those: SQL> select index_name from all_indexes where table_name='OBJ$' and owner='SYS'; INDEX_NAME ------------------------------ I_OBJ1 I_OBJ2 I_OBJ3 and so on.
To tag on to Tony Andrew's answer, many of the tables in the data dictionary are stored in B*tree clusters: (as sys as sysdba) SQL> SELECT TABLE_NAME, CLUSTER_NAME FROM USER_TABLES 1 WHERE CLUSTER_NAME IN (SELECT CLUSTER_NAME FROM USER_CLUSTERS) 2 ORDER BY CLUSTER_NAME; TABLE_NAME CLUSTER_NAME ------------------------------ ------------------------------ CCOL$ C_COBJ# CDEF$ C_COBJ# UET$ C_FILE#_BLOCK# SEG$ C_FILE#_BLOCK# SLOG$ C_MLOG# MLOG$ C_MLOG# VIEWTRCOL$ C_OBJ# ICOLDEP$ C_OBJ# LIBRARY$ C_OBJ# OPQTYPE$ C_OBJ# REFCON$ C_OBJ# NTAB$ C_OBJ# TYPE_MISC$ C_OBJ# ATTRCOL$ C_OBJ# SUBCOLTYPE$ C_OBJ# COLTYPE$ C_OBJ# LOB$ C_OBJ# TAB$ C_OBJ# CLU$ C_OBJ# COL$ C_OBJ# ICOL$ C_OBJ# IND$ C_OBJ# HISTGRM$ C_OBJ#_INTCOL# RGROUP$ C_RG# RGCHILD$ C_RG# TYPE$ C_TOID_VERSION# PARAMETER$ C_TOID_VERSION# ATTRIBUTE$ C_TOID_VERSION# RESULT$ C_TOID_VERSION# METHOD$ C_TOID_VERSION# COLLECTION$ C_TOID_VERSION# FET$ C_TS# TS$ C_TS# TSQ$ C_USER# USER$ C_USER# SMON_SCN_TIME SMON_SCN_TO_TIME So, for example, there's an "undocumented" index on both FET$ (free extents) and $TS (tablespaces) on the TS# column.