Get index of next same character
Get the index of the nth occurrence of a string?
Add different materials to different parts of a mesh? How do you add more than one material to a mesh?   I have tried adding two materials to the object, and then assigning one of the materials to a vertex-group, but I could not find a place to assign it.  I am making a striped bouncy ball that I want to deform, so adding a different material by separating the mesh into different objects would not be ideal. How to create a Wi-Fi Hotspot (in Access Point mode)? How to setup an Access Point (AP) mode Wi-Fi Hotspot?  Point to be noted: Wireless access points aren't the same as ad hoc networks. They differ significantly. In short, ad hoc networks aren't supported on newer devices and most Android, Windows Phone and Blackberry devices (and maybe iOS devices too), whereas AP mode Wi-Fi hotspots are. To get an idea about AP mode hotspots, ad hoc networks and their difference, refer to . For $n\geq 3$ there exist $x,y\in S_n$ such that $x$ and $y$ have order $2$ and $xy$ has order $n$. Assume that $n\geq 3$. Let $S_n$ be the symmetric group with $n!$ elements. Prove that there exists $x$ and $y$ in $S_n$ such that $x$ and $y$ have order $2$ and $xy$ has order $n$.  For $n=3$, it is easy to see that $x=(1, 2)$ and $y=(1, 3)$ works. How to prove it for the general case? I was wondering what is the purpose of piping the downloaded file by curl into sudo -E bash - in the following shell:   curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - The situation is as below:  -------|----------------------------        |  stump |batsmen2   broken|batsmen1  here  |  -------|----------------------------   Is it a runout in the above situation? Probability that no two consecutive heads occur? A fair coin is tossed $10$ times. What is the probability that no two   consecutive tosses are heads?   Possibilities are (dont mind the number of terms):  $H TTTTTTH$, $HTHTHTHTHTHTHT$.  But except for those,  let $y(n)$ be the number of sequences that start with $T$  $T _$, there are two options, $T$ and $H$ so,  $y(n) = y(n - 1) + x(n-1) = y(n - 1) + y(n - 2)$  Let $x(n)$ be the number of sequences that start with $H$,   $H _$ the next option is only $T$ hence,  $x(n) = y(n - 1)$   The total number of sequences $F(n)$ is:  $$F(n) = y(n) + x(n) = 2y(n - 1) + y(n - 2)$$  We are after $F(10)$,  $$F(10) = 2y(9) + y(8)$$  $$F(3) = 2y(2) + y(1) = 1 + 4 = 5$$  $$F(4) = 2y(3) + y(2) = 6 + 2 = 8$$  But I'm not quite sure where this will take me though. Attacks of the MAC construction $\mathcal{H}(m\mathbin\|k)$ for common hashes $\mathcal{H}$? Consider a common practically-collision-resistant hash function $\mathcal{H}$ (e.g. , , , ), perhaps based on the  as are the first three. We define a  $\mathcal{C}$ $$(k,m) \mapsto \mathcal{C}(k,m)=\mathcal{H}(m\mathbin\|k)$$ where $\mathbin\|$ denotes concatenation, $k$ is a secret key (constant, or at least of fixed size), and $m$ is a message (possibly of variable length). Assume that an adversary can (iteratively) submit queries with $m_j$ and obtain $C(k,m_j)$, and wants to obtain $k$ or otherwise compute $C(k,m)$ for some $m\ne m_j$.  That MAC $\mathcal{C}$ is not trivially bad. In particular, if $\mathcal{H}$ was indistinguishable from a random function in the , $\mathcal{C}$ would be secure. And even though $\mathcal{H}$ may have the , it does not turn into a devastating attack on $\mathcal{C}$.  The less impractical generic attack that I see is that if a collision was known for $\mathcal{H}$ with the colliding messages of moderate identical length, it could be deduced countless collisions for $\mathcal{C}$. Hence security is demonstrably not better than collision-resistance of $\mathcal{H}$ (for identical-length messages). We could assume that $k$ is half the size of the result of $\mathcal{H}$, and hope that the security is about  or  or , 280, 2128, 2256 hash rounds for SHA-1, RIPEMD-160, SHA-256, SHA-512.   What are the known attacks against $\mathcal{C}$ (better than the above), and their cost, for each of these common hashes?  Is there hope for an argument that an attack against $\mathcal{C}$ would turn into an attack of similar cost against $\mathcal{H}$, or hint of the contrary?  Update: this  is of interest, but I fail to find that it really answers the present question.  Update 2: I am aware that the construction considered is weaker than , and in particular is vulnerable to collision on $\mathcal H$; I stated that, and that it is thus pointless to have the key wider hopeless to target security against some attacks better than half the hash's size. I'm asking exactly what cryptanalytic attack better than finding a collision on $\mathcal H$ there are. There is room for such an attack only by exploiting a weakness in the structure or/and the round function of a concrete $\mathcal H$. I want to do something like:  MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone();   And then make changes to the new object that are not reflected in the original object.  I don't often need this functionality, so when it's been necessary, I've resorted to creating a new object and then copying each property individually, but it always leaves me with the feeling that there is a better or more elegant way of handling the situation.  How can I clone or deep copy an object so that the cloned object can be modified without any changes being reflected in the original object? I have a large set of data points of the form (mean, stdev). I wish to reduce this to a single (better) mean, and a (hopefully) smaller standard deviation.  Clearly I could simply compute $\frac{\sum data_{mean}}{N}$, however this does not take in to account the fact that some of the data points are significantly more accurate than others.  To put it simply, I wish to preform a weighted average of these data points, but do not know what the weighting function should be in terms of the standard deviation. Can I load a 32 bit DLL into a 64 bit process on Windows? Should I use "or" or "nor" in the following case? I wasn't forcing myself to say anything, or/nor trying to be funny.   "Or" sounds more grammatically correct to me. But "nor" has more Google results. So I'm confused. Why do I have the "required reviews completed" status on my submission in Elsevier? I had submitted my paper in an Elsevier journal one year back. Now, status update on the submission tracking says "Required reviews completed." However, for the last two weeks still there is no change in the status.  Should I ask the editor what is going on with my submission? If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it,  what is the most efficient way of going through the map?  Will the ordering of elements depend on the specific map implementation that I have for the interface? Is a DNA molecule a single strand of polynucleotide or two of them linked together? Our molecular biology teacher told us that a double helix of DNA was composed of two DNA molecules linked together by hydrogen bonds. The thing is, until now, I always thought a DNA molecule was composed of two strands, those being polynucleotides, both of them being linked together. I can't find a link which is saying the same as my teacher, even if it seems technically correct to call a double helix a dimer of two DNA molecules.  I was curious to know what was the exact terminology. How do I make my textures show in cycles? I am admittedly new to Blender, and of course cycles. I am working on a scene and I have textures set to my objects that render with internal engine just fine. However, when I go into cycles, everything is greyish. I have two light sources that should be sufficient (I think), I just don't know what I'm doing wrong. This is a screenshot of the cycles result. Problems with booting the system I have yesterday updated packages and today the system cannot boot properly. After seeing the Kubuntu logo there is a black screen which shows repeatedly.     Stopped User Manager for UID 121.      Removed slice User Slice of gdm.      Created slice User Slice of gdm.       Starting User Manager for UID 121...      Started Session c3 of user gdm.       Started User Manager for UID 121.   Please see the screenshot below Why Re-throw Exceptions? I've seen the following code many times:  try {     ... // some code } catch (Exception ex) {     ... // Do something     throw new CustomException(ex);      // or     // throw;      // or     // throw ex; }   Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best practice in exception handling? (I've read somewhere that it's called "Caller Inform" pattern?) What size should the HMAC key be with SHA-256? I'm trying to generate a secret key to be used for HMAC SHA-256 signature processing. I've seen many sample of keys with variable length from 32 characters to 96 characters.  What is the ironclad rule for this key size? Disabling IPv6 on Mint and Debian How does one disable IPv6 completely (for all interfaces, resp. for the whole machine?  Keep in mind, I don't want any kind of GUI solution.    OS in question:   Linux Mint 18.x Cinnamon 64-bit GNU/Linux Debian 9.x Cinnamon 64-bit What's the difference between adjusting highlights and shadows in the basic panel and in the tone curve in the Develop Module of Lightroom? I wanted to reduce some highlights in a photo and found that there were two possible ways of doing so: one from the basic panel and another from the tone curve. when I reduce the highlights in one pane the value on the other is unchanged. Are both of them the same thing? Which would be better?