Finding specific implementation of generic interface on classpath I bumped recently (twice) at following problem - is it possible to find on classpath specific implementation of generic interface? To visualize this please consider these snippets of code:    public interface Cleaner&lt;T extends Room&gt; {} public class KitchenCleaner implements Cleaner&lt;Kitchen&gt; {} public class BathroomCleaner implements Cleaner&lt;Bathroom&gt; {}   Now - Is it possible to have a following method ?:  public static &lt;T extends Room&gt; findCleanerServiceForRoomType(T room) {     return ??? }   returning KitchenCleaner for Kitchen class and BathroomCleaner for Bathroom class? Of course I would like to have it extensible so that when new Room and Service type is added this method still works... So no switches or ifs :)
How can I get a list of all the implementations of an interface programmatically in Java? Can I do it with reflection or something like that?
How do rich people guarantee the safety of their money, when savings exceed the FDIC limit? I am curious how a millionaire would guarantee the safety of his money, given that the FDIC only insures up to $250K of an individual's deposits at a bank.  If someone had $3 million that they wanted to put into the bank, would they have to open up 12 different bank accounts and deposit $250K into each one, so that all of his money is insured by the FDIC?  Or is there an easier way to guarantee the safety of all his money? Can the system leave a deletion reason when it deletes a question? they were question banned; it turned out it (in part) it was because of deleted questions.   was deleted by the Community user.  I'm aware it will delete old posts that have a negative score, but for a minute or two, I was really puzzled as to why it was unilaterally deleted without some notation left.  Can we have the Community user leave a notation in a post's history as to why the post was deleted?    Something like the following would suffice:     Post deleted automatically due to having negative votes and no activity for three months How can I convert raster (stream segments result of a watershed analysis) to vector polylines, preferably shapefile. In ArcGIS this is easily acomplished with the Raster to Polyline tool.  I only see Polygonize (Raster to Vector) tool under the Raster -> Conversion menu. Why crontab scripts are not working? Often, crontab scripts are not executed on schedule or as expected. There are numerous reasons for that:   wrong crontab notation permissions problem environment variables   This community wiki aims to aggregate the top reasons for crontab scripts not being executed as expected. Write each reason in a separate answer.  Please include one reason per answer - details about why it's not executed - and fix(es) for that one reason.  Please write only cron-specific issues, e.g. commands that execute as expected from the shell but execute erroneously by cron. Travelling as unmarried couple in Dubai Only charge capacitor when button pushed then turn on LED momentarily with capacitor when button released I am trying to make circuit to turn on an LED momentarily. I would like to charge the capacitor when the button is pushed, then when released turn on the LED momentarily with the capacitor. Show that $y_1$ and $y_2$ are not Linearly Independent Suppose that $y_1(x)$ and $y_2(x)$ are solutions of the differential equation $y''+py'+qy=0$ on $I$. How can I show that if $y_1$ and $y_2$ vanish at the same point then they are not linearly independent?   Here is my attempt to prove the problem. Since $y_1(x)$ and $y_2(x)$ are solutions of the differential equation $y''+py'+qy=0$ on $I$, it is enough for me to show that the Wronskian of $y_1$ and $y_2$ denoted by $W(y_1,y_2)$ is zero. Now since $y_1$ and $y_2$ vanish at the same point say $p$ we have $y_1(p)=0$ and also $y_2(p)=0$.   Solving for $W(y_1,y_2)(p)$ we have: $y_1(p)y_2'(p)-y_2(p)y_1'(p)=0$ since $y_1(p)=0$ and also $y_2(p)=0$.   Am I correct? Thanks This is trigonometry from double angles and compound angles. Thus far I've simplified it up to this point. $$2 \sin^2θ – 3\sinθ +1 = 0$$  I'm trying to factorize this to solve for General Solution. I tried taking out a common but that +1 is giving me a problem. I used the quadratic equation to get 1 and 0.5 as an answer, but i don't know how to write it in terms of 2sin(squared)θ and -3sinθ.  Any help will be appreciated. Can hard drives fully utilize SATA III? My motherboard currently supports both SATA II and III (3 Gb/s and 6Gb/s respectively), but after reading some online, it seems as though connecting a HDD to the 6 Gb/s is pretty much pointless. If this is the case I'm going to leave my two SATA III ports open for something that can actually use it (which at this point I'm not really sure what can).  This is part of an article I read:     In terms of everything else, we saw basically no difference from the same single drive being plugged into a SATA 6Gb/s or SATA 3Gb/s port. All of this is obviously due to the hard drive not being able to actually take advantage of the 6Gb/s bus.   from . How do I capture the milky way? Can the milky way actually be photographed ? I know the image is manipulated, and is probably a composite, but how do you capture such contrast in the milky way? Is an equitorially mounted scope required? Any advice or pointers are welcome, thanks.  I'm heading out towards much less light polluted areas middle of next week and I want to try some nighttime sky captures with my 7D.  Additional info: I just found  on wikipedia that says: 54s, tripod mounted 5D, 16mm lens, f/2.8, ISO800. What else do I need to be aware of? My 7D is only an APS-C and the widest lens I have is 19mm. I'm thinking that might not be wide enough to capture an interesting shot? Dividing an equilateral triangle into N equal (possibly non-connected) parts It’s easy to divide an equilateral triangle into $n^2$, $2n^2$, $3n^2$ or $6n^2$ equal triangles. But can you divide an equilateral triangle into 5 congruent parts? Recently M. Patrakeev  an awesome way to do it — see the picture below (note that the parts are non-connected — but indeed are congruent, not merely having the same area). So an equilateral triangle can also be divided into $5n^2$ and $10n^2$ congruent parts.  Question. Are there any other ways to divide an equilateral triangle into congruent parts? (For example, can it be divided into 7 congruent parts?) Or in the opposite direction: can you prove that an equilateral triangle can’t be divided into $N$ congruent parts for some $N$?                                               (Naturally, I’ve tried to find something in the spirit of the example above for some time — but to no avail. Maybe someone can find an example using computer search?..) I’d prefer to use finite unions of polygons as ‘parts’ and different parts are allowed to have common boundary points. But if you have an example with more general ‘parts’ — that also would be interesting. How can I see my progress for different badges? How to find required information in man The man command brings up a nice manual for many programs, but how can I use it more effectively? For example man gcc brings:  NAME        gcc - GNU project C and C++ compiler  SYNOPSIS        gcc [-c|-S|-E] [-std=standard]            [-g] [-pg] [-Olevel]            [-Wwarn...] [-Wpedantic]            [-Idir...] [-Ldir...]            [-Dmacro[=defn]...] [-Umacro]            [-foption...] [-mmachine-option...]            [-o outfile] [@file] infile...         Only the most useful options are listed here; see below for the        remainder.  g++ accepts mostly the same options as gcc. .... many text   But what if I need only some part of it? What is the best way to jump to the section where -Idir is described, for example? It has been discussed before, but in light of some of the , I can't help but wonder what is accomplished by displaying the author of a given question or answer.  There is a , but if anything, I don't think it goes far enough.  If questions and answers are supposed to stand on their own merit, why do we need to show the author at all?  I'm not proposing any change to the way rep works; rep should still be accrued and abilities gained.  The only difference is that questions and answers would appear anonymous.  Does this better reflect the goals of SO?  If so, how far do you think the anonymity should be taken?  If not, what shortcomings am I missing? How to down-weight older data in time series regression In a regression fit of vectors varying with time $t$ $\qquad y \sim [x_t\ x_{t-1}\ x_{t-2}\ ...] \cdot [c_t\ c_{t-1}\ c_{t-2} \ ...] $ , how can one down-weight the older $x_t$ to model "older is less relevant" (than the regression gives) ? Say that rows in data matrix $X$ are observables (stocks, market segments ...) and columns are times. Correct me,   weights rows; how does one weight columns, times ?  Added: Down-weighting older data in time series looks complex, much more so than linear least squares with i.i.d. errors in rows (observations) -- just divide through by $\sigma_i$; or classification  with i.i.d. errors in columns (e.g. features) -- just centre each column. Can anyone say either   yes, I downweight time series; here are some examples on the web no: down-weighting time series is complex, not for novices.   (  discussed this question 10 years ago, mentioning Kalman filters and hierarchical Bayes, but with no examples.) I want to better understand why the construction something + [adjective] makes grammatical sense. Background: I was recently reading a Washington Post article and came across the following sentence.  So if you fall in that category, [the movie] feels more like magic than repetitive.  (Note: I've copied the relevant spoiler-free sentence above; following the link to the article will open you up to movie spoilers! ) The phrase more like magic than repetitive struck me as odd, presumably because it was non-parallel (more like [noun] than [adjective]). I would have expected &quot;...more like magic than something repetitive.&quot; (Actually, that needs to be rewritten to flow better, but the point is that at least it appears to be grammatical.) Thus, one would have the noun phrase &quot;something repetitive,&quot; of the form &quot;[noun] [adjective].&quot; This got me to thinking about the use of adjectives after nouns. There is a great Stack Exchange article  that involves the characteristics of the adjective that indicate it should come after the noun. But I haven't been able to find examples of how the word &quot;something&quot; requires a postponed adjective. Consider the following sentences:  I want to buy something red. I am looking for something sweet to eat.  You cannot say:  *I want to buy red something. *I am looking for sweet something to eat.  But you can say:  I want to buy something (that is) red. I am looking for something (that is) sweet to eat.  So, my question:  Do the above examples mean that the &quot;something [adjective]&quot; construction is an example of the ellipsis of &quot;that is&quot;?  Is there something special about the word &quot;something&quot; that requires the postponed adjective? Note that I am NOT looking for details about adjectives that are postponed; I'm interested in the word that precedes the adjective (either &quot;something&quot; or similar words).   By the way, I am not interested in the following constructions, which are different:  I want to paint the house red. I tried to build the brick house taller.  Thanks in advance! This problem comes from another equation on another question (. I tried to split it in half but I found out that $$\sum_{k=0}^\infty \frac{k}{2^k}$$ can't be divided. Knowing that $$\sum_{k=0}^\infty x^k=\frac{1}{1-x}$$ I wrote that $$\sum_{k=0}^\infty \frac{k}{2^k}=\sum_{k=0}^\infty \left(\frac{\sqrt[k] k}{2}\right)^k=\frac{1}{1-\frac{\sqrt k}{2}}=\frac{2}{2-\sqrt[k] k}$$ But that's not what I wanted. Could anyone help me? How do I install a .tar.gz (or .tar.bz2) file? How to rank a million images with a crowdsourced sort I'd like to rank a collection of landscape images by making a game whereby site visitors can rate them, in order to find out which images people find the  most appealing.  What would be a good method of doing that?   Hot-or-Not style? I.e. show a single image, ask the user to rank it from 1-10. As I see it, this allows me to average the scores, and I would just need to ensure that I get an even distribution of votes across all the images. Fairly simple to implement. Pick A-or-B? I.e. show two images, ask user to pick the better one. This is appealing as there is no numerical ranking, it's just a comparison. But how would I implement it? My first thought was to do it as a quicksort, with the comparison operations being provided by humans, and once completed, simply repeat the sort ad-infinitum.   How would you do it?  If you need numbers, I'm talking about one million images, on a site with 20,000 daily visits. I'd imagine a small proportion might play the game, for the sake of argument, lets say I can generate 2,000 human sort operations a day! It's a non-profit website, and the terminally curious will find it through my profile :) There are several ways to execute a script. The ones I know are: /path/to/script # using the path (absolute or relative) . script        # using the . (dot) source script   # using the `source` command  Are there any other way? What are the differences between them? Are there situations that I must use one and not another?