indexing

PHP Undefined Index When Checking Cookie Value And Cookie Exists

馋奶兔 提交于 2019-12-25 02:49:06
问题 I know to check for the existence of a cookie before I try to use it, but in this case If I set a cookie and then try to use it immediately afterwards without checking, the code works, however I get an "undefined index" warning in my php.log. The code below determines if the device is a computer or mobile and sets a cookie. It then checks the cookie value and if a mobile it redirects to a page. (If not, it will output a page and then show the content within a frame). <?php // Determine if

Extract items from array: between given values/conditions

我的未来我决定 提交于 2019-12-25 02:43:13
问题 I have a number of timeseries data in arrays and wish to extract values between given dates in the simplest way possible avoiding loops. Here's an example: from numpy import * from datetime import * # datetime array date_a=array([ datetime(2000,1,1), datetime(2000,1,2), datetime(2000,1,3), datetime(2000,1,4), datetime(2000,1,5), ]) # item array, indices corresponding to datetime array item_a=array([1,2,3,4,5]) # extract items in a certain date range # after a certain date, works fine item_b

R - check elements of vector against other vector

£可爱£侵袭症+ 提交于 2019-12-25 02:25:09
问题 I would like to match the elements of a column in a dataframe against another dataframe. Consider these dataframes: A=data.frame(par=c('long A story','long C story', 'blabla D'),val=1:3) B=data.frame(par=c('Z','D','A'),val=letters[1:3]) Each element of B column 'par' should be matched against A column par. If there is a match, it should be labeled in A. [This then gives a column of common values for merging A and B]. The desired result is therefore: A=transform(A,label=c('A','NA','D')) How

Alternatives to GUID for clustered index

好久不见. 提交于 2019-12-25 01:46:40
问题 I have the following situation: I'm creating a database that will work locally, but can be migrate to a online database that have the same schema and will already have some data. For this reason, I'm planning to use GUIDs as the primary keys for it's tables, as it will make migrations easier by avoiding the need to change primary key values (and cascading it to referencing tables) that would occur if I use any identity column (am I right?). The database is build on SQL Server 2012. Despite

Perform sort on field that's not primary index

隐身守侯 提交于 2019-12-25 01:19:44
问题 Error: No index exists for this sort, try indexing by the sort fields. I've tried creating indexes on anotherValue , _id+anotherValue , but no difference. This is my query: { "selector": { "_id": { "$gt": null }, "$or": [ { "_id": "10" }, { "value": "10", "anotherValue": "1234" }] }, "sort": [{"anotherValue": "desc"}] } Indexes setup: Your available Indexes: special: _id 回答1: Try adding a desc index on anotherValue: { "index": { "fields": [ {"anotherValue":"desc"} ] }, "type": "json" } and

What is the best way to index data on elasticsearch?

我怕爱的太早我们不能终老 提交于 2019-12-25 01:18:47
问题 I have 4 tables: country state city address These tables are related by ids where country is the top parent: state.countryId city.stateId address.cityId I want to integrate elastic search on my application and want to know what is the best way to index these table? Should i create 1 index for each tables so that i have 1 index for each of country, state, city and address? Or should i denormalize the tables and create only 1 index and store all the data with redundancy? 回答1: ES is not afraid

Mongodb compound indexes for filtering and sorting on BIG collection

∥☆過路亽.° 提交于 2019-12-25 01:11:01
问题 Can somebody tell me please if is possible to make indexes in Mongodb more efficient in this case: I have database with 50 millions items. There are two indexes on fields "ico" and "publishDate". Ico is used for filtering and publishDate for sorting . Is it possible to make it like a compound index to be more efficient? Can I combine filtering and sorting in compound index? Is important to choose which one should be the first in index definition? It is little complicated cause I have not the

How do you create an Array<octave_idx_type> in an .oct file?

我怕爱的太早我们不能终老 提交于 2019-12-25 01:08:34
问题 I'd like to use the Array octave_idx_type as an index vector to insert a matrix into an NDArray ( see stackoverflow thread here ) as in A.insert( B , Array<octave_idx_type> ) ; where the array A is 3-dimensional. I know that I can use A.insert( B , 0 , 0 ) ; to insert into the first "page" but it is important that I be able to insert into the other pages of A in a loop, presumably by changing the idx_vector values for the page once in each loop. How do I create this idx_type array? 回答1: Hava

Syntax error when attempting to amend a string with indexing

风流意气都作罢 提交于 2019-12-25 00:34:16
问题 I'm studying APL from here. Why am I getting this syntax error? 'computer' [ 1 2 3 ] ← 'COM' SYNTAX ERROR 'computer'[1 2 3]←'COM' ^ But if I save 'computer' in a variable I don't get the error: T ← 'computer' T computer T[1 2 3] ← 'COM' T COMputer What am I doing wrong? 回答1: 'computer' is a constant, and you can't change the value of a constant itself, only the current value of a variable. Think about it: If you could assign to 'computer' , then next time you wrote 'computer' , would you

How do you create an Array<octave_idx_type> in an .oct file?

走远了吗. 提交于 2019-12-25 00:34:08
问题 I'd like to use the Array octave_idx_type as an index vector to insert a matrix into an NDArray ( see stackoverflow thread here ) as in A.insert( B , Array<octave_idx_type> ) ; where the array A is 3-dimensional. I know that I can use A.insert( B , 0 , 0 ) ; to insert into the first "page" but it is important that I be able to insert into the other pages of A in a loop, presumably by changing the idx_vector values for the page once in each loop. How do I create this idx_type array? 回答1: Hava