I want to get the iterator for the element I'm testing for in binary-search. But it only returns a bool indicating whether it found the value or not. How to get the iterator?
I need a binary search algorithm that is compatible with the C++ STL containers, something like std::binary_search in the standard library's &lt;algorithm&gt; header, but I need it to return the iterator that points at the result, not a simple boolean telling me if the element exists.  (On a side note, what the hell was the standard committee thinking when they defined the API for binary_search?!)  My main concern here is that I need the speed of a binary search, so although I can find the data with other algorithms, as mentioned below, I want to take advantage of the fact that my data is sorted to get the benefits of a binary search, not a linear search.  so far lower_bound and upper_bound fail if the datum is missing:  //lousy pseudo code vector(1,2,3,4,6,7,8,9,0) //notice no 5 iter = lower_bound_or_upper_bound(start,end,5) iter != 5 &amp;&amp; iter !=end //not returning end as usual, instead it'll return 4 or 6   Note: I'm also fine using an algorithm that doesn't belong to the std namespace as long as its compatible with containers. Like, say, boost::binary_search.
"By" vs "Per". Which one should I use on expressions like "P&L/Geography" or "VaR/Asset"? In the finance field, it is quite common to express some measures in relation to some grouping criteria. Some groupings can be temporal (year, month, etc.) and others like greography, asset class (e.g. a financial product), strategy (used in trading), and others.   Which one is the most appropriate preposition to apply in this kind of expression ?    "VaR per asset" or "VaR by asset" "P&amp;L per strategy" or "P&amp;L by strategy".   Is there any well defined rule behind the most appropriate use ? Converting *.tif file into headerless (flat) binary file? I am using NDVI files (value range -1 to +1) created from Landsat CDR images to produce a timeseries in TIMESAT software.   My  .tif file has following characteristics.  File type  TIFF,Data Type  Double Precision, Byte Order Host (Intel), Interleave BSQ  As per the requirement of TIMESAT, the image should be headerless(flat) binary file, and values can be stored as 8 bit integer(0-255), 16 bit signed integer(-32767 to +32768) or 32 bit real.   Now i need to change my data type into any of these 3 format and .tif file into headerless binary files.   Any idea? Custom related list button is not working in partner portal I have created custom button called "New Employee" on employee object and it is related with both account and contact objects via lookup relation. If i click on "New Employee" button on employee related list under Account detail page, working fine in both salesforce classic and lightning experience but not in partner portal.  /a03/e?CF00N342300009cAB8={!Account.Name}&amp;CF00N342300009cAB8_lkid={!Account.Id}&amp;CF00N90000009cUVB={!Contact.Name}&amp;CF00N90000009cUVB_lkid={!Contact.Id}&amp;retURL={!Account.Id}   Any help on this. I have a bit of code where I've written a SOQL query that returns a list of SObject records, however I need a Set&lt;Id&gt; structure to pass to another method that I don't have control of (and thus can't change the method signature of).  How can I turn my returned List&lt;SObject&gt; into a Set&lt;Id&gt;? Is the best option just a for loop? Once a world enters hardmode, corruption and hallows being spreading at an alarming rate, including the underground. Grass, which grows on dirt, succumbs easily to both. Jungles and glowing mushrooms grow on mud and provide unique and valuable items. Will corruption/hallows destroy these if left unchecked? If they do destroy mud-based life, how can I preserve these fragile ecosystems? Let $G$ be a non-empty finite set with an associative binary operation so that cancellation law holds, i.e. $ab=ac$ or $ba=ca$ implies $b=c$, for any choices of $a,b,c$ in $G$. Assume that there is an identity element $e$ in $G$. Show that $G$ is a group.  Proof: To show $G$ is a group, conditions must hold. Suppose that $ab=ac$, then $b=eb=(a^{-1}a)b =a^{-1}(ab)=a^{-1}(ac) =(a^{-1}a)c=ec=c$. So left cancellation holds in $G$.  2) Suppose $ba=ca$, then $b=be=b(aa^{-1}) =(ba)a^{-1}=(ca)a^{-1} =c(aa^{-1})=ce=c$. So right cancellation holds in $G$.  3) If $a$ exists in $G$ then $aa^{-1}=a^{-1}a=e$, where $a$ is an inverse of $a^{-1}$. Since inverses are unique, $(a^{-1})^{-1}=a$.  4) Let $x$ be the inverse of $ab$. Then $(ab)x=e$. By associativity we have $a(bx)=aa^{-1}$. Through left cancellation we have  $bx=a^{-1}bx=ea^{-1}=b(b^{-1}a^{-1})$ and $x=b^{-1}a^{-1}$.  Thus $(ab)^{-1}=b^{-1}a^{-1}$. So all conditions hold, $G$ is a group.  Is this proof correct? I know to show $G$ is a group these conditions have to be met. This is all I have to show right? Quick way to remove solidify thickness I have made the mesh and added solidify modifier and applied. But later i thought to increase the thickness. So now i want to remove thickness so that i can added the solidify modifier again. I want to know is there any quick remove thicknes. When i select the edge then ctrl+ the selection goes downward not to single face. So i want to know a quick way to decrease thickness. Any suggestion or help. Penalized methods for categorical data: combining levels in a factor Why is the Java plugin (JRE) disabled in Chrome? Why is the Java plugin (JRE) is disabled in Chrome? It is some security concern?  From official Java website:     Chrome no longer supports NPAPI (technology required for Java applets)   The Java plug-in for web browsers relies on the cross platform plugin architecture NPAPI,   which has been supported by all major web browsers for over a decade.   Google's Chrome version 45 (scheduled for release in September 2015) drops support   for NPAPI,   impacting plugins for Silverlight, Java, Facebook Video   and other similar NPAPI based plugins.   But anyone knows why? How it could be dangerous for Chrome user with latest version of Java JRE installed? Can I rephrase the sentence "Can you explain this word to me?" into "Can you explain me this word." Formal Languages - Regular Expression I've been battling the following two questions for more than a day today.  Write a regular expression (comprised of {a, b}) that contain at least two b and do not contain abb. Write a regular expression (comprised of {a, b}) that contain abba and do not contain baa.  For the first part I wrote a basic one to start off with that doesn't handle the must two-b: b* OR a* OR (a+ AND b)* OR a*  I ran a few &quot;truth tables&quot; inputs over it and it seems ok. But the moment I add the requirement, things go haywire. Mostly because when pushing in those &quot;b&quot;s, you can suddenly use the OR to break things up. Same thing on the second one.... Any help would be greatly appreciated! Norah Anime: boy transforms into white+orange being after a terrorist attack $|G|>2$ implies $G$ has non trivial automorphism I am trying to find the splitting field of $x^6+x^3+1$ over $\mathbb{Q}$.  Finding the roots of the polynomial is easy (substituting $x^3=t$ , finding the two roots of the polynomial in $t$ and then taking a 3-rd root from each one). The roots can be seen  [if there is a more elegant way of finding the roots it will be nice to hear]  Is is true the that the splitting field is $\mathbb{Q}((-1)^\frac{1}{9})$ ? I think so from the way the roots look, but I am unsure.  Also, I am having trouble finding the minimal polynomial of $(-1)^\frac{1}{9}$, it seems that it would be a polynomial of degree 9, but of course the degree can't be more than 6...can someone please help with this ? Fisher's exact test on 2x4 table I am working on 4 different plants. I have the (RNA-Seq) data from sequencing. I look for two events E1 and E2, say, at certain positions in their genome. Let's say E2 is the common one and E1 is a special event. The positions I look for are identical across all 4 (in the genome). And let's say I see that the observation I have for 1 particular position is:      P1   P2  P3  P4 E1   0   20   0   17 E2 100   80 100  120    Here, P1 through P4 refers to plants and E1 and E2 refers to the events. E2 is more common. So, my objective is to actually check if E1 occurs more often in one or more plants than in the others. If they occur at the same proportion in all, of course it is not interesting to me.  I have 2 questions: (I have already asked  before but didn't get an answer)     Will a fisher test be right for this problem?    I hypothesize (Null) that the proportion of E1 is not different in occurrence between the 4 plants. Now, I set out to find if the proportion I have here is by any means significantly different. I use R, fisher.test() and I get p-value=2.5e-10. So, I reject my Null hypothesis for this case because I find strong evidence against it.  Sometimes, I have an observation like this,        P1   P2  P3  P4 E1   0   20   0  17 E2   0   80   0 120    then fisher.test() gives me a p-value of 0.147. So, I don't reject the Null   hypothesis. However, from a biological point of view, I would consider this significant. However fisher test answers the question I originally asked. I guess the proportion 0/0 for P1 and P3 are not useful (or not used).  So, my question is: Is it possible to modify the test such that it is sensitive even if E1 and E2 are 0 in 1 or more plants for a particular observation?     Having thought a bit to frame this post, I guess, in that case I have to ask a different question. How can I make my AES encryption identical between Java and Objective-C (iPhone)? What is the fastest way to create a 90° joint? I often want to create joints like this:    Since I end up making these more than a little, I'd like a fast way to do it (i.e. on the order of &lt; 10 seconds)  I've found a couple tools which come close to being the ideal solution, but I've had some problems with them as listed below:   When using the spin tool I usually end up having to fiddle with the location for a while in order to to get a natural curve:    Are there any techniques to expedite this process of fiddling? The bridge tool is nice because I can precisely specify where both ends of the joint will be, however I often end up with subtly uneven joints, probably due to my initial mesh being not quite square.    Is there a fast way to correctly line up the initial edge loops in a way that will result in an even joint? I have asked more than 100 questions on SO. The problem with asking so many questions is that it's sometimes very hard to navigate to the question I want.  Is there any way to improve the interface further? Totally bounded, complete $\implies$ compact I have tried as following:  1. Turn off: export DISPLAY=:0.0 &amp;&amp; xset dpms force off  2. Turn on: export DISPLAY=:0.0 &amp;&amp; xset -dpms   Which works but that is a temporary solution, which does not fix my problem yet. When i reboot system it start again and again the same auto turn off mode.   How can i now remotely using SSH turn it off forever?  IMPORTANT:  - KIOSK (ATM machine will use this option) - 24/7 advertising display/slides will use this   Optional Note: this guide i followed   , but permanent solution did not worked.