So I am currently learning a little about java and sql, using MySQL. I wrote a function to insert a new row into a table using a prepared statement. I created an array for the values I want to put in so I can loop over them. Since the columns have differing datatypes, I tried using the getMetaData().getColumnTypeName() method to use the appropriate function for the datatype, but it just gives me a null pointer exception.  I tried using the same approach in a regular statement using ResultSet and it worked just fine. Here is my function:  public void insertCustomer() {     try {         ps = connection.prepareStatement("INSERT INTO customers(customerNumber, customerName, contactLastName, contactFirstName," +                 " phone, addressLine1, addressLine2, city, state, postalCode, country, " +                 " creditLimit) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");          String[] columns = {"customerNumber(int)", "customerName(String)", "contactLastName(String)",                 "contactFirstName(String)", "phone(String)", "addressLine1(String)", "addressLine2(String)",                 "city(String)", "state(String)", "postalCode(String)", "country(String)", "creditLimit(double)"};          String[] values = new String[12];          for(int i = 0; i &lt; columns.length; i++) {             System.out.print("Enter " + columns[i] + ": ");             values[i] = input.nextLine();              /* Gives NullPointerException             if(ps.getMetaData().getColumnTypeName(i + 1).equals("INT"))                 ps.setInt(i + 1, Integer.parseInt(values[i]));              if(ps.getMetaData().getColumnTypeName(i + 1).equals("VARCHAR"))                 ps.setString(i + 1, values[i]);              if(ps.getMetaData().getColumnTypeName(i + 1).equals("DOUBLE"))                 ps.setDouble(i + 1, Double.parseDouble(values[i]));*/         }          ps.setInt(1, Integer.parseInt(values[0]));         ps.setDouble(12, Double.parseDouble(values[11]));          for(int i = 1; i &lt; values.length - 1; i++) {             ps.setString(i + 1, values[i]);         }          ps.executeUpdate();     } catch(SQLException e) {         e.printStackTrace();     } catch(Exception e) {         e.printStackTrace();     } }   I commented out the code giving me the exception. They should replace the 5 lines of code below the if statements.  Again, Im really new to SQL and Java so keep that in mind :)
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?
What kind of behaviour causes an interrupted exception? I'm relatively new to Threading in Java and I've noticed that everytime I use Thread.sleep() I have to catch InterrupetdException.  What kind of behaviour causes this, and in simple applications where I have a monitor thread can I just Ignore the exception? When a Battle Master fighter gets a critical hit and uses a maneuver that adds a superiority die to the damage, is that damage die doubled? The Battle Master fighter has access to a number of maneuvers that add a superiority die to the damage roll. For instance, the Trip Attack maneuver says (PHB, p. 74):     When you hit a creature with a weapon attack, you can expend one   superiority die to attempt to knock the target down. You add the   superiority die to the attack’s damage roll, and if the target is   Large or smaller, it must make a Strength saving throw. On a failed   save, you knock the target prone.   The Critical Hits rule states (PHB, p. 196):     When you score a critical hit, you get to roll extra dice for the   attack’s damage against the target. Roll all of the attack’s damage   dice twice and add them together. Then add any relevant modifiers as   normal. [...] If the attack involves other damage dice, such as from   the rogue’s Sneak Attack feature, you roll those dice twice as well.   During our game, the fighter PC rolled a critical hit. He then wanted to use a superiority die to use the Trip Attack maneuver to trip the enemy. Based on the above rules, is the damage from the superiority die also doubled?  I'm assuming the answer is yes based on the last statement in the Critical Hits section, but I wanted to confirm. Search All Fields In All Tables For A Specific Value (Oracle) Is it possible to search every field of every table for a particular value in Oracle?  There are hundreds of tables with thousands of rows in some tables so I know this could take a very long time to query. But the only thing I know is that a value for the field I would like to query against is 1/22/2008P09RR8. &lt;  I've tried using this statement below to find an appropriate column based on what I think it should be named but it returned no results.  SELECT * from dba_objects  WHERE object_name like '%DTN%'   There is absolutely no documentation on this database and I have no idea where this field is being pulled from.  Any thoughts? In D&amp;D 4E as with many RPGs, characters have a fixed armour value or AC. When attacking, the attacker must roll a die to overcome the target's AC. In 4E offensive magic works the same way: the target has a fixed Fortitude/Reflex/Will defence determined by their stats, and in order to hit, the attacker rolls to overcome whichever defence is relevant.   However it was not always like this. Some spells in 3E and now again in 5E work the opposite way. In those editions the target is the one who rolls against a fixed value determined by the caster's stats, in order to avoid spell-damage.  Both methods compare the attacker and target's stats, and have an element of randomness. I personally like the 4E system as it simplifies combat without leaving anything out. Why was the decision made, when designing the early D&amp;D editions (and still when iterating upwards into (A)D&amp;D 1e&ndash;3e), to use saving throws to control spells?  Answers should consist of designer quotes and not personal opinions. MicroSD card is set to Read-only state. How can I write data on it? I have a MicroSD card reader in my notebook. When I insert a MicroSD memory card into it, I can't write any data on it - it's read-only. The same thing happens when I try to do it under root. And I can't change the permission policy for it. This problem happens for all microSD cards (I've tested 2 cards). I've encountered it on Ubuntu 12.04 LTS, now I'm on Ubuntu 12.10, the problem is still on it's place. When I try to insert such a "read-only" card in my mobile phone, everything's OK and I can write data on it. So, can anybody tell me, how can I write a data onto the card?  UPD: here's fdisk -l output:  Disk /dev/sdc1: 2013 MB, 2013135360 bytes 62 heads, 62 sectors/track, 1022 cylinders, total 3931905 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000   Device Boot      Start         End      Blocks   Id  System   The file system of the card is msdos. As to me it's weird.   UPD2: I've found a small "lock" switch on my card adapter, and it turns out, that when I insert it in my notebook, it switches on. Perhaps, I have to find some glue or something to get that switch stuck...  UPD3: There was no glue near me, so I've decided to buy another card-reader. This code won't compile:  \documentclass{article} \usepackage{listings} \lstset{     language=C,     basicstyle=\small }  \begin{document} lorem ipsum\footnote{% \begin{lstlisting} // some C code or whatever... printf("Blah blah\n"); \end{lstlisting}} \end{document}   It says Illegal parameter number in definition of \lst@insertargs. I know listings is really picky about where it goes, but there must be a way to cram a listing into a footnote, right?  (This is a MWE and my tex files are a bit more complex; my actual error is Paragraph ended before \lst@next was complete. but they are hopefully related; I couldn't get this error with the MWE.) How can I create a select menu in a shell script? I'm creating a simple bash script and I want to create a select menu in it, like this:  $./script  echo "Choose your option:"  1) Option 1   2) Option 2   3) Option 3   4) Quit     And according to user's choice, I want different actions to be executed. I'm a bash shell scripting noob, I've searched the web for some answers, but got nothing really concrete. Why {are you / you are} making noise? Is there local file manipulation that's been done with JavaScript? I'm looking for a solution that can be accomplished with no install footprint like requiring .  Specifically, I'd like to read the contents from a file and write those contents to another file. At this point I'm not worried about gaining permissions and am just assuming I already have full permissions to these files. Great Expectations [is written vs has been written] by Charles Dickens I had a grammar quiz at the university today.    One of the questions was:     "Great Expectations" ____ by Charles Dickens.      a) is written   b) has been written   c) was written    Undoubtedly, the c option isn't correct since the time (the publication date) isn't stated or implied.  I crossed the a option out because it is neither a general truth nor a law. It is not a well-known fact to use present simple here.  Finally, I have chosen b. I still have doubts if a is the only right option.   It is unclear to me. Could you clarify it? Any help would be appreciated. Why would the command "ls *" generate an error about invalid options? There is a thread that talks about ls "*" not showing any files, but I actually wonder why the simple  ls *   command doesn't output anything in my terminal other than  ls: invalid option -- '|' Try 'ls --help' for more information.   while   ls   will list all the files in the current directories as    1                  ferol                      readme.txt  2                  fichier                    sarku  2018               GameShell                  Templates  22223333          '-|h4k3r|-'                 test  3                  hs_err_pid2301.log         test2  CA.txt             important.top.secret.txt   toto.text  CA.zip             JavaBlueJProject           tp1_inf1070  countryInfo.txt    liendur                   'tp1_inf1070_A19(2) (1)'  currency           liensymbolique             tp1_inf1070_A19.tar  curreny            LOL                        Videos  Desktop            Longueuil                 'VirtualBox VMs'  Documents          Music                      words  douffos            numbers                    Zip.zip  Downloads          Pictures  examples.desktop   Public   Any ideas as to why the globbing doesn't take effect here? I'm on Ubuntu, working in the terminal, I don't know if it makes a difference.  Thanks. Is there a way to save selection by faces I'm trying to find a way to save selection faces, tried Vertex Group, the issue with Vertex Group is that it adds the faces that are marked by 4 vertices that are added to the Vertex Group, there are some cases were this doesn't apply, the image explains what I mean. So is there a way to save my selected faces, so I don't have to go through the whole process of reselecting them each time I need to do so? If you check the image, I didn't assign the hatched faces to the Vertex Group, still when I select the Vertex Group, they get selected, I understand that they got selected because the four boundary vertices are assigned to the Vertex Group, I need to save only face selection, not vertex selection. Baryons have charges that are the result of a polynomial calculation of their building blocks (quarks)'s fractional charges. But what gives these quarks electric charges? What interactions do they have with photons? And what about leptons, like muons and electrons? How do they get their -1 charge? And then, how do positrons and anti-muons get +1 charge? Same goes for quarks: how does up-antiquarks get -2/3 charge? Or I may want to formulate my question this way:  How does any elementary particle interact with the EM-Force to get an electric charge? Batch Rename Files in Folder How to achieve this smudge effect in photoshop? I came across this photo by Jacob Sutton and wanted to know if someone knew how to get this effect in photoshop?    (source: ) What's the rationale for requiring that a field be a $\boldsymbol{non}$-$\boldsymbol{trivial}$ ring? The title pretty much says it all.  Of course, one answer (IMO unsatisfactory) to such questions goes something like "a definition is a definition, period."  In my experience, mathematical definitions are rarely completely arbitrary.  Therefore I figure there must be a good reason for insisting that a field be a non-trivial ring (among other things), but it's not obvious to me.  I realize that a trivial ring would make for a very boring field, but it is also a rather boring ring, and yet it is not disallowed as such.  EDIT: I found a hint of a rationale in the statement that "the zero ring ... does not behave like a finite field," but I could not find in the  for this assertion exactly how the zero ring fails to behave like a finite field. Gray cone obscuring/clipping the 3D Viewport When looking at my objects in 3d view I'm seeing a gray cone that seems to be hiding other objects.   Can anyone help me turn this off and explain what it is please.  Screenshots attached. math behind complex numbers C||RLC I have a mathematical problem with the following formula. The goal is to transform this equation to have a seperated real and imaginary part. I have already done this with several other equasions, but for this particualar one I don't know where to start.  I dont expect you to do the complete work of transforming for me, it would already be very nice if you could give me a hind on how you would start.  Thank you in advance!  C||RLC      This is my current progress:    My question is:  How can I get rid of the imaginary part jωC2*R?  When the denominator is completely real I can just split up the formula and have an imaginary and a real part. Showing that $f_0 (x_1, \ldots, x_m) \mathrm tr A =\displaystyle{ \sum_{i=1}^n} f_0(x_1, \ldots, Ax_i,\ldots, x_m)$ Question:  Consider $f: (-\epsilon, \epsilon) \to \mathbb R^{m^2}$ a differentiable path of matrices $m \times m$ such that $f(0) = I_m$ and the function $g: I \to \mathbb R$ is defined by $$g(t) = \det f(t)$$  Show that $g'(0) = \mathrm{tr} \,a $ (trace of the matrix $a$), where $a = f'(0)$.   Attempt:  First we use that $\det f(t) = \det (f_1(t), \ldots, f_m(t)) $, where $f_i$ is the $i$-th row of the matrix $f(t)$ $m \times m$. Considering the operator $': \mathbb R^m \to \mathbb R^m$, $f(t) \mapsto f'(t)$  With this in mind $$\begin{align}g'(t) = \det'f(t) &amp;= \sum_{i=1}^{m} \det (f_1(t),\ldots,f'_i(t),\ldots, f_m(t)) \\&amp;\underbrace{=}_{(*)}\det(f_1(t), \ldots, f_m(t))\, \mathrm tr f'(t) \end{align}$$  For $t = 0$ we have   $$\begin{align}g'(0) &amp;=\det(e_1, \ldots, e_m) \,\mathrm tr f'(0) \\&amp;= 1 \dot\, \mathrm tr \,a \\&amp; = \mathrm tr \, a\end{align}$$  I'm trying to come up with a proof using the fact that $\det$ is a $m$-linear form.   In order to prove $(*)$ I need the following equality, which according to this  holds.   If $A: V \to V$ is a linear operator and $f_0$ is a alternated $m$-linear form, such that $f_0 (e_1, \ldots, e_m) = 1$ then   $$f_0 (x_1, \ldots, x_m) \mathrm tr A = \sum_{i=1}^m f_0(x_1, \ldots, Ax_i,\ldots, x_m) $$  Could someone give a proof to this? What is so special about speed of light in vacuum?