FAQ Database Discussion Community


Indexing cannot yield multiple results in MATLAB

matlab,indexing,confusion-matrix
I'm trying to build confusion matrix in Matlab but I'm getting this error. Indexing cannot yield multiple results. Error in Untitled3 (line 184) [Max, argmax1]= max(simoutelem); I want to find maximum value in this matrix and its index.I know from enter link description here that max can be used to...

Numpy: Multidimensional index. Row by row with no loop

python,numpy,multidimensional-array,indexing,vectorization
I have a Nx2x2x2 array called A. I also have a Nx2 array called B, which tells me the position of the last two dimensions of A in which I am interested. I am currently getting a Nx2 array, either by using a loop (as in C in the code...

Why does my array lose its mask after doing multidimensional indexing in Numpy?

python,numpy,multidimensional-array,indexing
I wish to use a multidimensional MaskedArray as an index array: Data: In [149]: np.ma.arange(10, 60, 2) Out[149]: masked_array(data = [10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58], mask = False, fill_value =...

Covering index and getting rid of Key Lookup

sql-server,indexing,key
I have a SQL statement that is giving me a Key Lookup sucking the processing of this query below. Since its part of a 3 part union, getting rid of the key lookup is preferable. My query is below. SELECT c.customerName, c.customerNumber, totals.TotalLoanAmount, totals.TotalCommitmentAmount, l.loanNumber, l.commitmentAmount, ed.amountThreshold, ex.exceptionId, IsNull(ex.reminderDateGracePeriod, ed.defaultReminderDateGracePeriod)...

ElasticSearch- “No query registered for…”

search,indexing,elasticsearch
ElasticSearch returns me "No query registered for [likes_count]" error when trying to look up entries using the following query. The field likes_count is a new field of documents and does not exist in every document. The same query works without the sort part. Why does this error appear? Thanks {...

Jquery/javascript named index array with array association

javascript,jquery,arrays,indexing,named
I want to know if its possible (and correct) to construct a named index array that is associated with other arrays. E.g., var signOptionSet = []; signOptionSet['basic'] = ['Sign Width', 'Sign Height', 'Sign Depth', 'Base Material', 'Finish']; signOptionSet['advanced'] = ['Area', 'Perimeter', 'Lighting']; How would I access something like 'Sign Height'...

Get specific values form JSON Table with javascript over IDs

javascript,arrays,json,indexing
I have the following problem: I have a JSON table with the data I need (found this on the internet since it is nearly what I need) var testext ={"key1":[ { "firstName":"Ray", "lastName":"Villalobos", "joined":2012 }, { "firstName":"John", "lastName":"Jones", "joined":2010 } ]} document.getElementById("demo").innerHTML=testext.key1[0].firstName; This works fine but as you can see...

Decision to use KEY or UNIQUE KEY

mysql,indexing,unique-index
I understand that UNIQUE KEY is a unique index and KEY is a non-unique index. I have read that in case of unique index'es inserting data might result in some IO. If we don't have to rely on the DB for unique-ness and we still want fast lookup's using column...

How can I use MySQL statement 'show index' with PDO?

php,mysql,indexing,pdo,show
I am trying to use PDO and prepared statements to get the primary key of a table. From other questions I saw that this is possible when executing something like this: show index from TABLENAME where Key_name = 'PRIMARY' The problem is that I can not use this from inside...

Finding a specific cell contanining value greater than the desired value

excel,indexing,excel-formula,vlookup
I'm looking for a way to return a specific cell value from a range based on an initial desired value. It looks like this: DesiredValue typed in cell: | 125| Search Range: line1 RangeA|RangeB line2 1 | 50 line3 51 | 100 line4 101 | 500 line5 501 | 1500...

python compare items in 2 list of different length - order is important

python,list,loops,for-loop,indexing
list_1 = ['a', 'a', 'a', 'b'] list_2 = ['a', 'b', 'b', 'b', 'c'] so in the list above, only items in index 0 is the same while index 1 to 4 in both list are different. also, list_2 has an extra item 'c'. I want to count the number of...

indexing a text file into two arrays

c#,file-io,indexing
So I have a text file that holds 12,970 lines. I want to take this file and make them into two arrays, list, anything that will separate the file into two groups: group one being called apollo that holds the lines 0 through 7678 and group two being called sabre...

Looping through numbers to create a large table

excel,vba,excel-vba,indexing
I have a code that works, but I want to add some more functionality to it. It currently does what it is supposed to do, and has sped up some processes, but now I think it can be sped up even more. I am using the solution that I marked...

Subsetting and Indexing in For Loop in R

r,for-loop,indexing,minimum
I am trying to collect the n number of smallest values in a dataset sorted by rank. Here is my code: testscript <- function(num) { df <- data.frame(State = paste0("State",sort(rep(1:2,10))), City = rep(paste0("city",rep(1:10,2))), Value = runif(n=20)) vec <- NULL df$Rank <- ave(df$Value, df$State, FUN=rank) for (i in 1:num) { vec[i]...

Proper if..else syntax in Python

python,if-statement,indexing,operand
In my python code, I am attempting to implement an if..else statement. See below: if index[y] == index[x]: continue else index[y] != index[x] indexdn = indexd indadd= index[y]-index[x] indexdn[:,y]=indexdn[:,y]+ indadd index[y,:]=-indexdn[:,y] indexdn[y,y]=0 However, no matter how many different ways I attempt to write else index[x] is not equal to index[y]...

MySQL not using index when where condition have if clause

mysql,indexing
Below is the query SELECT * FROM mytable WHERE if(@type=1,col1,col2) = 1420070400; @type is a session variable. I have two indexes defined on both columns col1 and col2 but mysql does not uses in this case. Is there any way by which we can make mysql use index? Below is...

Do you get the same performance using index prefixes?

performance,mongodb,indexing
Say I have a collection containing documents like the one below: { _id: ObjectId(), myValue: 123, otherValue: 456 } I then create like below: {myValue: 1, otherValue: 1} If I execute the following query: db.myCollection.find({myValue: 123}) will I get the same performance with my index as I would if I...

Create a text index on MongoDB schema which references another schema

javascript,node.js,mongodb,indexing,mongoose
I am trying to add an index to a certain Schema with mongoose for text searches. If I add a text index to individual fields it works fine, also with compound indexes it is okay. For example the answer provided here is great: Full text search with weight in mongoose...

Access data.table columns with strings

r,string,indexing,data.table
Apologies for a question that probably makes it obvious that I usually work in Python/pandas, but I'm stuck with this. How do I select a data.table column using a string? dt$"string" dt$as.name("string") dt$get("string") I'm sure this is super simple, but I'm not getting it. Any help is greatly appreciated! --------------...

Is there a way to associate data with a file in a folder hierarchy?

java,indexing,uniqueidentifier,tagging,subfolder
Using Java, I am creating a program that indexes a folder structure and allows a user to search for files and also tag a file with keywords and then search for files based off of those tags. I have been traversing through the folder hierarchy using the FileUtils listFiles method...

Checking whether indexes are being used in SQL query?

mysql,sql,indexing,phpmyadmin
I have two tables in my database that look roughly like this: Movement: Timestamp visitorID Type X Y 2012-03-02 11:02:30 379 pedestrian 32 46 2012-03-01 12:32:41 654 pedestrian 54 56 2012-03-02 07:02:16 789 pedestrian 39 52 Communication: (Calls made) Timestamp senderID toID GeneralLocation 2012-03-02 09:02:30 878 674 Grasslands 2012-03-02 11:30:01...

Multiple field Indexing in pymongo

mongodb,indexing,pymongo
I am trying to apply indexing for my mongodb collection through pymongo. I am using db[collection_name].ensure_index([("field_name" , "text"),("unique", 1), ("dropDups" , 1)]) and it works. But now how can apply it for multiple fields? Something like this db[collection_name].ensure_index([("field_name1" , "text"),("field_name2", "text"),("field_name3", "text"),("unique", 1), ("dropDups" , 1)]) I know we can...

Using [] on pointers in C?

c,pointers,indexing
Right now I'm looking over some C code and they have some pointer syntax that I'm confused about. So first they declared a pointer like so: int32_t *p_tx_buf=NULL; Then later on they wrote: p_tx_buf = malloc(...math... ); The stuff in the middle is just math to calculate the size of...

Converting MATLAB to Python: too many indices return error

python,arrays,matlab,numpy,indexing
I am attempting to convert a script I have in MATLAB to Python in order to increase speed and efficiency of the overall algorithm. In MATLAB, the code is as follows: for iter = 1:T costi = costo; for i = 1:length(index) for j = i+1:length(index) if index(j) == index(i)...

comparing index values in an array

ruby-on-rails,ruby,indexing,each
I have an array that looks like this ranking_array = ['NC', '40', '30/5', '30/4', '30/3', '30/2', '30/1', '30', '15/5', '15/4', '15/3', '15/2', '15/1', '15', '5/6', '4/6', '3/6', '2/6', '1/6', '0', '-2/6', '-4/6', '-15', '-30'] I have also a model user, my user has a ranking which is a value that...

Unable to understand the error generated

python,indexing,range
error section--> student_grade_system = StudentGradeSystem(sys.argv1) errored place--> Traceback (most recent call last): File "C:\Users\Daphnie\Desktop\Python_code\12\student_grade\grade_system.py", line 111, in main() File "C:\Users\Daphnie\Desktop\Python_code\12\student_grade\grade_system.py", line 105, in main student_grade_system = StudentGradeSystem(sys.argv1) IndexError: list index out of range Code: import sys from student import Student class StudentGradeSystem(object): def __init__(self, score_file): self._score_file =...

Lucene vs Solr, indexning speed for sampe data

java,indexing,solr,lucene,full-text-search
I have worked upon Lucene before and now moving towards Solr. The problem is that I am not able to do Indexing on Solr as fast as Lucene can do. My Lucene Code: public class LuceneIndexer { public static void main(String[] args) { String indexDir = "/home/demo/indexes/index1/"; IndexWriterConfig indexWriterConfig =...

Numpy Indexing: Get every second coloumn for each even row

python,numpy,indexing
I want to select in an numpy array all odd off diagonals. Basically the following: a = np.arange(16).reshape(4,4) array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) b = a[::2,1::2] and at the same time a[1::2,::2] array([[ 1, 3], [...

python and arduino : list index out of range err

python,indexing,arduino
So I am trying to get from my arduino some resource values and some id's , and I can't figure out how to solve this. I haven't played with python, this is my first time, so it is have to be something easy ... this is my python program import...

MySQL indexes performance on huge tables

mysql,sql,database,performance,indexing
TL;DR: I have a query on 2 huge tables. They are no indexes. It is slow. Therefore, I build indexes. It is slower. Why does this makes sense? What is the correct way to optimize it? The background: I have 2 tables person, a table containing informations about people (id,...

Pandas: break categorical column to multiple columns

python,indexing,pandas
Imagine a Pandas dataframe of the following format: id type v1 v2 1 A 6 9 1 B 4 2 2 A 3 7 2 B 3 6 I would like to convert this dataframe into the following format: id A_v1 A_v2 B_v1 B_v2 1 6 9 4 2 2...

Creating index while updating the documents

mongodb,indexing
I have a collection I am updating adding a new field. The document looks like: {"A": "P145", "B":"adf", "C":[{"df":"14", "color":"blue"},{"df":17}], "_id":ObjectID(....), "Synonyms":{"Synonym1": "value1", "Synonym2": ["value1", "value2"]}} In the update I am adding new elements to C I want to create a index on the field A and B. A and...

Why can't I access the elements of my NSMutableArray?

objective-c,indexing,nsmutablearray
I declared arrays a,b,c and d as properties in my interface class and initialized them like this: [self setPatternA:[[NSMutableArray init] initWithArray:@[@0,@0,@1,@1,@2,@2]]]; [self setPatternB:[[NSMutableArray init] initWithArray:@[@3,@4,@4,@5,@5,@3]]]; [self setPatternC:[[NSMutableArray init] initWithArray:@[@3,@3,@4,@4,@5,@5]]]; [self setPatternD:[[NSMutableArray init] initWithArray:@[@0,@1,@1,@2,@2,@0]]]; and now I'm trying to access them like this: NSInteger a=[patternA objectAtIndex:3]; NSLog(@"pattern a: %ld", (long)a); but...

Remove inf from Theano array

python,indexing,theano
Supposing I have a vector in Theano and some of the elements are inf, how do I remove them? Consider the following example: import numpy as np import theano from theano import tensor vec = tensor.dvector('x') fin = vec[(~tensor.isinf(vec)).nonzero()] f = theano.function([vec], fin) According to the Theano documentation, this should...

Python: How to check the value of a non-existent list element without getting IndexError?

python,list,if-statement,indexing,indexoutofboundsexception
I'm using Python's one-line conditional thus: x = 'foo' if myList[2] is not None else 'bar' to assign to x the value of an item at a certain index of a list - if and only if it exists - and a different value if it doesn't. Here's my challenge:...

Finding a critical point in matrix

matlab,function,for-loop,matrix,indexing
I'm attempting to find a critical point in a matrix. The value at index (i,j) should be greater than or equal to all elements in its row, and less than or equal to all elements in its column. Here is what I have (it's off but I'm close): function C...

php not executing in a get_file_contents document

php,indexing,footer,copyright
In my index.php file I have a command to retrieve the footer content. <?php echo file_get_contents('template/footer.php'); ?> In the footer.php document I have an additional script to get a automatic generated copyright date however when the footer.php document is rendered it isn't executing the php. <?php echo date("Y"); ?> Is...

Lucene how to index in Database (Cassandra)

java,indexing,lucene,cassandra
I am just experimenting with Lucene and want to indexing objects in Database(Cassandra) as a table. But, I didnt realized out, how the indexing does work on Cassandra. Especially searching... When i take a simple Example Indexing in Lucene: Document doc = new Document(); doc.add(new TextField("id", "Hotel-1345", Field.Store.YES)); doc.add(new TextField("description",...

R - How to re-order row index number

r,vector,indexing,data.frame,row
Simply put, I have the following data frame: Signal 4 9998 3 549 1 18 5 2.342 2 0.043 and I want to reset the index numbers to be like : Signal 1 9998 2 549 3 18 4 2.342 5 0.043 ...

Reduction of list dimensions in Python

python,list,indexing,nodes
I'm trying to assign classes to a list of nodes, and separate all nodes into separate lists based on class tag. For example, if we have the following code: #define number of classes MaxC=5 index=[4 4 5 1 4 1 4 5 4 4 3 1 3 3 1 1]...

replace zero values with previous non-zero values

matlab,indexing,vectorization
I need a fast way in Matlab to do something like this (I am dealing with huge vectors, so a normal loop takes forever!): from a vector like [0 0 2 3 0 0 0 5 0 0 7 0] I need to get this: [NaN NaN 2 3 3...

Creating Index in Elasticsearch using Java API giving NoClassFoundException

java,indexing,elasticsearch
I'm trying to create a node based client using Java API and index a JSON document. Here's the code : import java.util.Date; import java.util.HashMap; import java.util.Map; import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse; import org.elasticsearch.client.Client; import org.elasticsearch.node.Node; import static org.elasticsearch.node.NodeBuilder.*; public class Els { public static void main (String args[]){ Els p = new Els();...

Lucene get all non deleted document from index file

java,indexing,lucene
I am trying to get all documents from Lucene Index (which is already not deleted ). I heard that if I delete something from Lucene Index, Lucene will not delete immediately from file. So I wanted to get the documents from Index file which is not deleted....

Creating SQL Indexes?

mysql,sql,indexing,phpmyadmin
I have two tables in my database that look roughly like this: Communication: (Calls made) Timestamp FromIDNumber ToIDNumber GeneralLocation 2012-03-02 09:02:30 878 674 Grasslands 2012-03-02 11:30:01 456 213 Tundra 2012-03-02 07:02:12 789 654 Mountains Movement: Timestamp IDNumber Type X Y 2012-03-02 11:02:30 379 pedestrian 32 46 2012-03-01 12:32:41 654 pedestrian...

np.argmax on multidimensional arrays, keeping some indexes fixed

numpy,multidimensional-array,indexing,argmax
I have a collection of 2D narrays, depending on two integer indexes, say p1 and p2, with each matrix of the same shape. Then I need to find, for each pair (p1,p2), the maximum value of the matrix and the indexes of these maxima. A trivial, albeit slow, way to...

How do I create a dictionary that indexes the location of certain keys?

python,dictionary,indexing,data-structures
I have a class that inherits the dict object. my_subclassed_dict = SubclassedDictionary({ "id": {"value1": 144 "value2": "steve", "more" {"id": 114} }, "attributes": "random" }) On initialization of SubclassedDictionary, I would like paths generated which match a certain condition. Hypothetically, if I was to make this condition, 'index all numbers above...

mysql multiple indexes for small sets of values

mysql,indexing
I have a table for logging data into, example TABLE IF NOT EXISTS `message_log` ( `id` int(8) NOT NULL AUTO_INCREMENT, `user_id` int(8) unsigned NOT NULL, `channel` tinyint(8) unsigned NOT NULL DEFAULT '0', `type` tinyint(4) NOT NULL DEFAULT '0', `message` varchar(255) NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `confirmed` datetime...

Retrieve index of newly added row - for loop in R

r,for-loop,indexing
I am trying to retrieve the index of a newly-added row, added via a for loop. Starting from the beginning, I have a list of matrices of p-values, each with a variable number of rows and columns. This is because not all groups have an adequate number of treated individuals...

Fast indexing using multiple ES nodes?

java,indexing,elasticsearch,lucene,scalability
All I read and understand about running multiple ES nodes is to enable index replication and scaling. I was wondering if it could help us to make indexing faster for large number of files. I have two questions and they are as follows: Question 1: Would it be accurate to...

Problems with matrix indexing using for loop and if condition

matlab,if-statement,for-loop,matrix,indexing
I to do some indexing, something like what follows: for c=1:size(params,1) for d=1:size(data,2) if params(c,8)==1 value1(c,d)=data(params(c,11),d); elseif params(c,8)==2 value2(c,d)=data(params(c,11),d); elseif params(c,8)==3 value3(c,d)=data(params(c,11),d); end end end The problems with this is that if we have params(:,8)=1,3,1,3,2,3,1... then value1 will contain all zeros in rows 2, 4, 5, 6, etc. These are...

Creating analyzed and not_analyzed index on all fields in Elasticsearch

python,indexing,elasticsearch,mapping
Im pretty new to Elasticsearch. I have a requirement of creating ALL string fields with an "analyzed" and "not_analyzed" index. I have been able to do it for 1 or 2 fields, but how can I do this if I have 50 fields in my document? I have used the...

Python Pandas: select rows based on comparison across rows

python,indexing,pandas
In the dataframe below, the first column is the index with occasional non-unique values. | | col1 | |---|------| | A | 120 | | A | 90 | | A | 80 | | B | 80 | | B | 50 | | C | 120 | |...

IF duplicate cell value found in column then return value

excel,if-statement,indexing,match,countif
I need to track a person in a data sheet to determine from which location to which location the person moved. If a person appears more then one time in Column J that means the person has changed the location and the location value is in Column L. For this...

Does PostgreSQL quickly search for columns with arrays of strings?

arrays,database,performance,postgresql,indexing
According to Can PostgreSQL index array columns?, PostgreSQL can index array columns. Can it do searches on an array column as efficiently as it does for non array types? For example, suppose you have a row from a questions table (like SO): title: ... content:... tags: [ 'postgresql', 'indexing', 'arrays'...

Referencing numpy array locations within if statements

python,arrays,matlab,numpy,indexing
I have the following section of Python: for j in range(0,T): for x in xrange(len(index)): for y in xrange(x+1,len(index)): if index(y) == index(x): continue For which I have been attempting to translate successfully from a MATLAB equivalent. In matlab, this operation is simple as follows: for iter = 1:T for...

Need i make reindex when i create new index in T-SQL?

sql-server,tsql,indexing
I need to create new index for table in database which size is around 300 gb, but need i perform any additioanl action after i complete with it ? My database engine is microsoft sql server 2008 ?

retrieve Hashmap Elements by index based

java,indexing,hashmap
Map pins = new HashMap(); pins.put("t1","test1"); pins.put("t2","test2"); pins.put("t3","test3"); pins.put("t4","test4"); Here is my code,i store key and values in HashMap. And i want to retrieve key and value by index value just like array. Retrieve value by key using iterator working. But i want index based can any body help me...

Do index names have to be unique across entire database in Mysql?

mysql,sql,indexing
For example, if I have two tables Teacher and Student that would have a column named IDNumber, do I have to name the indexes separately like this: IDNum_teach IDNum_stu Or could I just create an index on each table for IDNumber and name them both IDNum? ...

Why iterative loop to remove items in list stops

list,python-2.7,loops,indexing
New to Python, trying to understand how this iterative loop that is intended to remove all items form the list is handling the indexes in the list and why it stops where it does... Why does this loop: foo = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] for i...

Postgres Index-only-scan: can we ignore the visibility map or avoid heap fetches?

postgresql,indexing
Sorry, lots of context before the actual question as we've throughly researched this and I wanted to give you full context. Some context: postgres index-only-scans rely on the visibility map (VM). If a page is not marked as not-fully-visible in the visibility map, postgres fetches that page to ensure the...

Python numpy bool masks for absoluting values

python,arrays,numpy,indexing,masking
Suppose you have a numpy array(n,n) ie. x = np.arange(25).reshape(5,5) and you fill x with random integers between -5 and 5. Is there a method to use a boolean mask so that all of my values which are 0 become 1 and all my numbers which are nonzero become zero?(i.e,...

Why MongoDB doesn't uses Index Intersection?

mongodb,indexing,database-indexes,mongodb-indexes
I am trying to reproduce the first example of index intersection instruction (http://docs.mongodb.org/manual/core/index-intersection/) but facing a problem: mongo doesn't uses both indexes My steps: Download mongo (3.0.3) and install it Run mongod: mongod.exe --dbpath d:\data (folder is empty) Run mongo: mongo.exe Add indexes: db.orders.ensureIndex({ qty: 1 }) db.orders.ensureIndex({ item: 1...

Find the sentence’s index (sentences in a list) of a specific word in Python

python,list,indexing,nltk
i currently have a file that contains a list that is looks like example = ['Mary had a little lamb' , 'Jack went up the hill' , 'Jill followed suit' , 'i woke up suddenly' , 'it was a really bad dream...'] I would like to find the index of...

Creating NxM indices from a Python array

python,numpy,indexing
I would like to take an NxM matrix, for simplicity, we'll use x=np.arange(25).reshape((5,5)) And I would like to create a new matrix, A, in which I can store a node for each element in the first row, its N-direction index in the second row, its M-direction index in the third...

SQL Index - is this overlapping?

sql,sql-server,indexing
I'm going through and removing duplicate and redundant indexes in a SQL database. So if I have two identical indexes I delete. If I have overlapping indexes I delete, for example... Index 1: brand, model Index 2: brand, model, price I delete index 1. What about indexes in same order...

Python: How to index the elements of a numpy array?

python,arrays,numpy,indexing
I'm looking for a function that would do what the function indices does in the following hypothetical code: indices( numpy.array([[1, 2, 3], [2, 3, 4]]) ) {1: [(0,0)], 2: [(0,1),(1,0)], 3: [(0,2),(1,1)], 4: [(1,2)]} Specifically, I want to produce a dictionary whose keys are the unique elements in the flattened...

Which tables do not have indexes in Oracle? [closed]

oracle,indexing,sqlplus
I think its wrong question ,but its a university project assignment .. The question : I want to find tables without indexes in Oracle with select statement in SqlPlus. Thanks for helping.....

How can I access semi-sparse data efficiently in java?

java,arrays,indexing
So I'm working with a problem where I am parsing a large text file into data - each row of the file being represented by a Node object with several data fields. During program execution, these objects will be accessed many times according to their int id field (specified in...

MySQL performance with index clairification

mysql,performance,indexing
Say I have a mysql table with an index on the column 'name': I do this query: select * from name_table where name = 'John'; Say there are 5 results that are returned from a table with 100 rows. Say I now insert 1 million new rows, non that have...

Neo4j: configure legacy index with cypher or property file

indexing,neo4j
I am using Neo4j-server and I am trying to find a way to configure a legacy index either with cypher or with a property. So far to enable the legacy indexing I just uncommented the related line in neo4j.properties file. How can I apply some of the configurations listed here...

Printing corresponding elements from multiple lists by using known element from a single list in Python

arrays,indexing,elements
I have 4 very large arrays, a, b, c, and d of the same size. I have selected specific elements in 'a', and I need the corresponding elements from b, c, and d (i.e. if I select an element from 'a' want the elements from the other arrays that have...

Apache Cassandra. Specific case for an Index or a table with composite primary key

indexing,cassandra,cassandra-2.0,composite-primary-key
I have this scenario in a POC of Cassandra. A table CREATE TABLE B (B-UID UUID, A-UID UUID, CREATED_AT timestamp , JSON text, PARENT_B-UID UUID, POSTALCODE text, CUSTOMER_TYPE text, START_DATE timestamp, END_DATE timestamp, SOME_PRICE int, PRIMARY KEY (B-UID)); 24 k rpm of write / 2 k rpm of read. For...

How to get a mysql query to use a specific index?

mysql,database,table,indexing
SELECT * FROM orders WITH (INDEX(idx)); When i fired above query i got the error mysql #1064 - You have an error in your SQL syntax I have created index as below create index idx on orders(date,status); Can anybody tell me the correct syntax?...

PHP Autoincrement Array

php,arrays,indexing,key,key-value
I am having trouble with expanding my PHP array. Here is a sample of my code : <select name="PaymentCounts"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <?php $arr = array ('Client' => "Alex", 'BillNumber' => "123", 'PaymentCounts' => "1", 'Amounts' => array ('PaymentNumber' => array( array('Amount1' => "100.00",...

Trying to create a new dataframe based on internal sums of a column from another dataframe using Python/pandas

python,indexing,pandas,sum,dataframes
Let's assume I have a pandas dataframe df as follow: df = DataFrame({'Col1':[1,2,3,4], 'Col2':[5,6,7,8]}) Col1 Col2 0 1 5 1 2 6 2 3 7 3 4 8 Is there a way for me to change a column into the sum of all the following elements in the column? For...

Variable indexes outside of defined range in AMPL

variables,indexing,set,linear-programming,ampl
Not too familiar with AMPL, but running into some issues with indexes... Basically, I have some variables defined as such: var array{i in set}; And I need to do some amount of checking the elements around a given i in some of the constraints: subject to Constraint{i in set}: array[i]...

Postgres does not use an index even less than 5% rows are returned

database,postgresql,indexing,database-performance
I have a postgres table with the following structure: +---------+-------------+-------------+----------+---------+---------+ | id | timestamp | numvalues | text1 | text2 | text3 | +---------+-------------+-------------+----------+---------+---------+ |abcd12344| 4124135 |[1,2,53,1241]| apple | banana | papaya | +---------+-------------+-------------+----------+---------+---------+ id - random alphanumeric value<br> timestamp - epoch timestamp<br> numvalues - array of integers<br> text(n) -...

How to count the characters of each line in a string and convert the number to a hex

java,arrays,indexing,hex
I have this String here called message. Bruce Wayne,Batman,None,Gotham City,Robin,The Joker Oliver Queen,Green Arrow,None,Star City,Speedy,Deathstroke Clark Kent,Superman,Flight,Metropolis,None,Lex Luthor Bart Allen,The Flash,Speed,Central City,Kid Flash,Professor Zoom I need to count the number of characters in each line and print them in hex. First line should be (From Bruce to Joker) 2b Second...

Manipulate a matrix based on another matrix

matlab,indexing
I have a variable est which is 20x1 double, something like this: 12 15 68 85 0 25 3 ... and variable k which is also 20x1 double consisting of 0, 1, or 2, something like this: 1 2 0 1 0 0 2 ... I would like to change...

Postgres full text search: how to search multiple words in multiple fields?

sql,postgresql,search,indexing,full-text-search
i'm using for the first time Postgresql and i'm trying to create a search engine in my website. i have this table: CREATE TABLE shop ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, description TEXT, address TEXT NOT NULL, city TEXT NOT NULL ); Then i created an index...

What can I use as an array index in GLSL in WebGL ?

arrays,indexing,glsl,webgl
Are there ONLY constants allowed or can I use for loop indices or any other dynamic values ?

Search for nodes in Neo4j with schema index

indexing,neo4j,lucene
I have a graph that has only Schema indexes and not legacy indexes as Neo4j documentation recommends. I want to search for nodes like in this example described under the legacy indexing section (exact match, start queries etc). I am wondering if this is possible with schema indexes and if...

Postgres tsearch performance on first query

performance,postgresql,indexing,full-text-search,ispell
We are using a custom text search configuration for searching in german texts for a proper support of compound words. The dictionary can be found here: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ (ispell-german-compound.tar.gz). The dicts got converted to UTF8 and I used the following script to add the configuration to the database: DROP TEXT SEARCH...

Optimizer using an index not present in the current schema

oracle,indexing,optimizer
CONNECT alll/all SELECT /*+ FIRST_ROWS(25) */ employee_id, department_id FROM hr.employees WHERE department_id > 50; Execution Plan Plan hash value: 2056577954 | Id | Operation | Name | Rows | Bytes | | 0 | SELECT STATEMENT | | 25 | 200 | 1 | TABLE ACCESS BY INDEX ROWID| EMPLOYEES...

Multidimensional List get Position of a String Python

python,string,list,indexing,set
I got following List relational_scheme = [["F",["DC"]],["A",["EBD"]],["DC" , ["BAF"]],["E",["DB"]]] Now i want to get the second List as a Set like def returnSetOfList(relational_scheme,"F") So that this output generates set(["DC"]) How can i make this? an easy Index don't work. Thanks in advance. UPDATE got it, was just blind Solution: def...

SQL - Avoid 2 columns in 1 record having the same value

mysql,indexing
I'm now working on a new MySQL database (interface PHPmyadmin) for my personal project and I don't know how to avoid two columns on a same table to have the same value. So, i want that we can't insert same values for 2 differents columns in one record. Example TABLE...

Optimize the execution of select

sql-server,indexing,query-optimization,clustered-index,non-clustered-index
I want optimize this select: Select Dane1, Dane5, Dane6, Dane7 FROM Test INNER JOIN Test2 ON Test.Id=Test2.IdTest WHERE Dane5 > 199850 My database has 2 tables test, test2: test design: Id int ->PRIMARY KEY, Dane1 int, Dane2 int, Dane3 int, Dane4 int, Dane5 int, test2 design: Id int ->PRIMARY KEY,...

Postgres 9.4 jsonb array as table

sql,json,postgresql,indexing,jsonb
I have a json array with around 1000 elements of the structure "oid: aaa, instance:bbb, value:ccc". {"_id": 37637070 , "data": [{"oid": "11.5.15.1.4", "value": "1", "instance": "1.1.4"} , {"oid": "11.5.15.1.9", "value": "17", "instance": "1.1.4"} , {"oid": "12.5.15.1.5", "value": "0.0.0.0", "instance": "0"}]} oid and instance are unique per json array. If I...

IndexError obstructing code from working with larger csv file

python,csv,indexing,pandas
I have data that sorts a csv by using groupby and then plots the information. I used a small sample of information to create the code. It ran smoothly and so then I tried running it with the huge file of data. I am pretty new at Python and this...

Delete ndb EntitiesByProperty index table

google-app-engine,indexing,gae-datastore,app-engine-ndb
I have an NDB model with some obsolete EntitiesByProperty indexes. Some belong to properties that are no longer part of the schema (but they do exist on some old entities), and some belong to properties that are never used for queries (but they were with Indexed=True because this is ndb...

How to use all the cores of Solr in solrj

java,indexing,solr,lucene,solrj
I have downloaded solr 5.2.0 and have started using $solr_home/bin/solr start The Logs stated: Waiting to see Solr listening on port 8983 [/] Started Solr server on port 8983 (pid=17330). Happy searching! Then I visited http://localhost:8983/solr and created a new core using Core Admin / new Core as Core1 (...

What indexer do I use to find the list in the collection that is most similar to my list?

search,indexing,solr,levenshtein-distance
Lets say I have my list of ingredients: {'potato','rice','carrot','corn'} and I want to return lists from a database that are most similar to mine: {'beans','potato','oranges','lettuce'}, {'carrot','rice','corn','apple'} {'onion','garlic','radish','eggs'} My query would return this first: {'carrot','rice','corn','apple'} I've used Solr, and have looked at CloudSearch, ElasticSearch, Algolia, Searchify and Swiftype. These engines only...

C# implementation of Dictionary to Create an index of words

c#,visual-studio,dictionary,indexing,text-processing
I'm currently trying to create an application to do some text processing to read in a text file, then I use a dictionary to create index of words, reading a text file and checking to see if the word is already in that file or not. If so, it will...

Getting index of a certain element in a 2D numpy array

python,numpy,multidimensional-array,indexing,dynamic-arrays
I'm new to python so I need some help with this: I have 2D array of numbers that represent density of a circle of material in a space and I want to locate the centre. So I want to get the index of the numbers representing the diameter and then...

Python `dict` indexed by tuple: Getting a slice of the pie

python,dictionary,indexing,tuples
Let's say I have my_dict = { ("airport", "London"): "Heathrow", ("airport", "Tokyo"): "Narita", ("hipsters", "London"): "Soho" } What is an efficient (no scanning of all keys), yet elegant way to get all airports out of this dictionary, i.e. expected output ["Heathrow", "Narita"]. In databases that can index by tuples, it's...

Searching a TextField and IntField together seperated by an AND condition In Lucene

java,search,indexing,lucene
I have indexed my documents as: doc.add(new IntField("ID", id, Field.Store.YES)); doc.add(new TextField("First_Name", First_Name, Field.Store.YES)); doc.add(new TextField("Last_Name", Last_Name, Field.Store.YES)); doc.add(new TextField("Address", add, Field.Store.YES)); doc.add(new TextField("City", city, Field.Store.YES)); doc.add(new TextField("State", state, Field.Store.YES)); doc.add(new IntField("Zip_Code", zip, Field.Store.YES)); Where id, FirstName, city, add, state, zip are variables that store the values to be indexed....

System.ArgumentOutOfRangeException in For loop due to entry deleted from database. Help fix it

database,vb.net,for-loop,indexing
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim TimeNow As DateTime TimeNow = DateTime.Now With ReservationTableDataGridView For i As Integer = 0 To (.Rows.Count - 1) ListView1.BackColor = Color.Black Dim ToBeTested As DateTime ToBeTested = (.Rows(i).Cells(1).Value) # Console.WriteLine(ToBeTested) If ToBeTested > TimeNow.AddMinutes(45) Then Me.ReservationTableTableAdapter.Delete((.Rows(i).Cells(4).Value), (.Rows(i).Cells(1).Value), (.Rows(i).Cells(2).Value), (.Rows(i).Cells(3).Value))...

PL/SQL can't put value into index by table

table,indexing,plsql,insert,value
I can't put my value of v_emp into my emp_table. It is all going wrong at this line: emp_table(counter) := v_emp; The error that i get is: invalid use of type name of subtype name I can't see what the problem is.. CREATE OR REPLACE PROCEDURE laatste_emp IS v_emp employees%ROWTYPE;...

How to force use of indices in MongoDB?

mongodb,indexing
How could we make MongoDB report errors for queries that don't use indices? We end up creating indices for every query anyway so it would be great if MongoDB would report missing indices for us. Also it would be convenient to be able to configure the restriction on a connection...

Oracle Function Based Index: Modify a deterministic function?

oracle,indexing,plsql,deterministic
I'm using an own DETERMINISTIC function for a function based index on one of my tables. What will happen if I modify the PL/SQL-Code of this function? (located in an package) Will the Index invalides? Do I have to rebuild it (manually)? Thanks! Edit: Here is my example script, which...