please help me.i write this code :  public class MainActivity extends AppCompatActivity {      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         File dir=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);         File[] files=dir.listFiles();         Toast.makeText(this,files.length+"",Toast.LENGTH_LONG).show();      } }   and it has this error :  Caused by: java.lang.NullPointerException     at ir.itpro.videosample.MainActivity.onCreate(MainActivity.java:20)   i put 3 files in directory downloads .  how to fix it now??
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?
Fast way to find period-n points of a tent map? I need to find a period-3 orbit for a tent map defined by $$T(x)=\begin{cases}2x &amp; 0\le x\le0.5 \\[2ex] 2-2x &amp;0.5 &lt; x \le 1 \end{cases}$$  So, what is a fast and efficient way of finding it? I only know how to do it by guessing-and-checking. For example, I picked a random point, $x = \frac{2}{7}$ and found that $$T\left(\frac{2}{7}\right)=\frac{4}{7}\\[4ex]T\left(\frac{4}{7}\right)=\frac{6}{7}\\[4ex]T\left(\frac{6}{7}\right)=\frac{2}{7}$$ which is a period-3 orbit. Is there any better way of finding a period-3 orbit , more specifically, a period-3 point? Using expect to pass a password to ssh How can I install Ubuntu without removing Windows? I need my pre-installed version of Windows 7 (or any other version of Windows), how could I install Ubuntu without erasing it? `time echo` got no output Pixelated wallpaper/background I installed Ubuntu 14.04 on my Lenovo IdeaPad Y510P today. Everything worked fine, but after installing my graphics card driver the background became pixelated (Nvidia GeForce GT755m). I downloaded the driver through Additional Drivers and selected Version 331.113 (Proprietary, tested). It was using Nouveau before.  When I apply Nouveau it becomes clean again, but it is much weaker when I open games, it gives me very low FPS even in Counter-Strike. With Nvidia driver FPS and everything else seems fine, except things look pixelated and when I minimize windows and maximize again, the window goes black.    I attempted to solve the problem myself by removing the old Nvidia driver and manually installing the latest version, but it did not help.  Please let me know if you need more details. When visiting my profile on the mobile app, my hat scrolls with the page:    It doesn't stay linked to my icon at the top. I'm on an iPhone 6+ running iOS 9.2 and version 1.4.1 of the SE app. Allow retracting a moderator flag if the post has been deleted and I don't have enough reputation to see deleted posts Currently, custom flags for moderator attention are not automatically invalidated (marked helpful) when a post gets deleted. Ordinarily, one can retract a moderator flag by going to the post, clicking &quot;flag&quot;, and then &quot;Retract Flag&quot;. This works even if the post has been deleted, provided they can see the post (they have 10,000+ rep, it's their own post, or they have answered it). However, it's not possible to self-remove a flag on a deleted post if they can't see the deleted post, because they can't get to the &quot;flag&quot; button. Is this intended? If not, can this ability please be implemented? As Aurora0001 commented, there is no server-side check, the button is just not visible. Can this please be implemented on the website, or is the fact that it's possible server-side a bug that will soon be fixed by removing it? Export each image from a collection in Google Earth Engine I am trying to export each image in a filtered stack of Sentinel-1 images and cannot seem to get it right.   suggests using imageCollection.map() and a custom function (such as a geometric clip).  // Create a geometry representing an export region. var roi = ee.Geometry.Rectangle([-63.0, 9.2, -63.1, 9.3]);   // Load the Sentinel-1 ImageCollection. var sentinel1 = ee.ImageCollection('COPERNICUS/S1_GRD');   // Filter by metadata properties. var IW_H = sentinel1   // Filter to get images with VV and VH dual polarization.   .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))   .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))   // Filter to get images collected in interferometric wide swath mode.   .filter(ee.Filter.eq('instrumentMode', 'IW'))   // Filter IWs to get High res.   .filter(ee.Filter.eq('resolution', 'H'))   // Filter IW-Highs to get 10m res   .filter(ee.Filter.eq('resolution_meters', 10));   // Filter to get images from different look angles  var DescCollection = IW_H.filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'));   var ClipFunc = function(iImage, geom) {   var iClip = clip(iImage, geom);   return(iClip); };   imageCollection.map(ClipFunc(DescCollection, roi)); I'm trying to remember the name of a series of books about a boy who works with dragons.  Dragon's blood (or maybe it was slobber?) is acidic, and the children who wrangle these dragons often end up with deep pock marks.  On this world, days are like ours but nights get very cold, requiring anyone stuck outside to find a shelter until dawn (not the false dawn)  The other thing I remember is that in one of the books by slicing open a dragon and spending the night, the character emerged with special dragon powers. Post apocalyptic journey in search of knowledge from fallen society (ours) I'm racking my memory for a post-apocalyptic novel that I borrowed from a library maybe 15 years ago, but I'm sure it was published a few years before that though (maybe early 90s?).  I remember a party of people travelling across the flooded USA after some kind of apocalypse (climate change/flooding?). Towards the end of the book the group makes their way to New York(?) and finds a partially flooded library, discovering a set of books that gives hope for the return/rebuilding of society. I have a simple question.     over centuries / for centuries   what is the difference?  Thank you. What determines which frames are inertial frames? I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2. Malus Law in Michelson Morley experiment My book of physics (I don't quote it here, since it is in Catalan) says  that in the 1887 Michelson - Morley experiment, after getting the transversal and longitudinal phase shifts, they claim that the number of fringer observed will belong to the number of times that both phase shifts contains 2 pi because that is the phase two maximums  repeat. My question is: why is here said that waves should form maximums? Because as I understand it, the expected result was to obtain a destructive interference whose phase shift could be jsed to determine Earth's velocity. If they were expecting a destructive interference, shouldn't the book use the phase two minimums repeat? How can I get ssh-agent working over ssh and in tmux (on OS X)? I have a private key set up for my github account, the passphrase to which is, I believe, stored in OS X's keychain. I certainly don't have to type it in when I open a terminal window and enter ssh git@github.com.  However, when I'm running bash over an ssh session, or locally inside a tmux session, I have to type in the passphrase every single time I attempt to ssh to github.   suggests that a similar problem exists with screen, but I don't really understand the issue well enough to fix it in tmux. There's also  which includes a fairly complicated solution, but for zsh.  EDIT:  In response to , from a local terminal I get the following output:  [~] $ echo $SSH_AUTH_SOCK /tmp/launch-S4HBD6/Listeners [~]  $ ssh-add -l 2048 [my key fingerprint] /Users/richie/.ssh/id_rsa (RSA) [~] $ typeset -p SSH_AUTH_SOCK declare -x SSH_AUTH_SOCK="/tmp/launch-S4HBD6/Listeners"   Whereas over ssh or in tmux I get:  [~] $ echo $SSH_AUTH_SOCK  [~] $ ssh-add -l Could not open a connection to your authentication agent. [~] $ typeset -p SSH_AUTH_SOCK bash: typeset: SSH_AUTH_SOCK: not found   echo $SSH_AGENT_PID returns nothing whatever shell I run it from. the output when I start firefox from Terminal What is a complete list of the usual assumptions for linear regression? When to use a GAM vs GLM I realize this may be a potentially broad question, but I was wondering whether there are assumptions that indicate the use of a GAM (Generalized additive model) over a GLM (Generalized linear model)? Someone recently told me that GAMs should only be used when I assume the data structure to be &quot;additive&quot;, i.e. I expect additions of x to predict y. Another person pointed out that a GAM does a different type of regression analysis than a GLM, and that a GLM is preferred when linearity can be assumed. In the past I have been using a GAM for ecological data, e.g.:  continuous time-series when the data did not have a linear shape I had multiple x to predict my y that I thought to have some nonlinear interaction that I could visualize using &quot;surface plots&quot; together with a statistical test  I obviously don't have a great understanding of what a GAM does different than a GLM. I believe it's a valid statistical test, (and I see an increase in the use GAMs, at least in ecological journals), but I need to know better when its use is indicated over other regression analyses. Where can I leave luggage in Frankfurt, either airport or train station? I need to find a place to leave my luggage in lockers for 2 days in Frankfurt, either the airport (Terminal 1) or at the train station. I have to go by train to Stuttgart for 2 days without luggage. The luggage is 5 bags, 28 inches. Points disappear when zooming past certain scale in ArcMap? My points are disappearing when I zoom in past 300,000 in ArcMap.  I tried to repair geometry, but it doesn't fix anything?    I also checked the scale extents and those are turned off.  I can export the points to a new shapefile/feature class, but I'd like to not have to do that.    I'm using 10.1 on Windows 7 x64.