I need to create a file (in my java source code) that will be able to execute a bash script without having to have the user type chmod 755...in their terminal. I tried command files, but it still asked me to give the file permission. Thanks  I have tried command files, exe files, jar files, etc  import java.io.*; import java.util.*; public class twint2 {     public static void main (String [] args)throws FileNotFoundException{                  File bash = new File ("/Users/garrettpartenza/Desktop/myScriptss.command");                     PrintStream out = new PrintStream (new FileOutputStream(bash));                         out.println("#!/bin/bash");                         out.println("twint -u realDonaldTrump -s china -o /Users/garrettpartenza/Desktop/file.csv");          }     }   It downloads the command file, but it still needs permission to execute.
In Java, I'm dynamically creating a set of files and I'd like to change the file permissions on these files on a linux/unix file system.  I'd like to be able to execute the Java equivalent of chmod. Is that possible Java 5? If so, how?  I know in Java 6 the File object has setReadable()/setWritable() methods. I also know I could make a system call to do this, but I'd like to avoid that if possible.
Expected Value of Local Maxima and Local Minima Recently I came across this question:  Given a random permutation of integers 1, 2, 3, …, n with a discrete, uniform distribution, find the expected number of local maxima. (A number is a local maxima if it is greater than the number before and after it.) For example, if n=4 and our permutation was 1, 4, 2, 3, then the # of local maxima would be 2 (both 4 and 3 are maxima). I know the answer will be (n+1)/3 .I wanted to know what will be the answer when we have to consider the local maxima as well as the local minima i.e Finding out the expected number of local maxima and local minima. How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server? I mistakenly have source .bash_profile in the bashrc file and vice versa. Now when I tried to ssh into the machine (ec2), it will stuck at loading bash and get connection closed in a second. Is there a way I could fix it? Could I mount the disk to another ec2 instance to fix the bash files?  Update 1: I tried the following: %  ssh -i &quot;my-pem.pem&quot; -t ubuntu@&lt;server_address&gt;.amazonaws.com &quot;/bin/bash --noprofile --norc&quot; Connection to &lt;server_address&gt;.amazonaws.com closed.  Nothing else showed up. Do you have any idea on what was going wrong? For sanity check, if I do ssh -i &quot;my-pem.pem&quot;ubuntu@&lt;server_address&gt;.amazonaws.com, the message will be ...  28 packages can be updated. 0 of these updates are security updates. To see these additional updates run: apt list --upgradable  New release '20.04.2 LTS' available. Run 'do-release-upgrade' to upgrade to it.   Last login: Mon Feb 22 23:17:41 2021 from ip Connection to &lt;server_address&gt;.amazonaws.com closed.  Solution Just ssh onto the machine and immediately do Ctrlc and fix the bash files. Distance from a point to a plane in normed spaces How can we calculate the distance from a point to a plane in normed spaces ? where we are not inner product, for example:  Calculate the distance in $(C[0,1],||\cdot||)$ endowed with the supremum norm $$||f||=\sup_{t\in[0,1]}|f(t)|$$ from the function $f(t)=t^2$ to the linear hull of the functions $g(t)=t$  and  $h(t)=\sin(t)$  Any hints would be appreciated. Pygame rotating cubes around axis Are immutable arrays possible in .NET? Is it possible to somehow mark a System.Array as immutable.  When put behind a public-get/private-set they can't be added to, since it requires re-allocation and re-assignment, but a consumer can still set any subscript they wish:  public class Immy {     public string[] { get; private set; } }   I thought the readonly keyword might do the trick, but no such luck. Why is it difficult to differentiate between  and ? Is it because we don't clearly understand how both of these phenomenon takes place?   My thoughts: From an answer to one of my earlier question  I could understand that light waves behave differently when it strikes a slit which is of several times bigger than its wavelength and when it strikes a slit of size comparable to it its wavelength.In the former case the different points on the slit acts as wave-front sources producing circular wave fronts which interfere to form the diffraction pattern but in the later case plane wave-front striking a slit after passing through it forms circular wave-fronts and two such wave-fronts from two different slits interfere to form the interference pattern. But, I'm not satisfied by that because I don't get any intuition about points on the slit acting as wavefront sources. So, what is actually happening? app engine datastore auto-clears every time project runs Can creatures without hands (and as a consequence fingers) use rings? Pretty much what it says on a label. I have a monster for my next adventure that has a pretty interesting ring in his treasure. Since it is intelligent, and would be able to use the ring, I don't see why the ring should be lying there in a chest waiting to be looted.  Monster would use the ring, if it only had hands or even fingers. Hold a second, are fingers even necessary in 5e?  For reference, assume it only has grasping / manipulating tentacles like a  (although it is not one); Said tentacles are very flexible, capable of fine manipulation, and have varying thickness. Lightning New Case action override I have action override on New Case button which runs our custom component.  As you know, we can create a new Case from different places in org, e.g. from related lists. When creating a Case from related list on Account using standard action in Lightning we have prepopulated AccountId to the lookup field. Is it possible to do the same with custom component? I can't catch the AccountId using force:hasRecordId, because action override redirects me to the new page with custom component where I don't have a context of Account. URL also doesn't contain its Id. What can I do to grab Id of context object and populate it to my component? I wonder whether it is possible to perform within R a clustering of data having mixed data variables. In other words I have a data set containing both numerical and categorical variables within and I'm finding the best way to cluster them. In SPSS I would use two - step cluster. I wonder whether in R can I find a similar techniques. I was told about poLCA package, but I'm not sure ... Asking distant cousins for DNA? In my family we have a DNA contradiction – two cousins (at about the 4th cousin level) took a Y-DNA test, but did not match and had two completely different haplogroups.   Since then, I have traced living cousins with the same surname – the only ones left living that I am aware of – and I would love to pay to have them tested to see if we can figure out where the non-paternity event (NPE) or other event happened (i.e. this new cousin could help us determine which line the NPE occurred in depending on which cousin he matches).   Does anyone have a sample letter, or know the best way to go about asking a distant cousin for DNA?   I have their address and am planning to write a letter, but I can't imagine receiving such a letter, so I am not quite sure how to ask without scaring them off. Determinant of a $2\times 2$ block matrix I would like to know the proof for:  The determinant of the block matrix $$\begin{pmatrix} A &amp; B\\ C&amp; D\end{pmatrix}$$ equals $$(D-1) \det(A) + \det(A-BC) = (D+1) \det(A) - \det(A+BC)$$ when $A$ is a square matrix, $D$ is a scalar, $C$ is a row vector and $B$ is a column vector.  I appreciate your help. How to use grep and cut together? Lets say I'm doing a database for fruits. Using a text file for it, inside contains, in this format,  (Fruit:Quantity:Cost) Apple:10:1 Orange:20:2 Pears:10:3 Banana:20:4  10 Apples at $1 each. 20 Oranges at $2 each. 10 Pears at $3 each. 20 Bananas at $4 each.   My simple script goes like this:  echo "Enter fruit to find" read fruit  echo "Enter quantity to find" read count  echo "Enter cost to find" read cost  grep $fruit FruitDB.txt     It will display the fruits in the database.  But how do i use grep and cut together to find just by the quantity or the cost. In the quantity count area, let's say i enter 20, it will display the Oranges and Banana. Or when i enter count and cost, it will display just those that meet the conditions. How do I increase the open files limit for a non-root user? This is happening on Ubuntu Release 12.04 (precise) 64-bit Kernel Linux 3.2.0-25-virtual  I'm trying to increase the number of open files allowed for a user. This is for my eclipse java application where the current limit of 1024 is not enough.  According to the posts I've found so far, I should be able to put lines into   /etc/security/limits.conf like this:  soft nofile 4096 hard nofile 4096   to increase the number of open files allowed for all users.  But that's not working for me and I think the problem is not related to that file.  For all users, the default limit is 1024, regardless of what is in /etc/security/limits.conf (I rebooted after changing that file)  $ ulimit -n 1024   Now, despite the entries in /etc/security/limits.conf I can't increase that:  $ ulimit -n 2048   -bash: ulimit: open files: cannot modify limit: Operation not permitted The weird part is that I can change the limit downwards, but can't change it upwards - even to go back to a number which is below the original limit:  $ ulimit -n 800 $ ulimit -n 800  $ ulimit -n 900  -bash: ulimit: open files: cannot modify limit: Operation not permitted   As root, I can change that limit to whatever I want, up or down. It doesn't even seem to care about the supposedly system-wide limit in /proc/sys/fs/file-max  # cat /proc/sys/fs/file-max 188897  # ulimit -n 188898 # ulimit -n  188898   But even I get eclipse to run as root, my application still crashes because of "Too Many Open File" exception!   So far, I haven't found any way to increase the open files limit for a non-root user.  How should I properly do this? I have looked at several other posts but no luck! Can I open a US bank account even if I don't live in the country? Why didn't Doc remember Marty's outfit? In Back to the Future 3, Doc (from 1955) sends Marty back in time wearing a cowboy outfit.  But then, Doc (from 1885) doesn't remember that it was him who offered this outfit to Marty.   Does this mean there are two different Docs (from differing timelines) or is it the same Doc but he somehow forgot the outfit. Union of uncountable cardinals I have to prove the following:  Let $\omega_1$ be the least uncountable cardinal and, for each $n \in \omega$ (here, $\omega$ is the set of natural numbers denoted as an ordinal/cardinal), $n\ge1$, let $\omega_{n+1}$ be the least cardinal that is greater than $\omega_n$. Show that $\bigcup_{n\in\omega}\omega_n$ is a cardinal.  I suppose the proof has something to do with transfinite induction/recursion, but I don't know exactly how I'm supposed to use it. Any thoughts? Provisioning Profiles menu item missing from Xcode 5 Using BibTeX/biblatex to make a list of references without having citations in the body of the document? Is there any way to have BibTeX or biblatex insert a bibliography without having citations in the body of the document itself? Maybe a way to hide the in-text citations, so that BibTeX still sees them and includes them in the bibliography, but does not print them in the body? interpreting scatter plots I have plotted my predictors versus my response variable in order to be able to fit a good Poisson model to my data. However i am getting  those scatter plots for nearly all predictors which make me rather worried since including these predictors is making my residual deviance a value of 575 on 571 df(high enough) Thanks