indexing

Finding smallest next bigger element

核能气质少年 提交于 2019-12-19 04:37:35
问题 I have a task which requires me to find the smallest of all bigger elements in an array for all array entries and store the respective indexes in an array and I can't quite figure out the last part of the solution. This is kind of similar to the problem explained here: https://www.geeksforgeeks.org/smallest-greater-elements-in-whole-array/ The only difference is that only the values right of the array entry are accounted for (j>i), e.g.: input: [80; 19; 49; 45; 65; 71; 76; 28; 68; 66] output:

Get index of array of objects via jquery

倖福魔咒の 提交于 2019-12-19 04:25:46
问题 I have the following array: var = array[ {"id" : "aa", "description" : "some description"}, {"id" : "bb", "description" : "some more description"}, {"id" : "cc", "description" : "a lot of description"}] and I try to find the index of the array that contains the id === "bb" . The solution I came up with is the following: var i = 0; while(array[i].id != "bb"){ i++; } alert(i) //returns 1 Is there an easier way that has cross-browser functionality? I tried $.inArray(id,array) but it doesn't work

SUMIF dynamically change summing column

余生长醉 提交于 2019-12-19 04:15:21
问题 I am using SUMIFS and want the sum_range dynamically to change according to the name I have of a column. I have a table with about 100 columns. Say one of these columns is Paid_BC_items . I want a formula that looks for which column Paid_BC_items is in and somehow insert that into the SUMIF here where the Sheet4!J:J part is. I have a few other criteria here too which are fixed so they don't need to be dynamic. =SUMIFS(Sheet4!J:J,Sheet4!$C:$C,Sheet2!$D$3,Sheet4!$E:$E, Sheet2!$C6, Sheet4!$G:$G,

Cursor Index Out of Bounds Exception

你离开我真会死。 提交于 2019-12-19 04:12:57
问题 In attempting to execute a query on my database, I get this exception. However, the documentation states that the method SQLiteDatabase.query(...) returns, "A Cursor object, which is positioned before the first entry," which I interpret to mean that the Cursor is at the start of the rows returned. If I add the Cursor.moveToFirst() before accessing data in the Cursor, I get no exception. What is going on? Do I need to always call "moveToFirst" before trying to get data? The documentation says

Speed up MongoDB aggregation

风流意气都作罢 提交于 2019-12-19 04:09:50
问题 I have a sharded collection "my_collection" with the following structure: { "CREATED_DATE" : ISODate(...), "MESSAGE" : "Test Message", "LOG_TYPE": "EVENT" } The mongoDB environment is sharded with 2 shards. The above collection is sharded using Hashed shard key on LOG_TYPE. There are 7 more other possibilities for LOG_TYPE attribute. I have 1 million documents in "my_collection" and I am trying to find the count of documents based on the LOG_TYPE using the following query: db.my_collection

Multiple Indexes in same Solr Core..?

筅森魡賤 提交于 2019-12-19 04:07:58
问题 I am using Apache Solr..I have the following Scenario.. : I have Two table in my PostGreSQL database. One is " Cars ". Other is " Dealers " Now i have a data-config file for Cars like the following : <document name="offerings"> <entity name="jc_offerings" query="select * from jc_offerings" > <field column="id" name="id" /> <field column="name" name="name" /> <field column="display_name" name="display_name" /> <field column="extra" name="extra" /> </entity> </document> I have a similar data-

Get each <li> index number with jQuery

跟風遠走 提交于 2019-12-19 03:43:13
问题 I'm trying to get the index number of few <li> 's. The li's are 8 and I'm trying to get each li's number. On each li click I do this function: var str = $('#amastorage li').index(); alert(str); Which always give's me 8. EDIT: This is how I get it: $("#amastorage ul").find('a').click(function () { var str = $('#amastorage li').index(); alert(str); }); I cant change: $("#amastorage ul").find('a').click(function () { because It's from a plugin and it won't work. Thanks How can I alert the li

MySQL: comparison of integer value and string field with index

孤者浪人 提交于 2019-12-19 02:37:10
问题 Table a_table has index on string_column . I have a query: SELECT * FROM a_table WHERE string_column = 10; I used EXPLAIN to find that no indexes are used. Why? Could you help me with MySQL documentation link? Updated: Sandbox (SQL Fiddle) 回答1: The essential point is that the index cannot be used if the database has to do a conversion on the table-side of the comparison. Besides that, the DB always coverts Strings -> Numbers because this is the deterministic way (otherwise 1 could be

Alter Non Clustered Index in SQL Server to Add more included columns

让人想犯罪 __ 提交于 2019-12-18 21:53:29
问题 Is it possible to alter an existing non clustered index to include more columns as a part of Covered columns. e.g. ALTER INDEX IX_NC_TableName_ColumnName FOR TableName(ColumnName) INCLUDE(Col1, Col2, Col3) Want to include Col4 in above index. What will be the impact of adding this column? Will there be fragmentation or anything else? 回答1: The cost of an additional included column will be increased storage and potentially fragmentation. Fragmentation will increase slightly compared to the old

Subfolder directory browsing in Apache2

邮差的信 提交于 2019-12-18 21:27:13
问题 Got a folder at http://myserver/folder/, I have disabled directory browsing for that folder. But I want to enable directory browsing for the subfolders of http://myserver/folder/ How can I do this?? Thanks. 回答1: here's a working simple solution: <Directory /path/to/docroot/folder> Options -Indexes </Directory> <DirectoryMatch /path/to/docroot/folder/(.)*/> Options +Indexes </DirectoryMatch> 回答2: If you do not control apache, you can do this in a per-directory basis in your own files adding