i have problem with my android studio i want to passing data with parcel but it cant cause i get this message if i click my list view always get force close, how to fix it?  error          package com.example.moviee;  import androidx.appcompat.app.AppCompatActivity;  import android.os.Bundle; import android.widget.ImageView; import android.widget.TextView;  import java.util.ArrayList;  public class MovieDetail extends AppCompatActivity {      String txt_name;     String txt_deskripsi;     int foto;      public static final String EXTRA_MOVIE = "text_extra_movie";      TextView tvName, txt_detail;     ImageView imgposter;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_movie_detail);          tvName = findViewById(R.id.text_ph);         txt_detail = findViewById(R.id.txt_deksrip);         imgposter = findViewById(R.id.img_poster);          ArrayList&lt;Film&gt; film = new ArrayList&lt;&gt;();         film = this.getIntent().getParcelableArrayListExtra(EXTRA_MOVIE);          txt_name = film.get(0).getNama();         tvName.setText(txt_name);          txt_deskripsi = film.get(0).getDeskripsi();         txt_detail.setText(txt_deskripsi);          foto = film.get(0).getFilm();         imgposter.setImageResource(foto);     } }   movieDetail.java      package com.example.moviee;  import androidx.appcompat.app.AppCompatActivity;  import android.content.Intent; import android.content.res.TypedArray; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList;   public class MainActivity extends AppCompatActivity implements View.OnClickListener {     private FilmAdapter adapter;     private String[] dataNama;     private String[] dataDeskrip;     private TypedArray dataPhoto;     private ArrayList&lt;Film&gt; filmed;      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);           adapter = new FilmAdapter(this);         ListView listView = findViewById(R.id.lv_list);         listView.setAdapter(adapter);          prepare();         addItem();          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {             @Override             public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {                 Intent intent = new Intent(MainActivity.this, MovieDetail.class);                 ArrayList&lt;Film&gt; movies = new ArrayList&lt;Film&gt;();                  Film movie = new Film();                 movie.setFilm(dataPhoto.getResourceId(i, -1));                 movie.setNama(dataNama[i]);                 movie.setDeskripsi(dataDeskrip[i]);                   movies.add(movie);                 intent.putParcelableArrayListExtra(MovieDetail.EXTRA_MOVIE, movies);                 startActivity(intent);             }         });     }      @Override     public void onClick(View v) {     }     private void addItem(){         ArrayList&lt;Film&gt; films = new ArrayList&lt;&gt;();          for (int i = 0; i &lt; dataNama.length; i++){             Film film = new Film();             film.setFilm(dataPhoto.getResourceId(i, -1));             film.setNama(dataNama[i]);             film.setDeskripsi(dataDeskrip[i]);             films.add(film);         }         adapter.setFilms(films);     }       private void prepare(){         dataNama = getResources().getStringArray(R.array.data_film);         dataDeskrip = getResources().getStringArray(R.array.data_deskripsi);         dataPhoto = getResources().obtainTypedArray(R.array.data_foto);     } }   mainactivity.java
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?
Suppose that C is a closed convex subset of $\mathbb R^n$ and $x \in \mathbb R^n$. The projection of $\mathbf x$ onto C is the closest point $\mathbf y \in C : \mathbf z = \mathbf y$ minimizes ||$\mathbf z - \mathbf x$||$_2$ over all $\mathbf z \in C$.  (a) Show that the minimum exists.  (b) Show that there is only one minimizer: that is, show that if $\mathbf y_1$ and $\mathbf y_2$ both minimize ||$\mathbf x - \mathbf z$|| then $\mathbf y_1 = \mathbf y_2$   My ideas:  For (a), to show that the minimum exists I will need to show that it is closed and bounded. We already know it's closed because C is a closed convex subset so I just need to show it's bounded. Am I wanting to minimize ||$\mathbf x - \mathbf z$||$_2$? This is just the Euclidean norm which would be $\sqrt{(\mathbf z - \mathbf x)^2}$=$\sqrt{\mathbf z^2 -\mathbf z \mathbf x -\mathbf x \mathbf z + \mathbf x^2}$. I'm not sure where to go from here...  For (b) I want to use proof by contradiction- so I will assume that $\mathbf y_1$ and  $\mathbf y_2$ both minimize the function and then I'll somehow see that they are in fact equal. How do I set up this argument? How do I automate a key press in AppleScript? Let $X$ be a beta distributed variable with parameters $a$, $b$. Let $Y$ be a beta distributed variable with parameters $c$, $d$. Let $Z = \max(X, Y)$.  Does anybody know of a fast way to compute the mean and variance of $Z$ given $(a, b, c, d)$?  $X$, $Y$ don't necessarily need to have beta distributions, but they should be similar -- in $[0, 1]$.  What I really want to find is a way to quickly approximate the distribution of the sample max of a bunch of random variables. Let $Z = \max(\{X_1, X_2,\dots , X_n\})$. If I know parameters (not necessarily beta-distribution) for $X_1, X_2,\dots, X_n$, can I quickly compute a set of parameters (same distribution as $X_i$) to form a distribution that closely approximates $Z$?    EDIT: To clarify, the purpose of this has to do with programming AI for board games. If we are evaluating a position in a chess game and we determine one move leads to a 60% chance of winning while all others have a 20% chance of winning, then we value the position as a 60% win. This is the minimax algorithm... However, what I'm curious about is whether this can be improved upon. In the simple case, we approximate: $$ \mu_c = \max(\{\mu_1, \mu_2,\dots, \mu_n\}) $$ where $\mu_c$ is the expectation from the current position and $\mu_i$ is the expectation from each of the sub-trees.  It seems like we should be able to do better than this. Can we find a function f that replaces max and closely approximates parameters for the distribution of the sample maximum? $$ (\mu_c, \sigma_c) = f\left(\{(\mu_1,\sigma_1), (\mu_2,\sigma_2), \dots, (\mu_n, \sigma_n)\}\right) $$ In this case, we still want $\mu_i$ to be the expectation from each of the nodes. However, $\sigma_i$ does not necessarily need to be variance/standard deviation; just a parameter that represents uncertainty.  Just as: $$ \max(\{a, b, c\}) = \max\left(\{\max(\{a, b\}), c\}\right) $$ We should expect: $$ f\left(\{a, b, c\}\right) \approx f\left(\{f(\{a, b\}), c\}\right) $$ So $f$ does not necessarily need to take parameters for more than two nodes.  One thing, however, is that $f$ should be relatively fast to compute. If the integrals must be calculated, I think doing double exponential integration might work well, but I'm not sure -- Express $x^8-x$ as a product of irreducibles in $\Bbb Z_2[x]$ Express $x^8-x$ as a product of irreducibles in $\Bbb Z_2[x]$.  Work so far:  $$x^8 - x = x(x^7 - 1) = x(x - 1)(x^6+x^5+x^4+x^3+x^2+x+1)$$  From here, I think the Zeros of an Irreducible over a splitting field Theorem would be the method. I am unsure how to proceed Whenever I try to Get then Install any app from the App Store, I get this message:     We could not complete your purchase.  cancelled   I did some searching online, but barely found any useful hits. What is this about?! I need to test this code, but when writing a trigger, I get an invalid type I need help. I am currently trying to test this code before uploading  public class CoreValuesExt { ApexPages.StandardController sc; public boolean readonly {get; set;} public Core_Values__c cv {get; set;} public integer countEdit = 1; public string buttonValue {get; set;} public integer recordScan;  public CoreValuesExt(ApexPages.StandardController sc) {     this.sc = sc;     cv = new Core_Values__c();     cv.Account__c = sc.getid();      readonly = true;     buttonValue = 'Edit';     recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];    if (recordScan != 0){    cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];     }  }  public ApexPages.PageReference Save() {     return sc.Save(); }  public void ApplyAction() {     countEdit++;     Integer modolus = Math.mod(countEdit, 2);     String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;     if(modolus == 0)     {         readonly = false;         buttonValue = 'Save';     }     else     {         if(total != 'nullnullnullnullnullnull')            {         if (recordScan == 0){         insert cv;         readonly = true;         buttonValue = 'Edit';         }         else         {         update cv;         readonly = true;         buttonValue = 'Edit';         }         }     }    }   }  With this trigger.  trigger CoreValuesTrigger on Core_Values__c (before insert) {  Core_Values__c cvs = Trigger.new; CoreValuesExt.ApplyAction(cvs);  }   But when I try to save, I get a message saying:      Illegal assignment from List to   CoreValuesExt__Core_Values__c at line 3 column 1   "  How do I go through with this? I need help. Thanks Is it possible to search by posts that contain an image? Sometimes when going back through e.g. my previous answers to find some information, I know the question I am looking for contains an image, and I know the language tag, but I'm a little hazy on the other parameters.    Is there a search option to restrict results to only those posts that contain an image? Akin to filtering email to show only those with attachments I guess.  I see that with  you can filter by user, votes, answer count or whether a question has an accepted answer, or has been closed or migrated. But not images? Tag hierarchy to browse through tags Possible Duplicate:          Since so many thousands of tags and topics exist, it would be really useful to visually browse through tags by organizing them into a , or hierarchical map. This drill-down map would make it easier to find the tag/subtopic you want or just generally browse within the topics you're interested in.  So we could nest all "visual-studio-2008" and "visual-studio-2003" tags into "visual-studio", which would be under "dev-tools". Something like how Wikipedia's categories have sub-categories. Is it "to play a game on someone" or "play games with someone"? I find this expression strange because it's clearly widely used, but seems sort of "unofficial", the "official" version, meaning the one described in dictionaries and grammar books, being playing games with, not on.  Both expressions seem to be current and valid, according to Google Books. I'm just not entirely clear on the context and the usage.  My understanding is that playing games with implies some sort of tricky, mischievous behavior, which may or may not be intentionally malicious, like office politics or standing someone up on a date ("Jane didn't show up...again. Is she playing games with me?"), while playing games on implies a form of studied deception. ("The ad said that the comic book was in mint condition but there are barely noticeable tears... are they trying to play a game on me?") What requests do browsers' "F5" and "Ctrl + F5" refreshes generate? Is there a standard for what actions F5 and Ctrl + F5 trigger in web browsers?  I once did experiment in IE6 and Firefox 2.x. The F5  refresh would trigger a HTTP request sent to the server with an If-Modified-Since header, while Ctrl + F5 would not have such a header. In my understanding, F5  will try to utilize cached content as much as possible, while Ctrl + F5  is intended to abandon all cached content and just retrieve all content from the servers again.   But today, I noticed that in some of the latest browsers (Chrome, IE8) it doesn't work in this way anymore. Both F5 and Ctrl + F5 send the If-Modified-Since header.   So how is this supposed to work, or (if there is no standard) how do the major browsers differ in how they implement these refresh features? How do I perform a Perl substitution on a string while keeping the original? Verbless sentence I thought I heard my teacher said: 'Don't construct a sentence without a verb.'  Is there such rule in english grammar?     She looks like 70 years old. Perhaps older.   How about the question above? Is it correct? Is there any book that can be used references for wide range of topics in grammar(including syntax, morphology et cetera)? I have finished oxford grammar in use recently and think it wasn't enough for me. My players have been scheming with rapid entry tactics for the megadungeon I've recently started running. Unfortunately, the monsters are aware of the adventurers, and this has lead to a weird question of priority. Given the following situation (which I'm pretty sure is going to happen next session in some form or another) what happens?     Alice the adventurer readies an action; if her teammate Carlos opens   the door, she's going to throw the alchemists fire through the door,   which should do enough damage to kill any goblins hiding there.      Meanwhile, on the other side of the door, Bob the goblin is lying in   wait. He readies an action; if the door opens, he's going to hit the   switch to open the trapdoor in the next room, which should drop any    pesky adventurers into a pit with spikes at the bottom.      Carlos opens the door.   I know what happens when , but what happens when multiple readied actions get triggered at the same time? My guess would be an opposed reflex save or initiative check of some kind to see who goes first, but that's entirely just intuition speaking. The rulebook doesn't seem to speak to the issue. Should individual letters be preceded with "an"? I was reading a comic book and I noticed that the author used "an A" and "an N" in a particular phrase (screenshot below). While I understand the usage of "An A" here (A being a vowel and what not) and "N" having a pronunciation which has a sound similar to "A".  Since most of English alphabets have pronunciations which start with a syllable similar to one of the vowels or semi-vowels; is it OK to prefix the letters using "An"?  For eg. An X, or An Y.        Zenescope's Grimm Fairy Tales - Werewolves: The Hunger, page #8 (Click to enlarge) Let $A [a_{i,j}]$  and $B =[b_{ij}]$   be two diagonal matrices in   $M_n(F)$. Let $i \ne j \in \left\{1, \ldots, n \right\}$. Using the   product rule, we obtain      $$(AB)_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj}$$      We claim that $a_{ik}b_{kj} =0$ for all $k \in \left\{1, \ldots, n \right\}$ thus $(AB)_{ij}=0$ for all $i \ne j$ and $AB$ is diagonal. To    prove the claim, note that since $i \ne j$ , we have $i \ne k$ or $    k\ne j$. Thus either $a_{ik} = 0$ (since $A$ is diagonal) or $b_{kj} =  0$ (since $B$ is diagonal), thus in all cases $a_{ik}b_{kj}=0$ and the   claim is proved.   Where does the bit "we have $i \ne k$ or $k\ne j$" come from? I understand that since $i \ne j$, and $k$ and $j$ run over the same set of natural numbers, we also have $i \ne k$. But the "or $k \ne j$" baffles me. I understand that $k \ne j$ implies that we can have $i=k$. But that's from the other direction ($\Longleftarrow).$  Also, when it says $a_{ik}=0$ or $b_{kj}=0$ it's talking about when $i \ne k$ or $k \ne j$ right? Many thanks. Subscribing to questions and comments that don't belong to you cd in bash script without alias, function, source I've written a bash script which should cd me to a directory.   My problem is that only the directory in the subshell changes.  I've read of many similar problems to this, but I want to know if there is a solution besides using an alias, a function or sourcing the script.  If you don't understand what I mean, here's an example:  user@linux ~: cat ./myscript.sh #!/bin/bash cd /any/directory user@linux ~: ./myscript.sh user@linux ~:    Please note that my script is much longer, so I don't want to use a function! Comma before which I'm not sure which of the following sentences is correct. Is the comma mandatory, optional or unnecessary? I've googled a bit about this topic, but I got confused.     Our mapping contains 2000 words, which map to more than one lemma.   or     Our mapping contains 2000 words which map to more than one lemma.   Context: In total, there are more than 2000 words.  I've read  . If I understand the answers correctly, my "which map to more than one lemma" is a defining clause and no comma is required. But is it wrong to add one? I have several covariates in my calculation for a model, and not all of them are statistically significant.  Should I remove those that are not?  This question discusses the phenomenon, but does not answer my question:   There is nothing in the answer to that question that suggests that non-significant covariates be taken out, though, so right now I am inclined to believe that they should stay in.  Before even reading that answer, I was thinking the same since a covariate can still explain some of the variance (and thus help the model) without necessarily explaining an amount beyond some threshold (the significance threshold, which I see as not applicable to covariates).  There is another question somewhere on CV for which the answer seems to imply that covariates should be kept in regardless of significance, but it is not clear on that.  (I want to link to that question, but I was not able to track it down again just now.)  So...   Should covariates that do not show as statistically significant be kept in the calculation for the model?  (I have edited this question to clarify that covariates are never in the model output by the calculation anyway.)  To add complication, what if the covariates are statistically significant for some subsets of the data (subsets which have to be processed separately).  I would default to keeping such a covariate, otherwise either different models would have to be used or you would have a statistically significant covariate missing in one of the cases.  If you also have an answer for this split case, though, please mention it. Is there anything like “cubic formula”?