I'm building an integration with S3 and I want to create a pre-signed URL so I can access S3 from SF with a single user. I use the method below to generate a URL: public static string getSignedURL(string file, String bucketName, String accessKey, String secretKey, String state) {     String filename = EncodingUtil.urlEncode(file, 'UTF-8');     Datetime now = DateTime.now();     Datetime expireson = now.AddSeconds(60);     Long Lexpires = expireson.getTime() / 1000;      String stringtosign = 'GET\n\n\n' + Lexpires + '\n/' + BucketName + '/' + filename;     Blob mac = Crypto.generateMac('HMacSHA1', blob.valueof(stringtosign), blob.valueof(SecretKey));     String signed = EncodingUtil.base64Encode(mac);     String url = 'https://' + BucketName + '.s3.us-east-1.amazonaws.com/' + filename + '?AWSAccessKeyId=' + AccessKey + '&amp;Expires=' + Lexpires + '&amp;Signature=' + signed;     return url;  }  The method works, but the downside as you can see is that I need to send my accessKey and secretKey and I wish to avoid that. So I want to use a Named Credential to authenticate, and then I want to call my method getSignedURL(). But I don't know how I can pass the secret and key to the getSignedURL() method using a Named Credential. I didn't find a merge field related to AWS Signature Version 4 in the . I was hoping to find something like: {!$Credential.acessKey} {!$Credential.secretKey}
I am trying to make a callout to AWS S3 using named credentials and Apex  The named credential is set up as follows  Label: AWS S3 Name: AWS_S3 URL: https://bucket-name.s3.amazonaws.com - Certificate: Identity Type: Named Principal Authentication Protocol: AWS Signature Version 4 AWS Access Key: AKIAxxxxxx AWS Secret Access Key: xxxxxx AWS Region: ap-southeast-2 AWS Service: s3 - Generate Authorization header: true Merge fields in header: false Merge fields in body: false   The Apex class is very simple  HttpRequest req = new HttpRequest(); req.setEndpoint('callout:AWS_S3'); req.setMethod('GET');                        Http http = new Http(); HTTPResponse res = http.send(req);                 System.debug(res.getBody()); return res.getBody();   The response body contains the following:     SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.AKIAxxxxx   I have used the same bucket, endpoint and credentials using Postman and am able to successfully return the list of objects in the bucket so it is not an IAM permissions issue  There have been a couple of similar questions on stackexchange but unfortunately they do not provide any resolution or assistance in this case:    I've tried looking for code samples or further pointers in the Apex documentation but it doesn't really give any further guidance on how to proceed or correctly set this up so I'm a bit stuck
Erdős-Straus conjecture The  (ESC), states that for every natural number $n \geq 2$, there exists a set of natural numbers $a, b, c$ , such that the following equation is satisfied:  $$\frac{4}{n}=\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\tag{1}$$  The basic approach to solving this problem outlined by Mordell [Ref1] is described below  By defining $t$ and $m$ as positive integers greater than zero and $q$ a positive integer greater than one we can observe that  a) There is always a solution for even $n$, since if $n=2^qt$ we have the trivial solution $$\frac{4}{4t}=\frac{1}{t}$$  In the remaining case $n=2(2t+1)$, a solution in the form of two Egyptian fractions can always be found  e.g. $$\frac{4}{2(2t+1)}=\frac{2}{2t+1}=\frac{1}{t+1}+\frac{1}{(t+1)(2t+1)}$$  b) If $(1)$ is a solution for some particular prime $n$ then all composite numbers $mn$ divisible by $n$ are also solutions, thus  $$\frac{4}{mn}=\frac{1}{ma}+\frac{1}{mb}+\frac{1}{mc}$$  will also be a solution. This means that we can simplify the analysis to the cases where $n$ is a prime greater than 2.  Using Mordell's approach we have just shown that we only need to consider the cases where $n$ is prime and where $n \equiv 1 \pmod{2} \;\;[meaning \;\;n=2t+1]$  The argument continues...  Mordell goes on to show in turn that the search can be reduced further to the cases when $$n \equiv 1 \pmod{4} \;\;[meaning \;numbers \;\;n=4t+1]$$ $$n \equiv 1 \pmod{8} \;\;[meaning \;numbers \;\;n=8t+1]$$ $$n \equiv 1 \pmod{3} \;\;[meaning \;numbers \;\;n=3t+1]$$ $$n \equiv 1,2,4 \pmod{7} \;\;[meaning \;numbers \;\;n=7t+1,n=7t+2 \;or\;n=7t+4 ]$$ $$n \equiv 1,4 \pmod{5}  \;\;[meaning \;numbers \;\; n=5t+1 \;or\;n=5t+4]$$  Assembling these results together, Mordell showed that the conjecture can be proved in this context except for the cases when $$n \equiv 1,11^2,13^2,17^2,19^2,23^2 \pmod{840}$$  Mordell stated that since the first prime meeting this condition is 1009, this is proof that the conjecture holds for $n&lt;1009$.  This basic approach can be pursued further. Other workers have shown that the conjecture holds for much higher values of $n$ using similar methods as can be seen on the above Wikipedia page.   Note that other intermediate results can be constructed from the above congruence's, e.g. $n \equiv 1 \pmod{24}$.  The question is:  Are there any other elementary approaches to solving this problem than the one outlined by Mordell (and described above)?  [Ref1] Louis J. Mordell (1969) Diophantine Equations, Academic Press, London, pp. 287-290. If the positive series $\sum a_n$ diverges and $s_n=\sum\limits_{k\leqslant n}a_k$ then $\sum \frac{a_n}{s_n}$ diverges as well So I've been trying to figure out how to prove the following.     Let $(a_n)$ be a sequence of positive numbers such that $\sum\limits_{n=1}^\infty a_n =\infty$, and define $s_n=\sum\limits_{i=1}^n a_i$. Then $\sum\limits_{n=1}^\infty\frac{a_n}{s_n} =\infty$ as well.   I can prove it by comparing it to $\int_1^\infty \frac{1}{x} \, dx $ if the sequence $a_n$ is bounded by some $M$, but that's as far as I've been able to get. I understand that the eigenvectors of a linear transformation are the vectors that, when transformed, are simply scaled by a factor of the corresponding eigenvalue. Therefore $$ A\vec{x}=\lambda\vec{x}. $$ We can replace the scaling of the vector $\vec{x}$ by $\lambda$ with its equivalent linear transformation, $\lambda I$. Then we can rearrange this equation as follows: $$ A\vec{x}-(\lambda I)\vec{x}=\begin{bmatrix}0\\0\end{bmatrix}\\  (A-\lambda I)\vec{x}=\begin{bmatrix}0\\0\end{bmatrix}\\  $$ For this to be true either $\vec{x}$ must be a zero vector or the transformation $A-\lambda I$ must have $\vec{x}$ in its null-space. The course I'm following says that we can solve for $\lambda$ by finding when the determinant of $A-\lambda I$ is zero, but why does that guarantee that $\vec{x}$ will become the zero vector when transformed by $A-\lambda I$? I understand that for $\vec{x}$ to be an eigenvector this transformation must have a determinant of zero, but I don't see how the inverse can be true; having a determinant of zero doesn't gaurantee that $\vec{x}$ will be transformed into the zero vector. For example, let $$ (A-\lambda I) = \begin{bmatrix}1&amp;2\\0&amp;0\end{bmatrix}, \vec{x}=\begin{bmatrix}1\\1\end{bmatrix} $$ Then, although $\det\begin{bmatrix}1&amp;2\\0&amp;0\end{bmatrix} = 0$, it does not gaurantee $(A-\lambda I)\vec{x}$ to be the zero vector. $$ \begin{bmatrix}1&amp;2\\0&amp;0\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix}=\begin{bmatrix}3\\0\end{bmatrix}  $$ We can see that the transformation gives us $\begin{bmatrix}3\\0\end{bmatrix}$ and not the zero vector. Why does finding when the determinant of this transformation is equal to zero help us find the eigenvectors? Am I missing something? Modified files in a git branch are spilling over into another branch A friend of mine, native EN speaker, told me that the following is correct written like this:      We met on the 1st of June.   Is that really true? I cannot see any reference that these are used in written text. Bidirectional 1 to 1 Dictionary in C# I am looking for a generic, bidirectional 1 to 1 Dictionary class in C# (2), ie. a BiDictionaryOneToOne&lt;T, S&gt; which is guaranteed to only contain one of each value and key (up to RefEquals anyway), and which can be searched using either key or value. Anyone know of one, or should I just implement it myself? I can't believe that I'm the first person to need this...  There is a BiDictionary in the answers to , but it is not for unique elements (and also does not implement RemoveByFirst(T t) or RemoveBySecond(S s)).   Thanks! Lost email settings and no icon for Mail I've lost my Settings → Mail, Contacts, and Calendars on my iPhone 5.  No icon for Mail and no Mail settings.  How do I get it back? in a file containing :  ... 18-11-2018:othercharacters 10-11-2018:othercharacters 03-10-2018:othercharacters 30-10-2018:othercharacters 27-09-2018:othercharacters 03-12-2018:othercharacters ...   the command :  sort -t- -k2 -k1    does not sort by date, what am I missing ? I think the title says it all. I can't see any reason employers have to incentivize employees to contribute to their 401(k) evenly throughout the year. Instead couldn't they use a relatively simple formula that is based on how much of their income the employee has contributed to their 401(k) thus far for the year? If that or their current contribution is over the threshold, they get the match this pay period, even if they didn't contribute anything.  EDIT: To clarify, my employer matches 100% of the first 3% of my contribution and 50% of the next 2%. The match is added every pay period along with my contribution. I am pretty sure there is no "true-up" feature, so if I were to hit the $17.5K limit early, and not be able to contribute at least 5% of my salary, I would not get the full match. So I have to be careful to make my contributions evenly throughout the year to get the maximum match. Just trying to figure out my employer's motivation for requiring this. Possible Duplicate:             I want to add some shell scripts in my launcher as shortcuts..  They are located deep inside and i have to navigate to it every time to execute them...  I tried  link where the 2nd answers seems to solvee it but as said in comments neither can i find any option to add a launcher..  I guess it existed in 11.04 with a "+" button on launcher but i use 12.04.  So how do i get this working?? And i need those commands everytime for sure..! $A$ is an $n\times n$ matrix of complex numbers. Prove that if $\lambda$ is an eigenvalue of $A^2,$ then $\sqrt{\lambda}$ or $-\sqrt{\lambda}$ is an eigenvalue of $A.$    If $\lambda$ is an eigenvalue of $A^2,$ we have $\lambda\alpha=A^2\alpha$ for some $\alpha.$ Then how can we find a $\beta$ s.t. $\sqrt{\lambda}\beta=A\beta?$ How many solutions has the equation $\sin x= \frac{x}{100}$ ? How do I install wine? 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?) Identify the plane defined by $|z-2i| = 2|z+3|$ I tried:  $$|z-2i| = 2|z+3| \Leftrightarrow \\ |x+yi-2i|=2|x+yi+2|\Leftrightarrow \\ \sqrt{x^2+(y-2)^2}=\sqrt{4((x+2)^2+y^2)} \Leftrightarrow \\ \sqrt{x^2+y^2-4y+4} = \sqrt{4x^2+24x+36+4y^2} \Leftrightarrow \\ x^2+y^2-4y+4 = 4x^2+24x+36+4y^2 \Leftrightarrow \\ y^2-4y-4y^2=4x^2+24x+36+x^2 \Leftrightarrow \\ -3y^2-4y=5x^2+24x+26 \Leftrightarrow \\ ???$$  What do I do next? Is there i.i.d. assumption on logistic regression? Is there i.i.d. assumption on the response variable of logistic regression?  For example, suppose we have $1000$ data points. It seems the response $Y_i$ is coming from a Bernoulli distribution with $p_i=\text{logit}^{-1}(\beta_0+\beta_1 x_i)$. Therefore, we should have $1000$ Bernoulli distributions, with different parameter $p$.  So, they are "independent", but are not "identical".  Am I right?    PS. I learned logistic regression from "machine learning" literature, where we optimize the objective function and check if it is good in testing data, without talking too much about assumptions.   My question started with this post  Where I try to learn more on statistical assumptions. Just out of curiosity, I have developed a small app analysing and generating sitemaps for a given domain.   Can I tell search engines to look for the sitemap of a given domain on my app using a dynamic url i.e. can you use cross-domain sitemaps.xml without validating you are owner of the destination domain?  For example :   http://example.com/mydomain.com/sitemap.xml I have some text in a table and I want to add a forced line break. I want to insert a forced line break without having to specify the column width, i.e. something like the following: \begin{tabular}{|c|c|c|} \hline Foo bar &amp; Foo &lt;forced line break here&gt; bar &amp; Foo bar \\ \hline \end{tabular}  I know that \\ inserts a line break in most cases, but here it starts a new table row instead.  A similar question was asked before: Raise all windows with a specific title I'm trying to find a way to raise all the windows that have one, specific title.  For example, I have two windows named superconky (yes, you guessed it, I'm trying to get conky running in lubuntu).  I have a command I got from the LXDE forums: sh -c 'wmctrl -k on; wmctrl -a superconky;'  I use it to show the desktop, except conky. It works perfectly, but only if you have one conky. If you have two or more, you get left with one and all the others minimized.  So, what should I do to raise all the windows?  Thanks in advance. Concatenating numbers and adding in leading zeros? I have three text fields populated as follows: 1, 9, 1 that I need to concatenate into a field that looks like 01.09.01.  Getting to 1.9.1 is easy but can anyone help out with how to formulate it so that each value has two places (i.e. add in those zeroes).  I used to do this in Excel but can't figure out how to work in ArcMap 10.