Search Results

Search found 2 results on 1 pages for 'meff'.

Page 1/1 | 1 

  • I'm an idiot/blind and I can't find why I'm getting a list index error. Care to take a look at these 20 or so lines?

    - by Meff
    Basically it's supposed to take a set of coordinates and return a list of coordinates of it's neighbors. However, when it hits here:if result[i][0] < 0 or result[i][0] >= board.dimensions: result.pop(i) when i is 2, it gives me an out of index error. I can manage to have it print result[2][0] but at the if statement it throws the errors. I have no clue how this is happening and if anyone could shed any light on this problem I'd be forever in debt. def neighborGen(row,col,board): """ returns lists of coords of neighbors, in order of up, down, left, right """ result = [] result.append([row-1 , col]) result.append([row+1 , col]) result.append([row , col-1]) result.append([row , col+1]) #prune off invalid neighbors (such as (0,-1), etc etc) for i in range(len(result)): if result[i][0] < 0 or result[i][0] >= board.dimensions: result.pop(i) if result[i][1] < 0 or result[i][1] >= board.dimensions: result.pop(i) return result

    Read the article

  • Handling primary key duplicates in a data warehouse load

    - by Meff
    I'm currently building an ETL system to load a data warehouse from a transactional system. The grain of my fact table is the transaction level. In order to ensure I don't load duplicate rows I've put a primary key on the fact table, which is the transaction ID. I've encountered a problem with transactions being reversed - In the transactional database this is done via a status, which I pick up and I can work out if the transaction is being done, or rolled back so I can load a reversal row in the warehouse. However, the reversal row will have the same transaction ID and so I get a primary key violation. I've solved this for now by negating the primary key, so transaction ID 1 would be a payment, and transaction ID -1 (In the warehouse only) would be the reversal. I have considered an alternative of generating a BIT column, where 0 is normal and 1 is reversal, then making the PK the transaction ID and the BIT column. My question is, is this a good practice, and has anyone else encountered anything like this? For reference, this is a payment processing system, so values will not be modified, so there will only ever be transactions and reversals.

    Read the article

1