I'm trying to write a code that returns a new array which swaps every pair of elements. If there is an odd number of elements, the last element remains the same.   Currently what I have is this which doesn't seem to be working at all. I keep returning a nullpointerexception error when trying to test it   public static String[] pairSwap(String[] inputArray) {     String[] outputArray = new String[inputArray.length];     for (int i = 0; i &lt; inputArray.length; i += 2) {          inputArray[i] = outputArray[i + 1];         inputArray[i + 1] = outputArray[i];          if (inputArray.length % 2 != 0) {             inputArray[inputArray.length] = outputArray[inputArray.length];         }     }     return outputArray; }
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
How do I display a decimal value to 2 decimal places? 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? How to send and receive data from Salesforce to a FTP server My question is how I can intergrate Salesforce with different FTP servers in real time. I have read some articles about it, but to be absolutely sure I thought it would be a good idea to post a question here.  I want to be able to send and receive data from Salesforce as a csv file to a ftp server. How I'm thinking about doing this is listed below.  Send the data:  Create a apex class which query the necessary data in Salesforce and create a csv file. I guess this is trivial? Then send the file to a web service created in Salesforce, just by calling it in the apex code. Create a web service in Salesforce which receives the data from the apex code. This web service should in some way send the data to the appropriate ftp server. I guess I can simply modify some of the code provided by Salesforce to make this work? The file is sent. Receive the data  This one is a bit trickier. I guess I have to pull the data from the FTP server by using my web service, which then send the file collected to the appropriate apex class. Or, the FTP server could send the data to the SFDC web service, I don't know if this is possible? The web services on the other side that sends the data to the ftp server, could send it directly to the SFDC web service, which then again forward it to the apex class. I guess the web service will use the remote site url to connect to the SFDC web service? What are instructions on how to download videos from YouTube?    Notice: Terms of Service Violation  Please be aware that by following any of the answers below, you will be violating YouTube's . In particular, from Section 5.B.:     Content is provided to you AS IS. You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content. YouTube and its licensors reserve all rights not expressly granted in and to the Service and the Content. What's the meaning of "be blowed"? I would like to know what's the meaning of "be blowed" in the following text:     'I'm going to smoke' Jenkins said; 'be blowed to Bertie dear.' (Mrs. Smythe had once addressed her husband in the office as 'Bertie dear', and thereforth that had been his name among the staff.) Richard made no answer. When a minute later Jenkins, discreetly directing his puffs to the open window, asked him for the titles of one or two of Zola's novels in English, and their price, he gave the required information without turning round and in a preoccupied tone.   , Arnold Bennett, 1911. I want to create a text file which will add each command I am going to run on the terminal as a new line entry in the text file. i.e., I need to keep a record of what are the things I'm doing in the terminal. Further if I can keep a record of outputs I'm getting in the terminal, along with the inputs in the terminal, as a text file, it will be much better.   Each time I forget a command I have to search again in the Internet for the command.  Can I can make a file like above? Do I need a license to create pdf files? I hope this is the correct place where I could ask this question. My mother is an accountant with a degree in economics. She works as a freelancer and she needs some licenses for her job.  The biggest problem is adobe acrobat standard, which costs 400€, quite a lot. I want understand if she must buy it to create pdf files or she can use some free (even for commercial use) programs that she has because of her job (the chamber of commerce provide some advantages to accountants).  She is actually using PDFCreator, which as I can read is free for business usage (open source also!!):   Thanks for any suggestion Proving a sequence converges by defining the sequence recursively. Let $a &gt; 0$. Choose $x_1 &gt;$ $\sqrt a$. Define a sequence {$x_n$} recursively as $x_{n+1} = 1/2(x_n + a/x_n)$ for $n &gt; 1$.   Prove that lim$x_n = \sqrt a$.  I think I first want to prove that {$x_n$} is bounded below by $\sqrt a$. But, I am having trouble with this. Could someone help me out a little? I'm trying to prove that if $A\neq 0$ is a commutative ring and there is an injective $A$-module homomorphism $A^m\hookrightarrow A^n$ then $m\leq n$ must necessarily hold.    This is exercise 2.11 from Atiyah and MacDonald's Introduction to Commutative Algebra, but unfortunately all the solutions available online are either very sparse with regard to this question or seem to use (to my surprise) a generalized version of Cramer's rule. Is there perhaps some other "cleaner" approach to solving this problem? I am trying to display certain features in a shapefile-based layer using QGIS. I have found the subset function in the properties panel, which does exactly what i want, but is too tedious given that I have to manually sift through a large number of features. Is there a quicker way to do this?  I am using both shapefiles and postGIS best,  dietmar Questions like:   ♦ ♦-should-discriminate-more-when-bumping-unanswered-questions ≠-users-who-want-to-write-good-posts   well, you can see there.  The diamond (and other problematic Unicode characters) in the title breaks the automatic prettification of internal question links.  This becomes a bit more of an issue when one wants to link to an answer.  For example ♦-break-the-automatic-hyperlink-parser/242572#242572 should link to Martijn's answer, but, it doesn't (tangent, but a different issue is that  which is the share link doesn't auto-prettify unless the userid part is removed - one keeps having to manually remove things to get the auto prettify to engage).  If one looks at the html generated for  for the title and the url linked in the &lt;h1&gt; of the page, we get:  &lt;title&gt;Users who can&amp;#39;t write good posts ≠ users who want to write good posts - Meta Stack Exchange&lt;/title&gt;     &lt;h1 itemprop="name"&gt; &lt;a href="/questions/238644/users-who-cant-write-good-posts-%e2%89%a0-users-who-want-to-write-good-posts" class="question-hyperlink"&gt;Users who can&amp;#39;t write good posts ≠ users who want to write good posts&lt;/a&gt; &lt;/h1&gt;   And while that's a long link title, I will point out that the quote as part of the word "can't" was removed from the slug.  The bug is that this should be done for other characters too. What are the uses of Unicorns? What different uses does the unicorn have?  Other than the delicious taste of them coming off the grill.   At Wit's End #221 Non trivial valuation over a finite extension $F/\mathbb{Q}_p$ is equivalent to the one induced by $v_p$ Can others in my party go through TSA PreCheck? If I have  (i.e. I have a KTN from TSA and the "pre-check" logo gets printed on my boarding pass) and a travel companion does not, can they go with me through the PreCheck security lines? This is assuming that the travel companion is booked in the same reservation on the same flights and is also a U.S. citizen and not on any no-fly or otherwise increased scrutiny lists.  I'm guessing the answer is no, but I haven't seen anything from TSA specifically addressing this. How can I vertically align elements in a div? I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS needed for this to work on all common browsers? &lt;div id=&quot;header&quot;&gt;   &lt;img src=&quot;..&quot; &gt;&lt;/img&gt;   &lt;h1&gt;testing...&lt;/h1&gt;   &lt;img src=&quot;...&quot;&gt;&lt;/img&gt; &lt;/div&gt; I've got a repo that I contribute to within an Organization that I administer. I'm trying to add it to careers, but it won't allow it. Is this on purpose? I don't really want to fork it to my personal account, since I won't be maintaining it from there. A group $G$ with a subgroup $H$ of index $n$ has a normal subgroup $K\subset H$ whose index in $G$ divides $n!$ How do I choose between "while" and "whilst"? When should whilst be used instead of while?  For example, should I use the first or the second sentence?      They don't do this whilst they do that.   They don't do this while they do that.   Which would be correct? Is there anything in the physics that enforces the wave function to be $C^2$? Are weak solutions to the Schroedinger equation physical? I am reading the beginning chapters of Griffiths and he doesn't mention anything. Proof that the One-Dimensional Simple Harmonic Oscillator is Non-Degenerate?