Hi I'm new in the world of android. So I tested a tutorial do fetch data from a XAMPP database and list it in my app with listview. Everything is like in the tutorial, so why my app doesnt't work? When I start the app i got an error message and the app crushes.  Thank you for your help!  public class MainActivity extends ActionBarActivity {  private TextView responseTextView;  @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main);       this.responseTextView = (TextView) this.findViewById(R.id.responseTextView);       new GetAllCustomerTask().execute(new ApiConnector());   }  public void setTextToTextView(JSONArray jsonArray) {     String s  = "";     for(int i=0; i&lt;jsonArray.length();i++){          JSONObject json = null;         try {             json = jsonArray.getJSONObject(i);             s = s +                     "ID : "+json.getInt("id")+"\n"+                     "Name : "+json.getString("name")+"\n\n";         } catch (JSONException e) {             e.printStackTrace();         }      }      this.responseTextView.setText(s);  }   private class GetAllCustomerTask extends AsyncTask&lt;ApiConnector,Long,JSONArray&gt; {     @Override     protected JSONArray doInBackground(ApiConnector... params) {          // it is executed on Background thread          return params[0].GetAllCustomers();     }      @Override     protected void onPostExecute(JSONArray jsonArray) {          setTextToTextView(jsonArray);       } }   }  public class ApiConnector {  public JSONArray GetAllCustomers() {     // URL for getting all customers       String url = "http://localhost/getAllCustomers.php";      // Get HttpResponse Object from url.     // Get HttpEntity from Http Response Object      HttpEntity httpEntity = null;      try     {          DefaultHttpClient httpClient = new DefaultHttpClient();  // Default HttpClient         HttpGet httpGet = new HttpGet(url);          HttpResponse httpResponse = httpClient.execute(httpGet);          httpEntity = httpResponse.getEntity();        } catch (ClientProtocolException e) {          // Signals error in http protocol         e.printStackTrace();          //Log Errors Here        } catch (IOException e) {         e.printStackTrace();     }       // Convert HttpEntity into JSON Array     JSONArray jsonArray = null;      if (httpEntity != null) {         try {             String entityResponse = EntityUtils.toString(httpEntity);              Log.e("Entity Response  : ", entityResponse);              jsonArray = new JSONArray(entityResponse);          } catch (JSONException e) {             e.printStackTrace();         } catch (IOException e) {             e.printStackTrace();         }     }      return jsonArray;   }   }  This is my logcat  04-06 22:17:21.550  23914-23914/diplomarbeit.at.dbfetchcontenttester E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: diplomarbeit.at.dbfetchcontenttester, PID: 23914 java.lang.NullPointerException         at diplomarbeit.at.dbfetchcontenttester.MainActivity.setTextToTextView(MainActivity.java:34)         at diplomarbeit.at.dbfetchcontenttester.MainActivity$GetAllCustomerTask.onPostExecute(MainActivity.java:66)         at diplomarbeit.at.dbfetchcontenttester.MainActivity$GetAllCustomerTask.onPostExecute(MainActivity.java:53)         at android.os.AsyncTask.finish(AsyncTask.java:632)         at android.os.AsyncTask.access$600(AsyncTask.java:177)         at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)         at android.os.Handler.dispatchMessage(Handler.java:102)         at android.os.Looper.loop(Looper.java:136)         at android.app.ActivityThread.main(ActivityThread.java:5105)         at java.lang.reflect.Method.invokeNative(Native Method)         at java.lang.reflect.Method.invoke(Method.java:515)         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)         at dalvik.system.NativeStart.main(Native Method)
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?
Query Activity for ORDER BY xxx DESC LIMIT I'm trying to create a query activity in order to show, from a Data Extension, only the last 5 articles ids. I tried with the formula ORDER BY xxx DESC LIMIT 0,5 as in SQL but it is not working and it is returning this exception:     The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified   How can I use ORDER BY in a Data Extension? Is propagation of uncertainties linear? I'm in doubt with one thing: let's imagine that we have $n+1$ quantities, $n$ of them being directly measured, and the other one being related to the first $n$ by a function $f : \mathbb{R}^n \to \mathbb{R}$. If the $x_i$ is one of the quantities being directly measured and if $\Delta x_i$ is it's uncertainty, then I've learned that the uncertainty of the quantity $y = f(x_1, \dots x_n)$ is given by:  $$\Delta y=\sum_{i=1}^{n}{\frac{\partial f}{\partial x_i}\Delta x_i}$$  My problem in understanding this is: well, if $f$ is such a function, it's derivative is the linear transformation $df : \mathbb{R}^n \to \mathbb{R}$ given by:  $$df=\sum_{i=1}^{n}\frac{\partial f}{\partial x_i}dx_i$$  Where $dx_i : \mathbb{R}^n \to \mathbb{R}$ is given by $dx_i(a_1 \dots a_n) = a_i$. Hence, what we are saying, is that $\Delta y = df ( \Delta x_1, \dots \Delta x_n)$, in other words, we are saying that the uncertainty of $y$ is given by a linear function of the vector of uncertainties of the quantities $x_i$. Why should that be true? I mean, what's the reasoning behind this? I really didn't get the point, my teacher just gave the equation without justifying or anything like that.  Any help and reference is appreciated. If you try to execute a program that is not installed you will get a message  The program 'x' is currently not installed. You can install it by typing:  sudo apt-get install x   and instead of offering you to install the program for you, you have to type the actual command. How can this behavior be changed? Seeking SF Short Story from late 1970s/early 1980s about dystopian future with an old man playing a piano I read this in the late 1970s or early 1980s, possibly as part of a juvenile fiction anthology/collection. From what I remember in this story a post-apocalyptic society requires each member to go out before their 18th birthday and kill an "oldster" adult (i.e. I think over 30 similar to the time in Logan's Run) to make room for themselves.  Otherwise they will be killed.   The kids actually cut off the hand of the victim which has a tattoo on it with the birthdate/age. In this case, the world has gotten to the point the person who kills the oldest person gets a "prize" of one more year of life beyond 30. Note, this is NOT Logan's run nor the novel upon which it is based.   The hero in this case finds an old man, the oldest he had ever seen (something like 45-50 I think) making wonderful sounds with a strange device. It was a piano.   He then confronts the old man  SPOILER ALERT     ... but cannot bear to kill him. The old man takes pity on the boy and offers him his hand to take back so he can live. The boy asks if the old man will still be able to play the piano with just one hand. The old man smiles and says "Yes, but not as well. " Then, the boy decides to stay with the old man and risk becoming an outlaw so he can learn to play the piano. $24\mid n(n^{2}-1)(3n+2)$ for all $n$ natural problems in the statement. There is a way to change top bar background opacity in ubuntu 20.04 lts.  I installed the hide top bar extension but is not a option to change it. I have two NTFS partitions, and I don't want to mount them manually every-time I start Ubuntu.   How can I do this?  Is there a tool or a code to use?   If so, is it safe to automount? specially when they are being used by another OS? Down arrow button for choosing the desired site What causes close votes to be annotated with "(deleted)"? Derivation of the formula for Ordinary Least Squares Linear Regression How was the formula for Ordinary Least Squares Linear Regression arrived at?  Note I am not only looking for the proof, but also the derivation. Where did the formula come from? Since canonical is  Ubuntu One, what are the possible alternatives?  I currently use Ubuntu One as a backup service for my Documents folder and various other folders I deem important. Of course I have backups on an external hard drive as well, but nevertheless, I find Ubuntu One to be very useful. What I'm especially looking for is a cloud service that does not need a special folder (such as a dropbox or google drive folder); something that is able to integrate into my own file system and syncs just any folder I want to.   I am aware that this question is rather subjective, but I do guess many people who have used Ubuntu One are now in the dark. Let $f_n = \mathbb 1_{[-n,n]}$ for all $n \in \mathbb{N}$   Compute explicitly $f_n \star f_1$ for all $n \in \mathbb{N}$.  Show that $f_n \star f_1$ is the Fourier transform of $g_n = \frac{  \sin{(2\pi x)} \sin{(2 \pi nx)}}{\pi ^2 x^2}$  Show that $\| g_n \|_1 \to \infty$  Deduce that the Fourier transform is not surjective from $\mathcal{L}^1(\mathbb{R})$ to $C_0( \mathbb{R})$    Here, $C_0(\mathbb{R})$ is the space of continuous functions $f : \mathbb{R} \to \mathbb{R}$ that tends to $0$ at $-\infty$ and $+\infty$. I managed to compute 1) and proved 2). But I don't know how to prove 3). Moreover, I don't see how can 1), 2) and 3) prove 4). Can anyone help? What exactly happens to the signals hitting a common mode choke? I'm trying to better understand the principles behind the common mode choke. I made a few drawings to clarify.  &nbsp; Differential Mode Signals  Differential currents (driven by differential voltages) create equal but opposite magnetic fields B in the inductor core:    These magnetic fields cancel each other out, so the net flux in the core is zero. As such, these differential currents don't "feel" any impedance.  &nbsp; Common Mode Signals  In contrast, common mode currents generate equal and additive magnetic fields in the core. That's why they "feel" a high impedance, and cannot get through (or getting through means they are highly attenuated).    But what exactly happens? I have several theories, which I will describe below.  &nbsp; Common Mode Signals - Theory 1  My first thought would be that the common mode signal hits the choke and creates a magnetic flux inside. By doing this, lots of energy is lost (hysteresis and perhaps other effects) as heat. Only a small part gets through:      What kind of common mode choke would behave in this particular way? "Burning up" the voltage spike seems a very desirable effect to me.  &nbsp; Common Mode Signals - Theory 2  Perhaps the voltage spike doesn't really get the chance to build up much magnetic flux in the core, or maybe the core is simply not "lossy" enough. The voltage spike bounces off the core and turns back. Only small part gets through:    Although the system on the right side of the choke is protected, the system on the left has to deal with reflected signals. Nasty things like standing waves might appear.  &nbsp; My questions  I've got a few questions for you:   Do you think theory 1 or theory 2 is most plausible? Do you think certain types of common mode chokes tend to behave as described in theory 1, others like in theory 2? Perhaps both of my theories are just plain wrong. If so, what actually does happen?   Please enlighten me. Why do you need 2 resistors when hooking up a transistor as a switch What is the point of R2 in the following diagram:   I get that R1 controls the current to the Base, but what does R2 do? Long ago someone demonstrated the following card trick with a standard 52-card deck:  (1) A volunteer selects 5 cards from a shuffled deck, which the performer does not see.  (2) The assistant puts exactly 4 of those in a pile and passes it to the performer.  (3) The performer can then identify the 5th card.  There are a few ways to execute this trick, one of which goes as follows.  (1) The assistant finds a suit common to 2 of the 5 cards, with values $x$ and $y$ modulo $13$.  (2) He then removes one of them, say $x$, such that $x-y \in [1..6]$ modulo $13$.  (3) He then puts the other one at the top of the pile.  (4) And he puts the 3 other cards after that in a permutation corresponding to $x-y$ modulo $13$.  Since (1) works by pigeonhole, (2) works because $\frac{13-1}{2} = 6$, and (4) works because there are 6 possible permutations of 3 cards, the trick succeeds. My question is whether the same trick can work with more than 52 cards. It is not obvious to me how to do so, nor compute the maximum number of (pairwise distinct) cards possible. Also, it seems to me that even if the trick can be made to work for $n$ cards, it may not work for $n-1$ cards! Any ideas? Gimp won't allow me to copy and paste a transparent image On the latest version of GIMP on my PC, whenever I try to copy a transparent image from the internet, GIMP will automatically fill in the transparent areas with the background color I have selected.  This is a non-issue on my Mac, but I need to do this work on my PC, so how can I make it recognize the alpha of the image and not fill it with the background color?  The image canvas that I'm working with does have an alpha channel, but that does not seem to make a difference. Is it true that $aH = bH$ iff $ab^{-1} \in H$ Let $H$ be a subgroup of a group $G$. The I know that for $a,b\in G$ we have $aH = bH$ if and only if $a^{-1}b \in H$.  My question is if it is also true that $aH = bH$ if and only if $ab^{-1} \in H$? Does it matter where the $-1$ goes?  I am guessing that this is not true since we keep putting the $-1$ on the left element, but I am also thinking that it might be true because they look like the same.  If $G$ is abelian, then it doesn't matter, so a possible counter example would have to involve a non-abelian group. If $H$ is a normal subgroup, then it should also be true because then $a^{-1}bH = Ha^{-1}b$. Is there a proof from the first principle that the Lagrangian L = T - V? Passing multiple commands to gnome-terminal from a script My bash-script is not run in a terminal, but opens a terminal at runtime to ask for user input (sudo password). I would like to tell the user in this terminal what the script is trying to do. First, here is my script:  #!/bin/bash #This should install: Qt Linguist, lrelease  #for Qt Linguist dpkg-query -l qt4-dev-tools if echo $? == 0; then  check1=1 fi  #for lrelease dpkg-query -l qt4-default if echo $? == 0; then  check2=1 fi  echo $check1 echo $check2  if [ $check1 = 1 ] &amp;&amp; [ $check2 = 1 ];then  gnome-terminal -x sudo apt-get install qt4-dev-tools qt4-default fi $SHELL   This opens a terminal with this:  [sudo] password for "username":    But I would like to have:  qt4-dev-tools and qt4-default are missing. Now trying to install. [sudo] password for "username":    How do I get this when starting the terminal with gnome-terminal -x? Why is the product of all units of a finite field equal to $-1$? Suppose $F=\{0,a_1,\dots,a_{q-1}\}$ is a finite field with $q=p^n$ elements. I'm curious, why is the product of all elements of $F^\ast$ equal to $-1$? I know that $F^\ast$ is cyclic, say generated by $a$. Then the product in question can be written as  $$ a_1\cdots a_{q-1}=1\cdot a\cdot a^2\cdots a^{q-2}=a^{(q-2)(q-1)/2}. $$ However, I'm having trouble jumping from that product to $-1$. What is the key observation to make here? Thanks!