When using the "in" operator to check whether an element exist in a numpy array, is there any way to also get the index of that element? Thank you
Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python?
Ksplice is an amazing software (or whatever it is). It changes the way kernel updates work: Instead of rebooting after an update, it patches memory, so you don't need to do anything. Mutual set of representatives for left and right cosets: what about infinite groups? Let $G$ be a group and $H$ a subgroup of $G$. If $G$ is finite, then according to Philip Hall's "marriage theorem" there is a left transversal $T$ of $H$ in $G$ (that is, $T$ contains precisely one element from each left coset of $H$) such that $T$ is also a right transversal of $H$.   Does this theorem generalize to infinite groups? The original theorem treats only the case where $|H| &lt; \infty$ and $[G:H] &lt; \infty$.  What can we say when $|H| = \infty$ and $[G:H] = \infty$? What about $|H| &lt; \infty$ and $[G:H] = \infty$? Also $|H| = \infty$ and $[G:H] &lt; \infty$? Is every dense subspace of a separable space separable? Comparing SVM and logistic regression Can someone please give me some intuition as to when to choose either SVM or LR? I want to understand the intuition behind what is the difference between the optimization criteria of learning the hyperplane of the two, where the respective aims are as follows:     SVM: Try to maximize the margin between the closest support vectors LR: Maximize the posterior class probability    Let's consider the linear feature space for both SVM and LR.  Some differences I know of already:   SVM is deterministic (but we can use Platts model for probability score) while LR is probabilistic. For the kernel space, SVM is faster (stores just support vectors) Commas with "so" I am confused with the usage of so.  Consider some examples from Oxford and Meriam-webster        It was still painful so I went to see a doctor (Oxford).   We were bored with the movie, so we left (MW).   There are no more chairs available, so you'll have to stand (MW).      So is a conjunction in all the above sentences. But I don't understand when to place a comma before it. So is one of FANBOYS. Thus, we have use a comma when it connects two independent clauses, which I think contradict the first sentence.  Is the placement of comma before so depends on a style guide? For example, Americans prefer a comma while the British doesn't. Change \headheight for a \pagestyle Is there a Pythonic way to have only one instance of a program running?   The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this?    (Take into consideration that program is expected to fail sometimes, i.e. segfault - so things like "lock file" won't work) How did Luke know where to land on Dagobah? Cleaning unwanted overlapping duplicate meshes I have a model with hundreds of mesh objects. Unfortunately I clicked shift+D to duplicate many and did not notice. Later after working a while, I was rendering, and noticed there are double meshes overlapping each other.   How can I find all duplicate meshes and delete them. I could do it manually,  just clicking,  but it would take a long time and if I miss something i will not notice.   Is there any option,  or can anybody suggest to me,  how can I find all duplicate mesh and delete them.  Model with all double (duplicate) mesh  Final Result Show that $\int_0^\pi f(\sin x)\,\mathrm{d}x = 2\int_0^{\pi/2}f(\sin x) \, \mathrm{d}x$ Best practices for storing UI settings? we're currently planning a larger WPF LoB application and i wonder what others think being the best practice for storing lots of UI settings e.g.   Expander States Menu orders Sizing Properties etc...   i don't like the idea of having dozens of stored values using the delivered SettingsProvider (i.e. App.config file) although it can be used to store it in an embedded database using a custom SettingsProvider. being able to use some kind of databinding is also a concern. Has anyone had the same problems?   What did you do to store lots of ui user settings? The computed moments of log normal distribution can be found . How to compute them? Topological Circuit Simulator Does something like  exist for topological (eg. braided) circuits?   Alternatively, any ideas on how @ is getting  (or something similar)? Is it possible to obtain AES-128 key from a known ciphertext-plaintext pair? I have a file, which was encrypted with AES-128 in ECB mode. I know the format of the original file and know that all files in this format have the same headers. So, I have an encrypted block and the original block.  Can I get the encryption key, using this information? Scale Image Using PHP and Maintaining Aspect Ratio I've just installed MariaDb on a fresh Ubuntu Gnome and ran  afterwards where I set a decent admin password, removed the anonymous user etc.  Afterwards I realized some strange behavior regarding the admin password:   If I try to login from my normal user account using the command mysql -u root -p I always get an error: ERROR 1698 (28000): Access denied for user 'root'@'localhost' I'm pretty sure I entered the correct password which I set with  earlier... When I run the command from root using sudo mysql -u root -p, I always get access to the database, no matter which password I actually enter...   Is this normal behavior, am I doing anything wrong or have I somehow screwed up the installation? Midpoint-Convex and Continuous Implies Convex Printing pointers in C I was trying to understand something with pointers, so I wrote this code:  #include &lt;stdio.h&gt;  int main(void) {     char s[] = "asd";     char **p = &amp;s;      printf("The value of s is: %p\n", s);     printf("The direction of s is: %p\n", &amp;s);      printf("The value of p is: %p\n", p);     printf("The direction of p is: %p\n", &amp;p);      printf("The direction of s[0] is: %p\n", &amp;s[0]);     printf("The direction of s[1] is: %p\n", &amp;s[1]);     printf("The direction of s[2] is: %p\n", &amp;s[2]);      return 0; }   When compiling it with gcc I get these warnings:  $ gcc main.c -o main-bin -ansi -pedantic -Wall -lm main.c: In function ‘main’: main.c:6: warning: initialization from incompatible pointer type main.c:9: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char (*)[4]’ main.c:11: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char **’ main.c:12: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char ***’   (The flags for gcc are because I must be C89)  Why incompatible types of pointer? Isn't the name of an array a pointer to it's first element? So if s is a pointer to 'a', &amp;s must be a char **, no? And why do I get the other warnings? Do I have to cast the pointers with (void *) in order to print them?   And when running I get something like this:  $ ./main-bin The value of s is: 0xbfb7c860 The direction of s is: 0xbfb7c860 The value of p is: 0xbfb7c860 The direction of p is: 0xbfb7c85c The direction of s[0] is: 0xbfb7c860 The direction of s[1] is: 0xbfb7c861 The direction of s[2] is: 0xbfb7c862   How can the value of s and it's direction (and of course the value of p) be the same? Explanation of finite population correction factor? I understand that when sampling from a finite population and our sample size is more than 5% of the population, we need to make a correction on the sample's mean and standard error using this formula:  $\hspace{10mm} FPC=\sqrt{\frac{N-n}{N-1}}$  Where $N$ is the population size and $n$ is the sample size.  I have 3 questions about this formula:   Why is the threshold set at 5%? How was the formula derived? Are there other online resources that comprehensively explain this formula besides  paper? How do I disable X at boot time so that the system boots in text mode?