5 in-a-row algorithm

Hi. I'm develoing a Go-Moku (5 in-a-row) and I need some help to develop a good algorithm implementing IA (computer platyer).
Any idea?
Anyone knows a good book or article (on-line if possible) related with?
Thanks.

AI, which stands for Artificial Intelligence, is generally spelled AI, not IA.
Now that you know that, you can google "gomoku AI" and see what others have done.
Enjoy!

Similar Messages

  • SCD2 Implementation

    We have PL/SQL programs that maintain Type II SCDs using a cursor and procedural logic. Within the cursor loop, there is a lookup that test to see if a row already exists with the set of SCD column values. If it exists, then the loop is continued and the next cursor row is read. If it does not exist, then the row with the new set of SCD values is added. Does anyone have an approach for implementing this processing in OWB? It would be an insert mapping with a conditional insert that only occurs when no "matching" row is found in the target.
    I am pursuing this avenue because I have not found a set based SCD Type II approach that will work as well.
    Chris Busch
    [email protected]

    This approach is valid only for SCD type 1 (No History).
    For SCD type 2 (keep all versions of each row), algorithm a little more difficult:
    1. Find Rows in DWH
    2. If Row not exists,
    3 then insert row
    4 elseif something is changed
    5 then close previous version
    6 open new version
    7 else do nothing with this row
    As to implementation this algorithm in OWB, there are some approaches:
    1st. Create 2 mappings
    1a. Close version (Update)
    1b. Insert new version (Insert)
    2nd. Create mapping with lookup (find previous version)
    and split
    2a close old version, insert new version
    2b insert new row (first version)
    3rd... maybe somebody share with us another approach :)
    Hope this helps
    Sergey

  • Java Sparse Matrix tools

    Hi, I am now having a major problem with a Matrix storage in Java and hope someone here can shed some light:
    I need to store a Huge sparse matrix in memory, over 10k *10k double entries. I know that over 90% of the entries
    will be 0s (sparse) so apparently I need to use a sparse matrix storage algorithm.
    I have tried the famous MTJ package. however it gaves me the classic
    "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" error even when I try to do this:
         public static void main(String[] args){
              int row = 100000;
              int col = 100000;
              FlexCompRowMatrix matrix = new FlexCompRowMatrix(row,col);
              for(int i=0;i<row;i++){
                   for(int j=0;j<col;j++){
                        matrix.set(i, j, 0);
    evening defining a completely sparse matrix will result in out of memory, this is strange!!
    (using -Xmx 512m argument)
    I was wondering if anyone know why, or another actually usable sparse matrix class/package that can:
    1. handle at least 10k * 10k entries without pre-allocation (many other Sparse Matrix class I know, using the compressed column/row algorithm, need you to specify the two dimensional array to convert to the sparse matrix. this is stupid, if I can fit into a 2D array then I don't need to store it cleverly.
    2. can store an element at arbitrary position (basically supports set(i,j, value) ).
    I hope I made myself clear...

    ok sloved, It is my interpretation wrong about what "sparse" meant:
    at least in the mtj package, you only want to set values that are not "sparse", so if 0 is your sparse data
    then you don't want to set(i,j,0)
    I thought that sparse element is having value 0 , so setting 0s to all the rows and columns will not consume memory.
    I was so wrong!

  • Query executed within a plug-in script returns 0 rows, although data exists

    I created a plug-in script for algorithm entity: Service Quantity Rule.
    The script calls a business service that I created using query zones. The query returns the values of the bill segment (ci.bseg.bseg_id and ci_bseg.closing_bseg_sw) that is created while running a bill manually. The zone receives the bseg_id as a parameter.
    The problem is that when I execute the business service within the plug-in script the business services returns 0 rows even though the data is actually being stored in the database.
    The script calculates some SQI values and saves it to the bill segment based on a response that is received from MDM (I'm using the usage request object).
    Steps:
    1.- Create Bill. The bill segment is created in error as it is waiting for the bill determinants to be sent from the MDM. If I test the zone with the bseg_id (as a parameter) of the newly created bill segment it works fine.
    2.- We send a message from the MDM to CC&B. The message is received and processed and it gets to a point when the usage updates the bill segment.
    3.- After the bill segment has been updated with the values from the usage request object it starts executing the plug-in script.
    4.- I obtain the bseg_id from the usage request and use the business service (passing the bseg_id as a parameter) and it returns no result.
    5.- The process finishes and if test the zone with the bseg_id (as a paramter) of the billing segment it works fine.
    So apparently during the execution of the script after the billing determinants are received from MDM I can't have access to the Bill segment that was created, even if the physically the record exists in the database (CI_BSEG).
    I also tried instantiating an object related with the bill segment and got the same result.
    Any idea or clue of what is happening?

    Could you be more explicit.
    What CC&B version?
    What MDM version?
    More details are required for:
    2.- We send a message from the MDM to CC&B. The message is received and processed and it gets to a point when the usage updates the bill segment.
    3.- After the bill segment has been updated with the values from the usage request object it starts executing the plug-in script.
    4.- I obtain the bseg_id from the usage request and use the business service (passing the bseg_id as a parameter) and it returns no result.

  • How to determine what row an item should go in

    Hi all,
    This is more of an algorithm question than a java specific one (but if you want to provide an answer using java code then feel free)
    I'm trying to write a piece of code that automatically imposes documents in the correct position on a sheet. here is my example
    Data array = A, B, C, D, E, F, G, H, I, J
    Impose: 3 Up
    So my output will look like this
    A - E - I
    B - F - J
    C - G -
    D - H -
    I can figure out what column each item goes in by doing this
    Total Pages= ceil of (Total Rows/Impose)
    4 = Ceil(10/3)
    Now work out my breakpoints:
    Make an array of empty breakpoints
    For n=0; n<Impose; n++
    breakpoint[n]=n*Total Pages
    This should give me a breakpoint array of
    0, 4, 8
    Then I can check its column by checking its numerical position against each breakpoint
    e.g.
    for array element 6
    is this greater than breakpoint 0? Yes
    is this greater than breakpoint 4? Yes
    is this greater than breakpoint 8? No
    So this must be breakpoint 4, ie column 2
    So I know element 6 needs to go in the middle column. But what I need to know is what row element 6 will appear in.
    So I need to say, I know there are 4 rows, and 3 columns, and element 6 will appear in row 2/column 2.
    I hope that makes some sense.
    any help?

    Nevermind, I've figured it out.
    FYI
    Because I know the breakpoint, i just take the current array position and subtract from the given breakpoint.
    E.g.
    Array Element 6 is in column 2 therefore the breakpoint is 4
    So i do 6-4=2
    Line 2 is correct

  • Find more than one min and max in 2D array contain 0 rows

    Hi
    I have a 2D array and I would like to find the max and min elements between series of 0s. As you can see in the picture If I remove all 0s from the array and use the max and min function then I will have just one min and one max but I need to find min and max after every 0 rows so you can see from the picture ( just as an example) I will have 3 min and 3 max numbers. Would you please help me with this code. Do you now any algorithm that can find min and max between 0s?
    I have also attached my code to remove 0s and then search for max and min numbers but as I mentioned I need min and max for every part
    Many thanks
    Attachments:
    2.jpg ‏82 KB
    3.jpg ‏27 KB

    Thanks altenbach
    I have attached the vi to this post. I would really apperciate if you help me with this example. The min values should be 100, 1500 and 4000 and the max values should be 1200,2600,5400 so as u mentioned the output should be this 2D array 
    100,1200
    1500,2600
    4000,5400
    Attachments:
    new.vi ‏6 KB

  • Bad performance when iterating/updating the rows of a tree table

    Hello,
    we have a tree table based on a VO and EO (with transient attributes). One of the attribute is a flag.
    The VO is populated with a complex query having many thousands of rows.
    Now, when the user clicks on a parent node, all the children are updated (their flag is set to true) recursively.
    This is really really slow. It might require several minutes, while a similar update via PL/SQL on a real table would required few seconds.
    Is there any way to improve the performance? We have already applied all the tunings on both the EO and VO mentioned in Oracle Documentation, but they had almost no effect:
    - retain viewlink row set iterators
    - query hints
    - Use update batching
    The algorithm we use is the following:
        private void checkTreeNodes(JUCtrlHierNodeBinding node, Boolean check) {
            if (node == null) {
                return;
           TreeVORowImpl nodeRow = (TreeVORowImpl)node.getRow();
            if (nodeRow != null) {
                    nodeRow.setFlag(check);
            List<JUCtrlHierNodeBinding> children = null;
            if (!nodeRow.getLevel().equals("4"))  // no more than 4 levels
                children = node.getChildren();
            if (children != null) {
                for (JUCtrlHierNodeBinding _node : children) {
                    checkTreeNodes(_node, check);
        }

    Thanks for you answer.
    I am trying to move the logic in a method of the AM. But I have an exception (jdev 11.1.2.1):
        public void checkTreeNodes(TreeVORowImpl node, Boolean check, int level) {
            if (node == null)
                return;
            node.setFlag(check);
            if (level >= 4)
                return;
            Key key = new Key(new String[] { node.getId() }); // Id is the primary Key
            // By debugging via System.out.println, the code stops here:
            RowIterator rowIt = getMyVO().findByAltKey("ParentId", key , -1, false); // children have ParentId = Id
            while (rowIt.hasNext()) {
                TreeVORowImpl row = (TreeVORowImpl)rowIt.next();
                checkTreeNodes(row, check, level + 1);
        }findByAltKey gives the following exception (since it's called from the UI by getting the AM from DataControl):
    oracle.jbo.InvalidObjNameException: JBO-25005: [...]
         at oracle.adf.model.binding.DCBindingContainerState.validateStateFromString(DCBindingContainerState.java:573)
         at oracle.adf.model.binding.DCBindingContainerState.validateStateFromString(DCBindingContainerState.java:504)
         at oracle.adf.model.binding.DCBindingContainerState.validateToken(DCBindingContainerState.java:684)
    Do you see anything wrong or not efficient?
    Thanks.

  • How do i write data in a new row to Spreadsheet

    Hello,
    I have to write data an a existing file but i don't want to write under the existing data but i need to write the new data
    in a new row. I have 2 loop. The first loop aquired data and the second repete the processus. When the first loop is activate i can
    write the data but  what i need is when the second loop repete the processus i want to write the new data in a new row.
    Somebody Can help me?????

    Thanks for reply,
    I used Write to Spreadsheet File in a file.txt. The first loop do  a simple algorithm and each time it's run I have to stock the data in a file and all data aquired it's for one profil . If i want to simulate 3 profil I increment the second loop .I need to stock each profile in a different row
    Attachments:
    simulation.vi ‏18 KB

  • How do I store the values in the @D array in the below mentioned VI? Only the last row in the Array is populated with values from the image.

    Hello Guys,
    I am trying to build a sinogram from 180 projection images and I am not able to store the summed values into the array as it is moving the values and then populating all the rows except for the last with ZERO.
    Thanks in advance.
    Attachments:
    sinogram.vi ‏53 KB

    Your loop runs only three times, so all you can possibly populate is 3 rows.
    Typically, you would initialize a shift register with the initialized array, then use replace array subset, feeding the modified array back into the shift register. However, in this case you could just autoindex the 1D array at the output tunnel to build the resulting 2D array.
    Sorry, I am not familiar with sinograms. Do you have a link describing the algorithm?
    LabVIEW Champion . Do more with less code and in less time .

  • The algorithms in my homework

    hello
    1. A cost-map contains M*N cells, we have the cost rate for each individual cell.
    2. The path is defined as a sequence of cells that connect to each other directly.
    3. If two cells are in the same row or column, and there is no cell between them, these two cells are defined as directly connected.
    4. The cost of a path is the summary of all the cells&#8217; costs involved.
    question:
    you are required to find out a cheapest path from one specified cell to another.
    i have designed several class architecture as follow,maybe they are not complete,but it is not important,what i more care about is:how can i implement the algorithm to find the cheapest path?,who can give me the code snippet about the algorithm to get the cheapest path?or where can i find it?
    thank you!
    public class Map{
    int A;
    int B;
    public Cell getCell(int row, int col){
    public Cell getStartCell(){
    public Cell getTargetCell(){
    A: is the row number of the map
    B: is the column number of the map
    getCell returns the Cell with row and column specified. The start index is 0.
    getStartCell and GetTargetCell return the start and end cell of the problem.
    public class Cell{
    int row;
    int col;
    public int getCost(){
    public class Trace{
    public int getTraceLength(){}
    public Cell getCell(int n){}
    public int getCost(){}
    getTraceLength returns how many cells are involved in this trace.
    getCell returns the number n cell in this trace.
    getCost returns the total cost of this trace.

    >
    i have designed several class architecture as
    follow,maybe they are not complete,Obviously.
    but it is not important,Yes it is. If you'd done more you might have gotten some help. What you're asking is: "Will someone do my homework for me?" That's not what the forum is about.
    what i more care about is:I'll bet it is.
    how can i implement the algorithm to find the cheapest path?,
    Write more Java code.
    who can give me the code snippet about the algorithm to get the cheapest path?or where can i find
    it?Try a Google search or go to the library. I'm sure the algorithm is in a book somewhere. - MOD

  • Order By Columns in a Row

    Hi,
    I'm struggling to solve a problem. I want to sort the values of fields in each row.
    RDBMS : 11.2.0.3
    CREATE TABLE test_order
      (a NUMBER, b NUMBER ,c NUMBER ,d NUMBER
    REM INSERTING into test_order
    Insert into "test_order" (A,B,C,D) values ('18','29','14','21');
    Insert into "test_order" (A,B,C,D) values ('40','11','29','12');
    Insert into "test_order" (A,B,C,D) values ('22','20','19','24');
    select * from test_order
             A          B          C          D
            18         29         14         21
            40         11         29         12
            22         20         19         24 I'm trying get result in order as shown below DOES NOT matter column name.
    Each row ordered by its own columns.
             A          B          C          D
            14         18         21         29
            11         12         29         40
            19         20         22         24 Note: my real table have more than one million records.
    Any helps is welcome.

    Seeing as Frank is also having fun with this, and I'm bored watching a data pump import ticking over partition by partition, I thought about creating a SQL data type called TSortedNumbers - allowing you to create/store a set of numbers as a sorted list, and providing a method for returning a specific item in the set.
    As PL/SQL code needs to be used to override the default constructor, I decided to use a PL/SQL quicksort on the number list - as oppose to an expensive context switch to SQL to have SQL doing the sort for you. No idea what (if any) performance improvements there are using a PL/SQL quicksort.
    However, this does demonstrate the really kewl and awesome functionality Oracle provides by enabling one to define custom SQL types.
    // TNumbers is an array/collection of numbers
    SQL> create or replace type TNumbers as table of number;
      2  /
    Type created.
    // package Lib, implements the well-known Quick Sort algorithm - and sorts an
    // array of numbers, where the array is of data type TNumbers
    SQL> create or replace package Lib is
      2          procedure QuickSort( array in out nocopy TNumbers );
      3  end;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body Lib is
      2          procedure SwapPivots( array in out nocopy TNumbers, pivot1 number, pivot2 number ) is
      3                  pivotValue      number;
      4          begin
      5                  pivotValue := array(pivot1);
      6                  array(pivot1) := array(pivot2);
      7                  array(pivot2) := pivotValue;
      8          end;
      9
    10          procedure  Partition( array in out nocopy TNumbers, left number, right number, pivotIndex number, storeIndex out number ) is
    11                  pivotValue      number;
    12          begin
    13                  pivotValue := array(pivotIndex);
    14                  SwapPivots( array, pivotIndex, right );
    15                  storeIndex := left;
    16                  for i in left..right - 1 loop
    17                          if array(i) < pivotValue then
    18                                  SwapPivots( array, i, storeIndex );
    19                                  storeIndex := storeIndex + 1;
    20                          end if;
    21                  end loop;
    22                  SwapPivots( array, storeIndex, right );
    23          end;
    24
    25          procedure QuickSort( array in out nocopy TNumbers, left number, right number ) is
    26                  pivotIndex      number;
    27                  pivotNewIndex   number;
    28          begin
    29                  if left < right then
    30                          pivotIndex := trunc( DBMS_RANDOM.value( left, right ) );
    31
    32                          Partition( array, left, right, pivotIndex, pivotNewIndex );
    33                          QuickSort( array, left, pivotNewIndex-1 );
    34                          QuickSort( array, pivotNewIndex+1, right );
    35                  end if;
    36          end;
    37
    38          procedure QuickSort( array in out nocopy TNumbers ) is
    39          begin
    40                   QuickSort( array, 1, array.Count );
    41          end;
    42
    43  end;
    44  /
    Package body created.
    // We define a a custom SQL data type that contains a single property called n,
    // where n is of type TNumber.
    // The default constructor for this type is: TSortedNumbers ( <array-of-numbers )
    // We create a custom constructor with the same signature, in order to override
    // the default constructor.
    SQL> create or replace type TSortedNumbers is object(
      2          n       TNumbers,
      3
      4          constructor function TSortedNumbers(n TNumbers) return self as result,
      5          member function Get(i integer) return number
      6  );
      7  /
    Type created.
    // Using our custom constructor, we accept the array-of-numbers parameter,
    // assign it to our  TSortedNumbers property n, and quick sort our property so
    // that the array-of-numbers is in ascending values.
    // We also provide a method called Get(), that allows the caller to get a value
    // from our sorted array, by index number.
    SQL> create or replace type body TSortedNumbers as
      2          constructor function TSortedNumbers(n TNumbers) return self as result is
      3          begin
      4                  self.n := n;
      5                  Lib.QuickSort(self.n);
      6                  return;
      7          end;
      8
      9          member function Get(i integer) return number is
    10          begin
    11                  return( self.n(i) );
    12          end;
    13
    14  end;
    15  /
    Type body created.
    // Create sample table and populate it with data
    SQL> create table testtab( a number, b number, c number, d number );
    Table created.
    SQL>
    SQL> insert into testtab (A,B,C,D) values ('18','29','14','21');
    1 row created.
    SQL> insert into testtab (A,B,C,D) values ('40','11','29','12');
    1 row created.
    SQL> insert into testtab (A,B,C,D) values ('22','20','19','24');
    1 row created.
    // To create an array of numbers, we use the TNumbers() data type. Its
    // constructor  is TNumbers( num1, num2, .., numn ). We pass the columns of
    // the rows as parameters into this constructor and it creates an array of our
    // column values. As we now have an array-of-numbers, we can instantiate a
    // TSortedNumbers object. Its constructor required an array-of-numbers
    // parameter. Which is what we have created using our row's columns.
    // As the TSortedNumbers object contains a sorted array-of-numbers of our
    // columns, we can display the numbers in the array using the Get() method
    // and index position in the array of the number we want to display.
    SQL> with results as(
      2  select
      3          rownum,
      4          t.*,
      5          TSortedNumbers( TNumbers(a,b,c,d) ) as NUMBER_SET
      6  from       testtab t
      7  )
      8  select
      9          r.number_set.Get(1)     as "1",
    10          r.number_set.Get(2)     as "2",
    11          r.number_set.Get(3)     as "3",
    12          r.number_set.Get(4)     as "4"
    13  from       results r
    14  /
             1          2          3          4
            14         18         21         29
            11         12         29         40
            19         20         22         24
    SQL>
    Edited by: Billy  Verreynne  on Apr 13, 2013 6:04 PM. (Added comments to example)

  • Sql query to get union of matching rows

    I want to write a sql query that shows union f all the [Type] for each [Key] if [Key] has atleast one [Type] in common and for non matched [Key]s it will return the row as it is.
    For example In the sql table below [Key] '1' and '2' has [Type] 'B' in common and [Key] '1' and '4' has [Type] 'A' in common. In this case [Key] '1', '2' and '4' are related so result will be union of [Type]s in [Key]s '1', '2' and '4' which are 'A', 'B', 'C'
    and 'E' for each [Key]. And [Key] '3' has no [Type] in common so it will return itself.
    Input:
    declare @categories table ([Key] int, [Type] Char(1))
    insert into @categories ([Key], [Type]) values (1, 'A')
    insert into @categories ([Key], [Type]) values (1, 'B')
    insert into @categories ([Key], [Type]) values (2, 'B')
    insert into @categories ([Key], [Type]) values (2, 'C')
    insert into @categories ([Key], [Type]) values (3, 'D')
    insert into @categories ([Key], [Type]) values (4, 'E')
    insert into @categories ([Key], [Type]) values (4, 'A')
    insert into @categories ([Key], [Type]) values (5, 'F')
    insert into @categories ([Key], [Type]) values (5, 'G')
    insert into @categories ([Key], [Type]) values (6, 'G')
    insert into @categories ([Key], [Type]) values (6, 'H')
    Desired output:
    Key Type
    1 A
    1 B
    1 C
    1 E
    2 A
    2 B
    2 C
    3 D
    4 A
    4 B
    4 E
    5 F
    5 G
    5 H
    6 F
    6 G
    6 H

      
    The data element names are wrong. KEY is a reserved word; “Categories" and "type" are called attribute properties in ISO-11179 rules. Matthias Kläy is right; this is a graph problem in disguise, but you can do it with set theory to get  what are called
    equivalence classes. 
    An edge in a graph has two nodes. Some authors allow a single node to count as a edge, but a better way is to put the same node on both ends of the edge. Here is the graph in a table with all the needed constraints. This is why you should post DDL and not be
    so rude.  
    DROP TABLE Graph;
    CREATE TABLE Graph
    (edge INTEGER NOT NULL,
     node_1 CHAR(1) NOT NULL,
     node_2 CHAR(1) NOT NULL,
     CHECK (node_1 <= node_2),
     PRIMARY KEY (node_1, node_2));
    Here is your data in the correct format. 
    INSERT INTO Graph 
    VALUES 
     (1, 'A', 'B'),
     (2, 'B', 'C'),
     (3, 'D', 'D'), -- orphan node
     (4, 'A', 'E'),
     (5, 'F', 'G'),
     (6, 'G', 'H');
    Now Google Warshall's Algorithm. It uses three nested loops and an adjacency array. This is very clean and fast in a procedural language. Not so much in SQL. Let us do this in steps:
    WITH X1 (edge, node1_1, node1_2, node2_1, node2_2 )
    AS
    (SELECT CASE WHEN G1.edge <> G2.edge 
           THEN G1.edge ELSE G2.edge END,
           G1.node_1, G1.node_2, 
           G2.node_1, G2.node_2       
      FROM Graph AS G1, Graph AS G2
     WHERE G1.node_1 IN (G2.node_1, G2.node_2) 
       AND G1.edge <> G2.edge),
    X2 (edge, node_1, node_2)
    AS
    (SELECT edge, 
    CASE WHEN node1_1 IN (node2_1, node2_2) THEN node1_2 ELSE node1_1 END,
    CASE WHEN node2_1 IN (node1_1, node1_2) THEN node2_2 ELSE node2_1 END
    FROM X1)
    SELECT DISTINCT edge,
           CASE WHEN node_1 < node_2 THEN node_1 ELSE node_2 END,
           CASE WHEN node_2 < node_1 THEN node_1 ELSE node_2 END
     FROM X2;
    The X1 subquery gets the paths of length two. The X2 subquery removes the middle node and creates a new sorted edge. Insert these new rows into Graphs, if they are not there. Repeat the process until no more rows are added. 
    DROP TABLE Graph;
    CREATE TABLE Graph
    (edge INTEGER NOT NULL,
     node_1 CHAR(1) NOT NULL,
     node_2 CHAR(1) NOT NULL,
     CHECK (node_1 <= node_2),
     PRIMARY KEY (node_1, node_2));
    INSERT INTO Graph 
    VALUES 
     (1, 'A', 'B'),
     (2, 'B', 'C'),
     (3, 'D', 'D'), -- orphan node
     (4, 'A', 'E'),
     (5, 'F', 'G'),
     (6, 'G', 'H');
    Here is the monster rolled up into a single statement. 
    INSERT INTO Graph
    SELECT DISTINCT edge,
           CASE WHEN node_1 < node_2 THEN node_1 ELSE node_2 END,
           CASE WHEN node_2 < node_1 THEN node_1 ELSE node_2 END
     FROM (SELECT edge, 
    CASE WHEN node1_1 IN (node2_1, node2_2) THEN node1_2 ELSE node1_1 END,
    CASE WHEN node2_1 IN (node1_1, node1_2) THEN node2_2 ELSE node2_1 END
    FROM 
    (SELECT CASE WHEN G1.edge < G2.edge 
           THEN G1.edge ELSE G2.edge END,
           G1.node_1, G1.node_2, 
           G2.node_1, G2.node_2       
      FROM Graph AS G1, Graph AS G2
     WHERE G1.node_1 IN (G2.node_1, G2.node_2) 
       AND G1.edge <> G2.edge) AS X1(edge,node1_1, node1_2, node2_1, node2_2) )
        AS X2(edge, node_1, node_2)
    EXCEPT 
     SELECT * FROM Graph;
     SELECT * FROM Graph ORDER BY edge, node_1, node_2;
    1 A B
    1 A C
    1 B E
    1 C E
    2 B C
    3 D D
    4 A E
    5 F G
    5 F H
    6 G H
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Search row and column for return value

    Dear Sir/Madam,
                               I have a problem for searching spreadsheet and hope you can help me out a bit.  Im pretty new to Labview and Im currently using Labview 8.0.  My task is to search the spreadsheet I have attached in row and column-wise, then return the corresponding value out.  I had an attempt in doing this as you can see from the vi that i have attached.  I try inputting the 'read from measurement file' into an array and using delete, index and search array I will be able to find the index value for the relevant row and column that i searched for by inputting them into an index array with the orginal array from the 'read from measurement file'.
                              So ultimately, when i enter a row value of 0.5 and a column value of 0.3, my output will be 1.688.
                              I can't see any mistakes in my logic but I getting really strange results, like I can read my data has been entered into an array but when i try deleting the first column and put it into another array, the orginal array with nothing deleted is outputted hence making my search to give out -1 value. So could you take a look please and give me any suggestion that can solve my problem or enhance the code a bit.  Thank you for your time.
    Best Regards,
    Coato
    P.s for some reason i can't attached the .lvm file of my data hence i have attached the excel version but i think you need to convert it back to .lvm for the 'read from measurement file' function to work.
    Attachments:
    Backswing compensation.csv ‏10 KB
    Backswing comnpensation2.vi ‏109 KB

    Your VI makes absolutely no sense to me, but maybe I don't understand what you are trying to do.
    You seem to have dynamic data with 6 signals and 48 points/channel. Now you reshape this into an array of dynamic data with 4x13 elements from which you slice out one row or column, resp. "delete from array" is NOT the correct tool to do this, use "Index array" with one index unwired to get a row or column as 1D array.
    So you end up with two 1D arrays of dynamic data that you search for DBL. It is difficult to understand how you want to search for an array element that corresponds to a scalar DBL value of 0.1. Your array elements are NOT DBLs but dynamic data, each containing many signals!
    There are two elements on all your data that are "3", the rest are zero. You will never find anything that is 0.1.
    Maybe you can convert your original dynamic data to a 2D array with "rows are signals" using "convert from dynamic data", then operate on the 2D array.
    Coato wrote:
                              So ultimately, when i enter a row value of 0.5 and a column value of 0.3, my output will be 1.688.
    Sorry, Please explain.
    Please make a VI containing a simple 2D aray as diagram constant that contains e.g. 5x5 typical values. Let us know what kind of result you expect from your algorithm..
    LabVIEW Champion . Do more with less code and in less time .

  • Verifying table rows

    Hi,
    I am trying to move a table from one tablespace to another. I was wondering if there is any way to verify the table rows using md5 hash or some other algorithm!! I can easily count the number of rows in a table before and after the move, but that does not prove the data is right.
    Thanks
    Kapil

    Hi,
    If you use the following command, you will not have any problem with data integrity :
    alter table table_name move tablespace tablespace_name;Example :
    SQL> create table toto(t number);
    Table created.
    SQL> select tablespace_name from dba_tables where table_name = 'TOTO';
    TABLESPACE_NAME
    PSDEFAULT
    SQL> alter table toto move tablespace tools;
    Table altered.
    SQL> select tablespace_name from dba_tables where table_name = 'TOTO';
    TABLESPACE_NAME
    TOOLS
    SQL> Nicolas.

  • Effective solution for algorithm

    I have table T defined below.
    1. Table t definition.
    with t as
    (select 'A' CODE from dual
    union all
    select 'A' CODE from dual
    union all
    select 'B' from dual)
    select * from t;1) In plsql code i have to return cursor ("o_cur") over table t, that i can achieve as:
    open o_cur for
    select * from t;
    2) Also input varivale "i_code" is given and an output variable "o_code" should be returned with following logic:
    if o_cur has in its records value "i_code" then return o_code = i_code,
    else if, o_cur has exactly on row then return o_code value as the value in that one record,
    else return o_code=null;
    What is the effecients way to achieve step 2?
    I can do un-effeciently those 2 queries:
    2.1) select count(1)
    into v_count from t;
    2.2) select count(1)
    into v_count from t
    where CODE = i_code;
    And then wrote the logic in step "2)" to get output variable o_code value. But this seems slow.
    Maybe i can query already opened cursor "o_cur" somehow? Or is there better way?
    I only can do this way:
    with t as
    (select 'A' CODE from dual
    union all
    select 'A' CODE from dual
    union all
    select 'B' from dual)
    select count(1) CNT
    , max((case when t.CODE = 'A' then 'Y' else 'N' end)) YN
    from t ;--rowcount=3, 'A' in list
    with t as
    (select 'A' CODE from dual
    union all
    select 'A' CODE from dual
    union all
    select 'B' from dual)
    select count(1) CNT
    , max((case when t.CODE = 'C' then 'Y' else 'N' end)) YN
    from t ;--rowcount=3, 'A' is not in listSeems it is the best solution.
    Edited by: CharlesRoos on Apr 6, 2010 3:57 AM

    CharlesRoos wrote:
    Thx,
    with "count(*) over () as total_records"
    i can add to output cursor additional column, which have on all rows same value showing the count of all records. So if i add this additional column to output cursor "o_cur" then i can fetch one row from it, close cursor, and open again. And fro mfetching the one record i get information about the total count of records. But as you see algorithm i nstep "2)" also requires knowledge of weather the input value "i_code" appeared in cursor resultset.
    I think i better do additional query after openeing the cursor like:
    with t as
    (select 'A' CODE from dual
    union all
    select 'A' CODE from dual
    union all
    select 'B' from dual)
    select count(1) CNT
    , max((case when t.CODE = 'C' then 'Y' else 'N' end)) YN
    from t ;--rowcount=3, 'C' is not in list
    Another analytical function can be used to test for the existence of a value in the result set, e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  select empno, ename, job, sal
      2        ,row_number() over (order by empno) as rn
      3        ,count(*) over () as cnt
      4        ,sum(decode(job,'CLERK',1)) over () as clerks
      5  from emp
      6* where deptno = 10
    SQL> /
         EMPNO ENAME      JOB              SAL         RN        CNT     CLERKS
          7782 CLARK      MANAGER         2450          1          3          1
          7839 KING       PRESIDENT       5000          2          3          1
          7934 MILLER     CLERK           1300          3          3          1
    SQL>Here I've used the sum function to sum up the number of CLERK jobs in the results. This shows a "1" for all rows indicating there is 1 CLERK in the result set, even if it hasn't yet been selected by the cursor.

Maybe you are looking for

  • Occasionally my screen doesn't refresh properly...

    I have a main menu screen that is list of open sales orders and a list of actions (scripts) that can be performed on the selected order. One of the actions takes a billing block off of the sales order and SHOULD remove it from the list. Very occasion

  • 16-Bit Workflow in Adobe Camera RAW 6.3

    With the "Depth" button set to 16,  I go through the RAW editing options from top to bottom as they are laid-out on the right side of the screen. I must convert to 8-bits at some point. It can be either before leaving the RAW editor or within the Pho

  • Corrupt image formatting when creating pdf from embedded visio image in MS word

    Hello, Using Adobe Acrobat 9 standard and trying to create a PDF file from an MS word (version 2003) document.  PDF file created is fine except for an image (embedded visio diagram imported into word).  When created in PDF, the image is missing many

  • How to move tracks from one course to another in a different category

    Hello. I have 10 tracks that I simple uploaded into a course in the Academical Lectures category. These tracks are also smart fed into another course in the News and Events category. I would like to delete them out of the Academical Lectures course (

  • Regarding Transfer Order

    Hi All, TO is Auto Created I have material showing in storage type B04 (p/n TRM-1). This material was issued to kanbans on 05/02/08 on transfer orders XXX55, XXX56 and XXX57. It should be in W004. How do I get it moved there? There is no material doc