I'm trying to generate placeholders in clause IN then set values. It seems working but finally returns one less row. I can't use setArray method as it's Oracle and I can't modify db.  Code below. public void loadObject(Connection connection, number1, number2, commentCodeList)  throws SQLException{     String sqlToFind = &quot;SELECT DISTINCT ccommid FROM COMMENT WHERE number = ? \n&quot; +             &quot;AND number2 = ? AND ccommid IN (%s)&quot;;      String sql = String.format(sqlToFind, preparePlaceHolders(commentCodeList.size()));      PreparedStatement preparedStatement = connection.prepareStatement(sql);     preparedStatement.setInt(1, number1);     preparedStatement.setInt(2, number2);     setValues(preparedStatement, commentCodeList.toArray());      ResultSet resultSet = preparedStatement.executeQuery();      while(resultSet.next()){         Comment comment = new Comment();         comment.setCcommid(resultSet.getString(1));         commentList.add(comment);     } }  private String preparePlaceHolders(int size){     StringBuilder builder = new StringBuilder();     for (int i = 0; i &lt; size;) {         builder.append(&quot;?&quot;);         if (++i &lt; size) {             builder.append(&quot;,&quot;);         }     }     return builder.toString(); }  public static void setValues(PreparedStatement preparedStatement, Object... values) throws SQLException {     for (int i = 0; i &lt; values.length; i++) {         preparedStatement.setObject(i + 3, values[i]);     } }
What are the best workarounds for using a SQL IN clause with instances of java.sql.PreparedStatement, which is not supported for multiple values due to SQL injection attack security issues: One ? placeholder represents one value, rather than a list of values.  Consider the following SQL statement:  SELECT my_column FROM my_table where search_column IN (?)   Using preparedStatement.setString( 1, "'A', 'B', 'C'" ); is essentially a non-working attempt at a workaround of the reasons for using ? in the first place.    What workarounds are available?
Where do the bipolar jets of black holes come from? Omission of "the" in "elected him president" and "made captain" I have a couple of floats in my document, which contain large Images (it consumes the half of the page). In this case, the figure get's its own page and no text goes on this page.  How can I configure this? I'd like to have text before and after the floats until the float doesn't use more then 75% of the page height. Are there integer solutions to $9^x - 8^y = 1$? Let $f:[0;1]\to\mathbb R$ be continiously differentiable An item to break only SPECIFIED blocks? I know that I can make certain blocks only placeable on a specified block, but what is the command to give an item that can only BREAK certain blocks? What measures can/should I take to make sure that security around my SSH server is absolutely impermeable?  This will be community wiki from the start, so lets see what people do to secure their servers. I suspect that some bug makes internal linking count towards Publicity badges too. The badges :  These badges are specifically for linking to questions like the description says. The link must be clicked from outside the network in order for it to count for this purpose.  However, 2 days ago I was  for a question that I really feel does not need such linking to start with: . Also, I always try to use full links. And above all:  for the link gives me a single hit, for . Maybe it's thinking that empty REFERER headers (for those that block that, or for Safari users who ) should be counted too? Or maybe some search bot is using lots of IP addresses? Or visitors of Stack Overflow clones are to blame? What are the pros and cons of having a separate home partition? When A and B are positively related variables, can they have opposite effect on their outcome variable C? A is positively related to B.  C is the outcome of A and B, but the effect of A on C is negative and the effect of B on C is positive.  Can this happen? How to revert a do-release-upgrade? I can update my Ubuntu to the new LTS version. As you can think, its not a highly important server since I run 13.10 (not a LTS version). Anyway - I actually want to upgrade my server, but would like to be able to revert this upgrade.   I would be able to reinstall Ubuntu 13.10 and overwrite it with my backup. But I want to know if there is a more comfortable way to do this. TBH I guess theres no command as undo-release-upgrade but I thought it would be worth to ask for it.  This is my current daily backup script  tar cvpzf $backup_file --exclude=/proc --exclude=/lost+found --exclude=$backup_file --exclude=/mnt --exclude=/sys --exclude=/media --exclude=/tmp / 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? Infinite series $\sum _{n=2}^{\infty } \frac{1}{n \log (n)}$ Recently, I encountered a problem about infinite series. So my question is how to know whether the infinite series $\sum _{n=2}^{\infty } \frac{1}{n \log (n)}$ is convergent? Smooth shaded model has odd shading I'm currently working on a model of an X-wing that I'm intending for use in a game and running into a bit of trouble with the shading of the mesh. The upper nose is rounded off where the sensor cone attaches, but at the point it reaches the canopy frame it flattens out and meets at a corner.  Everything is fine and dandy when the sides are modeled:    but once I close it off and add the top of the nose, the shading goes to hell:    As you can see, the smoothing gets confused at the lip of the cockpit.  I've tried a couple different means of getting around this, none of which looks right while maintaining the correct shape. The transition from the rounded to flat is a fairly important part of the ship's character, so I don't want to discard the contours, either.  Any tips or suggestions on modeling this area?  Addendum:  If I eliminate that second angle where the canopy frame meets the fuselage as marked in red:    this also fixes the smoothing. However this is not a solution, as the angle is a part of the design. It DOES give me another thought on fixing, but I won't be able to test it until I get home. Optional Android notifications for reputation changes I would like to get a notification if my reputation count has changed. I think there is already some internal API for that. (I can see that changes in the menu bar in the top).  I'm sure that some people would not like that so that should be optional. The problem is stated as follows:  "Let $R$ be a Noetherian ring and $\theta$ be a ring homomorphism from $R$ to $R$. Show that if $\theta$ is surjective then it is also injective."  Regardless of the right solution, I don't understand why is the following wrong:     We have $\theta: R\to R$. By the isomorphism theorem $R/\ker\theta\cong\operatorname{Im}\theta$. Since $\operatorname{Im}\theta = R$, it follows $\ker\theta =0$, so it's injective.   Harsh criticism will be appreciated. Thanks. Why does "Size on disk" vary when "Size" does not with the same set of files? In The Last Jedi:     The Resistance fleet is tracked through hyperspace by the First Order after they make their jump away from their old base.   As soon as the FO ships appear, the Resistance immediately come to the (correct) conclusion as to the tech that was used.  Why would they assume the use of this tech, that they have never encountered before, as opposed to the more common technique of     tracking a ship through the use of a homing beacon. I have a text box that will have a currency string in it that I then need to convert that string to a double to perform some operations on it.   "$1,100.00" → 1100.00  This needs to occur all client side. I have no choice but to leave the currency string as a currency string as input but need to cast/convert it to a double to allow some mathematical operations. Looking for a book, wormhole, space ship Crash landing From what I remember of the book:   A spaceship goes through a wormhole (I think) and crash lands on a planet They salvage what they can from the ship and build a castle on a mountain, cutting the stone with the lasers from the crashed ship The crew develop some sort of powers, the captain (She) seems to develop some sort of Precognition The planet's inhabitants where men rule and women are second class citizens Some women escape to the crew's castle so they can be equal citizens After they build the castle the crew fight the inhabitants the that came to attack them   What is the name of this book?