Hello I am trying to move a group of directories with the mv command and curly braces expansion as follows:   #!/bin/bash ... group_name=$1 group=$((total/set)) group=$((group-1)) mkdir "$group_name""1"  mv dat{10.."$group"} "$group_name""1" ...   The function is used as follows:  grouping_dirs total set group_name  e.g: grouping_dirs 30 2 dir_name    And the list of directories I have are:  dat10 dat11 dat12 dat13 dat14 dat15 and so on.   But I want to move only the directories dat{10..14} to dir_name1.  However I get the following error:  mv: cannot stat 'dat{10..14}': No such file or directory  Even though the directories exists. I know that because I tried changing:  mv dat{10.."$group"} ... to mv dat{10..14} ...    And it worked. I think I am not correctly using " " within the curly braces, but I am rather new to bash scripting...So I would appreciate your insight! Thanks!
I want to use $var in a shell brace expansion with a range, in bash. Simply putting {$var1..$var2} doesn't work, so I went "lateral"...   The following works, but it's a bit kludgey.    # remove the split files echo rm foo.{$ext0..$extN} rm-segments &gt; rm-segments source rm-segments   Is there a more "normal" way?
How would one write object-oriented code in C? What are some ways to write object-oriented code in C? Especially with regard to polymorphism.    See also this Stack Overflow question . How to set the default program for opening files without an extension in Windows? How to set the default program for opening files without an extension in Windows? Euler's equations of rigid body motion from least action principle I would like to derive Euler's equations of rigid body motion from least action principle.   Suppose we are in free space so we have no gravity so Lagrangian is equal to kinetic energy.   $$ L = T = \int_M \rho(x)(x\cdot \Omega_B)^2 d^3x $$  where $\rho$ is density, $\Omega_B$ is angular velocity bivector in reference body frame and $M$ is the rigid body.  The action principle says(if I haven't messed up something) that   $$ 0 = \frac{d}{ds}\bigg|_{s=0}\int_0^T \int_M \rho(x)[x\cdot (\Omega_B(t)+s \delta \Omega(t))]^2 d^3x $$  for every $\delta \Omega$ with zero ends i.e. $\delta \Omega(0)=\delta \Omega(T) = 0$. I should get these equations:  $$ I(\Omega_B) - \Omega \times I(\Omega_B)=0 $$  where  $$ I(\Omega) = \int_M \rho(x) (x\wedge (x\cdot \Omega)) d^3x. $$  But I can't see where I would get the time derivative of $\Omega_B$ from the action principle. Can someone tell me what I'm doing wrong? I guess there is some trouble with that $\delta \Omega$ can't be completely arbitrary. How do I declare and initialize an array in Java? How can I find my Apple ID on my iPad? My mum can't find her apple ID on her iPad. I'm not with her at the moment and do not have an iPad so I don't know where to look.  She already has an Apple ID set up on this iPad, so I don't want to set up another one. Help us find duplicates efficiently After installing Telegram Desktop on Ubuntu 16.04 by these commands:  sudo add-apt-repository ppa:atareao/telegram sudo apt-get update sudo apt-get install telegram   I get this error:  $ telegram telegram: Panic - Unable to find your tty (pts/2) in /var/run/utmp How to solve ~(P → Q) : P & ~Q by natural deduction? I'm trying to solve the following by natural deduction:  ~(P → Q) : P &amp; ~Q  It's a trivial problem if identities are used, as can be seen by the following:   {1}      1.   ~(P → Q)                    Prem. {1}      2.   ~(~P ∨ Q)                   1 Mat. Impl. {1}      3.   ~~P & ~Q                    2 De Morgan's {1}      4.   P & ~Q                      3 DNE   Starting from step 2 of the previous proof, it's also fairly straightforward to reach a conclusion using natural deduction; i.e. starting from ~(~P ∨ Q), which is an identity of ~(P → Q):  ~(~P ∨ Q) :  P &amp; ~Q   {1}      1.   ~(~P ∨ Q)                   Prem. {2}      2.   ~P                          Assum. {2}      3.   ~P ∨ Q                      2 ∨I {1,2}    4.   ~(~P ∨ Q) & (~P ∨ Q)        1,3 &I {1}      5.   P                           2,4 RAA {6}      6.   Q                           Assum. {6}      7.   ~P ∨ Q                      6 ∨I {1,6}    8.   ~(~P ∨ Q) & (~P ∨ Q)        1,7 &I {1}      9.   ~Q                          6,8 RAA {1}      10.  P & ~Q                      5,9 &I   I also found that it's fairly easy to conclude ~Q:   {1}      1.   ~(P → Q)                    Prem. {2}      2.   Q                           Assum. {3}      3.   P                           Assum. {2,3}    4.   P & Q                       2,3 &I {2,3}    5.   Q                           4 &E {2}      6.   P → Q                       3,5 CP {1,2}    7.   ~(P → Q) & (P → Q)          1,6 &I {1}      8.   ~Q                          2,7 RAA ... {1,2}    12.  P & ~Q   In spite of how easy it looks, I can't figure out how to do it. I believe it can be done in 12 steps. Thanks! Removing Firefox in Ubuntu with all add-ons like it never existed I have been using Firefox for a long time in Ubuntu, I downloaded some add-ons but it made firefox extremely slow, even if I remove them nothing will change.  I tried to remove Firefox also, but re-installing it will somehow recover the same Firefox I had- it seems it write some info somewhere that even if you remove Firefox, it will keep them.  Moreover, I am not able to use see any flash videos or website with Firefox(chrome works fine).. Honestly I tampered with plug-in settings in Firefox that this happened. But right now I can't do anything to overwrite the setting...  My question is how I can remove Firefox in a way to remove any previous traces and re-install a new version like for the first time? I am currently trying to establish a clear picture of pure/mixed/entangled/separable/superposed states. In the following I will always assume a basis of $|1\rangle$ and $|0\rangle$ for my quantum systems. This is what I have so far:   superposed: A superposition of two states which a system $A$ can occupy, so $\frac{1}{\sqrt{2}}(|0\rangle_A+|1\rangle_A)$ seperable: $|1\rangle_A|0\rangle_B$ A state is called separable, if its an element of the (tensor)product basis of system $A$ and $B$ (for all possible choices of bases) entangled: $\frac{1}{\sqrt{2}}(|0\rangle_A|1\rangle_B+|1\rangle_A|0\rangle_B)$ is not a state within the product basis (again for all possible bases). mixed state: Is a statistical mixture, so for instance $|1\rangle$ with probability $1/2$ and $|0\rangle$ with probability $1/2$ pure state: Not a mixed state, no statistical mixture   I hope that the above examples and classifications are correct. If not it would be great if you could correct me. Or add further cases, if this list is incomplete.   On wikipedia I read about      Another way to say this is that while the von Neumann entropy of the whole state is zero (as it is for any pure state), the entropy of the subsystems is greater than zero.   which is perfectly fine. However I also read on wikipedia a criterion for :     Another, equivalent, criterion is that the von Neumann entropy is 0 for a pure state, and strictly positive for a mixed state.   So does this imply that if I look at the subsystems of an entangled state, that they are in a mixed state? Sounds strange... What would be the statistical mixture in that case?  Moreover I also wanted to ask, whether you had further illustrative examples for the different states I tried to describe above. Or any dangerous cases, where one might think a state of one kind to be the other? I need to periodically run a command that ensures that some text files are kept in Linux mode. Unfortunately dos2unix always modifies the file, which would mess file's and folder's timestamps and cause unnecessary writes.   The script I write is in Bash, so  I'd prefer answers based on Bash. I have a Java bean like this:  class Person {   int age;   String name; }   I'd like to iterate over a collection of these beans in a JSP, showing each person in a HTML table row, and in the last row of the table I'd like to show the total of all the ages.  The code to generate the table rows will look something like this:  &lt;c:forEach var="person" items="${personList}"&gt;   &lt;tr&gt;&lt;td&gt;${person.name}&lt;td&gt;&lt;td&gt;${person.age}&lt;/td&gt;&lt;/tr&gt; &lt;/c:forEach&gt;   However, I'm struggling to find a way to calculate the age total that will be shown in the final row without resorting to scriptlet code, any suggestions? How can I use an array of function pointers? How should I use array of function pointers in C?  How can I initialize them? Can a shell script set environment variables of the calling shell? I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell.  setenv FOO foo   in csh/tcsh, or  export FOO=foo   in sh/bash only set it during the script's execution.  I already know that   source myscript   will run the commands of the script rather than launching a new shell, and that can result in setting the "caller's" environment.  But here's the rub:  I want this script to be callable from either bash or csh.  In other words, I want users of either shell to be able to run my script and have their shell's environment changed.  So 'source' won't work for me, since a user running csh can't source a bash script, and a user running bash can't source a csh script.  Is there any reasonable solution that doesn't involve having to write and maintain TWO versions on the script? How do I show that the equation $x^3+10x^2-100x+1729$$=0$ has at least one complex root $a$ such that $|a|$$&gt;$$12$. Before the seasonal flu vaccine was recommended for all healthy adults, people in developed countries might get vaccinated against on the order of 10 different pathogens and develop immunity for some more via natural exposure.  Now the same person is expected to take a seasonal flu vaccine for a new strain every year - won't this put them in an uncharted territory as far as effects on the immune systems are concerned within a couple of decades? How to secure Elliptic Curve ElGamal encryption against known plaintext attacks? If I have an encoding function  $f(x)$ that maps a message $m$ to a point $P$ on a suitable Elliptic Curve $E$ . If I have the public key $Q$ of my recepient then I can encrypt the message as follows:  Choosing a random number $k &lt; n -1 $ where $n$ is the order of the curve E .  Calculating $C = [k] G $ where $G$ is the generator point of the curve E   Calculating $R = [k]Q $ where $Q$ is the recipient's public key   Now the message is encrypted by adding $P$ to $R$ to get          $C_e$ $( = R + P)$ which is sent along with $C$ to the recepient.  DECRYPTION:  Now for the recepient to decrypt my message they compute $R = [privatekey] C $ (where $C = [k]G $) and simply subtract $R$ from $C_e$ to get the encoded point $P$ back which is then decoded by an inverse function $f^{-1}(x)$ to recover $m$.  Now , two problems arise : If the attacker knows the plaintext (suppose if I follow a particular format of data while sending messages ) he could encode his guessed plaintext and subtract it from $C_e$ to recover $ R $ back ! . If I used that same $ R  $ to encrypt further "blocks" of my message then the security of the later parts of my message has been breached!   I realize that doing  something like a scalar multiplication over and over again for every block of data, would be a huge drawback in efficiency and speed.   Is there any way to compute a different $ R $ for every block of data, without using much resources and that too quickly ?   Does reusing the same $R$ for another message break security ?  NOTE: This question is for educational purposes only. It's for the sake of expanding my knowledge on Crypto. Error java.lang.OutOfMemoryError: GC overhead limit exceeded "They're going gorilla watching" - is there a verb at the end of the sentence? In this sentence:     They're going gorilla watching.   what's the function of the verb watching?   Is it a verb? a noun? ... maybe gorilla watching means "mirador de gorilas", in spanish?  In English, I have not seen a verb at the end of a sentece. Elliptic Curves of different forms Looking at  to find a safe curve, I find that most curves described here are of a different form from that generally used.  In , for example, FpCurves take curves of the form $y^2 = x^3+ax+b$ (Weierstrass), whereas the (safe) curves found on the above linked have different forms, such as $y^2 = x^3+ax^2+x$ (Montgomery) - how do I translate between the two? How do I use the second form of curve with, for example, Bouncy Castle?  (Or do I simply have to accept that no safe curves of the Fp form exist?)    What else have I tried? Guide to Elliptic Curve Cryptography (Hankerson et.al.) covers curves of the forms $y^2 = x^3+ax+b$ for fields with characteristic > 3, and only offer alternatives (that are not interchangable with the safe curves, either) for lower characteristics, that are not very useable in my situation. Even then, some curves on the safe curves website are of forms that I cannot immediately find explained anywhere.