Get index of selected option with jQuery

I’m a little bit confused about how to get an index of a selected option from a HTML <select> item. On this page there are two methods described. However, both are always returning -1. Here is my jQuery code: $(document).ready(function(){ $(“#dropDownMenuKategorie”).change(function(){ alert($(“#dropDownMenuKategorie option:selected”).index()); alert($(“select[name=”dropDownMenuKategorie”] option:selected”).index()); }); }); and in html (…) <select id=”dropDownMenuKategorie”> <option value=”gastronomie”>Gastronomie</option> … Read more

Why does PostgreSQL perform sequential scan on indexed column?

Very simple example – one table, one index, one query: CREATE TABLE book ( id bigserial NOT NULL, “year” integer, — other columns… ); CREATE INDEX book_year_idx ON book (year) EXPLAIN SELECT * FROM book b WHERE b.year > 2009 gives me: Seq Scan on book b (cost=0.00..25663.80 rows=105425 width=622) Filter: (year > 2009) Why … Read more

How important is the order of columns in indexes?

I’ve heard that you should put columns that will be the most selective at the beginning of the index declaration. Example: CREATE NONCLUSTERED INDEX MyINDX on Table1 ( MostSelective, SecondMost, Least ) First off, is what I’m saying correct? If so, am i likely to see large differences in performance by rearranging the order of … Read more

pandas loc vs. iloc vs. at vs. iat?

Recently began branching out from my safe place (R) into Python and and am a bit confused by the cell localization/selection in Pandas. I’ve read the documentation but I’m struggling to understand the practical implications of the various localization/selection options. Is there a reason why I should ever use .loc or .iloc over at, and … Read more

SQL Server Index Naming Conventions [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Postgres unique constraint vs index

As I can understand documentation the following definitions are equivalent: create table foo ( id serial primary key, code integer, label text, constraint foo_uq unique (code, label)); create table foo ( id serial primary key, code integer, label text); create unique index foo_idx on foo using btree (code, label); However, a note in the manual … Read more